summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimagereaderwriterhelpers.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QStringBuilder: use data_ptr().data() instead of constData()Thiago Macieira2023-12-121-3/+0
| | | | | | | | | | | | | | | | As the comment says, this allows us to skip the check for non-detached strings and for null ones. We know that the one we've just created isn't either, so long as len != 0. All QConcatenable::appendTo() calls do nothing if len == 0, including not calling memcpy() at all. Moreover, because it no longer references the QByteArray::_empty variable, the GCC -Warray-bounds warning should be gone too. Task-number: QTBUG-116763 Pick-to: 6.7 6.6 6.5 Change-Id: Ica7a43f6147b49c187ccfffd179eba2897ce2aff Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Work around GCC 13's bogus "out of bounds" check to QByteArray::_emptyThiago Macieira2023-10-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Nothing here is empty and even if anything were, QStringBuilder properly handles empty strings. In static member function ‘static void QConcatenable<QByteArrayView>::appendTo(QByteArrayView, char*&)’, inlined from ‘static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = char; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:398:37, inlined from ‘T QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> >::convertTo() const [with T = QByteArray; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:117:54, ... qstringbuilder.h:178:19: error: ‘void* memcpy(void*, const void*, size_t)’ forming offset [1, 5] is out of the bounds [0, 1] of object ‘QByteArray::_empty’ with type ‘const char’ [-Werror=array-bounds=] QStringBuilder::convertTo() creates the target as const qsizetype len = QConcatenable< QStringBuilder<A, B> >::size(*this); T s(len, Qt::Uninitialized); We know len can't be zero because GCC is complaining about a memcpy() when the offset has been changed from 0, meaning QByteArray was given a non-zero size and therefore its data pointer is not &QByteArray::_empty. Fixes: QTBUG-116763 Pick-to: 6.5 6.6 Change-Id: I85599ea5ca7a4b79a8bbfffd178af437984080fb Reviewed-by: Shawn Rutledge (away) <shawn.rutledge@qt.io>
* Fix gcc 13 fatal warning: emplace_back() rather than append()Shawn Rutledge2023-09-191-1/+1
| | | | | | | Fixes: QTBUG-116763 Pick-to: 6.6 Change-Id: Ie7c897deb14fcd1ff27277892f0c5a151ff63b41 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qimagereaderwriterhelpers: deduplicate literalAnton Kudryavtsev2023-09-021-3/+5
| | | | | | | Extract literal to constexpr function and reuse it Change-Id: I0a1ec24cb67e413222c826f2f26d78e16459ff8c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* imageFormatsForMimeType: port to QBAVAnton Kudryavtsev2023-09-011-2/+2
| | | | | | | to reduce allocations Change-Id: Ic48616d0627cb1dfee5f844bee263a59a430d9ba Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: Disambiguate static variablesFriedemann Kleint2023-02-031-8/+8
| | | | | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I3c51fb41d29e5c649537b999dced7e2d413b26a7 Done-with: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-281-3/+5
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFactoryLoader: continue the port from JSON to CBORThiago Macieira2021-10-201-6/+5
| | | | | | | | | | | | | | This continues the effort from the previous commit, by not passing through the JSON conversion at all, and simply using CBOR directly. The port in qtbase is complete, but in order to support the conversion in other modules without introducing breakages, there's a temporary class used for converting to QPluginParsedMetaData from QJsonObject. It'll be removed once all other modules have finished converting. Change-Id: I2de1b4dfacd443148279fffd16a3ed4ddaf34afc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-3/+3
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce QImage{Reader,Writer}::imageFormatsForMimeType()Alexander Volkov2018-02-271-2/+34
| | | | | | | | | | It can be used if, for example, you get an image MIME type from the user, and you want to find the appropriate format for loading or saving this image. Task-number: QTBUG-49714 Change-Id: Iae5a7e9d658d6c3d1cd750a8bbc279f1812f99df Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid code duplication in QImage{Reader,Writer}Alexander Volkov2018-02-111-0/+148
Extract code related to supportedImageFormats() and supportedMimeTypes() into QImageReaderWriterHelpers namespace. Change-Id: If0f56682072859be1b6f07afd7737431325827fc Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>