QMimeDatabase: check 128 bytes rather than 32, for text vs binary
As per today's change in the MIME spec. https://bugs.freedesktop.org/show_bug.cgi?id=97372 Change-Id: Iba4fdd95c3ebec8a042404956db3466a46c97f1d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
b7d810a7cc
commit
8d7af27e42
|
|
@ -311,9 +311,9 @@ static inline bool isTextFile(const QByteArray &data)
|
|||
if (data.startsWith(bigEndianBOM) || data.startsWith(littleEndianBOM))
|
||||
return true;
|
||||
|
||||
// Check the first 32 bytes (see shared-mime spec)
|
||||
// Check the first 128 bytes (see shared-mime spec)
|
||||
const char *p = data.constData();
|
||||
const char *e = p + qMin(32, data.size());
|
||||
const char *e = p + qMin(128, data.size());
|
||||
for ( ; p < e; ++p) {
|
||||
if ((unsigned char)(*p) < 32 && *p != 9 && *p !=10 && *p != 13)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue