summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* QFile: fix coding style violationMarc Mutz2019-06-021-1/+2
| | | | | | | | | | | | | | | | | | Amends dd8131e3b25a4ac60eb55022b69b374f0b9a476c. Change-Id: Ic7d440816ee7bada49740f15919e404860dd8ac7 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* corelib/io: use qUtf16Printable(), %ls, qErrnoWarning()Marc Mutz2019-05-296-34/+35
| | | | | | | | | | | | | ... instead of qPrintable(), %s, explicit qt_error_string(). Saves temporary QByteArray creation, and 540b in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: Id4e861683cf05a92faf51e4a9de9eb1dec4fc84a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWindowsFileSystemWatcher: optimize qWarning() useMarc Mutz2019-05-291-12/+10
| | | | | | | | | | | | | | | | | | The first two changes avoid creation of a temporary QString and QByteArray each, by realisiing that QChar is more-or-less wchar_t on Windows and so we can just use %ls to print the wchar_t array directly. In msgFindNextFailed(), remove the inline keyword and mark the function as cold (not sure this has any effect on Windows). When building the result, don't use QTextStream. Everything that is streamed is text, so just use QString::op+=. When using the result, use qUtf16Printable and %ls instead of qPrintable and %s, to avoid the creation of a temporary QByteArray. Change-Id: I09f576b894761fe342109b386c1de3532200e03c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFile: share some codeMarc Mutz2019-05-301-14/+13
| | | | | | | | | | | | Pack four qWarning() calls into a separate cold function. Use qUtf16Printable(). Saves >600b in text size on optimized AMD64 Linux GCC 9.1 builds. Change-Id: Ib25ea473d1d77faaecaf8750726c83675d87279e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-05-271-33/+17
|\ | | | | | | Change-Id: Ia279fc4a8226626041c772902a07b2f90f37b53b
| * Fix canonicalFilePath() for files with trailing slashesVolker Hilsheimer2019-05-211-33/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Such files do not exist (as per QFileInfo::exists), but on some platforms that rely on realpath(), QFileInfo::canonicalFilePath did not return the empty string. Use the same logic on macOS as we already did on Android, and include a test case. Remove the unnecessary dynamic memory allocation and use a stack-allocated array instead, unless we use modern POSIX in which case realpath() will alloc the memory for the result for us. Change-Id: Ide987c68ebf00cbb7b1a66c2e9245a12c7807128 Fixes: QTBUG-44242 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QStandardDirs: fix quadratic loopMarc Mutz2019-05-211-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of a bad copy of remove_if, with quadratic complexity, use an ok copy of copy_if, with linear complexity. Port to QStringRef as a drive-by. Change-Id: I47fde73b33305385835b0012f6d332e973470789 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QFileSystemWatcher: fix quadratic loop by porting away from QMutableListIteratorMarc Mutz2019-05-211-18/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMutableListIterator::remove() is linear, so called in a loop, the loop potentially becomes quadratic. Fix by porting to std::remove_if. In this case, since the old code unconditionally detached, anyway, we use remove_copy_if to build a new list. That's still more efficient than the old code, even if nothing is removed. It also prepares the code for when Java-style iterators will be deprecated. Since the same code appears in two different functions, do an Extract Method into a file-static function. Lastly, restore NRVO for most compilers by returning the same object from all return statements of the function. Change-Id: I6909c6483d8f7acfd1bf381828f020038b04e431 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QFileSystemWatcherEngines: port some Java-style iterators to ranged-forMarc Mutz2019-05-214-53/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java-style iterators are scheduled to be deprecated. The general pattern used in the patch is that instead of copying an input list, then iterating over the copy with some calls to it.remove() (which leads to quadratic-complexity loops), we simply copy conditionally (a la remove_copy_if instead of remove_if). To make clearer what's going on, rename the outgoing list to 'unhandled'. To avoid having to touch too much of the loops' structure, which sometimes is quite convoluted, use qScopeGuard to do the append to 'unhandled', unless the original code removed the element. Saves a surprising almost 5KiB in text size on GCC 9.1 optimized AMD64 Linux builds. Change-Id: Ifd861de9aa48d66b420858606998dd08a8401e03 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QFileSystemWatcher: lock autotest code away into a cold sectionMarc Mutz2019-05-211-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code contained a sizeable chunk of string parsing along with qDebug()s in the normal path of execution. That code, however, was only used for Qt's own autotests. The idea of this patch is, then, to not only move the autotest case into the cold text section (using Q_UNLIKELY), but also to completely exclude it, when QT_BUILD_INTERNAL is not set. Unfortunately, the structure of the function did not really lend itself to #ifdefing that part of the code out (production code was in the middle of non-production code), so I transformed the engine selection code into a lambda, replacing assignment with returns, and swapping the branches of the central if around to yield a single block of code that can be excluded from compilation with just one #ifdef. As a consequence, the runtime code is almost unaffected, and the function is much easier to read now. Since the test-specific code is only compiled into Qt now in developer builds, guard the tests that rely on this behavior with the same macro. Change-Id: I9fd1c57020a13cef4cd1b1674ed2d3ab9424d7cd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-131-1/+1
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I81dbf90fc936c9bf08197baefa071117bddb1c63
| * Doc: replace even more null/0/nullptr with \nullptr macroChristian Ehrlicher2019-05-081-1/+1
| | | | | | | | | | | | | | | | Try to replace all wordings like '.. to 0' with '.. to \nullptr'. Also checked for 'null pointer' and similar. Change-Id: I73341f59ba51e0798e816a8b1a532c7c7374b74a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Migrate Windows system libs to external dependenciesJoerg Bornemann2019-05-081-1/+2
| | | | | | | | | | | | Started-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Change-Id: I211ce3252b836894aeeac1c85eb316d9596bca57 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Add QUrl to bootstrap setUlf Hermann2019-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | The QML language server needs to use QUrl as that is what the language server protocol uses to specify files. As we cannot implicitly cast char to QChar in the bootstrap library, we need to apply a build fix in qipaddress.cpp. Change-Id: Ifaf8421457b1f734402b5aad965ecdec764a73e8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-073-3/+8
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/corelib/kernel/qvariant.h src/corelib/tools/qlist.h Done-With: Milian Wolff <milian.wolff@kdab.com> Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: I6803f7239aa137a51a7467fab7cc7a01302a848d
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-061-1/+2
| |\ | | | | | | | | | Change-Id: Iaad9509712c848ed42ada2c25065162a6fc5a930
| | * fix crash when using ALDI usb-stick with broken filesystemNick Shaforostov2019-05-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was using a cheap usb-stick from ALDI supermarket with fat32, and my application crashed because filesystem was empty. Unrealistic scenario, but still just returning here false is better than a crash Change-Id: I8979d5a4e19ce57770ab03983e847b272ebf7019 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | QtCore: compile with QT_DISABLE_DEPRECATED_BEFORE=0x050d00Christian Ehrlicher2019-05-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't call or implement functions which are not available when compiling with QT_DISABLE_DEPRECATED_BEFORE=0x050d00 Change-Id: I949b12bba880c516391f312f58c8748303a1790d Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | Fix -Wdeprecated-copy warningsAllan Sandfeld Jensen2019-05-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit copy constructors or methods are considered deprecated for classes that has one of the two or a destructor. The warning is enabled with -Wextra in gcc 9 Change-Id: Ic9be654f2a142fb186a4d5a7d6b4f7d6f4e611d8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Prefix textstream operators with Qt::Lars Knoll2019-05-024-7/+7
| | | | | | | | | | | | | | | | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-292-4/+11
|\| | | | | | | | | | | Change-Id: Ic712e8a84b01b212bb1121d7a2c9b85e0d2da9da
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-282-4/+11
| |\| | | | | | | | | | Change-Id: Ibce9bfef928ce39070183c488ce86ae32e5ea705
| | * Make QFile::copy() less likely to create zero-sizedThiago Macieira2019-04-271-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFile::copy() didn't have the syncToDisk() call that QSaveFile::commit() has. So add it. [ChangeLog][QtCore][QFile] Made QFile::copy() issue a filesystem- synchronization system call, which would make it less likely to result in incomplete or corrupt files if the system reboots or uncleanly shuts down soon after the function returns. New code is advised to use QSaveFile instead, which also allows to display a progress report while copying. Fixes: QTBUG-75407 Change-Id: I95ecabe2f50e450c991afffd1598d09ec73f6482 Reviewed-by: Henrik Hartz <hhartz@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
| | * qdoc: Fix warnings about missing \inmodule commandKai Koehne2019-04-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings qtbase/src/corelib/io/qprocess.cpp:776: (qdoc) warning: Class CreateProcessArguments has no \inmodule command; using project name by default: QtCore qtbase/src/corelib/serialization/qcborstream.cpp:1441: (qdoc) warning: Class StringResult has no \inmodule command; using project name by default: QtCore Change-Id: I1c85ca32aff1f89f70898af7b11cfead96c80349 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-04-241-2/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/util/qshaderformat.cpp src/gui/util/qshaderformat_p.h src/widgets/graphicsview/qgraphicsitem_p.h Change-Id: Idafd88eb9a0a15b4af29f6143d009c1ec8ceecca
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-04-161-2/+11
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qlocale.qdoc tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Done-with: Edward Welbourne <edward.welbourne@qt.io> Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I88e0757b2d020f0a244714c87844631df4b3fd13
| | * Fix resolving NTFS symbolic links that point to UNC sharesVolker Hilsheimer2019-04-101-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this change, the target of a symbolic link that points to a UNC share would include UNC in the target path, and not be correctly made absolute. Add a relevant test case, and use the opportunity to factor out the helper code that creates NTFS symlinks into a function that takes care of error handling. The file created with the new test case only gets cleaned up correctly when passing the file path into QDir::rmdir, which is either way the right thing to do. [ChangeLog][QtCore][QFileInfo] Fixed resolving of symbolic links to UNC shares on NTFS file systems. Change-Id: I9ba75d627aedf7c4cc289f0cb71088d795d30d8a Fixes: QTBUG-73688 Task-number: QTBUG-63970 Task-number: QTBUG-30401 Task-number: QTBUG-20791 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QRegExp include cleanupSamuel Gaist2019-04-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRegExp includes can be found in several files where there's not even a use of the class. This patch aims to avoid needless includes as well as follow the "include only what you use" moto. This patch removes a QRegExp include from the QStringList header which means that there is likely going to be code breaking since QStringList is used in many places and would get QRegExp in. [ChangeLog][Potentially Source-Incompatible Changes] qstringlist.h no longer includes qregexp.h. Change-Id: I32847532f16e419d4cb735ddc11a26551127e923 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-04-101-9/+0
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/gui/image/qpnghandler.cpp Change-Id: Ied79d02912ffb3a307a99483df7db08c7f9d0cd8
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-061-9/+0
| |\| | | | | | | | | | Change-Id: Iec860bb703f983b7438e67c695b9c454e72b3e0f
| | * Remove unused static methodKai Koehne2019-04-051-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | The only use of this method got removed already in commit bebae3737624. Change-Id: I9757cbe34710efd9a9d31c74f81e01da40453ff9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-04-086-12/+0
| | | | | | | | | | | | | | | Change-Id: I7bc6c455fbae4cdad584c76773299a6d8cd40c82 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Remove handling of missing very old compiler feature checkAllan Sandfeld Jensen2019-04-062-37/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes handling of missing Q_COMPILER_NULLPTR, Q_COMPILER_AUTODECL, Q_COMPILER_LAMBDA, Q_COMPILER_VARIADIC_MACROS and Q_COMPILER_AUTO_FUNCTION. We haven't supported any compilers without these for a long time. Change-Id: I3df88206516a25763e2c28b083733780f35a8764 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Replace qMove with std::moveAllan Sandfeld Jensen2019-04-062-3/+3
| | | | | | | | | | | | | | | | | | Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-061-3/+3
|\| | | | | | | | | | | Change-Id: Ib7c4fc52915b5e6c72b9aa262fb59f2a041dccd7
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-051-3/+3
| |\| | | | | | | | | | Change-Id: I010a6322d12e038fdce247a58dfb05e204c2ff3b
| | * QFileSystemEngine: Fix typoOrgad Shaneh2019-04-051-3/+3
| | | | | | | | | | | | | | | Change-Id: I538ef771dcf6b757025c8d31f13a91222c2ebd3e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-052-1/+5
|\| | | | | | | | | | | Change-Id: If4974bbf0a166de244dd57cb71b05fa28bcc34ce
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-041-1/+3
| |\| | | | | | | | | | Change-Id: Ia7328524f2cd9d5995ac8705f0fe0bf570b2e831
| | * Windows: Fix QFileSystemEngine::id() for FAT32 drivesFriedemann Kleint2019-04-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GetFileInformationByHandleEx() which is used to to obtain the ID, has been found to fail on FAT32 (USB removable drives). Fall back to GetFileInformationByHandle() for these. Fixes: QTBUG-74759 Change-Id: Ib3ef60a6bf9e9edaf41af86bf71666001cb0aa58 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | wasm: disable XDG_RUNTIME_DIR warningMorten Johan Sørvig2019-04-031-0/+2
| | | | | | | | | | | | | | | | | | | | | XDG is not very relevant on the Web platform. Change-Id: Ibd885e28da15114d0601c73e34dec556e65cbe75 Reviewed-by: David Faure <david.faure@kdab.com>
* | | Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-0310-22/+22
| | | | | | | | | | | | | | | | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Use QScopedValueRollback more as a reentrancy guardAllan Sandfeld Jensen2019-03-263-6/+6
| | | | | | | | | | | | | | | | | | | | | It is documented for the use, but we were rarely using it. Change-Id: I812b9e6c8fbf204aba43ce2b79eca308ca75de88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-03-261-2/+2
|\| | | | | | | | | | | Change-Id: I38389a69411f4549fed432f1181dbe23398b34a2
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-201-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qplatformintegration.cpp src/gui/kernel/qplatformintegration.h src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/xcb/qxcbconnection_screens.cpp Change-Id: I15063d42e9a1e226d9d2d2d372f75141b84c5c1b
| | * QTemporaryFile: Return early if the passed in QFile cannot be openedAndy Shaw2019-03-191-2/+2
| | | | | | | | | | | | | | | | | | | | | Change-Id: I97f00163c24f74d31e1b41ec7337f72600bda2d5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Widen out parameter "result" of the native event filters for Qt 6Friedemann Kleint2019-03-221-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | LRESULT on Windows 64 is a 64bit type, adapt filter functions of QAbstractNativeEventFilter and QAbstractEventDispatcher accordingly. Fixes: QTBUG-72968 Change-Id: Ie53193e355f0b8e9bd59fa377f43e2b4664a2ded Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-162-25/+44
|\| | | | | | | | | | | Change-Id: Ief0a0b754c104d5348fee9ee15e967bd37c526f8
| * | Fix qdoc errors in QProcess headerFriedemann Kleint2019-03-151-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split apart the #ifdef so that qdoc on non-Windows systems sees Q_SECURITY_ATTRIBUTES and Q_STARTUPINFO, fixing: LOG Build & visit PCH for QtCore src/corelib/io/qprocess.h:204:9: error: unknown type name 'Q_SECURITY_ATTRIBUTES' src/corelib/io/qprocess.h:205:9: error: unknown type name 'Q_SECURITY_ATTRIBUTES' src/corelib/io/qprocess.h:210:9: error: unknown type name 'Q_STARTUPINFO' Change-Id: I50b4ee6113da4cd49b6b08b84e6e6590438c5573 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-151-16/+33
| |\| | | | | | | | | | Change-Id: I2bf3b4ceb79364330eae4cbf3cdee9a82d1be46d