summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersJani Heikkinen2015-02-11135-1100/+1004
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/devLaszlo Agocs2015-02-106-9/+18
|\
| * Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-02-106-9/+18
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro src/gui/image/qimage_conversions.cpp src/gui/opengl/qopenglextensions_p.h src/gui/text/qtextengine.cpp src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/eglfs/qeglfshooks_stub.cpp src/plugins/platforms/eglfs/qeglfsscreen.cpp src/plugins/platforms/eglfs/qeglfswindow.cpp src/plugins/platforms/windows/qwindowsfontdatabase.cpp src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp src/plugins/platforms/windows/qwindowsnativeinterface.cpp src/plugins/platforms/windows/qwindowsscreen.cpp src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/windows/qwindowswindow.h src/plugins/platforms/xcb/qxcbdrag.h src/widgets/itemviews/qabstractitemview.cpp src/widgets/kernel/qwidget.cpp src/widgets/util/qsystemtrayicon_p.h tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp conflicts. Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
| | * QProcess/Win: fix sporadic crashJoerg Bornemann2015-02-052-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QProcessPrivate::_q_processDied() was potentially called twice if there was a slot connected to readyRead() that called processEvents(), because the processFinishedNotifier was still enabled when readyRead() was emitted. This led to a null pointer access in findExitCode. Change-Id: I4b796b81f050dc46bb9469602984accaa6ebfa28 Task-number: QTBUG-33731 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
| | * Fix leaks in OS X bundle detectionDyami Caliri2015-02-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were several leaked CFStringRefs in the new OS X bundle detection code that is part of QFileSystemEngine. Change-Id: Id0817e9692da411c7eb8287b9bf71b99ae28f960 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
| | * Merge remote-tracking branch 'origin/5.4.1' into 5.4Frederik Gladhorn2015-01-292-2/+11
| | |\ | | | | | | | | | | | | Change-Id: Idadb5639da6e55e7ac8cc30eedf76d147d8d5d23
| | | * QTemporaryDir: Remove directories on failureEskil Abrahamsen Blomfeldt2015-01-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a temporary directory but failing to set its permissions, we need to remove the directory we created to avoid leaving 256 empty, unused directories in the destination folder. This happens on Android if you try creating a QTemporaryDir in the download path on the sdcard. Task-number: QTBUG-43352 Change-Id: Ic88fb7572f1abd65e5c7d8882b59c95f4b22ed72 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | * Fix memory leak in Qurl::toCFURL()Morten Johan Sørvig2015-01-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Release the temp CFString. Change-Id: I8a5b8f18a42a4a9b2c6671f0f5b32a3f0b14238d Task-number: QTBUG-43710 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | Doc: Improve description of QTextStream::readLine()Alexander Volkov2015-01-211-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't recommend a common value for maxlen, because we don't really know it. Soften a statement about not applying QString::trimmed() to the result because it may contain surrounding spaces. Change-Id: Ie90db6f033cfcc0dff0ef6796ba115028bcaaa77 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | | QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<Kai Koehne2015-02-091-2/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | QTextStream: remove a use of QString::sprintf()Marc Mutz2015-02-021-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using QString::sprintf() (and converting the result back to QByteArray), simply do the conversion from uchar to hex digits ourselves, using QtMiscUtils. This function is a copy of a similar (but not identical) one in qprocess_unix.cpp, but it's not clear whether they can or should be merged (both are only conditionally compiled), so this patch does not attempt to do so. Change-Id: I0be87963f78a98e35a54c98c5fb444756c57b672 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | QTextStream: fix a warning with QTEXTSTREAM_DEBUG definedMarc Mutz2015-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The warning was: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] Change-Id: I37dc13ca864d408e02c69102ba5208f8bfe70980 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | QProcess: fix warnings with QPROCESS_DEBUG definedMarc Mutz2015-02-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The warnings were: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=] (2x) Change-Id: If8c2e8fab7388cb4aa7d6e7ceb5faee531e16006 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Call QDir::homePath() only when necessary in QSettings::initDefaultPaths()Maks Naumov2015-02-021-3/+2
| | | | | | | | | | | | | | | Change-Id: I990520917ec65127ae554b5e872791cff78f0b56 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | QNX: QProcess workaround for the stdin pipeRafael Roquetto2015-01-231-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to a bug in the internal implementation of posix_spawnp on QNX, all file descriptors with a value lower than the maximum file descriptor specified in the file_actions structure are duplicated by default, ignoring the FD_CLOEXEC flag. This includes all file descriptors that we are not working with. So we add those file descriptors that have the FD_CLOEXEC flag to the file_actions structure as close actions. Change-Id: I316bc334addb46a4b84c199a69e9bd291ca706c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Handle posix_spawn using exit code 127 to indicate fail-to-startThiago Macieira2015-01-231-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Most posix_spawn implementations are done using fork(), so the only way to report errors afer fork() is via a special exit code. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html Change-Id: I3a37f81b0cb278bb31e5cb83c87e6b4c034dbc19 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Use forkfd in QProcessThiago Macieira2015-01-234-389/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the existing code in QProcess that dealt with signaling of child processes exiting with forkfd and spawnfd. The previous code was convoluted and hard to maintain, having shown its age in the last year. I've been running it for a year and a half and the new implementation is definitely an improvement. This change replaces support for the QNX Neutrino spawn() call with the POSIX version. We lose the ability to do setsid(), but we gain quite a few ioctls() that were done to fill in the file descriptor mapping structure. That's also the only OS for which we have the ability to thread-safely chdir() before the call to spawnfd(). Another advantage is that forkfd does not require a dedicated thread running to handle child processes exiting. Change-Id: I5eb76821dfdb6a8ed2989d7f53b3c31e515c3174 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | | Add the compilation of forkfd to QtCoreThiago Macieira2015-01-232-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | This also brings in the harness to forkfd that uses QBasicAtomic instead of the generic GCC atomics. Change-Id: Id5488bf192db0027bc684956ade0bf6c640c9512 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add QTextStream::readLine() overloadAlexander Volkov2015-01-232-5/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most common use case for QTextStream::readLine() is reading a file line by line in a loop. The existing readLine() method allocates new memory for each line, that results in a loss of speed. The introduced overload can use already allocated memory. Besides it allows you to not think about filesystem specifics. The current QFile documentation suggests a separate way to read files from /proc filesystem. With this overload it's possible to use the same idiom in all cases: QTextStream in(&file); QString line; while (in.readLine(&line)) { process_line(line); } The idea was inspired by the blog post of Ivan Čukić: http://ivan.fomentgroup.org/blog/2014/10/03/api-design-and-impact-on-the-performance-qt-vs-stl-example/ Change-Id: I0c62b4a52681870589bc099905e83ed69e03dd40 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/devSimon Hausmann2015-01-212-3/+4
|\ \ \
| * | | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-212-3/+4
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
| | * | QIncrementalSleepTimer: Use QElapsedTimer instead of QTimeDaniel Teske2015-01-191-3/+3
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | Since the former is monotonic and we need a monotonic timer here. Change-Id: I34325da4fe0317e12f64629a6eef6a80990c3e1a Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Add missing AppDataLocation caseMorten Johan Sørvig2015-01-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This amends commit f3bc9f5c. Change-Id: I69b1a5080e7ac92b8a39746d814da77b17c271c2 Task-number: QTBUG-43868 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | | Haiku: Add implementation for QStandardPathsTobias Koenig2015-01-212-0/+227
| | | | | | | | | | | | | | | Change-Id: Ic64a5ab3a1ef711180b855ee99154177b7e25696 Reviewed-by: David Faure <david.faure@kdab.com>
* | | MSVC: Silence warning about right shift by too large amountKai Koehne2015-01-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Silence the MSVC warning that got introduced in commit 62b752b3a2c9: warning C4333: '>>' : right shift by too large amount, data loss qdebug.cpp(316) : see reference to function template instantiation 'void putEscapedString<uchar>(QTextStreamPrivate *,const Char *,int,bool)' being compiled with [ Char=uchar ] qdebug.cpp(270) : warning C4333: '>>' : right shift by too large amount, data loss Change-Id: If1ee20b741feae3287a8d6a11c202b4296d429fb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QIODevice: remove ineffective caching membersAlex Trotsenko2015-01-202-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the QIODevice functions already have a locally cached "sequential" flag. Make the rest of them follow this strategy. This eliminates the need to use private caching members. Change-Id: I0edb2c9b7c5f411c5bee25c425e7b40e3c9021d3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: hjk <hjk@theqtcompany.com>
* | | Android: Fix canonical form of nonexistent pathsEskil Abrahamsen Blomfeldt2015-01-191-0/+20
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some Android devices, the realpath() implementation will return the full path even if the path does not exist. This breaks the expectation of the canonical path, which should be empty for nonexistent paths. A few autotests failed due to this. To work around it, we query existence before getting the canonical path. [ChangeLog][Android] Fixed canonical path for nonexistent paths on some devices. Change-Id: I5c1dabb8b8394694bc74d2a91912800aaff6b9e3 Task-number: QTBUG-43705 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QDebug support for NSObject and a few selected CoreFoundation typesTor Arne Vestbø2015-01-181-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lets us print out the interface name in addition to the address when doing: qDebug() << myNSObject; Unfortunately, CFTypeRef is just a typedef to void*, so we can't add a generic overload for CFTypeRef. For now, we provide operators for commonly used Core Foundation and Core Graphics types. Additional types may be added using Q_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE. Change-Id: I27b12ef9e62cb1be348b9771cb31657692903f6c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update QFileSelector to use QSysInfo betterThiago Macieira2015-01-161-21/+14
| | | | | | | | | | | | | | | | | | | | This reduces a bit of string duplication by relying on the constants defined in qglobal.cpp and detection via uname(2), in addition to adding the Linux distribution name as a selector. Change-Id: I64a46a0fc552c399db787125b1b32aae5c50056f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* | QFileSystemEntry: Replace manual seek in string with lastIndexOf()Orgad Shaneh2015-01-111-7/+1
| | | | | | | | | | Change-Id: Icf45795a962baa7102c02293cb7ce1781b8f2f56 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Do the same for qDebug of QByteArray and QLatin1StringThiago Macieira2015-01-112-3/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QLatin1String are actually Unicode, so print them with \uXXXX sequences. QByteArray are binary (arbitrary), so print as hex. Since hex escape sequences in C are not limited in length (\x00000F is a valid hex sequence), we need to insert "" if the next character is a valid hex digit. [ChangeLog][QtCore][QDebug] Similarly, printing of QByteArrays whenever "noquote" is not active now prints the arrays in a format consumable in C++, with all non-printable characters printed in hex escape sequences. Change-Id: Ibd0c1a97cbac98610c65c1091bfbcf5581c835db Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | QDebug: pretty-print QStrings and QStringRefsThiago Macieira2015-01-114-4/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QDebug] Printing of QStrings and QStringRefs whenever "noquote" is not active now prints the strings in a format that can be copied back to C++ code. All characters that aren't printable in US-ASCII are escaped (this includes printable Unicode characters outside of US-ASCII). Pretty-printing will not respect QTextFormat padding or field widths. Change-Id: I169a8a0508e24693f5652f0129defe7f709e5d08 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Haiku: Make corelib compile on HaikuTobias Koenig2015-01-101-0/+3
| | | | | | | | | | Change-Id: I66bc492390eedd723ab7866d3c7a38539d708727 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | QtCore: mark some operations nothrowMarc Mutz2015-01-103-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Get rid of QT_NO_QWARNING_MACROKai Koehne2015-01-091-1/+1
| | | | | | | | | | | | | | Just use QT_NO_QDEBUG_MACRO, like we do already for qInfo. Change-Id: I4b2ef68427fbe6f253fe02a3ab161fa25186e834 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QtInfoMsgKai Koehne2015-01-093-12/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an 'info' message type that can be used for messages that are neither warnings (QtWarningMsg), nor for debugging only (QtDebugMsg). This is useful mainly for applications that do not have to adhere to the 'do not print anything by default' paradigm that we have for the Qt libraries itself. [ChangeLog][QtCore][Logging] QtInfoMsg got added as a new QtMsgType. Use the new qInfo(), qCInfo() macros to log to it. Change-Id: I810995d63de46c41a9a99a34d37c0d417fa87a05 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | QStandardPaths: add AppConfigLocation.David Faure2015-01-099-12/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ConfigLocation was erroneously inconsistent, by adding the org name and app name on Windows (unintentionally) and not on Unix (while having subdirs in ~/.config is actually common practice for some XDG desktops) Therefore this adds AppConfigLocation, which always has the org name and app name (while GenericConfigLocation never does). [ChangeLog][QtCore][QStandardPaths] Added QStandardPaths::AppConfigLocation, for application-specific configuration directory. ConfigLocation was inconsistent. Task-number: QTBUG-38872 Task-number: QTBUG-38845 Change-Id: I80fb98f296436261f3996c9df87571c29b06ab35 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix authenticated POST/PUT http requests with buffering disabledAllan Sandfeld Jensen2015-01-092-30/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If reset is disabled then POST and PUT requests can not be authenticated as the upload device can not be reset. There shouldn't be any reason that shouldn't be allowed if the QIODevice given supports resetting. The disableReset feature of QNonContiguousByteDevice is removed as it is not used anywhere else, and is redundant when reset can indicate success or failure. Task-number: QTBUG-43628 Change-Id: If941a98fd3f797872351c10bdca6aa6745dbefea Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
* | QFileSystemWatcher: Use FSEvents FSW on OS XGabriel de Dietrich2015-01-091-4/+4
| | | | | | | | | | | | | | | | | | This removes one of the last references to 10.6. Change-Id: Ie23d9aba698714460e7478a421e85d4ad50d4ec9 Task-number: QTBUG-43505 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* | Remove workarounds for RVCT compiler bugsThiago Macieira2015-01-061-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does not try to remove support for RVCT. There has been no report of it working or failing to work, so the status continues to be unknown. In particular, the inline assembly code in atomic_armv[56].h remains in place. This commit only removes workarounds for compiler bugs or bogus warnings, assuming that anyone using this compiler has updated since Qt last tried to use it for Symbian in 2011. Note also how anonymous unions are now part of the language in C++11. Change-Id: Idc4fab092beb31239eb08b7e139bce2602adae81 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix QFileSystemWatcher::directoryChanged docs/testCory Bloor2015-01-051-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFileSystemWatcher does not signal directoryChanged() when files are modified in a watched directory. QTBUG-8945 was closed with the decision that it should not signal. Updating the docs and tests to reflect this fact. The test code that is being changed is a partial revert of Qt4 commit 1428cc6d71a65c1ac7123c9c4cc3cfaf225cceed. It appears that Symbian supported directoryChanged() on modification, hence why the check was for 0 or 1. Change-Id: I04320c68f227ca338ce65e525956ee201fd50699 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | Fix undefined behavior found by GCC 5Thiago Macieira2015-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC said: qtldurl.cpp:51:50: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations] qtldurl.cpp:51:48: note: possible undefined statement is here while (tldIndices[index] >= tldChunks[chunk] && chunk < tldChunkCount) { ^ That's because we check whether chunk is still valid (less than tldChunkCount) after we've dereferenced tldChunks[chunk]. That is, we've already read tldChunk[2]. Change-Id: I79b6a1ea9a2454813d6cce7596fc2bb6d972d097 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-12-292-4/+5
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/kernel/qplatformsystemtrayicon.cpp src/gui/kernel/qplatformsystemtrayicon.h src/plugins/platforms/xcb/xcb-plugin.pro Change-Id: I00355d3908b678af8a61c38f9e814a63df808c79
| * qstorageinfo_unix.cpp: Fix build on BSD and other unicesDmitry Shachnev2014-12-231-3/+4
| | | | | | | | | | | | | | | | | | | | | | * Include statvfs.h on all non-Linux and non-Solaris systems. * Fix type of stat_buf structure on BSD. Change-Id: I6336503082fafd7f6108cf95c079bdd329d2ea0f Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
| * Make sure we don't try to ask QByteArray to allocate too muchThiago Macieira2014-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QFile::readAll could be asked to read a file that is over 1 GB in size and thus cause an assertion: ASSERT failure in qAllocMore: "Requested size is too large!", ... The idea behind the existing code was correct, but the value was wrong. It prevented overflow of the integer size request, but didn't prevent overflowing the storage size. Change-Id: I072e6e419f47b639454f3fd96deb0f88d03e960c Reviewed-by: Martin Smith <martin.smith@digia.com>
* | QTextStreamPrivate::scan(): remove unnecessary checksAlex Trotsenko2014-12-131-8/+2
| | | | | | | | | | | | | | | | | | | | | | The delimiter search scan() loop detects a device or string reaching the end of input and size limits. After that, 'false' is returned only when no data was read at all. So, there is no a reason to test anything except 'totalSize'. Change-Id: Ib9cc21c0f4b7863c2dafb1bb074c5cda07387b8f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge the different implementations of toHex in one central placeThiago Macieira2014-12-132-3/+4
| | | | | | | | | | | | | | | | | | It's a simple enough function, but we don't need to duplicate those 17 bytes all over the place. Now they'll be duplicated at most once per library. Change-Id: Ic995e2a934b005e7e996e70f2ee644bfa948eb38 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | QTextStream: stream QStrings without modifying the user contentThiago Macieira2014-12-132-27/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QTextStream::operator<< calls QTextStreamPrivate::putString, which was taking a copy of the user's string and modifying it depending on padding. That is not necessary, since we're only talking about padding. Instead, calculate the left and right paddings. For the case of "accounting padding", we move the sign (if any) to the beginning of the left padding and skip it in the data. The one side-effect I can think of is that the stream could flush in the middle of the writing operation. The debugging section had to be removed because it doesn't make sense anymore. Change-Id: I57fdbf98ec6f054f4e085f2e465de3dcbb6225ce Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Clean up QDebug operators for QDirKai Koehne2014-12-101-13/+16
| | | | | | | | | | | | | | Change-Id: Ia0a9eb5058adde98f690288cfbbb62a82a75dc60 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QFileSystemEngineUnix: Don't stat before retrieving working path.Robin Burchell2014-12-101-22/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | This is entirely unnecessary. If the path is bad, then getcwd and friends will fail. Doing an extra stat imposes an extra performance overhead without reason. Trivia: A dive into Qt's history shows that the stat dates back to: Sat Aug 12 14:24:36 1995 +0100 The original purpose of the stat was to avoid calling getcwd unless the path had actually changed. Subsequently, the caching was removed, but the stat remained. Change-Id: Ia4598dc74ded36516b3e10e7ab0eb5a6a5690466 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>