summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcborstream.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Doc: Move literal code block to a separate fileCristian Maureira-Fredes2018-10-151-279/+30
| | | | | | | | | | | 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>
* qdoc: Fix remaining qdoc warnings for QCborxxx classesMartin Smith2018-08-171-2/+2
| | | | | | | | | | 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>
* 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>
* CBOR: Use "noexcept" directlyThiago Macieira2018-07-141-3/+3
| | | | | | | | | | | 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>
* CBOR: Add QDebug operators for the Qt CBOR value-like typesThiago Macieira2018-07-041-0/+113
| | | | | | | | | | I added a function that returns the string identifiers for QCborKnownTags and QCborSimpleType, in order to facilitate writing a QTest::toString for those types, as neither enum is part of a Q_OBJECT or Q_GADGET class. Change-Id: I56b444f9d6274221a3b7fffd150d2d26a1925c19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCborStreamReader: Fix uninitialized warningLiang Qi2018-06-181-1/+1
| | | | | | | | | | | serialization/qcborstream.cpp: In member function 'QCborStreamReader::StringResult<int> QCborStreamReader::readStringChunk(char*, qsizetype)': serialization/qcborstream.cpp:2845:62: error: 'content' may be used uninitialized in this function [-Werror=maybe-uninitialized] memcpy(ptr, d->buffer.constData() + d->bufferStart + offset, toRead); ^ Task-number: QTBUG-68889 Change-Id: Ieea05672f2fdd7685c2af0e0aa7fa8b281d25618 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborStreamReader: update to the new TinyCBOR zero-copy string APIThiago Macieira2018-06-061-45/+64
| | | | | Change-Id: Iab119b62106d40fb8499fffd1510abe5d8f2722a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborStreamReader: use QByteArray directly if possibleThiago Macieira2018-06-061-62/+122
| | | | | | | | | | | | | | | QIODevice represents considreable overhead, even with just QBuffer, for parsing simple things. Benchmarking showed it was spending 25% of the parsing time inside one QIODevice function or another. So this commit accomplishes two things: 1) it increases the buffer size from 9 bytes to up to 256, which should reduce the number of calls into the QIODevice 2) if the source data is a QByteArray, then use it directly and bypass the QIODevice, thus increasing performance considerably Change-Id: I56b444f9d6274221a3b7fffd150c531c9d28e54b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborStreamReader: rewrite read{String,ByteArray}()Thiago Macieira2018-05-301-39/+14
| | | | | | | | | This rewrites _readString_helper() in terms of _readByteArray_helper() (the helper version doesn't do type-checking) and rewrites _readByteArray_helper() in terms of readStringChunk(). Change-Id: Iab119b62106d40fb8499fffd1510aa404d9f3611 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QCborStreamReader: remove the documentation on the validation APIThiago Macieira2018-05-291-7/+0
| | | | | | | It's not present in this version. Change-Id: I6a540578e810472bb455fffd1532ac4d49d4b994 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Long live QCborStreamReader!Thiago Macieira2018-05-271-13/+1574
| | | | | | | | | | This is the counterpart of the previous commit. [ChangeLog][QtCore] Added QCborStreamReader and QCborStreamWriter, classes for low-level reading and writing of CBOR streams. Change-Id: Ia0aac2f09e9245339951ffff13c72e4bffdf4a56 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Long live QCborStreamWriter!Thiago Macieira2018-05-271-0/+1250
CBOR is the Concise Binary Object Representation, a very compact form of binary data encoding that is compatible with JSON. It was created by the IETF Constrained RESTful Environments (CoRE) WG[1] and has since been used in many new RFCs by that group, especially COSE[2], and is meant to be used alongside CoAP[3]. This API is a very simple, thin wrapper around TinyCBOR[4]. See RFC 7049 <http://tools.ietf.org/html/rfc7049>. [1] https://datatracker.ietf.org/wg/core/charter/ [2] https://tools.ietf.org/html/rfc8152 [3] https://tools.ietf.org/html/rfc7252 [4] https://github.com/intel/tinycbor Change-Id: Ia0aac2f09e9245339951ffff13c651cfeab77d3b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>