summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused header from qnetworkinformation.cppMate Barany2025-10-241-1/+0
| | | | | | | Pick-to: 6.10 Change-Id: If5239161254da7e7a9d6c6a6ce2d724841fec330 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostAddress: clear() the scopeId tooThiago Macieira2025-10-232-8/+7
| | | | | | | | | | | | Looks like this was forgotten since time immemorial. And not a lot called QHostAddress::clear(), so we never noticed; it was definitely not tested. Drive-by move it to the header to make it inline. Pick-to: 6.10 6.8 6.5 Change-Id: I2cdc8cf3cbbcb17ecc5ffffdb4257ce269813971 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostAddress: drop the Private constructor by using NSDMIThiago Macieira2025-10-062-11/+3
| | | | | | Pick-to: 6.10 Change-Id: Idf70d329977e17b5b936fffd1debc21f1b86c43a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractSocket/QHostAddress: ensure definition of static constexprs (II)Thiago Macieira2025-10-061-0/+7
| | | | | | | | | | | | | | | | | | Amends 043590b891a98350edb23715a86f4af6d3f1ecdb, which wasn't complete because half the change was in the wrong commit. Amends commit 969337bcfd6af6d91b988e4b412703274a0b5877, which introduced these constants. We've since learned that those either need an out-of-line definition or need to be in a non-exported base[1]. This commit uses both strategies: an out-of-line definition for the symbols that are used in Qt 6 and thus have an ABI requirement to stay the same, and moving to a base class for the Qt 7 ones, which don't yet. [1] https://lists.qt-project.org/pipermail/development/2024-January/044888.html Pick-to: 6.10 6.8 6.5 Change-Id: Iaad6d22475eba5eb5d16fffd2a31a74d2633a7b8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Prefer using namespace Qt::StringLiteralsMarc Mutz2025-10-041-2/+3
| | | | | | | | | | | | | | | | | ... over Qt::Literals::StringLiterals. The latter works, but is needlessly verbose. Since such code is copy'n'pasted, use the preferred form everywhere, to avoid proliferation. The docs have been fixed to suggest the shortcut in a separate commit. As a drive-by, move them to their preferred location, after the QT_BEGIN_NAMESPACE, but only if they were far away to begin with. Pick-to: 6.10 6.8 6.5 Change-Id: I0325f749f3b5a331d9c6af458a9bd3bb70d4aa3b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QtContentTypeParser: mark parse_content_type() inlineMarc Mutz2025-10-021-1/+1
| | | | | | | | | | | | To avoid double-definition when it's included more than once. Amends be84e9cf3e0ad6559921016ec563a25b1892d823. Pick-to: 6.10 6.8 Change-Id: Ia40cab02ec8d9c927b22cf090e8ea96d1821e68d Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
* Extract the content-type parser from qrestreply.cppMarc Mutz2025-10-011-0/+278
| | | | | | | | ... so it can be reused elsewhere. Pick-to: 6.10 6.8 Change-Id: Ia6b5f24cfbc586f0afe470cbb399cbb234c92f3d Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Move all Q_DECL_(PURE|CONST)_FUNCTION markers to the frontMårten Nordheim2025-09-191-1/+1
| | | | | | | | | While testing defining Q_DECL_PURE_FUNCTION for MSVC I discovered it cannot handle having the marker trailing, while GCC/clang can cope with either. Change-Id: Ic9dd088996c191263e2f2a43c2f6a16533bdb9c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a clear method to QAuthenticatorMate Barany2025-09-023-0/+39
| | | | | | | | | | | | Provide an alternative for *auth = QAuthenticator(); [ChangeLog][QtNetwork][QAuthenticator] Add a new method to clear all credentials. Fixes: QTBUG-139124 Change-Id: Ia33b5dcb8eb6961f5daa5bc78addd8c78dd10e9a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add example snippet to QNetworkInformation::isMetered()Mate Barany2025-08-201-0/+8
| | | | | | | | | Highlight only the important part. Task-number: QTBUG-136625 Pick-to: 6.10 Change-Id: I9707d0d69b964421ab4f8a07c8b87cc07fa01e2f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add simple example how to test for connectivity with QNetworkinfoMate Barany2025-08-201-0/+30
| | | | | | | | | | Extended with a description that explains the shortcomings of this approach. Task-number: QTBUG-136625 Pick-to: 6.10 Change-Id: I07473b1395fcc6dec0917da4bcc1c3791c1ed839 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Do not reference load() in the documentation of QNetworkInformationMate Barany2025-08-151-7/+7
| | | | | | | | | | | The method has been deprecated in favor of loadBackendByName() and loadBackendByFeatures(). Task-number: QTBUG-136625 Pick-to: 6.10 Change-Id: I092c693091f64b2f069366ed74940d427a600dab Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add an example snippet to QNetworkInformationMate Barany2025-08-141-1/+16
| | | | | | | | | | The methods are well-documented but it probably does not hurt to add a small snippet about a simple example use case. Task-number: QTBUG-136625 Pick-to: 6.10 Change-Id: I267250faae4a062ed514a2e0bccca57f7bd8a0b3 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QtNetwork: build with QT_NO_SCOPED_POINTERAhmad Samir2025-08-094-8/+4
| | | | | | Task-number: QTBUG-132213 Change-Id: If644d6afd4258aa9bc3e2ea2eb05c39f4ce07c30 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove QNetworkConnectionMonitorMate Barany2025-08-084-866/+0
| | | | | | | | | As it is not supported anymore on Apple, drop QNetworkConnectionMonitor for simplicity. Fixes: QTBUG-132137 Change-Id: If5e216e857b4449b9937323aa58630777cb4b82d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostInfo: simplify call to QAbstractEventDispatcher::instance()Thiago Macieira2025-08-051-1/+1
| | | | | | | | | | | We don't need the thread parameter, because nullptr implies "current thread". Instead, let QAbstractEventDispatcher get the thread-local variable on its own and benefit from any LTO code generation QtCore may have had. Pick-to: 6.10 Change-Id: Ia2f962c3886c8901a3a5fffde336c1505b68e185 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CRA[network/kernel]: Mark the rest significantMårten Nordheim2025-07-2833-0/+33
| | | | | | | | | The rest was handled separately. Fixes: QTBUG-135584 Pick-to: 6.10 6.9 6.8 Change-Id: I302f9f381712e5f65cc4b7354bfb441361c615e7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CRA[network/kernel]: Mark some files significantMårten Nordheim2025-07-286-0/+6
| | | | | | | | | | While the files are parsing some data, it is acquired from a trusted source, such as the operating system (e.g. /etc/resolv.conf) Task-number: QTBUG-135584 Pick-to: 6.10 6.9 6.8 Change-Id: Id1741d66258f5c247342015988e2ce916e5280b3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CRA[network/kernel]: Mark some files criticalMårten Nordheim2025-07-287-0/+7
| | | | | | | | | | | | | | The files are parsing or working with data that is obtained from outside. tldurl is special in that it is a list we ship or acquire from the system, but we are working with a string that was obtained from a user or from the network. Task-number: QTBUG-135584 Pick-to: 6.10 6.9 6.8 Change-Id: Icb13a9acc859e07460f6c10b3f108e65ff130c5c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: declare ProxyInfoObject as Q_APPLICATION_STATICAssam Boudjelthia2025-07-151-1/+2
| | | | | | | | | | | Since global destructors are not reliably fired on Android especially when QT_ANDROID_NO_EXIT_CALL to mitigate crashes at exit, it's better to define ProxyInfoObject as Qt application static instead. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-138238 Change-Id: Ib8fd7860a88907259216d498013bb6829e8a71b4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace one-shot uses of QSemaphore with QLatchThiago Macieira2025-06-301-3/+4
| | | | | | | | | | | | | | | This commit replaces one-shot synchronization of threads that were using QSemaphore with QLatch. QSemaphore is efficient on Linux and Windows, but allocates memory elsewhere. Even on those platforms where we have futex-like OS support, QSemaphore is heavier than what we really need here. All but one uses of QSemaphore in qtbase libraries (I didn't change examples or tests) were replaced. The remaining use of QSemaphore in qnetworkproxy_libproxy.cpp is a proper producer-consumer. Change-Id: Ib5ce7a497e034ebabb2cfffd1761a4fcb2be9a6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix broken "see also" linksDavid Boddie2025-06-252-2/+2
| | | | | | Pick-to: 6.9 6.10 Change-Id: Idbfb39bbe1f16de420711911df0a8c47a2a75420 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Clarify that 'netmask' in isInSubnet() means prefix lengthDheerendra Purohit2025-06-161-1/+5
| | | | | | | | | Clarified in the documentation that the 'netmask' parameter in QHostAddress::isInSubnet() is a prefix length, not a full netmask. Fixes: QTBUG-63252 Change-Id: I2917f0f57bb369cc9256f46a1ce15dd41f2199c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix namespace build when networkproxy is disabledJuha Vuolle2025-04-221-2/+2
| | | | | | | | | | | | | The QT_BEGIN_NAMESPACE macro was inside the "#if networkproxy" code block, whereas the QT_END_NAMESPACE was outside of it. When networkproxy feature is then disabled, the file will only effectively have the QT_END_NAMESPACE macro. This fails to compile when the build is an actual namespace build. Pick-to: 6.9 6.8 Change-Id: Ic0b0fd2d086811664a4f66e2c46424d370641355 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qnetworkinterface.cpp: Rename "interface" variables to "iface" to fix a ↵Nodir Temirkhodjaev2025-03-251-10/+10
| | | | | | | | | | | unity build On Windows the "interface" is defined as "struct". Pick-to: 6.9 6.8 Task-number: QTBUG-122980 Change-Id: I1a80c9e40d59449bb3c3773679a95405ea39d630 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add missing comparison operators for Microsoft::WRL::ComPtr on MINGWJøger Hansegård2025-03-061-1/+1
| | | | | | | | | | | | | | | | MINGW's implementation of Microsoft::WRL::ComPtr lacks comparison operators, and calling operator==() on them will implicitly convert them to bool before comparing the resulting bool values. Two non-zero ComPtr instances will therefore always compare equal, even if they point to different interfaces. This patch adds ComPtr comparison operators if they are missing, and replaces existing includes to wrl.h or wrl/client.h with QtCore/private/qcomptr_p.h Pick-to: 6.9 6.8 Change-Id: I8123d9d874ae53ebfd6d381b69097e75527848b6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Short live QCoreApplication::instanceExists()Thiago Macieira2025-02-261-1/+1
| | | | | | | | | | | | | | | | | | This is a thread-safe version of QCoreApplication::instance() != nullptr for Qt 6.x, because QCoreApplication::self is not atomic and thus reading it from outside the main thread could be a data race. That's not to say it always is: if by construction the code can only run in the main thread or while QCoreApplication definitely exists, that's safe. Therefore, this commit focuses on places that are meant to be used in multi-threaded environment (ruling out most of QtGui and QtWidgets) or where the code was going to dereference the returned pointer anyway. Change-Id: I6fc556c5fe5cbe0b5902fffdfb6b3bb345b0ee50 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QNetworkInfo: Document threading restrictionMårten Nordheim2025-02-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | Specifically on Windows we use COM, which requires being de-initialized in the same thread as it was initialized. Given that QNetworkInfo is a GLOBAL_STATIC with a qAddPostCondition (iirc APPLICATION_STATIC was not yet implemented at the time) to delete the backend when qApp is destructed, we need to cope with destruction happening on the main thread. If the backend is loaded on a secondary thread, the thread may have shut down, or we may not otherwise be able to rely on emitting Queued emissions to perform the destruction. Conversely we also can't trivially move the construction to the application thread (eg. using BlockingQueued emission during first load) because we may cause a deadlock. This leaves us with just documenting where the first load should happen. Fixes: QTBUG-133644 Pick-to: 6.9 6.8 6.5 Change-Id: I7f52e884151c6c24acc34f1112faabc897d9b0f9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNCM[Mac]: Update from SCNetworkReachability to Network frameworkEvgen Pervenenko2024-12-144-221/+126
| | | | | | | | | | | | | | | | Since SCNetworkReachability is deprecated, the implementation is now updated to use the Network framework. [ChangeLog][QNetworkInformation] Replace deprecated SCNetworkReachability implementation with Network framework (iOS, macOS) Fixes: QTBUG-132103 Change-Id: Iff4a667fd07002451b7d49cc8fd069945d426aab Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Create qdoc macros for C++ class docs 2.1: qHash()Marc Mutz2024-11-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a family of qdoc macros to document the various qHash() overloads we have. This patch does not change the \relates of the qHash() functions, they remain as inconsistent as they have been. Created QTBUG-129815 to clean things up. Since this author expects the \relates to change in the future, there are different \qhash commands, and all except \qhashbuiltin take the class name as an argument, for use in a centrally-choreographed fix for QTBUG-129815. As drive-by's, fix: - missing documentation about Key having to support qHash() in the associative Qt containers - drop noexcept and default arguments from \fn lines that needed to have their argument names changed - move the QStringView overload from qhash.cpp to qstringview.cpp (as it \relates to the former) Fixes: QTBUG-129574 Pick-to: 6.8 6.5 Change-Id: I8e8c2edc27422cbe5823f56baf3a24d7f7050836 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* QNetworkConnectionMonitor[Mac]: Fix potential use-after/during-freeEvgen Pervenenko2024-11-181-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a potential race condition on Mac that can lead to crashes when destroying `QNetworkConnectionMonitor`. This issue arises when `QNetworkConnectionMonitorPrivate` has already been destroyed, but is still being accessed through `QNCMP::probeCallback()` from another thread. To fix the issue, a reference counter is used. This counter indicates whether the callback is being used in monitoring. It increases when information is retained (when we set the callback, the info retains to 1) and decreases when information is released (the info releases to 0, when QNCMP object is not used in monitoring). A waitCondition is used to notify all threads when the reference counter reaches zero. The QNCMP::reset function waits until the probeCallback is disconnected and the reference counter is zero. This indicates that the info resource is free, allowing us to safely destroy the QNCMP object. The conditional variable protects the QNetworkConnectionMonitorPrivate object and ensures that the callback is disconnected properly. Fixes: QTBUG-130552 Pick-to: 6.8 6.5 Change-Id: I1259c429e92bc20c382604192243d6d8fadb5c25 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com>
* Create qdoc macros for C++ class docs 1.3: member-swap(), non-standard phrasingMarc Mutz2024-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and this third patch is for documentation that used a non-standard phrasing for documenting member-swap(). By using the macro, the documentation automatically conforms to what the documentation team picks as the \memberswap expansion going forward. As a drive-by, fix doc block indentation to the Qt standard of 4 spaces (only in changed lines), and add a few blank lines where they were missing before. Fixes: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: If007602d7690572fcbb848a8d0235416c908cfd2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Create qdoc macros for C++ class docs 1.2: member-swap(), simplified phrasingMarc Mutz2024-11-084-30/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and this second patch is for documentation that used the simplified phrasing ("Swaps this X with \a other."), which this patch adopts as the text for \memberswap, too, because it doesn't repeat the macro argument, making it easier to find a grammatically-fitting argument than in the traditional phrasing. This doesn't change the documentation, except as follows: * standardizes on simpified instead of traditional phrasing for docs that already use the \memberswap macro * adds the "very fast and never fails" blurb, if it was missing * changes the function's argument name to `other`, as required by the macro. Task-number: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I1123e783ce0da76c5997ff74007d77504ac5b334 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Create qdoc macros for C++ class docs 1.1: member-swap(), traditional phrasingMarc Mutz2024-11-051-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and the first patch is for documentation that used the traditional phrasing ("Swaps the X \a other with this X."). This doesn't change the documentation, except as follows: * adds the "very fast and never fails" blurb, if it was missing * changes the function's argument name to `other`, as required by the macro. Task-number: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: Ib494bd218334724b3b43796ba6f71fb52b83aa94 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Replace all QPair/qMakePair with std::pair in qtbase/networkIsak Fyksen2024-10-242-8/+9
| | | | | | | Task-number: QTBUG-115841 Change-Id: I34f3106e4b50a18cc19c4cda597205c346e7561e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Network: don't include qglobal.hMårten Nordheim2024-10-134-5/+2
| | | | | | | Task-number: QTBUG-106722 Fixes: QTBUG-106728 Change-Id: Id0435ad2ffffdb159e44c1929df6ba904bd5b01a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QIODevice::readLineInto() instead of readLine() in loopsRym Bouabid2024-09-201-2/+2
| | | | | | | | | | | | | | Most of the callers of QIODevice::readLine() are reading a device line by line in a loop. Instead, use one QByteArray and modify it in every iteration using QIODevice::readLineInto(). Use a QByteArrayView instead of QByteArray when calling trimmed() as it's an expensive operation. Fixes: QTBUG-103108 Change-Id: Ic1af487a2fbf352cc21d76a41717944d034d3709 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Network: includemocsMårten Nordheim2024-09-062-0/+3
| | | | | | | | IIRC they were Q_GADGET'ed Pick-to: 6.8 Change-Id: Ia80e506587fb583591ea4b89e648cb9cdfd98dfa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use NSDMI for all the members of the QNtlmPhaseBlock classesMate Barany2024-09-061-25/+8
| | | | | | | | | | After the base and derived classes have been merged we can uniformize the initialization as well. Task-number: QTBUG-127539 Pick-to: 6.8 Change-Id: I3828dc973fd7b3ccd06272e2e26eaae4edab8768 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge the block and blockbase classes in qauthenticator.cppMate Barany2024-09-051-46/+32
| | | | | | | | | | | | The inheritance is probably unnecessary. As a drive-by, initialize all the members to silence the original Axivion warning. Task-number: QTBUG-127539 Pick-to: 6.8 Change-Id: Iba9d8f2cba246616dbb6e8e9b7b21e8589af84d9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Do not export QDnsTlsAssociationRecord wholesaleIvan Solovev2024-09-041-12/+12
| | | | | | | | | | | | | This is a non-polymorphic class, so explicitly export only the out-of-line methods. Amends 4503dabfbd11c084c2781a679c9af12d5fb8f763. Found in 6.8 API review. Pick-to: 6.8 Change-Id: I600d355a3b3abd321841dfc33030de9e5707c38a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QDnsLookup/Unix: fix buffer size on sending DNS queriesThiago Macieira2024-07-181-2/+3
| | | | | | | | | | | | Commit f2f00b2a4632aaeb58e6cdae7faef9e0bafaff49 ("QDnsLookup: implement DNS-over-TLS") added the use of QSpan, but confounded the size of the buffer array with the size of the query we prepared. The queryLength variable was never used after checking if the preparation had failed. Pick-to: 6.8 Task-number: QTBUG-127073 Change-Id: Iac1ff680887641888e00fffd17e0e49faab1d579 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Logging: use qCDebug/Warning/Info when for categorized loggingVolker Hilsheimer2024-07-161-3/+3
| | | | | | | | | | | | | When building qt with QT_NO_DEBUG/WARNING/INFO_OUTPUT set, then the qDebug/Warning/Info macros expand to `QMessageLogger::noDebug`. That helper is not defined to take a logging category or category function, so using `qDebug(lcX, ...)` breaks the build. The correct way to emit categorized logging is to use the qCDebug/Warning/Info macros. Task-number: QTBUG-125589 Pick-to: 6.8 6.7 6.5 Change-Id: I968b0e826871a09023c11fec9e51caa5a2c4dc0b Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
* Use NSDMI to initialize the member variables of QIpPacketHeaderMate Barany2024-07-151-8/+6
| | | | | | | | | | | | While adding senderPort to the initializer list of the constructor we have decided that NSDMI would be a better approach for the member variables. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: Ibc65251f99a66f1d7ee0c3570e608c2b534aa8b3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Initialize the senderPort member variable in QIpPacketHeaderMate Barany2024-07-131-0/+1
| | | | | | | | | | | | | Address the "A constructor must initialize all data members of the class" warning found by an Axivion scan. Just as the destinationPort is defaulted to 0 initialize the senderPort to be 0 as well. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: Ifec55ba4b6c23a6feed2b4816d4ba6aae061f1cd Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add move constructor to QHostAddressMate Barany2024-07-122-0/+16
| | | | | | | | | | | | | The class has a move assignment operator, it should have a move constructor as well. Found by an Axivion scan. Task-number: QTBUG-125026 Pick-to: 6.8 Change-Id: I301e8e3f275b0d5217afc1559947870ff87bcf45 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove the struct NetlinkSocketMate Barany2024-07-111-24/+11
| | | | | | | | | | | | | | | | | | | | | Started with fixing a "Class with destructor should also declare a copy or move constructor and assignment operator." warning found by an Axivion scan. However, the NetlinkSocket struct is used only once and the behavior can be replicated with a qScopeGuard. Remove the struct NetlinkSocket and use a qScopeGuard for resource management. Drive-by: remove a Q_UNLIKELY that's not needed (qErrnoWarning() is already marked as Q_DECL_COLD_FUNCTION). Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I6b770e284fdda3ff97b8cabac205e9b5abe88b14 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add the nodiscard qualifier to the constructor of NetlinkSocketMate Barany2024-07-051-1/+1
| | | | | | | | | | | | This is a RAII class the result of the constructor call should never be discarded. As a drive-by made the constructor explicit. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I651dda87b5191d50e111732d11bab8d5aa58e9af Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QSharedDataPointer: Use new comparison helper macrosRym Bouabid2024-07-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide the new comparesEqual() helper function as an implementation of the (in)equality operators and compareThreeWay() helper function for the rest of the relational operators. Use Q_DECLARE_STRONGLY_ORDERED to provide all relational operators. Use the new Qt::totally_ordered_wrapper to wrap the "d" pointer to avoid UB when performing comparisons of QSharedDataPointer. The old implementation of the operators between QSharedDataPointer and the normal pointer T* used to cause a bug but this was not noticed because QSharedDataPointer didn't have any tests. I added tests and tried to compare using operator<(). I got build issues: error: no match for call to ‘(std::less<MyClass*>) (const MyClass*&, MyClass* const&)’ This happens because QSharedDataPointer has an implicit conversion to MyClass*. Making the normal pointer T* non-const as follow resolves the issue: DECLARE_COMPARE_SET(const QSharedDataPointer &p1, p1.d, T *ptr, ptr) DECLARE_COMPARE_SET(T *ptr, ptr, const QSharedDataPointer &p2, p2.d) A similar bug happens if we make the normal pointer const in the comparison macro Q_DECLARE_STRONGLY_ORDERED. The relational operators will be ambiguous. The compiler picks between operator<(QSharedDataPointer<MyClass>, MyClass*) and opeartor<(MyClass*, MyClass*) (In case we're calling <). Therefore, use: Q_DECLARE_STRONGLY_ORDERED(QSharedDataPointer, T*) Add some comparisons related tests for QSharedDataPointer. Use QT_TEST_ALL_COMPARISON_OPS macros in unit-tests. Task-number: QTBUG-120306 Change-Id: I8d1159a01651bab442b79a89c53e064914103133 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* JNI: pre-declare JNI classes for standard Java typesVolker Hilsheimer2024-06-201-1/+0
| | | | | | | | | | | | | | | | | | This avoids that we or users have to declare e.g. String or Uri in several places in Qt. This also prevents problems where multiple declarations (possibly from different headers) cause build errors. As a drive-by, remove some unnecessary type declarations (e.g. UriType, which had the same class string as Uri). To ease the submodule update process, define a preprocessor symbol that submodules can use to conditionally declare the type locally. Once the dependency update is through, the symbol can be removed and submodules can use the declaration from qjnitypes.h. Pick-to: 6.8 Change-Id: I7d96edf644a54246302b5c5cb478e66fa615e73e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>