summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* QFile: Add open() overload that accepts permissions argumentIevgenii Meshcheriakov2021-12-042-1/+49
| | | | | | | | | | | | | | | The new overload allows creation of files with non-default permissions. This is useful when files need to be created with more restrictive permissions than the default ones, and removes the time window when such files are available with less restrictive permissions. [ChangeLog][QtCore][QFile] Added QDir::open() overload that accepts permissions argument. Fixes: QTBUG-79750 Change-Id: Iddfced3c324e03f2c53f421c9b31c76dee82df58 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractFileEngine: Add permission argument to open()Ievgenii Meshcheriakov2021-12-0410-16/+51
| | | | | | | | | The new argument allows atomic creation of files with non-default permissions. Task-number: QTBUG-79750 Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTemporaryDir: Set directory permissions at the time of creationIevgenii Meshcheriakov2021-11-261-11/+3
| | | | | | | | | | | Use new QDir::mkdir() method to set directory permissions at the time of its creation on systems that support this feature. This removes the time window when the created directory is potentially accessible to everybody. Task-number: QTBUG-79750 Change-Id: I82afee7f0708bfdcc9b3b3978af9a2aef1b8672d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDir: Add support for setting directory permissions to mkdir()Ievgenii Meshcheriakov2021-11-2610-45/+380
| | | | | | | | | | | | | | This patch adds an overload of the QDir::mkdir() method that accepts permissions. This allows setting of the directory permissions at the time of its creation. [ChangeLog][QtCore][QDir] Added QDir::mdkir() overload that accepts permissions argument. Task-number: QTBUG-79750 Change-Id: Ic9db723b94ff0d2da6e0b819ac2e5d1f9a4e2049 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Replace use of \oldcode-\newcodeLuca Di Sera2021-11-251-2/+8
| | | | | | | | | | | The command-pair was recently deprecated. The replacement code should produce an output that is equal to the previous one. Task-number: QTBUG-98499 Change-Id: If26e0d85a174ebc3858b638c34d7f43637eab46d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use Authz API to query permissions info in Windows filesystem backendIevgenii Meshcheriakov2021-11-191-117/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | Microsoft documentation for GetEffectiveRightsFromAclW function that was used previously has this at the top of the page: > GetEffectiveRightsFromAcl is available for use in the operating > systems specified in the Requirements section. It may be altered > or unavailable in subsequent versions. Instead, use the method > demonstrated in the example below. This says to me that the function is deprecated. In addition to that, it is not able to handle ACLs that are not in "canonical" order, returning ERROR_INVALID_ACL. Such ACLs are useful to represent POSIX permissions in Windows, and are produced by Cygwin for example. This patch uses Authz API referenced by the message quoted above. The used API is available starting from Windows XP/Windows Server 2003. This API also allowe to perform access checks given access token, and so allows to use similar code all permission checks. Task-number: QTBUG-79750 Change-Id: I8b11ff3cc83cd9ed5bfb2ce9432a375a122cdbbf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLoggingRegistry: avoid double-lookupMarc Mutz2021-11-191-2/+5
| | | | | | | | | | | | | The code used the if (!contains()) { insert() } anti-pattern, necessitated by Qt's deviation from the STL of allowing insert() to overwrite an existing entry, causing two lookups of the same key. Fix by recording the size prior to the execution of the indexing operator and taking a size increase as the cue to populate the (new) entry. This way, we look up the key only once. Change-Id: Ica039035fe9ea4b88c20184784c324c9fac33d49 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QIODeviceBase: make dtor protectedMarc Mutz2021-11-181-0/+2
| | | | | | | | | | | | | Base class dtors should be virtual and public or else protected and non-virtual. This one was neither of these. [ChangeLog][Potentially Source-Incompatible Changes][QtCore] The QIODeviceBase destructor is now protected to avoid deleting objects of classes derived from it through a QIODeviceBase pointer, which would be undefined behavior. Change-Id: Id390ace75d5b64f746d9b1865b8800c9f0590977 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileSystemEngine: Fix permissions query in Windows backendIevgenii Meshcheriakov2021-11-181-1/+1
| | | | | | | | | Make fillPermissions() correctly set OtherExecutePermission instead of OwnerExecutePermission. Pick-to: 6.2 Change-Id: I77ef3c5bc59ac6110c5a461a599d03029c70493c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractFileEngine: fix UB (data race) on qt_file_engine_handlers_in_useMarc Mutz2021-11-161-4/+4
| | | | | | | | | | | | | | | | | | | While all writers of the variable hold fileEngineHandlerMutex for writing, the qt_custom_file_engine_handler_create() function checks the value before entering a fileEngineHandlerMutex read-side critical section, thereby causing a C++11 data race. Fix by making the variable atomic. Interestingly enough, relaxed atomic operations suffice here, since the actual synchronization happens in read- and write-side critical sections, and if qt_file_engine_handlers_in_use is wrong w.r.t. to the actual list, the critical sections will still work. We just mustn't cause UB by reading and writing to a simple bool without proper synchronization. Pick-to: 6.2 5.15 Change-Id: I30469504cdbc90e2ab27125181e53d74305f13fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QFileSystemEngine: Don't use _?W suffixesIevgenii Meshcheriakov2021-11-101-7/+7
| | | | | | | | | We don't use W suffix for most of the Windows API so there is no need to use it here either. Also remove W suffix for variables of type TRUSTEE (was TRUSTEE_W). Change-Id: Id67b772ba5d3232f882841a1e581fb1bbd392fa4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use nullptr to represent null pointersIevgenii Meshcheriakov2021-11-101-39/+36
| | | | | | | Replace occurrences of NULL and 0 when used for pointers. Change-Id: I485e73d22a1a85d1303f3e0967cd4e8f10ff5d33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFileSystemEngine: Fix some code style issues in Windows backendIevgenii Meshcheriakov2021-11-101-55/+113
| | | | | | | | | | | Wrap lines at column 101 so that it is easier to edit the file and review the changes in Gerrit. Move comments when they cannot be easily wrapped. Add curly braces to `if` statements if they became multiline. Run `git clang-format` on the file afterwards. Change-Id: Ib21afd65147a7b202e031d4a865b5f615e5ad6d8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move toMode_t() from qfilesystemengine_unix.cpp to qfiledevice_p.hIevgenii Meshcheriakov2021-11-102-28/+37
| | | | | | | | | | The function is needed in multiple files to implement QDir::mkdir() and QFile::open() methods that accept a permission argument on Unix. Task-number: QTBUG-79750 Change-Id: Ib0853f7d12bcb5d6f1116b43ec1aa07b6554bb93 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove useless blocksIevgenii Meshcheriakov2021-11-101-38/+34
| | | | | | | Don't put the code inside two blocks for no reason. Change-Id: I54b8d6fbfab50a26ddcd8ec07ba689e5094bcad3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-101-9/+0
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qC{Debug,Info,Warning,Critical}: Simplify #ifndef QT_NO_xxx_OUTPUTThiago Macieira2021-11-061-24/+32
| | | | | | | | | | | | | Further simplifies the definition of the macros. The class is placed in an unnamed namespace so two translation units can still have different settings. A difference is that the expanded no-output code is now using QDebug, not QNoDebug, but it should get dead-code-eliminated either way. Change-Id: I3eb1bd30e0124f89a052fffd16a7564f4450ec8a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* qC{Debug,Info,Warning,Critical}: centralize common partsThiago Macieira2021-11-061-12/+33
| | | | | | | | | | | Move some content to a helper structure and the rest to a common macro. Immediate advantage is that we avoid calling the category function twice. The Q_UNLIKELY also moves most of the formatting code out of the hot code paths of the functions where it's used. Change-Id: I3eb1bd30e0124f89a052fffd16a754e980c1d971 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QProcess: Distinguish between null and empty QProcessEnvironmentIevgenii Meshcheriakov2021-11-074-63/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation for QProcessEnvironment's default constructor says: This constructor creates an empty environment. If set on a QProcess, this will cause the current environment variables to be removed. This is not the case however, because setting such an environment for a process is equivalent to not setting an environment at all and the child process is executed with parent's environment. It is still possible starting from Qt 6.2.0 to create an empty environment by adding a variable to a null environment and removing it, but that's cumbersome, and the comparison operator says that it is equal to the null environment but it is obviously behaving in a different way. This change adds an additional constructor to QProcessEnvironment that can be used to construct a null environment, and changes the default constructor to produce an empty environment. The comparison operator is changed to correctly distinguish between such objects. This is a behavior change, but the current behavior is broken and this is unlikely to affect working code. [ChangeLog][QtCore][QProcessEnvironment] An additional constructor was added to explicitly create an object that when set on QProcess would cause it to inherit the environment from parent (this was formerly the behavior of a default-constructed QProcessEnvironment, which will now (as documented) actually give a process an environment with no variables set). A new method inheritsFromParent() was added to test for such objects. Fixes: QTBUG-58053 Change-Id: I15e20c6a5f01ebe2c736d5578c75dba1ee319320 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractFileEngine: Remove useless method overridesIevgenii Meshcheriakov2021-11-033-119/+0
| | | | | | | | | | | | Remove useless overrides of QAbstractFileEngine methods from the derived classes. Also remove "This virtual function must be reimplemented by all subclasses" passages from the QAbstractFileEngine's documentation. There are pure virtual methods for such use cases. QAbstractFileEngine already contains useful defaults for classes not supporting all the functionality. Change-Id: Ia25965854f3809b15d7502da3749cc2f3414bbc3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Rename LinkName to AbsoluteLinkTargetWang Fei2021-11-037-9/+9
| | | | | | | | | | | | | The existing symLinkTarget() always resolves the symlink target to an absolute path; It will be clearer to change LinkName to AbsoluteLinkTarget. It is ready for the commit about add symLinkPath() to read the raw link path. Fixes: QTBUG-96761 Change-Id: I8da7e23b066c9ac1a16abb691aa1c4a5f1ff8361 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Wang Fei <wangfeia@uniontech.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove pre-Win10 code paths in QtBaseYuhang Zhao2021-11-023-30/+4
| | | | | | | | | | | | | | Mostly a removal of dynamically loaded API. They should all exist on Windows 10 1809 (Qt6's minimum supported version). accessibility parts left untouched to make sure MinGW still compiles. Task-number: QTBUG-84432 Pick-to: 6.2 Change-Id: I7a091fc967bd6b9d18ac2de39db16e3b4b9a76ea Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Doc: Fix broken formattingIvan Tkachenko2021-10-291-1/+1
| | | | | | | | Amends f25bc30d8d9d13fffd34213dfbf5e7373a18222a Pick-to: 6.2 5.15 Change-Id: Ia42c7639e4919de3f995d771bfc7d8237a8773d8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLoggingRegistry: Disable internal tracking of source file namesThiago Macieira2021-10-271-3/+2
| | | | | | | | | | Commit d78fb442d750b33afe2e41f31588ec94cf4023ad (5.4) did this for all regular users of our macros, but obviously missed this manual override. So apply here too. Change-Id: I8c6a0ff3ec184205a544fffd16af7734fed2ebd1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLoggingRegistry: add the ability to have environment variable overridesThiago Macieira2021-10-272-1/+56
| | | | | | | | | | | Quite a lot of our code in Qt predating QLoggingCategory has manual environment variable controls. For compatibility with established documentation and tips-and-tricks out there, we should keep them working when switching to categorized logging. Change-Id: I3eb1bd30e0124f89a052fffd16a6c151d3e9d552 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QDebug operator<< for QMultiMap when Q_CLANG_QDOC is definedJoerg Bornemann2021-10-271-1/+1
| | | | | | | | This amends commit 8a8bf1b84e9a096993b892873eb62c735149f320. Pick-to: 6.2 Change-Id: If863d33d055e0a743606d11859b11c112de105f1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid warnings when compiling bootstrap library without zstdUlf Hermann2021-10-211-0/+4
| | | | | Change-Id: Ic67cd2b582df0464a17f6181157ebbd47986114c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make QDir::mkpath() return true when given an existing root pathKarsten Heimrich2021-10-201-0/+2
| | | | | | | | | | On macOs with APFS mkdir sets errno to EISDIR, so take the error code into account. Pick-to: 6.2 Fixes: QTBUG-97110 Change-Id: I8e7d10c95430a2802bdbfbf94dd65219bd9071a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QDir::mkpath() return true when given an existing drive nameKarsten Heimrich2021-10-201-1/+1
| | | | | | | | | | | | Commit ed48391c592e8ba68c723e3017ac384f0c7a7c23 removed the check for ERROR_ACCESS_DENIED reported by the Windows CreateDirectory(...) function in case an existing windows drive name was passed as argument. This restores the behavior of the function which broke after 5.15. Pick-to: 6.2 Fixes: QTBUG-85997 Change-Id: Ie86188100766f7364acee57b15a250f4a2720b9f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Fix docs for comparison/debug/data stream operators of Qt containersSona Kurazyan2021-10-182-0/+79
| | | | | | | | | | | | | | Because of the constraints on comparison, debug and data stream operators, the return types for them look weird in docs. Conditionally use the actual return types, in case if Q_CLANG_QDOC is defined. Also add the docs of debug stream operators for types for which they were misssing. Task-number: QTBUG-97247 Pick-to: 6.2 Change-Id: I57f2c52bd3af805c7eeebb602c47de1e95ee09bd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* corelib: Fix typos in documentationJonas Kvinge2021-10-125-6/+6
| | | | | | Pick-to: 5.15 6.2 Change-Id: I64d63af708bc6ddaabd12450eb3089e5077f849e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* corelib: Fix typos in source code commentsJonas Kvinge2021-10-1210-13/+13
| | | | | | Pick-to: 6.2 Change-Id: Ic78afb67143112468c6f84677ac88f27a74b53aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove union in QFileSystemEngineDavid Skoland2021-10-111-4/+3
| | | | | | | | | | The need for this union has disappeared at some point during refactoring It does confuse MemorySanitizer, though, so it's good to remove it. Change-Id: I5f5050adba302bf96db96d5f303d2a25630543ce Fixes: QTBUG-97109 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocalSocket/Win: stop reading in close()Alex Trotsenko2021-10-062-4/+21
| | | | | | | | | | After calling close(), the socket can enter 'Closing' state, in which we try to write buffered data before disconnecting. As the device is already closed, we must disable any pipe reader activity and clear the read buffer. Change-Id: I8994df32bf324325d54dd36cbe1a1ee3f08022d1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Replace 0 with nullptrKarsten Heimrich2021-10-021-2/+2
| | | | | | Change-Id: I9ee25644a3e066391e881bd2f64274909eabfcbf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix QDir::entryList to work for directories that end with '.lnk'Karsten Heimrich2021-09-303-5/+5
| | | | | | | | | | | | | In addition to checking the .lnk extension, check that the the specified path is not a path to a directory. Pick-to: 6.2 Fixes: QTBUG-85058 Change-Id: I83cef3d94c6ffa82a88f374c5b41779e88fe40b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* 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>