summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2018-04-26 19:16:53 +0200
committerDavid Faure <david.faure@kdab.com>2018-04-27 07:27:21 +0000
commit8d7af27e42e28fc5ebcbcf023b75444899dba2ca (patch)
tree9583559713ce8f787727cb07d935b5ae15b76bc1 /src
parentb7d810a7ccea3bc75663d5df9410d95834a0b2bf (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index 7d529372c4..68e3c8f10d 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -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;