diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-08-03 10:48:10 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-08-03 12:43:00 +0200 |
commit | 51b63d5e805814c1ec88e4a874cd7eabd58eb20a (patch) | |
tree | 600a94fe14b9741dc58492df5300265fe284118c /src/plugins | |
parent | ffbc37129d6a2623ddc731520baba0f4d3b6f3b1 (diff) | |
parent | 66131652f178cd1605b8a2c0ba7023392e13ad5a (diff) |
Merge 1.12 into master
Change-Id: I0ce6c28f9117f945c9fec0654bd06daf3d13ace0
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/scanner/qt/qtscanner.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/scanner/qt/qtscanner.cpp b/src/plugins/scanner/qt/qtscanner.cpp index 5a790efc1..51faadab3 100644 --- a/src/plugins/scanner/qt/qtscanner.cpp +++ b/src/plugins/scanner/qt/qtscanner.cpp @@ -119,7 +119,8 @@ static void *openScannerQrc(const unsigned short *filePath, const char *fileTags int r = fstat(opaque->fd, &s); if (r != 0) return nullptr; - opaque->mapl = s.st_size; + const int fileSize = static_cast<int>(s.st_size); + opaque->mapl = fileSize; void *map = mmap(0, s.st_size, PROT_READ, MAP_PRIVATE, opaque->fd, 0); if (map == nullptr) @@ -129,13 +130,14 @@ static void *openScannerQrc(const unsigned short *filePath, const char *fileTags if (!opaque->file->open(QFile::ReadOnly)) return nullptr; - uchar *map = opaque->file->map(0, opaque->file->size()); + const int fileSize = opaque->file->size(); + uchar *map = opaque->file->map(0, fileSize); if (!map) return nullptr; #endif opaque->map = reinterpret_cast<char *>(map); - opaque->xml = new QXmlStreamReader(opaque->map); + opaque->xml = new QXmlStreamReader(QByteArray::fromRawData(opaque->map, fileSize)); return static_cast<void *>(opaque.release()); } |