summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Revert "QProcess: do not emit aboutToClose() twice"Alex Trotsenko2021-09-241-0/+1
| | | | | | | | | | This reverts commit efb90f6e7ed3e8d4f7b6c0fb96012cb3a9a9d037. Reason for revert: behavior change for signal listeners Change-Id: Ibe3c5d496cd61a9fccab17a10cc9fda8334fc9d4 Reviewed-by: Björn Schäpers <qt-codereview@hazardy.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileSystemWatcher: fix QWindowsFileSystemWatcherEngine crashesTim Jenssen2021-09-231-1/+2
| | | | | | | | | | | | | | | | | | | | Since QHash in Qt6 does not guarantee stable iterators after an insert it crashed from time to time. - possible crash at the erase call if pit is invalid - possible crash at insert if pit is invalid QHash<QString, int> myHash; auto i = myHash.find("foo"); myHash.insert("foo", 789); i.value(); // possible crash myHash.erase(i); // possible crash Task-number: QTBUG-96790 Change-Id: Ia9b53d46b8d1fef81ab5a130c229bc9e936f6521 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit e60951eef4f0ade944e2f93ffe2f44abfc76d97a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Refactor QWindowsPipeWriter::writeCompleted()Alex Trotsenko2021-09-211-5/+4
| | | | | Change-Id: Id44215d6a96e7841330181c94cc54b6b677a153d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess: do not emit aboutToClose() twiceAlex Trotsenko2021-09-191-1/+0
| | | | | | | | | This signal is emitted by the QIODevice itself, so we don't have to emit it from QProcess::close(). Pick-to: 6.1 6.2 Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Q{LocalSocket|Process}/Win: handle write errorsAlex Trotsenko2021-09-184-0/+11
| | | | | | | | | To match the Unix behavior, we should emit errorOccurred() signal and close the channel if the write operation fails. Change-Id: Iac3acb18dbbfe6e7e8afb2555d9adaff1fe98d0f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QWindowsPipeWriter: do not clear the buffer in thread pool callbackAlex Trotsenko2021-09-183-49/+89
| | | | | | | | | | | | | | | | | In a blocking application, receiving the results of write operations must be synchronized with the waitFor...() functions. But, clearing the buffer in another thread can cause the code localsocket.write(...); QVERIFY(localsocket.bytesToWrite() > 0); to fail unexpectedly, if the socket has been disconnected between the calls. So, defer resetting the buffer until checkForWrite() is called. Change-Id: I8c21036aab6a4c56d02c0d9a18d4bbce52d724f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Doc: Centralize RFC documentation-links in rfc.qdocLuca Di Sera2021-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | In the effort of repairing broken links as per QTBUG-96127, a series of RFC links referring to `tools.ietf.org/html/*` were modified to point to the new address that the site redirected to. To simplify executing a similar task and to diminish the duplication of manually inserted urls, the already existing `rfc.qdoc` file, containing `\externalpage` commands directing to RFC locations, was enhanced with links to all RFCs that were mentioned in the current documentation, so as to aggregate this common category of links. All links pointing to a `ietf` domain inside QDoc documentation blocks were then changed to use the newly provided external-references. Task-number: QTBUG-96127 Pick-to: 6.2 Change-Id: I2a52eb6aa8c9e346f64ef1a627b039220d9f6c2a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* feat: add new interfaces for std::filesystem::pathJiDe Zhang2021-09-142-3/+108
| | | | | | | | | Add for QFile::exists/symLinkTarget/remove/moveToTrash/ rename/link/copy Change-Id: I4cbb908e945f043b2a5278a6d8d5149b2f20e871 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Change two types in qurlidnaDavid Skoland2021-09-091-2/+2
| | | | | | | | | To avoid comparison between signed and unsigned integers, and the compiler warnings that come with it. Change-Id: I1028a980dfde68acc338f0e480fdeec42ed81ffb Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWindowsPipeWriter: stop reporting errors from write()Alex Trotsenko2021-09-082-15/+12
| | | | | | | | | | | | | | | To match the Unix behavior, callers of the write() function (i. e. QProcess::writeData() or QLocalSocket::writeData()) should return -1 only if the pipe is already closed. All data being written must be buffered and no state transition is allowed in response to this call. Considering the fact that all callers ignore the return value of the write() function, there is no point in returning anything other than void. Change-Id: I52480fc453e076920209bb8e3d52813279393d70 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revert "QUrl: Remove explicit casts to {const,} void*"Andreas Buhr2021-09-071-2/+3
| | | | | | | | | | | | | | | This reverts commit 63c1e7c4a105df0b61f0cd1f8193820cdf026ae3. It caused the following compilation error with g++-11. error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class QChar’ from an array of ‘const char16_t’ Fixes: QTBUG-96268 Change-Id: I2680b15aba8d0d867092391fcee3815e7fa4c0bc Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix compilation for recursive Qt containersSona Kurazyan2021-09-071-6/+10
| | | | | | | | | | | | | | | | | | | | The operator checks cause compilation errors when trying to check for their existence for recursive containers. This happens because of trying to check for the operators on the template parameter type(s), that inherit from the container itself, which leads to compilation errors. Introduced alternative versions of the operator checks (with _container suffix), that first check if the container is recursive, i.e. any of its template parameter types inherits from the given container, and skips the operator check, if that's the case. The fix is done for all Qt container types that had the problem, except for QVarLengthArray and QContiguousCache, which don't compile with recursive parameter types for unrelated reasons. Fixes: QTBUG-91707 Pick-to: 6.2 6.1 Change-Id: Ia1e7240b4ce240c1c44f00ca680717d182df7550 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QUrl: Remove explicit casts to {const,} void*Ievgenii Meshcheriakov2021-09-061-3/+2
| | | | | | | | | Those casts are not needed when passing pointers to simple types to memcpy. Change-Id: I686265b0e152aa22e0195ff252c442ab1a122ba7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* corelib: Use char16_t and char32_t types for charactersIevgenii Meshcheriakov2021-09-061-41/+40
| | | | | | | | | Use standard char16_t and char32_t types instead of ushort and uint. Remove members of QUtf8BaseTraits that use those integer types. Change-Id: I77b1a9106244835c813336a50417f6bbdfada288 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* unicode: Regenerate qunicodetables{.cpp,_p.h}Ievgenii Meshcheriakov2021-09-031-5/+3
| | | | | | | | | | Run unicode utility to regenerate the Unicode tables. This reduces size of the IDNA mapping tables. Adjust the QUrl client code to use the new API. Task-number: QTBUG-85323 Change-Id: Iaa8d6932e611f7aa4009a3fae2972de87b875cf8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QWindowsPipeWriter: suppress a warning on unexpected peer disconnectionAlex Trotsenko2021-09-031-2/+8
| | | | | | | | | The other side can close the pipe at any time independently of us, so ignore the ERROR_PIPE_NOT_CONNECTED error code if the write operation failed. Change-Id: I4f7ccd73c19ca2dd24fa1c9f33b5f60541a7521d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Convert various callers of strtou?ll() to call strntou?ll()Edward Welbourne2021-08-302-7/+11
| | | | | | | | Where size is known or can readily be determined. Change-Id: I442e7ebb3757fdbf7d021a15e19aeba533b590a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QUrl: Implement UTS #46Ievgenii Meshcheriakov2021-08-264-2243/+591
| | | | | | | | | | | | | | | | UTS #46 (https://unicode.org/reports/tr46/) is a successor to IDNA 2003/2008 standards from Unicode. The current implementation uses nontransitional processing by default. An optional argument is added to QUrl::toAce() and QUrl::fromAce() to allow using transitional processing and to ignore the IDN whitelist. [ChangeLog][QtCore][QUrl] ACE processing is now performed according to the UTS #46 standard based on IDNA 2008 instead of IDNA 2003. Task-number: QTBUG-85371 Change-Id: I46b2e86792bc9699cb6961bae8e283fbff72f874 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Replace the example for QFileInfo::setFileLuca Di Sera2021-08-251-0/+2
| | | | | | | | | | | | | | | | The example in the documentation of `QFileInfo::setFile` made no use of `setFile` and only showed a use of `QDir::setCurrent`. The example was replaced with a new example showing how `setFile` changes the file that the information are retrieved from. The old example was moved under the documentation for `QDir::setCurrent` as it shows its working. Fixes: QTBUG-87128 Pick-to: 6.2 6.1 5.15 Change-Id: I8227876cfcb4d582040bda9b4b7f3f7debea1e07 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* tst_qurlinternal: Remove nameprep and STD3 rules testsIevgenii Meshcheriakov2021-08-252-4/+2
| | | | | | | | | | | | IDNA 2008/UTS #46 do not use nameprep anymore and have different validity rules. Unexport qt_nameprep() and qt_check_std3rules() because they are not used by any tests anymore. Task-number: QTBUG-85323 Change-Id: I38c0dbae9a6bd108fbcfac350767aa7e757e786f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix documentation issues for Qt CoreTopi Reinio2021-08-241-0/+1
| | | | | | | | | | | | | | * Tag deprecated Q(Multi)Map operators in the header to correctly match them with documentation \fn commands. * Add documentation for QByteArrayView comparison operators. * Add a dummy typedef 'jfieldID' for generating docs correctly on non-Android platforms * Fix other minor issues Pick-to: 6.2 Task-number: QTBUG-95860 Change-Id: I141d2f75d6aa10557aa374201f09ad74b4cd6e81 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDir: add assert for nullptr ok parameter in qt_cleanPathIvan Solovev2021-08-231-1/+3
| | | | | | | | | | | | | | Found by CodeChecker. The function returns early in case of empty path, but the bool parameter is never updated in this case. It's not a problem with the current codebase though. As it's a static local function, the reasonable solution is just to add an assert, so that we do not get hit in case of refactoring. Task-number: QTBUG-95727 Pick-to: 6.2 Change-Id: Idc00356c61b5db8b2204a574612c1ea8e65f4a69 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QUrl: Fix typos in the documentationIevgenii Meshcheriakov2021-08-201-2/+2
| | | | | | | | | URLs can contain underscores, not "undercores". Pick-to: 6.2 Change-Id: I000ed89649cee0e7c6f283f2d930097961379445 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Add see also links to operator== and operator!=Paul Wicking2021-08-181-0/+4
| | | | | | | | | | Add see also link from operator== and operator!= to matches() to avoid possible confusion. Fixes: QTBUG-95820 Pick-to: 6.2 5.15 Change-Id: Ica8112da436b57da0d410f8e1f6b71fc6bf0791f Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Fix compile with MinGW-W64 9.0.0: Redefinition of 'struct _FILE_ID_INFO'Jonas Kvinge2021-08-181-2/+2
| | | | | | | | | | | With MinGW-W64 9.0.0, _WIN32_WINNT is set to Windows 10 by default, so _FILE_ID_INFO is already defined. Fixes: QTBUG-94031 Pick-to: 6.2 Change-Id: I0b29a4a1932425e1c4079aba6768fe94460c60af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QUrl: Improve Punycode overflow handlingIevgenii Meshcheriakov2021-08-161-22/+54
| | | | | | | | | | | | | | | | | | | | Add more overflow checks from the sample code in RFC 3492. Also check if a code point to be inserted into output is in the allowable range for Unicode. Rewrite all overflow checks to use {add,mul}_overflow() functions. Do not try to process any inputs that are too long to be part of a valid domain name label. This fixes a test in tst_qurlinternal. Fixes: QTBUG-95689 Pick-to: 6.2 Change-Id: Ice0b3cd640d8a688b63a791192ef2fa2f13444be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QStandardPaths/Unix: use QStringTokenizerMarc Mutz2021-08-161-3/+1
| | | | | | | | | | Avoids having to allocate storage to hold the parts. Since the startsWith('/') will fail for empty parts, remove the SkipEmptyParts so we don't check for emptiness twice. Change-Id: Id33a52d5fbd29f7a9d4ead758729195bb201a369 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDir: use QStringTokenizerMarc Mutz2021-08-161-3/+1
| | | | | | | | Avoids having to allocate storage to hold the parts. Change-Id: Ie4d877af959751139f4c098b644e4a57f63d03b9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Make Punycode encoding code less surprisingIevgenii Meshcheriakov2021-08-161-7/+7
| | | | | | | | | | | | | | | Move the code that modifies the encoding loop variables from appendEncode() back to qt_punycodeEncoder() instead of passing the variables by reference. This gives better overview of how those variables change. Remove comment claiming overflow detection inside appendEncode() where no overflow detection is done. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: I8830e75370646f0c9b78cae883f778a12e32919d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Fix handling of invalid sequences starting with xn--Ievgenii Meshcheriakov2021-08-111-3/+6
| | | | | | | | | | | | | | Return ASCII sequences that start with xn-- but fail Punycode decoding as is when converting URLs to Unicode. This is consistent with handling of sequences that do decode successfully but fail other validity checks. This fixes one test in tst_qurlinternal. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: I63d7197f25102c96f5dc21d9fecec5e015c531cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct QStorageIterator::next()'s use of qstrtoll()Edward Welbourne2021-08-111-4/+5
| | | | | | | | | | The end-pointer out-parameter of qstrtoll() is set to the start of the subject string on failure, never to nullptr; and this only happens when ok gets set false in any case, so there's no need to check for it as well as checking ok. Change-Id: I852a77a2398ffdcd5cb0671a586362cd578b6df4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Fix Punycode handling for non-BMP codepointsIevgenii Meshcheriakov2021-08-101-14/+39
| | | | | | | | | | | | | | | | | Iterate over Unicode codepoints instead of UTF-16 characters when converting to/from Punycode as described in the specification. Additionally reject strings with invalid surrogate pairs when encoding to Punycode, reject strings with any encoded surrogates when decoding. Remove expected failure marking from the test for this issue in tst_qurlinternal. Fixes: QTBUG-95577 Pick-to: 6.2 Change-Id: I3dd68f95ada6d652e2fa5c0c3118dcfa0a5f4c4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCoreGlobalData: use QHash, not QMap, for dirSearchPathsMarc Mutz2021-08-061-1/+1
| | | | | | | | | No user of the variable iterates over the container, they only manipulate or inspect individual entries, so order doesn't matter. If order doesn't matter, use the more efficient QHash over QMap. Change-Id: Id28913a57bb14eb328e668624f236f76cad86def Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFsFileEngine (Unix): replace a QPair with a proper structMarc Mutz2021-08-042-4/+8
| | | | | | | | | | | | The comments in the declaration of the pair screamed "I want to be a struct with properly-named member variables", and the code that read it->first and it->second was really misleading to STL-aware readers. Fix by defining a small struct with member names taken from unmap()'s use of the pair's fields. Change-Id: Ie18852a3147f65cf14cfc5a3bb633f7b3e78f5a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFsFileEngine: avoid triple(quadruple) lookup of the same keyMarc Mutz2021-08-042-7/+9
| | | | | | | | | | | | | Instead of contains(), 1-2x operator[](), and remove(), equalling 3-4 separate lookups, use find() + erase(), which does just one lookup. Since our erase() function is C++11-compliant these days and takes const_iterator instead of (mutable) iterator, we can use the const find() overload to delay a detach (attempt) until we actually erase(). Change-Id: I8e67a48e221e548528049fa093ab7ef2f1802f7e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIODevice: allow subclasses to enforce unbuffered modeAlex Trotsenko2021-08-011-9/+16
| | | | | | | | | | | | | | | For subclasses that implement alternative buffering (such as QLocalSocket), it would be useful to bypass the QIODevice's internal buffer, even if the QIODeviceBase::Unbuffered flag is not set when opened. By setting the readBufferChunkSize member to 0 in their constructors, these classes now unconditionally switch the base class to unbuffered mode, while still reporting buffering with openMode() function. Change-Id: I351bc57ac0ccb45c81f8c6be15f1745131aa26ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: rework validation policy for read() functionsAlex Trotsenko2021-08-012-57/+79
| | | | | | | | | | | - avoid calls to private and virtual functions, if the device is not open; - avoid repetitive checks in loops; - add missing checks in readLine() overloads; - remove check against unsuccessful resize(). Change-Id: I973d5931163b25db1c09c7c3b66f29ea90bb1b29 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: fix converting OpenMode flag in debug outputAlex Trotsenko2021-07-311-3/+3
| | | | | | | | | | | | | Suppress error: src\corelib\io\qiodevice.cpp(791): error C2440: '<function-style-cast>': cannot convert from 'QIODeviceBase::OpenMode' to 'quint32' Pick-to: 6.1 6.2 Change-Id: I6b6e94790942d3af62bc2f38afad97c0b3c80817 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QDirIterator: add nextFileInfo()Marc Mutz2021-07-285-27/+40
| | | | | | | | | | | | | | | | | | | | | | | Before this change, next() was the only way to advance the iterator, whether the caller was ultimately interested in just the filePath() (good) or not (bad luck, had to call .fileInfo()). Add a new function, nextFileInfo(), with returns fileInfo() instead. Incidentally, the returned object has already been constructed as part of advance()ing the iterator, so the new function is faster than next() even if the result is ignored, because we're not calculating a QString result the caller may not be interested in. Use the new function around the code. Fix a couple of cases of next(); fileInfo().filePath() (just use next()'s return value) as a drive-by. [ChangeLog][QtCore][QDirIterator] Added nextFileInfo(), which is like next(), but returns fileInfo() instead of filePath(). Change-Id: I601220575961169b44139fc55b9eae6c3197afb4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* io: Remove version checks for versions below Win 10Mårten Nordheim2021-07-283-77/+37
| | | | | | | It's not supported. Change-Id: Ia17fc7e1d5ae785eca0a6ba530f9b9bc960605d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlQuery/Doc: update the information about encoded vs decodedThiago Macieira2021-07-271-1/+28
| | | | | | | | | | | This class was not subject to the QUrl API update that took place between 5.0 and 5.1 that changed the QUrl string defaults and added QUrl::ParsingMode. It always parses as TolerantMode. Fixes: QTBUG-95254 Change-Id: I37d93a60a0d649688bddfffd169348d874eacc92 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix typo in function nameIevgenii Meshcheriakov2021-07-261-2/+2
| | | | | | | | Fix typo: containsProhibitedOuptut -> containsProhibitedOutput. Pick-to: 6.2 Change-Id: I4eb8be4c7ceb2e96ac129ef7c64215558f7b308e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFileSelector: Preserve path to root directoryFabian Kosmale2021-07-211-1/+4
| | | | | | | | | | | | | | | | While QFileSelector is documented to work on files, select accepts arbitrary URLs. Moreover, the QML engine can end up intercepting arbitrary (user provided) URLs, including to directories. Prior to this change, passing "file:///" or "/" to the function would break: We would temporarily get a "//" path, which is invalid, and thus we would return an invalid in the end. Prevent this by only appending a slash to the path when it doesn't have one. Fixes: QTBUG-85410 Pick-to: 6.2 Change-Id: I1d2807a9d225df611c3a5e871e3c1d90a6a25953 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Hold QRingBuffer and QNonContiguousByteDevice in shared_ptrMarc Mutz2021-07-142-22/+22
| | | | | | | | | | | | ... instead of QSharedPointer. QSharedPointer performs twice as many atomic operations per pointer copy as std::shared_ptr, and this is private API, we're not bound by BC constraints, so we can port to the more efficient version. Change-Id: I9572a8321aae381e5dbe4a51119f2c9494a8fbc7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDuplicateTracker: accept the number of elements to reserve as a ctor argumentMarc Mutz2021-07-141-2/+1
| | | | | | | | | | | | This prevents us from first reserve()ing Prealloc elements, and then possibly reserve()ing a larger number, which leaves the first bucket list's memory unused. Consequently, deprecate reserve(). Change-Id: Ifc0a5a021097f4589557e7b5e45d9d0892797ade Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* macOS: Don't mangle QByteArray settings with @ prefix by decoding as UTF-8Tor Arne Vestbø2021-07-131-1/+9
| | | | | | | | | | | | | | | | | | QSettings encodes QVariants as @Type(data) strings. If that data contains a null-byte, we write the string as UTF-8 encoded CFData. When reading it back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant. The problem arises then the user writes raw QByteArrays with a @ prefix. We can detect this situation by checking the result of stringToVariant, and if it's just a simple conversion of the string into a QVariant, we know that stringToVariant hit its fallback path due to not finding any embedded variants. If that's the case, we return the raw bytes as a QByteArray. Pick-to: 6.2 6.1 5.15 5.12 Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNonContiguousByteDevice: ++explicitMarc Mutz2021-07-101-5/+5
| | | | | Change-Id: I5d40a12704789eff10db9b1fb34f4e375651f1f0 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QLocalSocket/Win: reimplement skipData() functionAlex Trotsenko2021-07-082-0/+20
| | | | | | | | The base implementation discards the data by reading into a dummy buffer, which is slower than necessary. Change-Id: Iabf0c4a25746af6cac5b61d7bda66d89501c808c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QLocalSocket: reimplement readLineData() functionAlex Trotsenko2021-07-062-0/+25
| | | | | | | | The base implementation reads data using repeated calls to getChar(), which is quite slow. Change-Id: Ie46624df63791b2cdd3c8a28fe3327427d942505 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Clarify readLine() behavior on sequential devicesAlex Trotsenko2021-07-061-1/+6
| | | | | | | | | | QIODevice::readLine() can also return partial lines, which was not properly documented. Add an autotest for QLocalSocket to illustrate and test this behavior. Pick-to: 6.2 Change-Id: Ia2c1c438cc68d2672d34881e11fdf7837232f3b4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>