summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Fix integer overflow in very long sections in ELF objectsThiago Macieira2018-09-151-1/+1
| | | | | | | | | | | | The source is an ElfXX_Off, which is an unsigned 32- or 64-bit. That means any section bigger than 2 GB would cause an overflow when we assigned in m_stringTableFileOffset = strtab.offset; Change-Id: Ib47c56818178458a88b4fffd15546bd47a89894e Fixes: QTBUG-70560 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.11.2' into 5.11Qt Forward Merge Bot2018-09-091-4/+4
|\ | | | | | | Change-Id: I2fa26fa061cbf5d2bded203a299a19b7d1c31d0a
| * Doc: Fix typos in QRectF documentationPaul Wicking2018-08-271-4/+4
| | | | | | | | | | | | | | | | | | Add missing 's'. Fixes: QTWEBSITE-823 Change-Id: I1acd3b7ae18982248bf3402fa5943ee95c1efdbe Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | QString: Fix snippet explaining "non-spaced numbered place markers"Andre Hartmann2018-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The snippet tries to explain the advantage of str.arg("Hello", QString::number(20), QString::number(50)); over str.arg("Hello").arg(20).arg(50); which only makes sense, if str contains the same formating sequence, namely "%1%3%2". That also matches the belonging comment. Amends 8481500f639e3d5e2259db57847a2e7068e30650 Task-number: QTBUG-44044 Change-Id: Ic2595107bc599c6d244ebf88184a5cc5569ed4f1 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Doc: Move the literal code blocks to a separate fileVenugopal Shivashankar2018-09-032-15/+17
|/ | | | | | | | It's easier to override the code blocks this way. Change-Id: I98d40626a94fdb70a95c50332c2da141e9277070 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* _q_interpolate<T> is unsafe with unsigned template argumentsLuca Beldi2018-08-221-1/+13
| | | | | | | | | _q_interpolate<T> subtracts 2 arguments of type T, for unsigned types this can cause wrapping around Task-number: QTBUG-57925 Change-Id: Iffa59f413579a3d5de8cb728fe71443d8e8a04aa Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Remove duplicate thread-safe documentation from logging macrosKai Koehne2018-08-201-16/+0
| | | | | | | | qdoc now handles \threadsafe also for macros, so we can remove the explicit \note. Change-Id: Iabeb7f69d237e7024a4f584adc516951b06d752b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Cast away -Wclass-memaccess warnings in QVarLengthArray methodsEdward Welbourne2018-08-201-3/+3
| | | | | | | | | | | | With g++ 8.2.0, I get warnings when a QVarLengthArray<QString> calls remove() or prepend(), as some tests in tst_QVarLengthArray do, as they call memmove() "writing to an object of type ‘class QString’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead"; which may indeed be a good argument for not using QVarLengthArray<QString>, but its own tests do. Change-Id: I4f8a64948b32a54e67a285df4ec7788f60739ffb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSortFilterProxyModel inserting at bottom of source modelLuca Beldi2018-08-171-2/+2
| | | | | | | | | | | | | | | | Before this change, if you try to insert a row at the bottom of QSortFilterProxyModel the row will be inserted in the source model at position proxy->rowCount rather than at the bottom. This causes insert at apparently random positions in the source. [ChangeLog][QtCore][QSortFilterProxyModel] QSortFilterProxyModel::insertRows(row,count,parent) with row == QSortFilterProxyModel::rowCount will insert at the bottom of the source model rather than at the row QSortFilterProxyModel::rowCount of the source model Task-number: QTBUG-58499 Task-number: QTBUG-69158 Change-Id: Ie78416c8fbc429303b8c9c98375630e3e4d85f6d Reviewed-by: David Faure <david.faure@kdab.com>
* QUrl: Make sure we do reject URLs for which IDNA nameprep failedThiago Macieira2018-08-162-7/+12
| | | | | | | | | | | | | | qt_nameprep() already reset the string to its original length to indicate failure, but we didn't handle that in qt_ACE_do(). So make it have a return value whcih makes it easier to handle that case and do handle it. [ChangeLog][QtCore][QUrl] Fixed a bug that caused URLs whose hostnames contained unassigned or prohibited Unicode codepoints to report isValid() = true, despite clearing the hostname. Change-Id: I41e7b3bced5944239f41fffd1545b7274c4b419d Reviewed-by: David Faure <david.faure@kdab.com>
* MSVC: add support for 64-bit POPCNT on 32-bit machinesThiago Macieira2018-08-161-3/+6
| | | | | | | | It's just adding the count of each half. Change-Id: I9868946ceaf74002bde1fffd154b29908319007f Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* doc: Add missing override and remove redundant virtual for snippetsAlexander Volkov2018-08-1612-22/+22
| | | | | Change-Id: I2395fd01b93c4ea364225e0cf1a5f59908b691d0 Reviewed-by: Martin Smith <martin.smith@qt.io>
* [macOS] Fix lower bound when searching for previous transitionsErik Verbruggen2018-08-141-1/+1
| | | | | | | | | The lower bound shouldn't be the smallest (positive) value representable by a double, but the *lowest* (finite) value. Task-number: QTBUG-69862 Change-Id: Ia66610e3c0f8d9643c329714607f5af573206fd8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix possible heap corruption in QXmlStreamAllan Sandfeld Jensen2018-08-131-1/+1
| | | | | | | | | The value of 'tos' at the check might already be on the last element, so triggering stack expansion on the second last element is too late. Change-Id: Ib3ab2662d4d27a71effe9e988b9e172923af2908 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Glib dispatcher: use default priority for timersSune Vuorela2018-08-131-1/+0
| | | | | | | | | | | | | | | | For some reason, the GLib event dispatcher was lowering the priority for timers compared to other events like for example socket events. the IDLE priority is for "Do this later when you are not busy", and that is wrong for generic timer events. See also https://bugs.kde.org/show_bug.cgi?id=230184 Task-number: QTBUG-48344 Change-Id: Id337a8f0c7fad3ebd5e5fa49d7831a0001ea9010 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QSysInfo: fall back to /usr/lib/os-release if the /etc one is missingThiago Macieira2018-08-081-4/+13
| | | | | | | | | | | | Turns out that there are two files and while a lot of distros symlink one to the other, some distros lack the one in /etc. [ChangeLog][QtCore][QSysInfo] Fixed QSysInfo::productType() to properly detect some Linux distributions that ship with a minimal /etc. Change-Id: Ia741b559c24d46c78fb2fffd1548cab414037220 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix qmake build with glibc 2.28Thiago Macieira2018-08-082-3/+11
| | | | | | | | | | | | | | We haven't yet run the configure checks to see if statx and renameat2 are present in glibc, so this fails when we redefine the structures and functions. linux/stat.h:56:8: error: redefinition of 'struct statx_timestamp' bits/statx.h:25:8: note: previous definition of 'struct statx_timestamp' qfilesystemengine_unix.cpp:110:12: error: 'int renameat2(int, const char*, int, const char*, unsigned int)' was declared 'extern' and later 'static' [-fpermissive] Change-Id: Ia741b559c24d46c78fb2fffd1548a792d22e3368 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* QString: Fix documentation for toDouble() and toFloat()Andre Hartmann2018-08-061-2/+2
| | | | | | | | The character 'g' is only a valid format when converting numbers to strings, but not other way round. Change-Id: Ie772886e7a45a5067c0a3e4eaa3a6ccef8e69426 Reviewed-by: Martin Smith <martin.smith@qt.io>
* QObject: do allow setProperty() to change the type of the propertyThiago Macieira2018-08-041-1/+2
| | | | | | | | | | | [ChangeLog][QtCore][QObject] Fixed a bug in setProperty() that caused a property change not to take effect if the old value compared equal using QVariant's equality operator, but the values were not strictly equal. Task-number: QTBUG-69744 Change-Id: I00e04a465fcf4fc1a462fffd1547885861a07a64 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Doc: Clean up Qt::ApplicationAttribute docsPaul Wicking2018-08-031-33/+35
| | | | | | | | | | | | | | | | * Remove () from links to QGuiApplication link names. The link targets QGuiApplication, and the syntax Q(Gui)Application to suggest both QGuiApplication and QApplication seems unnecessary, as QApplication derives from QGuiApplication anyway. * Move added in version line to the bottom of each entry that contains said line for consistency. * "was added in" > "has been added in" Task-number: QTBUG-56077 Change-Id: Ife93acb7936ff9f0d3af2f2f456ad0db95419797 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Doc: Increase precision in description of convenience typedefsPaul Wicking2018-08-031-1/+1
| | | | | | Task-number: QTBUG-53856 Change-Id: I57917bb311d1d93e0903f2b3e021cc4db0f0d05e Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Windows: Implement Qt::WindowStaysOnBottomHintFriedemann Kleint2018-08-031-2/+6
| | | | | | | | | | | | Set the Z-order to HWND_BOTTOM in that case. Add a doc note stating that it only works for frameless or full screen windows. Task-number: QTBUG-53717 Change-Id: I7abf219a88aac715c51d27d925504da9e91b56f1 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QProcess::startDetached: Fix behavior change on WindowsJoerg Bornemann2018-08-032-5/+13
| | | | | | | | | Do not overwrite stdout/stderr by default, but only if requested. This restores the behavior of QProcess::startDetached of Qt 5.9. Task-number: QTBUG-67905 Change-Id: Idccf7b0da7bd80f88a0624286ddf2851bc974fb1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve documentation of QString::indexOf that take QRegExpAlbert Astals Cid2018-08-011-8/+0
| | | | | | | | | | They said "By default, this function is case sensitive" but this makes no sense when you're using a regexp for searching, the regexp is case sensitive or not by itself, QStringList does not influence that. Change-Id: I7446cb52a9f915c6551af6046ce89cbc8bab96ed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix conditions for dup2 in QProcess::startDetachedJoerg Bornemann2018-08-011-7/+5
| | | | | | | | | | | The channel pipes are only set up if the channel's type is Redirect. Fix the conditions accordingly. This amends commit 7ad55ca6. Change-Id: Ie8a800fbe2bf9f5f6709b14ba03133b80e9b4bef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* QDeadlineTimer: Fix documentation typoAndre Hartmann2018-08-011-2/+2
| | | | | Change-Id: If8f7766ca0698a3defdf9c59c44fb02a8a5b3b62 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Doc: Update signals and slots introduction pagePaul Wicking2018-07-311-22/+26
| | | | | | | | | | | Use this as context in connect to functors/lambdas. Add description of the use of context in connects. Update the simple example to make it slightly less confusing for (new) readers. Task-number: QTBUG-69483 Change-Id: Ibbbe98c4282cea4ebd860b1d174871559b7f195b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Link from QLocale to where date-time formats are explainedEdward Welbourne2018-07-312-0/+16
| | | | | | | | | | | QLocale has various methods that deal in date-time formats, which may be supplied as strings; but does not document the form of a format string. That's documented in QDate, QTime and QDateTime, so link to them for the details. Task-number: QTBUG-23307 Change-Id: I6347d80a87dc03f6a4065e3d5bf4d535f05af93f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QJsonDocument: Make emptyObject an objectJüri Valdmann2018-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A default-constructed QJsonObject has no data payload, it is only a pair of null pointers. So, when it becomes necessary to 'materialize' such an object, a special global emptyObject constant is used as the substitute payload. There is a small problem with this global constant though, namely that it's is_object flag is unset. In other words, the emptyObject is not an object, but an array. Fix by setting the is_object flag on emptyObject. The example code in the bug report QJsonObject parent; QJsonObject child; parent["child"] = child; // 1 child = parent["child"].toObject(); // 2 child["test"] = "test"; // 3 runs into this problem on line 1. Inserting the default-constructed child means inserting a copy of emptyObject. On line 2 a pointer to this copy of emptyObject is retrieved and cast to an object. But it's not an object, it's an array, so things go wrong hereafter. Specifically, on line 3, two inserts are performed, one from operator[] and one from operator=. Each insert increments a compaction counter. The second insert triggers compaction (QJsonObject::insert calls Value::requiredStorage calls Data::compact) and compaction branches based on the is_object flag. Replacing line 3 with child.insert("test", "test"); causes the example to appear to work since compaction is not triggered and the JSON serializer does not look at the is_object flag. Still, any further insert() calls would trigger compaction and memory corruption. Task-number: QTBUG-69626 Change-Id: I8bd5174dce95998bac479c4b4ffea70bca1a4d04 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean before copying any QCollatorEdward Welbourne2018-07-261-2/+11
| | | | | | | | | This avoids the hazard of both (if on separate threads) trying to init() at the same time, if they were dirty before cloning. Task-number: QTBUG-69361 Change-Id: Iabb06942c074ba073ca58fd0de509d1db15c1093 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Check against copying the husk left by a moveEdward Welbourne2018-07-261-1/+2
| | | | | | | | | | | | | The copy-assign operator tests against other.d being NULL but the copy-constructor didn't. This can only matter if the value being copied has been moved from, so we could probably replace with an assertion in practice, but we should at least be consistent. Amended test to check this case too; and verified new test crashes without this fix. Change-Id: I46872a677775944bbdf6a9112e719873e574ae60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix the fix for mmap() overflow checkThiago Macieira2018-07-251-4/+3
| | | | | | | | | | | | | | | | The code I introduced in 4ee74257940e2ed21b653b986ad02a746e8438a6 only dealt with systems that reasonably used a 64-bit off_t parameter. Turns out that we don't turn on largefile support on 32-bit Android, which meant that the fix caused a regression. [ChangeLog][QtCore][QFile] Fixed a regression that caused QFile::map() to succeed or produce incorrect results when trying to map a file at an offset beyond 4 GB on 32-bit Android systems and on some special Linux configurations. Task-number: QTBUG-69148 Change-Id: I2c133120577fa12a32d444488bac3e341966f8d7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix MSVC builds with /Zc:wchar_t-Timur Pocheptsov2018-07-251-0/+2
| | | | | | | | | | | | 208c71768 introduced a problem for our users, who build on Windows with /Zc:wchar_t-, which makes wchar_t a typedef for the type 'unsigned short', preventing them from switching to more recent versions of Qt. While MSDN recommends against this option, we can add more #if-ery to avoid compiler's bailing out on a constructor's redefinition. Task-number: QTBUG-65101 Change-Id: I62a1d9b2572f3d4b1f70bcbc3e52e795b1944558 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix QUrl::setPath documentation, remove default TolerantModeMikhail Svetkin2018-07-241-1/+1
| | | | | | Change-Id: I97f6ce5fdaba3364aab3203974a3a3d4f92c8899 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Let QDir::absoluteFilePath() use isAbsolutePath() for resource pathsEdward Welbourne2018-07-231-36/+60
| | | | | | | | | | | Using QFileSystemEntry::isAbsolute() broke handling of resource paths. Extended QDir::absoluteFilePath() tests to cover absolute resource path and some UNC variants also resolved in the same fix. Amend existing filePath tests to use drives where needed. Task-number: QTBUG-68337 Change-Id: I4f02cf67828ad93e562857118f8442037f18bab7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add since version for QJsonDocument::toJson()Paul Wicking2018-07-231-0/+1
| | | | | | | Task-number: QTBUG-69527 Change-Id: I10df9cc2d6fa2080e07d68b78c6220500f459380 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
* Doc: Correct typo from decoded to encodedPaul Wicking2018-07-211-1/+1
| | | | | | Task-number: QTBUG-62081 Change-Id: Ia07b43445661d66ef0e8fe51d8d022bd5d803327 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Remove erroneous comma in snippetPaul Wicking2018-07-201-1/+1
| | | | | | Task-number: QTBUG-51719 Change-Id: I0621b872642aa8ad14f6af4bf1b9588450dfbb64 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Add since version for QJson method and enumPaul Wicking2018-07-192-0/+2
| | | | | | | | | QJsonValue::toInt() introduced in 5.2, 7372c6cf9d4 QJsonDocument::JsonFormat introduced in 5.1, 4bb5566632e Task-number: QTBUG-69527 Change-Id: Idb9df959f82fe7061e0afe2109f1ca34a4451a5f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Extend description of ShortcutOverride eventPaul Wicking2018-07-191-0/+6
| | | | | | | | | | Better late than never. Task-number: QTBUG-533 Change-Id: Ieb68d510f75553a6aa0a6e9046c11e3a34b8815f Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Plugins: fix crash if the binary JSON data contains invalid sizeThiago Macieira2018-07-194-11/+33
| | | | | | | | | | | | | | Eight bytes into the Binary JSON header there's a 32-bit little-endian size, which qJsonFromRawLibraryMetaData uses to determine the size of the stored metadata. That value is passed as a size to QByteArray, which means certain values could cause crashes due to being too big or via sign-extension in 64-bit. [ChangeLog][QtCore][QPluginLoader] Fixed an issue that could cause a crash when certain damaged or corrupt plugin files were scanned. Change-Id: I117816bf0f5e469b8d34fffd153dc5425cec39a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Windows: Don't output a warning when sHGetKnownFolderPath failsAndy Shaw2018-07-181-11/+6
| | | | | | | | | | | | | | | In the rare case where the known locations for the standard paths are not known (such as when an application is used without a user logged in), it will output a warning to indicate this. In the case of the GenericConfigLocation, this can mean that it will hang due to the fact that QLoggingCategory is looking for that location too before it can output anything. Therefore, the warning output is removed so that if this part fails it doesn't cause it to hang as a result. Change-Id: I4f189361899bd1f868292f30c09fbe50982d2288 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Linux: Bypass glibc's broken open() implementationThiago Macieira2018-07-172-0/+28
| | | | | | | | | | | | | | | | | | | | | | Glibc 2.21 and earlier have a bug that leaves the mode parameter unset when O_TMPFILE is used. So we bypass the glibc implementation and go directly for the syscall. We do this only for 32-bit x86, since of the current, modern platforms, it's the only one that passes parameters on the stack. Technically speaking, the glibc bug applies to all platforms, but it turns out that on all others, it appears to work. By doing this, we have two minor differences: 1) open() is a cancellation point, but syscall() isn't 2) if anyone tries to intercept open() calls via LD_PRELOAD, they're not going to catch Qt's. [ChangeLog][QtCore][QTemporaryFile] Worked around a bug in the GNU C Library versions 2.21 and earlier (used on Linux) that caused temporary files to be created with permissions 000. Task-number: QTBUG-69436 Change-Id: I20fd00e600264ff98c6afffd1540dceea89fa91f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* ELF parser: fix off-by-one errorThiago Macieira2018-07-141-1/+1
| | | | | | | | | I don't know why Arvid subtracted 1 when he wrote this code. But it was wrong. Fortunately, the section size was not used afterwards, but the next commit will. Change-Id: I117816bf0f5e469b8d34fffd153dc8383b00b94a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QPluginLoader: limit the amount of memory used when scanning pluginsThiago Macieira2018-07-145-30/+24
| | | | | | | | | | | | | | | | | | | When using actual memory allocation, limit to 64 MB, not the full file size. On most systems, the memory map technique will work, so this won't even be tried. In any case, we don't need the fix for the OOM situation that was applied in commit e211ab76d766878b4dbe88901b9a7a4a70ce7332. As for the memory mapping technique, this commit limits the allocation to reasonable values given the virtual memory addressing space. Half a gigabyte is probably acceptable on 32-bit systems, where there should be a contiguous space for the OS to allocate the file in. This commit also fixes an overflow when converting from qint64 of the file size to ulong (32-bit on 32-bit platforms and on Windows). For 64-bit systems, we currently limit to 1 TB. Change-Id: I117816bf0f5e469b8d34fffd153dc1705a8eedc4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Doc: Remove reference to Unicode 4.0Kai Koehne2018-07-131-1/+1
| | | | | | | | | | | | | | | It's unclear when the reference to Unicode 4.0 standard got added - it certainly predates the qt 4 git repository. Anyhow, nowadays we're using later versions, and it doesn't make much sense to highlight one specific version here. Instead, use the correct technical term - UTF-16 code unit. Also I added a 'correspond _to_', which sounds more common to me. Task-number: QTBUG-56699 Change-Id: I4bdcd9060cb2b11521638019c15ef7ab67aa768b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Correct Unix QStorageInfo's QStorageIterator::next()'s loop logicEdward Welbourne2018-07-131-3/+4
| | | | | | | | | | | | | | | | | | | | The loop was accepting any line with at least three entries, but the code that then used this line needed four entries. At the same time, the loop's check had to be repeated, in rearranged form, after the loop, to handle some failing cases. Restructuring the loop, and demanding at least four entries, fixes all of this, although care must be taken about the virtual file-system lying about .atEnd(). [ChangeLog][QtCore][QStorageInfo] Fixed a bug on Android that could cause QStorageInfo to skip some filesystems (if the mount table is a virtual file and contains any short lines) or crash (if the mount table contains any 3-field lines). Change-Id: I1c2674372d0d0b7d16937de4345a910bc7d6e0ad Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Johannes Rosenqvist <xeroc81@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFile::copy(): don't trust the old file metadata cacheThiago Macieira2018-07-121-15/+5
| | | | | | | | | | | | | | | | | Instead, let's just use sendfile(2) in a loop until it returns 0, which indicates EOF. [ChangeLog][QtCore][QFile] Fixed a regression in QFile::copy() that caused the original file not to be copied entirely if it was modified outside of this QFile object between the last time we checked its size and the copy() call. Note this is not a prevention against race conditions. Task-number: QTBUG-69417 Change-Id: Id59bdd8f1a804b809e22fffd15406c8aa31f4a1e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add missing init()-if-dirty in two of ICU's QCollator::compare()sEdward Welbourne2018-07-121-0/+6
| | | | | | | | | Both delegate to the one that did do the if dirty: init() check, but only after they've tested whether d->collator is set, which it might not be when dirty. Change-Id: I77533d6d32c4a8c9b42797c77003e50f5820775a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QStorageIterator where the last line in /proc/mounts is skippedJohannes Rosenqvist2018-07-121-1/+1
| | | | | | | | | | | | | | On Android systems QStorageIterator uses /proc/mounts to parse mounted volumes. For every call to QStorageIterator::next() a check was done to see if we had reached EOF with atEnd(), but didn't take account of the last call to file.readLine(), which might contain a valid entry. [ChangeLog][QtCore][QStorageInfo] Fixed a bug that caused the last entry in the mtab file to be ignored on Android. Task-number: QTBUG-60215 Change-Id: I064452002922c72ffa1c8954fec5f28738c42bae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>