summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization
Commit message (Collapse)AuthorAgeFilesLines
* Doc: "UTF" -> "UTF-8"Thiago Macieira2019-03-141-1/+1
| | | | | Change-Id: Ifbadc62ac2d04a9a8952fffd158a5a9ba87c30e0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add a pair of functions to convert to and from Q/CborErrorThiago Macieira2019-03-141-4/+21
| | | | | | | | | | | | | | | We've so far made our public API match the TinyCBOR error codes, so the conversion is trivial. Having the two functions allows us to change that, if it becomes necessary. It also effectively concentrates the Coverity warning about mixed enums in a single pair of functions. >>> CID 190307: Incorrect expression (MIXED_ENUMS) >>> Mixing enum types "CborError" and "QCborError::Code" for "err". Change-Id: Ifbadc62ac2d04a9a8952fffd1589e739c7a5b745 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix Coverity warning about mixing enumsThiago Macieira2019-03-091-1/+1
| | | | | | | | | | Coverity says: >>> CID 190310: Incorrect expression (MIXED_ENUMS) >>> Mixing enum types "CborType" and "QCborStreamReader::Type" for "type_". Change-Id: Ifbadc62ac2d04a9a8952fffd1589e6e304fc7703 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qtlite: Fix build libs with -no-feature-regularexpressionMikhail Svetkin2019-01-273-1/+28
| | | | | Change-Id: I427ff1f8f4986fbf466aba60a9d3de614c1e006f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.12.0' into 5.12Liang Qi2018-11-162-4/+6
|\ | | | | | | Change-Id: Ic1dd39044e19f50e1068d4ac70dacaad6440e570
| * Doc: QCbor classes: Fix \variable commandsTopi Reinio2018-11-062-4/+6
| | | | | | | | | | | | | | | | | | \variable must not include the variable type, QDoc will resolve that. This commit resolves four documentation warnings. Task-number: QTBUG-71502 Change-Id: I5e88cf66d3c3bb8f18495d5477e1271ac2cd9e74 Reviewed-by: Martin Smith <martin.smith@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-11-097-41/+43
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf qmake/Makefile.unix src/gui/text/qtextdocument.cpp src/gui/text/qtextdocument.h Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
| * | Modernize the "textcodec" featureLiang Qi2018-11-077-41/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also clean up QTextCodec usage in qmake build and some includes of qtextcodec.h. Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | | Correct which codecs QTextStream::autoDetectUnicode detectsThiago Macieira2018-11-081-6/+6
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-67187 Change-Id: If7e743cf8476463880ccfffd155f86b78a279f81 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Fix warning about missing initializer for a struct memberThiago Macieira2018-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 4.8 is complaining about perfectly valid (and recommended) code but we still support it, so... qcborvalue.h:74:25: warning: missing initializer for member ‘QCborError::c’ Fixes: QTBUG-71222 Change-Id: If7e743cf8476463880ccfffd155e8775b6b95469 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QCborStreamReader: make sure setDevice() clears the last errorThiago Macieira2018-11-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unit tests weren't running into this problem because the every setDevice() was preceded by the object being initialized with the exact same data, so there was never a previous error state. I've only changed a couple of tests, left the other setDevice() unchanged so we test both behaviors. Fixes: QTBUG-71426 Change-Id: I1bd327aeaf73421a8ec5fffd1561a590e3933376 Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Add qHash(QCborTag) and qHash(QCborSimpleType)Thiago Macieira2018-11-081-0/+10
| |/ |/| | | | | | | | | | | | | Needed in qHash(QCborValue). Change-Id: If7e743cf8476463880ccfffd155eeca91369b356 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | qjson: add missed Q_CHECK_PTRv5.12.0-beta3Ivan Komissarov2018-10-212-0/+2
| | | | | | | | | | | | | | | | | | There might be dereferencing of a potential null pointer 'h' Task-number: QTBUG-71156 Change-Id: I63c34f8cba3e358f109d70ff9b34199c31895202 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* | Doc: Move literal code block to a separate fileCristian Maureira-Fredes2018-10-154-325/+41
| | | | | | | | | | | | | | | | | | | | | | We need to override this snippet for the documentation we generate for Qt for Python, and it is easier to have it on a separate file. Task-number: PYSIDE-801 Task-number: PYSIDE-691 Change-Id: Ideb5b6af25024279f167137d3b65660bb9c96a7e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Support QCborMap::operator[] taking a string literalEdward Welbourne2018-10-082-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a template on the size of the char[], as suggested by Ville Voutilainen. This resolves ambiguity about whether such look-ups should be done via QString or QCborValue (not that it would have made any difference). When we come to add mutating indexing of QCborValue, chained dereferences like map[i][j][k] need to stay in operator[] const throughout, to avoid detaching intermediates to create references into them due to using the mutating operator[] on the earlier dereference's return. So const-qualify the QCborValue operator[] const variants at the same time, to match those of QCborValue itself. Change-Id: Ib1652ae9440fe3767a653afa2856b74040210e07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Change QCborArray to pad with invalid on inserting past endEdward Welbourne2018-10-084-10/+41
| | | | | | | | | | | | | | | | | | Likewise have mutating operator[] insert an invalid entry at its target index, if beyond the end of the array. This makes it possible to fill an array from high index to low, for example. Change-Id: If71699c20e2623142214ce2c11c4d6e4a120c989 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix QXmlStreamWriter xmlns attribute placementhjk2018-09-281-1/+1
| | | | | | | | | | | | | | | | | | Done-by: Eugenio Rustico Change-Id: Ibd6aa6cc8be9090a4fad4f96628086d8a498b8e0 Fixes: QTBUG-63434 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Correct documentation about the datastream versionsAndy Shaw2018-09-251-1/+1
| | | | | | | | | | | | | | | | This amends f5fe9fc5a4136a696f07c4bd3567d85348ec42d9 Change-Id: I1d21f5b5f4896a11376f37ed0e39f00f2214c67b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | CBOR: Add missing clear() methods to the two container classesThiago Macieira2018-09-094-2/+24
| | | | | | | | | | | | Change-Id: Id59bdd8f1a804b809e22fffd153fd5174b58014d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | JSON: Add qHash functions for JSON and CBOR typesUlf Hermann2018-08-2712-0/+106
| | | | | | | | | | | | | | This way we can easily use them as keys in QHash and QSet. Change-Id: Ie744c3b5ad1176ba2ab035c7e650af483757a0c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | qdoc: Fix remaining qdoc warnings for QCborxxx classesMartin Smith2018-08-175-6/+121
| | | | | | | | | | | | | | | | | | | | Several \fn commands are added for functions and operators that were not documented. A few qdoc warnings remain in qcborstream.cpp, but these are because an enum class was used, and qdoc doesn't yet handle those correctly all the time. Change-Id: I02a740c595e36c1b383af242c2a6419d1f37b135 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-08-161-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qconfig-bootstrapped.h src/plugins/platforms/xcb/qxcbbackingstore.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I4af138ffb2f5306373244523768209e8873b2798
| * Fix possible heap corruption in QXmlStreamAllan Sandfeld Jensen2018-08-131-1/+1
| | | | | | | | | | | | | | | | | | The value of 'tos' at the check might already be on the last element, so triggering stack expansion on the second last element is too late. Change-Id: Ib3ab2662d4d27a71effe9e988b9e172923af2908 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-08-071-1/+1
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-1/+1
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| | * QJsonDocument: Make emptyObject an objectJüri Valdmann2018-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A default-constructed QJsonObject has no data payload, it is only a pair of null pointers. So, when it becomes necessary to 'materialize' such an object, a special global emptyObject constant is used as the substitute payload. There is a small problem with this global constant though, namely that it's is_object flag is unset. In other words, the emptyObject is not an object, but an array. Fix by setting the is_object flag on emptyObject. The example code in the bug report QJsonObject parent; QJsonObject child; parent["child"] = child; // 1 child = parent["child"].toObject(); // 2 child["test"] = "test"; // 3 runs into this problem on line 1. Inserting the default-constructed child means inserting a copy of emptyObject. On line 2 a pointer to this copy of emptyObject is retrieved and cast to an object. But it's not an object, it's an array, so things go wrong hereafter. Specifically, on line 3, two inserts are performed, one from operator[] and one from operator=. Each insert increments a compaction counter. The second insert triggers compaction (QJsonObject::insert calls Value::requiredStorage calls Data::compact) and compaction branches based on the is_object flag. Replacing line 3 with child.insert("test", "test"); causes the example to appear to work since compaction is not triggered and the JSON serializer does not look at the is_object flag. Still, any further insert() calls would trigger compaction and memory corruption. Task-number: QTBUG-69626 Change-Id: I8bd5174dce95998bac479c4b4ffea70bca1a4d04 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | qdoc: Fix \fn commands for QCborxxx member functionsMartin Smith2018-08-072-12/+13
|/ / | | | | | | | | | | | | | | | | | | Severa qdoc function comments had incorrect signatures. This update corrects them to match the declarations in the header file. A \keyword command was also added for linking to the generic algorithms header file page. Change-Id: I997f7f2c7e4d0c3fcd269ee2c89a2836fecd4927 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QCborValue diagnostics: Properly escape stringsThiago Macieira2018-08-031-5/+71
| | | | | | | | | | | | | | | | | | I'm intentionally not testing improperly-paired surrogates, since those can't be encoded in CBOR. Change-Id: I0d3cc366baaa49f3ad28fffd154240287ce34c22 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge "Merge branch '5.11' into dev" into refs/staging/devEdward Welbourne2018-07-313-1/+4
|\ \
| * | Merge branch '5.11' into devEdward Welbourne2018-07-313-1/+4
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
| | * Doc: Add since version for QJsonDocument::toJson()Paul Wicking2018-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-69527 Change-Id: I10df9cc2d6fa2080e07d68b78c6220500f459380 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
| | * Doc: Correct typo from decoded to encodedPaul Wicking2018-07-211-1/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-62081 Change-Id: Ia07b43445661d66ef0e8fe51d8d022bd5d803327 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Doc: Add since version for QJson method and enumPaul Wicking2018-07-192-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | QJsonValue::toInt() introduced in 5.2, 7372c6cf9d4 QJsonDocument::JsonFormat introduced in 5.1, 4bb5566632e Task-number: QTBUG-69527 Change-Id: Idb9df959f82fe7061e0afe2109f1ca34a4451a5f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | QCborValue: move the toDiagnosticNotation() function to its own fileThiago Macieira2018-07-304-225/+284
|/ / | | | | | | | | | | | | | | | | | | If we ever need to add QCborValue to the bootstrap library, it's unlikely that we'll need this part. And by splitting it, I can make the code handle more cases, that hadn't been properly handled before. Change-Id: I2f630efbbce54f14bfa9fffd154160c0ad893695 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QCborValue: Disable support for spaceship operatorThiago Macieira2018-07-293-5/+5
| | | | | | | | | | | | | | | | | | __has_include(<compare>) is not the correct way to detect this feature, since that's a library header and may be provided by an implementation (libc++) before the compiler supports the syntax. Change-Id: I80aae0d068974d83b6c0fffd1544c8e558e2446b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Add QTextStream operators for QStringViewFriedemann Kleint2018-07-202-0/+16
| | | | | | | | | | Change-Id: I72d597fa21521a04b7f7c0e41bd45ee9dabb6222 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update TinyCBOR to 1b233087a6e6b6be297e69bfcce5ed36f338c91dThiago Macieira2018-07-181-22/+5
| | | | | | | | | | | | | | | | From the fork at https://github.com/thiagomacieira/tinycbor Change-Id: I117816bf0f5e469b8d34fffd153dc88683051208 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QCborArray: add const_iterator overloads for insert/erase/extractThiago Macieira2018-07-142-0/+9
| | | | | | | | | | | | | | | | | | They return regular iterators, since the container has been modified. Change-Id: Id59bdd8f1a804b809e22fffd153f92d4460f9b76 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QCborMap: make take() & remove() efficient if the item isn't thereThiago Macieira2018-07-141-8/+8
| | | | | | | | | | | | | | | | | | By using constFind(), we won't detach if the item isn't there. Both extract() and erase() can take const_iterators. Change-Id: Id59bdd8f1a804b809e22fffd153f92989ef84644 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | CBOR: Use "noexcept" directlyThiago Macieira2018-07-148-49/+49
| | | | | | | | | | | | | | | | | | | | | | All supported compilers support it. Doing this just for the new API. We should do it throughout Qt, but only if it won't interfere with the header review. Change-Id: Id59bdd8f1a804b809e22fffd153f9254688e5152 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | QCborValue: Silence Coverity warning about null-pointer dereferenceThiago Macieira2018-07-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | It's a false positive, since we've checked that the item HasByteData. But it's cheap to rewrite so the warning is silenced. >>> CID 190741: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a null pointer "this->byteData(idx)". Change-Id: If48c5c2e920c433298f1fffd153f7534be42a30b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QCborValue/QDebug: restore decimal state after hexThiago Macieira2018-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | Found by Coverity: >>> CID 190746: API usage errors (STREAM_FORMAT_STATE) >>> Changing format state of stream "dbg" for category basefield without later restoring it. Change-Id: If48c5c2e920c433298f1fffd153f74f9bbe7ef29 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | QCborArray & Map: implement move semanticsThiago Macieira2018-07-055-16/+70
| | | | | | | | | | | | | | | | | | | | | | There isn't a lot of efficiency gain, since QCborValue was already refcounted. This saves two atomic operations and an out-of-line call. In the case of QCborValueRef (which includes QCborMap), because we reset the container pointer in inline code, the call to QCborValue::dispose() is also suppressed. Change-Id: Icc2c231dc2c44abdb087fffd1533eaba7a9c70fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QCborValue: refactor extended types so isTag() is trueThiago Macieira2018-07-052-57/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes QCborValue more future compatible, as code written today for tags that QCborValue does not recognize will continue to work if QCborValue gains support for it in the future. This change also obviates the need for reinterpretAsTag(), which I had not written unit tests for as I knew this change was coming. Change-Id: I052407b777ec43f78378fffd15302bdc34f66755 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QCborMap: Add reserve() to the QHash conversionThiago Macieira2018-07-051-0/+1
| | | | | | | | | | | | Change-Id: Id4c99d74841842cfa442fffd15371720f9566708 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | CBOR: Avoid conflicts with X11 #defines in our enumsMichael Pyne2018-07-043-0/+36
| | | | | | | | | | | | | | | | | | | | Since the .cpp files in the implementation don't actually include the offending X11 headers they don't need the fix. This just adjusts the headers themselves to unbreak the namespace for just long enough to declare the right enums. Change-Id: If33757aa2289f8fe7b81836f9c08b0ad4592bc32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QCborValue: implement move semantics for QCbor{Array,Map} constructorsThiago Macieira2018-07-043-0/+12
| | | | | | | | | | | | | | | | Happens a lot because of the implicit conversions. So I made it inline. Change-Id: Icc2c231dc2c44abdb087fffd1533f311b95460b8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QCborArray & Map: implement efficient take() / extract()Thiago Macieira2018-07-046-10/+166
| | | | | | | | | | | | | | | | | | | | | | | | Questions: 1) should QCborMap::extract return value_type (a pair) instead of just the value? 2) should the both return the iterator to the next element too, like erase()? Change-Id: I052407b777ec43f78378fffd15302a9c14468db3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | CBOR: Complete the conversions between CBOR, JSON and Qt meta typesThiago Macieira2018-07-042-3/+38
| | | | | | | | | | | | Change-Id: I56b444f9d6274221a3b7fffd150d3130db6ef1a0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Metatype: make the Qt CBOR value-like types built-in meta typesThiago Macieira2018-07-041-1/+0
| | | | | | | | | | | | | | | | This change only adds them to the registry and reserves the IDs. The next commit will handle conversions. Change-Id: I56b444f9d6274221a3b7fffd150d2d49f40940c2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>