summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Extend documentation for QFile:copy()Paul Wicking2021-06-231-10/+4
| | | | | | | | | | | | - Add information about symlinks and file metadata. - Reflow text. - Extract text common to both overloads to a .qdocinc file for consistency and to avoid duplication. Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-94706 Change-Id: I3c730fd63f4018a1a573bb56751fedd2270a3247 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QF*Engine: port a couple of QFlags->int implicit conversions to toInt()Giuseppe D'Angelo2021-06-232-4/+4
| | | | | Change-Id: Iafc3527941a0b56a680322e3bc05b4046e560e89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWindowsPipeReader::read(): do not switch the mutex twiceAlex Trotsenko2021-06-222-5/+10
| | | | | | | | We can get better performance if we omit unlocking the mutex before relocking it in startAsyncRead(). Change-Id: Ia012a71b95876d4f90c1dc4b7db5d7b267fca7a6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QWindowsPipeReader::read(): remove redundant checksAlex Trotsenko2021-06-211-5/+1
| | | | | | | | | An initial EOF check is not required here because the code below correctly handles this case. Also, the condition '!pipeBroken' means that the pipe reader is in the 'Running' state. Change-Id: I608d932c4e38f8224d9e655272e61295e55414e0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: cleanup startProcess()Alex Trotsenko2021-06-191-17/+2
| | | | | | | | | Both the call to setProcessState(QProcess::NotRunning) and deleting the PROCESS_INFORMATION structure are redundant here. All this work was done by the previously executed cleanup() call. Change-Id: Iaf89f5edd2b661008a479d154e68974621b1b1eb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QLocalSocket/Win: simplify flush()Alex Trotsenko2021-06-192-47/+0
| | | | | | | | | | Replacing a call to waitForWrite(0) with checkForWrite() changes nothing in logic, but saves one system call. As a result, unused functions in the QWindowsPipeWriter class have been removed. Change-Id: I34ec6310d9659f59a720056b9be54e31f2193116 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QProcess/Win: avoid double buffering on writeAlex Trotsenko2021-06-186-61/+52
| | | | | | | | | | | | | As QWindowsPipeWriter now maintains a chunk queue, there is no need to use the internal QIODevice buffer and wait for the previous operation to complete. This also allows us to get rid of the stdinWriteTrigger timer; however, as a trade-off, QWindowsPipeWriter now needs to accept data even before a handle is assigned. Change-Id: I17fe0e36a6165fe05100bfab3fe01fc0d880d617 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Allow destruction of QWindowsPipeReader in its signalAlex Trotsenko2021-06-182-19/+18
| | | | | | | | As a result, we can refrain from using the deleteLater() technique in QProcess and avoid long-lived soft leaks in blocking applications. Change-Id: I89e02b02551a668b995ad3d12d3ce9575b2dd9dd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QWinSettings: use QScopeGuard to RegCloseKey()Marc Mutz2021-06-171-7/+5
| | | | | | | | | RAII rulez. Change-Id: I32bc070ae3074f782a1695bcf2079de0fc19597b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFileInfo: remove a couple of QFlags->int implicit conversionsGiuseppe D'Angelo2021-06-171-2/+2
| | | | | Change-Id: Iabfca134709852694967d605c6a93f34a9777d8a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLoggingSettingsParser: port setContent() to QStringViewMarc Mutz2021-06-162-4/+4
| | | | | | | | | | | Amends 16f927a4f1ffeff399351b625d73ac3cd7bccd51. At the time the original change was written, QStringTokenizer had not been integrated, yet. Change-Id: I83c31d816199bc48c4baea855d13cbf9eda9aaa2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QSettings: hide the return type of actualKey() and normalizedKey()Marc Mutz2021-06-151-7/+4
| | | | | | | | It may change in the future. Change-Id: If65bf690b12d4e6474557d7a48567941b18413bf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDebug: add missing docs for new QVLA streaming operatorMarc Mutz2021-06-151-0/+9
| | | | | Change-Id: I02af3b0e5615c8281b204fad0e6454bf40aca475 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QDebug: add support for QVarLengthArrayMarc Mutz2021-06-131-0/+7
| | | | | | | | | | | | | | Remove a conflicting definition of the same operator from qrhi.cpp. Who knows how many ODR violations this hidden gem may have caused... [ChangeLog][QtCore][QDebug] Can now stream QVarLengthArray objects. [ChangeLog][QtCore][QVarLengthArray] Can now be output via QDebug streaming. Change-Id: I12f7670e32029fa8c96b446e9a98ebf3b9732d0d Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QWindowsPipeWriter: centralize write result handlingAlex Trotsenko2021-06-122-36/+29
| | | | | | | | | | Both code paths (write() for the main thread and waitCallback() for the worker thread) use the same logic when processing write results. To avoid code duplication, consolidate the common part for both threads in the startAsyncWriteLocked() function. Change-Id: Ie2663b2ed221e2797a1ecbdb3fcee0ee8f030cc0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QLocalSocket/Win: avoid double buffering on writeAlex Trotsenko2021-06-094-9/+36
| | | | | | | | | As QWindowsPipeWriter now maintains a chunk queue, there is no need to use the internal QIODevice buffer and wait for the previous operation to complete. Change-Id: Id4d54edfe920aeb4a534980cb0cc85a56c067a70 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Switch-ify QFSFileEngine::fileName and update implementationKarsten Heimrich2021-06-081-27/+35
| | | | | | | Adapt to coding guidelines and use raw string literals. Change-Id: Ice9a87cafb22e01a361ad44221d561a298e5af05 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Implement QFileInfo::junctionTarget(), adjust auto-testKarsten Heimrich2021-06-059-2/+80
| | | | | | | | | | | | The change in 004e3e0dc2cab4a4534d2ed3ace41aad6bfbe45d introduces Windows junction awareness, though users were still unable to resolve the junction target. This change adds the ability to solve this. Fixes: QTBUG-93869 Change-Id: I9f4d4ed87b92e757f7b6d8739e2a61b58c096f63 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Unify behavior for long path or UNC prefix removalKarsten Heimrich2021-06-054-40/+34
| | | | | | | | | | | | | Split the code out of QDir::fromNativeSeparator into a separate reusable function to remove the above-mentioned prefixes. Fixes and unifies behavior if the prefix was given with slashes instead of backslashes. Add a couple more test cases. Fixes: QTBUG-93868 Pick-to: 5.15 6.0 6.1 Change-Id: Ibd94ae283e2fb113f9c2db97475fbc7d89522bbf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QProcess: untangle platform-specific detailsAlex Trotsenko2021-06-044-124/+131
| | | | | | | | | - add missing #ifdef in header file; - split some functions (writeData(), _q_canWrite(), cleanup()) into their platform-specific implementations. Change-Id: I4e7c1c377ec8468ed120d38acf2543eef9316c01 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess: refine 'Channel' structureAlex Trotsenko2021-06-032-19/+12
| | | | | | | | | | - exclude unused notifier pointer on Windows; - use default initialization for members; - avoid bit fields in declarations as there are extra padding bytes anyway. Change-Id: I2e03c4c269c885c90c0a6d18b8a935885f4b3feb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Introduce QProcessPrivate::closeChannels()Alex Trotsenko2021-05-314-15/+16
| | | | | | | Avoid duplicating code for both platforms. Change-Id: Iae00023672b63e8539cf824fa3aaaff2bf9ae0c5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Consolidate debug string generationAlex Trotsenko2021-05-314-87/+59
| | | | | | | | | | | | | | Several QIODevice subclasses use the qt_prettyDebug() function to get a printable representation of the buffer data for debug output. Rather than having this feature statically implemented in each respective file, this patch introduces a generic function in the QtDebugUtils namespace. Accordingly, some inaccuracies in the use-cases have been corrected. Change-Id: I1a8465cab08c8acf5fdcdba5085182511b1cbb7b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clarify that QLoggingCategory works independent of compiler build typeKai Köhne2021-05-271-1/+8
| | | | | | | | | Also mention exception for internal categories starting with 'qt.' Fixes: QTBUG-93852 Change-Id: Iff8657a31074ee70cba25f6acdccb5ba4b1d3b01 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: use QFlags::toInt / qToUnderlyingGiuseppe D'Angelo2021-05-231-8/+8
| | | | | | | | | | | In preparation for blocking QFlags->int conversions. The existing casts to uint are wrong, in the general case, as the enumeration might actually be backed by signed integers; that makes them fail to compile. Port them to toInt(). For symmetry, also use qToUnderlying. Change-Id: I851544f6ba05295fa5f6c5cc355b9de0f1362e2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess/Unix: fix build in debug modeAlex Trotsenko2021-05-231-1/+1
| | | | | | | qprocess_unix.cpp:633:55: error: ‘i’ was not declared in this scope Change-Id: I152fbd9df6e9d3f31e2c2c8b23a3c1ab87aa237a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QUrl::fromLocalFile with long path prefixKarsten Heimrich2021-05-191-2/+20
| | | | | | | | | | | | After commit 3966b571 the function was kinda broken already, though this got unnoticed since it was not covered by an the auto-test. This commit adds another test case with Windows native separators and removes the use of QDir::fromNativeSeparators. Instead use the original code from QDir::fromNativeSeparators to replace the backslashes. Pick-to: 5.15 6.0 6.1 Change-Id: I190560d0e75cb8c177d63b142aa4be5b01498da2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QLocalSocket/Win: fix closed state detection in waitFor...() functionsAlex Trotsenko2021-05-181-8/+11
| | | | | | | | | | | A delayed close should only be completed in the _q_bytesWritten() slot as a confirmation of a successful write operation on the socket. Otherwise, a failed write operation may cause the socket to be closed unexpectedly within the waitFor...() function, which may result in a malfunction. Change-Id: I14cff26734f64a89090b6b5c13037466a6400597 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QFile: code tidiesGiuseppe D'Angelo2021-05-172-8/+8
| | | | | | | | | | There's no need of converting a QFlags to int in openExternalFile's signature; just use the flag. Also, avoid an implicit QFlags->bool conversion by using testAnyFlag. Change-Id: Ia2d560bce235c842745d8a6a5fb5d8ac0851fc47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows QFSFileEngine: avoid some QFlags implicit conversionsGiuseppe D'Angelo2021-05-171-2/+2
| | | | | | | Go through fromInt/toInt instead. Change-Id: I73097e21f59f9e8eb2c9714e22084af0787a53d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileSystemMetaData: code tidiesGiuseppe D'Angelo2021-05-171-13/+15
| | | | | | | | | | Turn some implicit conversions into calls to QFlags::testAnyFlag. In one case, move some code using QFlags operators *after* such operators have been declared by the right macro. Change-Id: Ib5713f028ce74d1c9054b87cc12eea5715f2bc94 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFSFileEngine: code tidiesGiuseppe D'Angelo2021-05-171-2/+2
| | | | | | | Turn a couple of implicit conversions into calls to QFlags::testAnyFlag. Change-Id: I21a0b4c1644986a98a2d0d54ae4b95f9fdc92841 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIODevice: code tidiesGiuseppe D'Angelo2021-05-161-1/+1
| | | | | | | Turn an implicit conversion into a call to QFlags::testAnyFlag. Change-Id: Idbd80bb6a9b5d84952b76d8d7544f617fe693b91 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSaveFile: code tidiesGiuseppe D'Angelo2021-05-161-1/+1
| | | | | | | | | | | | | | Turn a cast into a call to QFlags::toInt(), plus a cast. This is in preparation for a future patch that will remove the implicit conversion. So why not casting directly? Because we don't know if the QFlags is backed by int or uint, so using the wrong cast won't compile; and we MUST pass unsigned because of the %x specifier. Granted, one could've used a static_assert, but I prefer a more flexible and idiomatic solution. Change-Id: I32a3e0ed69b925e8d56268ec84d9e668ca540188 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDir: remove an unneeded QFlags->int conversionGiuseppe D'Angelo2021-05-161-6/+6
| | | | | | | | Just use the original QFlags. Drive by, use testFlag to check if it contains a given value or not. Change-Id: I4d5e8454df33a3f4727855d55f7587143450dda6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDir(Iterator): code tidiesGiuseppe D'Angelo2021-05-162-13/+13
| | | | | | | | | | | | | * Turn some `flags & bit` statements that rely on QFlags->int->bool implicit conversions, into some more idiomatic `return flags.testAnyFlag(bit)`. This is in preparation for a future patch, and to avoid inserting casts (return statements do not contextually convert to bool). * Remove a magic constant, replacing it by the symbolic one. Change-Id: I62fc2b2bf6f0ab8fad121edd19cb2ea0d9e3582a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileDevice: code tidiesGiuseppe D'Angelo2021-05-141-2/+2
| | | | | | | Avoid QFlags->int implicit conversions. Change-Id: I29905ff66888759c71d1e70064913520c9f09ec2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileInfo: code tidiesGiuseppe D'Angelo2021-05-131-3/+3
| | | | | | | | Avoid some QFlags<->int conversions; use the named conversions instead. Change-Id: If12c55ca362ed5c2c73182e10562a2d09e80aa49 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDebug: code tidiesGiuseppe D'Angelo2021-05-121-1/+1
| | | | | | | Use the newly introduced QFlags::toInt(). Change-Id: I45337a299d20738767461c36641519a3e9b625d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlTwoFlags: add support for operator&=, |=, ^= taking QFlagsGiuseppe D'Angelo2021-05-121-0/+6
| | | | | | | | Rather than forcing an implicit conversion to int, accept a QFlags (over either one of the two enumerations) directly. Change-Id: I56af3a85982ecb66369e4a7105d07de0d6e0c40a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement QFileSystemEngine::createLink() on MS-WinKarsten Heimrich2021-05-123-49/+42
| | | | | | | | | Fixes: QTBUG-74271 Change-Id: I9e414dd16546f65e85b5a1a6c70c40dfa4284a6f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Purge QFILESYSTEMENTRY_NATIVE_PATH_IS_UTF16Karsten Heimrich2021-05-112-8/+2
| | | | | | | | | | | This was probably introduced for Symbian and did not change since the Qt4 import (except for the Symbian code cleanup). Since it seems only to effect Windows, use Q_OS_WIN instead. Change-Id: I36f4d83ed5254d8b77073fc216551dfa0cc64a9f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix QSaveFile and QTemporaryFile issues with windows network sharesKarsten Heimrich2021-05-113-24/+17
| | | | | | | | | | | | | | | | | | | The commit amends commit 3966b571 to take UNC prefix into account as well. Fixes the weird file name output as reported in QTBUG-74291 and QTBUG-83365. Replace manual separator normalizing in qt_cleanPath(), this is another spot where UNC prefix handling needs to be applied. Also make QTemporaryFile operate on '/' as file separators to fix creating both file types with native path separators on network shares. Fixes: QTBUG-74291 Fixes: QTBUG-76228 Fixes: QTBUG-83365 Pick-to: 5.15 6.0 6.1 Change-Id: Iff8d26b994bf4194c074cd5c996cda3934297fa5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocalSocket/Win: implement duplex communication in blocking modeAlex Trotsenko2021-05-062-59/+7
| | | | | | | | | | | | | | | | [ChangeLog][QtNetwork][QLocalSocket] The waitFor*() functions on Windows now support duplex operation, as they already did on Unix. As a side effect, this restores the behavior that a single call to waitForReadyRead() won't emit both readyRead() and disconnected(), which also matches Unix behavior. The groundwork for that misbehavior was laid by incorrect refactoring in d1a671b69 already, but at this point it was harmless, as the pipe couldn't be newly closed after a successful read. That changed with f265c87e0, which made the queuing of signals async. Change-Id: I1eb80e8f147bb58825143e0fe1e4300c59ae0fbb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QUrl: code tidiesGiuseppe D'Angelo2021-05-021-9/+9
| | | | | | | | | Change some casts of enumeration/flag types from int to uint. In fact, the enumerations (and flags) in question are *defined* to be backed by unsigned int. Change-Id: I757ded61a26fe979deeaa1e5a524478102960ffe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* fix: Optimize the performance of the inotify file system monitoring program。Gong Heng2021-04-301-1/+1
| | | | | | | | | | | | | | When the ioctl() functions is executed correctly, the value of buffSize may be 0. In this situation, there is no need to execute the following code. This modification can solve two benefits: 1. The readFromInotify function runs frequently, and this modification can improve the efficiency of the program. 2. When the buffSize is equal to 0, "read(inotifyFd, buffer.data(), buffSize)" function will be stuck.(I have encountered this kind of problem) Pick-to: 5.15 6.0 6.1 Change-Id: I9f85491ec91e336b4a1bec5c99b911835c5c06a5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove links to QRegularExpression#Wildcard matchingVolker Hilsheimer2021-04-271-6/+3
| | | | | | | | The topic existed for QRegExp but is not relevant in QRegularExpression. Pick-to: 6.1 Change-Id: Ife9d42b5b03163cfefff19725409a3feac1cddb2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add override to addPaths and removePaths in kqueue filesystem watcherNiclas Rosenvik2021-04-261-2/+4
| | | | | | | | | Add override to addPaths and removePaths in kqueue filesystem watcher Fixes build break in developer-build with gcc 10 on *BSD Pick-to: 6.1 Change-Id: I7d91251d6bcb1614bb9f21c319abc9c2df681cda Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QLockFile/Unix: remove the " (deleted)" suffix from kernel-supplied namesThiago Macieira2021-04-261-0/+6
| | | | | | | | | The kernel appends that to the symlink targets in /proc for files that have been deleted. Change-Id: I7a386ad4f0cb4e2ba629fffd16789b5a52491627 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QLockFile: don't use the local timezone to compare file timesThiago Macieira2021-04-262-5/+5
| | | | | | | | | There's no need to find the local time zone and do expensive conversions to compare regular, old seconds-since-1970 to the time now. Task-number: QTBUG-93069 Change-Id: I6cdea00671e8479b9c50fffd167897b91a04ce03 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>