summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* QTemporaryFile: fix the generation of names from templatesThiago Macieira2017-06-121-2/+5
| | | | | | | | | | | | | | | | First and most importantly, let's not use more than half of the template for the application's PID. With over 71% of all PIDs on a typical Linux system and 90% of those on a Darwin system having 5 decimal digits, using them all in a template that is usually 6 characters long is wasteful. That leaves only 1 character for the random part, thereby reducing the number of temporary files possible to only 52. So limit the PID to half the characters of the template. Second, let's use QRandomGenerator::bounded to create the the random part, instead of qrand (which is often unseeded at this point). Change-Id: Icd0e0d4b27cb4e5eb892fffd14b52eda5e467395 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-071-1/+5
|\ | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmenu.cpp Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
| * QStorageInfo: Pass MNT_NOWAIT to getmntinfoThiago Macieira2017-05-301-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | This forces the API not to wait for synchronous I/O from the filesystems and get the information, but instead just use the cached information directly. It's a good idea if we have an unresponsive FS, like NFS with an unreachable server. Task-number: QTBUG-61096 Change-Id: Iddeeffb6f4ad4a2894a2fffd14c32f6e90664a63 Reviewed-by: Tobias C. Berner Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Remove QWinOverlappedIoNotifierJoerg Bornemann2017-06-023-522/+2
| | | | | | | | | | | | | | | | | | | | This class in unused in qtbase since Qt 5.6.1. The only outside usage was in qtserialport, which got its own copy of QWinOverlappedIoNotifier in commit qtserialport/65dba188. Change-Id: I7668e67a1cc49c4418c66141784b180cd5f9d479 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-291-0/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/win32-g++/qmake.conf mkspecs/win32-icc/qmake.conf src/platformsupport/fontdatabases/mac/coretext.pri src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
| * QDirIterator docs: add a cool recursive file-finding snippetShawn Rutledge2017-05-161-0/+4
| | | | | | | | | | | | | | | | This is one of the main use cases for QDirIterator, but it wasn't obvious enough that it's possible. Change-Id: Idae11cfe75dd0e16f1a960bba2470b1695d11241 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Merge remote-tracking branch 'origin/5.9' into devFrederik Gladhorn2017-05-101-0/+2
|\| | | | | | | Change-Id: I172e3e19ddcc5b7665e6c8382d725e7cc4f9794f
| * Warn if files are not found because of features.filesystemiteratorStephan Binner2017-05-081-0/+2
| | | | | | | | | | | | Change-Id: Ife3197aa1c56ba3ab6e7f530fbcbcf761f223b16 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add QDebug operator for QFileInfoShawn Rutledge2017-05-092-0/+16
| | | | | | | | | | | | | | So far it only shows the path. Change-Id: Ibfecc20ddacce12a178e1ddb297b0e7b91f29f05 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-0717-52/+115
|\| | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkreply.cpp tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
| * QtCore: include mocsThiago Macieira2017-05-0512-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compilation and link times in CPU seconds with GCC 7, using precompiled headers (not including moc, rcc, uic, etc. steps or headersclean): Before After Debug -O0 198,1 180,3 Debug -Og 240,7 229,2 Release -O3 267,1 249,2 Release LTO 239,4 229,8 QtCore required a little manual adjusting because some files are bootstrapped into moc itself and into qmake. Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * Doc: Do not abbreviate directory in documentationKai Koehne2017-05-041-5/+5
| | | | | | | | | | | | Change-Id: I26e8c5caca31e842adc7a09151b6de2cc17698ed Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
| * QWindowsPipeReader: fix possible invalid invocation of ReadFileEx()Alex Trotsenko2017-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | If the user calls QLocalSocket::setReadBufferSize() with a value less than the current size of the pipe buffer, startAsyncRead() would call ReadFileEx() with invalid parameters: ReadFileEx(handle, nullptr, some_big_value, ...); Change-Id: I3d153e3ec34f8038dc001c1c896aeceb666a8979 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QUrl: fix IDN conversion when the ACE form is invalidThiago Macieira2017-04-251-9/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We guarded against the Unicode form being invalid and did not produce an encoded form. But we did not guard against proper Punycode sequences that decode to forms that had not passed the proper Nameprep stage. So check for that and, if it fails, just keep the label in the form we found it in (it's valid STD3 anyway). [ChangeLog][QtCore][QUrl] Fixed a bug that caused certain domain names that look like Internationalized Domain Names to become corrupt in decoded forms of QUrl, notably toString() and toDisplayString(). Task-number: QTBUG-60364 Change-Id: Iadfecb6f28984634979dfffd14b833142cca8d0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * QUrl: fix IDN whitelist checking when the TLD is in UnicodeThiago Macieira2017-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | The whitelist is kept in ACE form, so if the TLD came in Unicode, we need to run ToASCII before we can check the whitelist. This is slightly inefficient because we'll run the same operation later in this domain. Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
| * QLoggingRegistry: remove rules vectorMarc Mutz2017-04-212-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It only contained a concatenation of the individual rule sets, probably to fix their order in a central place, as well as simplifying iteration in defaultCategoryFilter(). Fix these two issues differently, but introducing a RuleSet enum that lists rule sets in the order in which they should be applied by defaultCategoryFilter(), and turn individual rule sets vectors into a C array of vectors. This enables two nested loops in defaultCategoryFilter to replace the one loop over 'rules'. Apart from building up 'rules' in updateRules(), this was the only access to that member. That leaves updateRules() with just the task of running defaultCategoryFilter() on the new rule sets. Consequently, a call to updateRules() can now replace the identical loop in installFilter(). Performance should not suffer. Iterating over a fixed-size array of vectors is hardly any slower than iterating over a single vector, and while the construction of 'rules' was probably a one-off task in most programs, this way of keeping the rules also saves memory because rules are not kept in two different vectors. It is also more maintainable, of course. Change-Id: Ibc132d096c8137dd02b034752646212e51208637 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QWindowsPipeReader: remove code duplication in read()Alex Trotsenko2017-05-051-11/+2
| | | | | | | | | | | | | | | | QRingBuffer::read() implements the same loop. Change-Id: I480fe07e2400dfaee560f22bdbf07d6cdd013eb2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QFileDevice/QFileInfo: Add fileTime() and setFileTime()Nikita Krupenko2017-04-2712-4/+373
| | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QFileDevice] Added fileTime() and setFileTime(). [ChangeLog][QtCore][QFileInfo] Added fileTime(). Task-number: QTBUG-984 Change-Id: I84dfb05b9454a54e26b57b78edee5773dc4c5c3c Initial-patch-by: Raphael Gozzo <raphael.rg91@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix casts and null pointer style in QProcessPrivate::startProcessJoerg Bornemann2017-04-231-4/+5
| | | | | | | | | | | | | | | | Using C++ casts fixes clang warnings, and using nullptr indicates what's a pointer and what's a flag. Change-Id: I17c44689f42b9af2c5ff1d9a7e3781a2243f257f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Support setCreateProcessArgumentsModifier in QProcess:startDetachedJoerg Bornemann2017-04-232-10/+20
| | | | | | | | | | | | | | | | | | Factor out both CreateProcess calls into one function that also calls the modifier callback for the CreateProcessArguments struct. Task-number: QTBUG-57687 Change-Id: I9d2ef4f2d7cd077aa4c3eba926ab4dfb9e570291 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Use list-initialization moreMarc Mutz2017-04-201-2/+1
| | | | | | | | | | | | | | Fixes a few ugly code pieces I added over the years. Change-Id: I5c06b73e858add04ea184120c6df71720baf9be3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-209-66/+87
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Split Q_COMPILER_UNICODE_STRINGS: add Q_STDLIB_UNICODE_STRINGSMarc Mutz2017-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit bf2160e72cd8840a8e604438cbdc807483ac980a, we can rely on charNN_t support in all compilers except MSVC 2013, and since that commit, we use (in 5.10, not 5.9, yet) !defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS) when we only need charNN_t, the type, as opposed to its library support (u16string, char_traits<char16_t>, ...). This patch splits the Q_C_UNICODE_STRINGS macro into two, adding Q_STDLIB_UNICODE_STRINGS for when we need std::uNNstring, leaving Q_C_UNICODE_STRINGS for when we need just charNN_t support. In QDebug, when constructing a QChar out of a char16_t, cast to ushort first, since QChar(char16_t) was only officially introduced in Qt 5.10. [ChangeLog][Potentially Source-Incompatible Changes] The internal Q_COMPILER_UNICODE_STRINGS macro is now defined if the compiler supports charNN_t, even if the standard library does not. To check for availability of std::uNNstring, use the new Q_STDLIB_UNICODE_STRINGS macro. Change-Id: I8f210fd7f1799fe21faf54506475a759b1f76a59 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Move Q_REQUIRED_RESULT to its correct positionThiago Macieira2017-04-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | That's before the return type or static, inline, constexpr or such keywords (if any). Perl Script: s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/ Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * Revert "Initialize QLoggingRegistry rules on first use, not qApp construction"Tor Arne Vestbø2017-04-192-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 47cc9e23a313d67a4a3107242f205d2473842021. We use QCoreApplication::applicationDirPath in the logging initialization to find a possible qtlogging.ini file. Because QCoreApplication::applicationDirPath requires a QCoreApplication instance this leads to a qWarning, which in turn leads to a recursive call to the logging initialization, and in turn to a recursive mutex deadlock. Task-number: QTCREATORBUG-18031 Change-Id: Ic75e1e8c062eb647991725378489bf87c9648cca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Initialize QLoggingRegistry rules on first use, not qApp constructionTor Arne Vestbø2017-04-182-2/+2
| | | | | | | | | | | | | | | | | | Allows categorized logging before QCoreApplication has been created, which otherwise would silently fail to output anything because the category would never be enabled, despite QT_LOGGING_RULES being set. Change-Id: Ia733105c5b6f28e22af511ced5271e45782da12b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-181-5/+5
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp Change-Id: I375fa4afa662fa411a15f212ebd5f2f0dffdba7f
| | * Restore compatibility with Qt 5.7.0 and 5.6.1Thiago Macieira2017-04-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSysInfo::productType() returned "osx" for all versions of macOS, even 10.12. Change 3e2bde35786 was incorrect. [ChangeLog][Important Behavior Changes] QSysInfo::productType() and QFileSelector behavior on macOS was restored to match what Qt used to return in version 5.7.0 and earlier. The behavior found in Qt 5.6.2, 5.7.1 and 5.8.0 is removed. [ChangeLog][Future Compatibility Notice] The identifiers that QSysInfo::productType() and QFileSelector will use to identify macOS systems will change in Qt 6.0 to match the Apple naming guidelines which will be current then. Task-number: QTBUG-59849 Change-Id: Ib0e40a7a3ebc44329f23fffd14b2b39392210c4f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
| * | QProcess: fix Unix buildJake Petroules2017-04-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression introduced in ff19ebcc Task-number: QTBUG-60046 Change-Id: I47c357433b25f07011a7a3a64d3150591785b206 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Optimize QLoggingSettingsParserMarc Mutz2017-04-102-39/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor the line parsing into a separate function, parseNextLine(), taking a QStringRef. In setContent(QTextStream&), use the new readLineInto() function to re-use the capacity of a single QString for all lines. In setContent(QString), use splitRef() to split the lines. In either function, pass each line to parseNextLine(). In order to port all the parsing to QStringRef, I needed to make some semantic changes: the old code removed all whitespace right at the beginning. This is not possible with QStringRef. It also didn't feel right, since a line like [ r u l e s ] would successfully parse as the section named "rules". I added trimmed() calls at the beginning, and around the valueStr and pattern extraction, which should be good enough. Also, when a section is found, don't store it anymore. Instead, only store whether it was the [rules] section, because that's all we'll test for. That way, we don't have to convert QStringRefs to QString just to store them across parseNextLine() calls. Replace the setSection() function with setImplicitRulesSection(), because "rules" is all that was ever passed. This is private API, we can bring back some of the dropped flexibility later, as needed. [ChangeLog][Important Behavior Changes] Logging rules can no longer contain arbitrary whitespace such as within a category identifier. Change-Id: Ic26cd23c71f5c810b37ef4b972354ac31d3408fe Reviewed-by: Kai Koehne <kai.koehne@qt.io>
| * | Fix QDir::mkpath() when the path contains "symlink/../"Thiago Macieira2017-04-071-19/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is incorrect to collapse a "symlink/.." segment because the parent directory of the symlink's target may not be the directory where the symlink itself is located. [ChangeLog][QtCore][QDir] Fixed a bug that caused QDir::mkpath() to create the wrong directory if the requested path contained a symbolic link and "../". Change-Id: Iaddbecfbba5441c8b2e4fffd14a3e367730a1e24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
| * | QDataStream: add operator<< and >> for std::nullptr_tThiago Macieira2017-04-072-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::nullptr_t is nullary: it accepts only one value, nullptr. So we don't need to read or write anything. This commit simply adds the two operators that allow generic code to operate on std::nullptr_t if required. This commit also adds the actual use to QMetaType::load/save, even though there's no change in behavior. [ChangeLog][QtCore][QDataStream] Added operator<< and operator>> overloads that take std::nullptr_t, to facilitate generic code. Change-Id: Iae839f6a131a4f0784bffffd14aa37e7f62d2740 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-071-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/linux-icc/qmake.conf mkspecs/macx-icc/qmake.conf mkspecs/win32-icc/qmake.conf src/gui/painting/qgrayraster.c Change-Id: Ib08c45ea3215be05f986ecb3e1f4b37d209aa775
| * | Fix warning for -no-feature-temporaryfileStephan Binner2017-04-041-0/+1
| | | | | | | | | | | | | | | | | | Change-Id: Ibb022a1fd043001f628a343dc8ae509083eb4471 Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-043-9/+6
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h src/plugins/platforms/xcb/qxcbwindow.cpp Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
| * | Prefer rvalue versions of toLatin() and toUtf8()Anton Kudryavtsev2017-03-302-5/+3
| | | | | | | | | | | | | | | | | | | | | ... to re-use existing buffers. Change-Id: I7c42529b8cd4400520a59e658ab76f4f8e965cd4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | Use QStringBuilder moreAnton Kudryavtsev2017-03-301-2/+1
| | | | | | | | | | | | | | | Change-Id: If5283e364e921d99ffa7a8fa1abb07356a4a2682 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Use case-insensitive compare moreAnton Kudryavtsev2017-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | ... to avoid allocations. Change-Id: I5993633d1509495ff6ce3a11274a53504aac7c5e Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | Prefer rvalue versions of toLower() and toUpper()Anton Kudryavtsev2017-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | ... to re-use existing buffers. Change-Id: Ib2bc938f1cf0451c1dbc012b3db022b878e987cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QProcess::startDetached: support nativeArguments on WindowsJoerg Bornemann2017-04-011-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The non-static method QProcess::startDetached now supports nativeArguments. [ChangeLog][QtCore][QProcess] Added the ability to specify native arguments for detached processes on Windows. Task-number: QTBUG-52405 Change-Id: Ic97c55caac7c1156e1412322000c1e40d80bdbbb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Simplify QFSFileEngine code: QFile does not require bufferingThiago Macieira2017-03-313-96/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We still support buffering via stdio.h (FILE*), but QFSFileEngine itself is not responsible for the buffering. Opening by file name (not FILE* and not file descriptor) already added the Unbuffered flag. Change-Id: I2bc52f3c7a574209b213fffd1498d4e3f78fe1bf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QProcess::startDetached: support custom process environmentJoerg Bornemann2017-03-312-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting a detached process with a custom process environment can now be achieved by: QProcess p; p.setProgram("foo"); p.setProcessEnvironment(myEnv); p.startDetached(); [ChangeLog][QtCore][QProcess] Added the ability to set a custom process environment for detached processes. Task-number: QTBUG-2284 Change-Id: I49406dffb64fa2aed41ea05cb271bd42eeabb729 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Simplify Unix implementation of QProcess::start{Process|Detached}Joerg Bornemann2017-03-312-65/+28
| | | | | | | | | | | | | | | | | | | | | | | | Use QStandardPaths::findExecutable instead of duplicated implementations. Change-Id: Ia944f1d343d8c215fc2b6e78dae6b2bfffbba688 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add non-static QProcess::startDetachedJoerg Bornemann2017-03-315-21/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The three static QProcess::startDetached overloads support a limited number of features: program, arguments and working directory. To support more features of QProcess (without adding a plethora of overloads) we add a non-static method startDetached that can be used as follows: QProcess p; p.setProgram("cat"); p.setArguments("meow"); p.setWorkingDirectory("/tmp"); if (!p.startDetached()) qWarning("Cannot start process."); We plan to add support for nativeArguments, processEnvironment, standard{Output|Error}File and maybe more in subsequent commits. [ChangeLog][QtCore][QProcess] Added non-static QProcess::startDetached to support more features for detached processes. Task-number: QTBUG-2058 Task-number: QTBUG-2284 Task-number: QTBUG-37656 Task-number: QTBUG-52405 Task-number: QTBUG-57687 Change-Id: If6fdd57ecb28cd13aa5fff566216a4177f81d339 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | | Port QResourceRoot::mappingRootSubdir() to QStringSplitterMarc Mutz2017-03-301-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code here performs a std::mismatch() on the normalized parts of 'root' and 'path', returning whether 'path' is a prefix of 'root'. If 'path' is a proper prefix of 'root', returns the first 'root' part after 'path', in '*match'. Instead of using QString::splitRef(), perform the splitting as we go, using this class' own tool, QStringSplitter. The goal here is to avoid the heap allocation caused by the QVector return of splitRef(), of course. But even though using QStringSplitter means the splitting is now purely inline, text size in optimized GCC 7 Linux AMD64 builds increases by only 24B. Change-Id: I396cc6a30306940220c9e783c31506e6ac17b784 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Optimize qIsEffectiveTLD()Marc Mutz2017-03-301-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TLD lookup is performed in up to three steps, which are decribed in a code comment. For the purposes of this patch, it suffices to mention that the last two steps involved a QStringBuilder expression. Avoid having to build these strings by distinguishing between the lookups using an enum instead of a string prefix. Since qt_hash() calls can now be chained, form the hash value by hashing the prefix character and the domain (part) separately. Also perform the expensive fromUtf8() call only when the string prefix (if any) matched. Once we have nothrow UTF-8/UTF-16 comparison operators, qIsEffectiveTLD() will no longer allocate memory, and run at full speed. Not there, yet, though. I have full confidence that the optimizer will have field day with this, inline all three containsTLDEntry() calls, and constant-fold the checks inside the loop. GCC does, so I didn't try to do it by hand. Change-Id: I1a7647ff52b6742310928ad859d851d1f0c6bdc3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QResource: use QStringViewMarc Mutz2017-03-301-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | Saves 240B in QtCore text size on optimized GCC 7 Linux AMD64 builds. Change-Id: Ifa7b8735027575fbe381896dce608b80ec458ee9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-289-33/+56
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/examples.pro tests/auto/corelib/tools/qchar/tst_qchar.cpp tests/auto/other/qaccessibility/accessiblewidgets.h Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
| * | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-271-1/+1
| |\| | | | | | | | | | Change-Id: Icdd71e9713725bda9c305e338f5c8b41a92ed8e8
| | * Fix some warnings found by QNX's compilerThiago Macieira2017-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Werror is now disabled for that compiler, but it doesn't hurt to fix. io/qstandardpaths_unix.cpp:149:32: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] qtestcase.cpp:2330:31: error: narrowing conversion of '(ms / 1000)' from 'int' to '_Timet {aka unsigned int}' inside { } [-Werror=narrowing] Change-Id: Id92f4a61915b49ddaee6fffd14aea2c1e686e8f2 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>