-
Notifications
You must be signed in to change notification settings - Fork 185
Comparing changes
Open a pull request
base repository: intel/tinycbor
base: 4f8c8df
head repository: intel/tinycbor
compare: d2c2fd1
- 11 commits
- 6 files changed
- 1 contributor
Commits on Sep 4, 2021
-
WSHUB-458: cborparser: Move parser initialisation to common routine.
`cbor_parser_init` and `cbor_parser_init_reader` are substantially similar, however the latter misses clearing out `it->flags`, leaving it uninitialised so possibly unsafe. Rather than copying & pasting that from `cbor_parser_init`, lets just use one routine that does the "common" part, then each routine can focus on the specifics needed.
Configuration menu - View commit details
-
Copy full SHA for a08f379 - Browse repository at this point
Copy the full SHA a08f379View commit details -
WSHUB-458: cborparser: Document
cbor_parser_init_reader
.Describe the input parameters for the function and how they are used as best we understand from on-paper analysis of the C code.
Configuration menu - View commit details
-
Copy full SHA for caa6ff9 - Browse repository at this point
Copy the full SHA caa6ff9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e2fac6 - Browse repository at this point
Copy the full SHA 0e2fac6View commit details -
WSHUB-458: cborparser: Pass CborValue to operation routines.
The `token` parameter is not sufficient since it is effectively shared by all `CborValue` instances. Since `tinycbor` often uses a temporary `CborValue` context to perform some operation, we need to store our context inside that `CborValue` so that we don't pollute the global state of the reader.
Configuration menu - View commit details
-
Copy full SHA for a46de1b - Browse repository at this point
Copy the full SHA a46de1bView commit details -
WSHUB-458: cborparser: Move
ops
outside ofunion
In its place, put an arbitrary `void *` pointer for reader context. The reader needs to store some context information which is specific to the `CborParser` instance it is serving. Right now, `CborValue::source::token` serves this purpose, but the problem is that we also need a per-`CborValue` context and have nowhere to put it. Better to spend an extra pointer (4 bytes on 32-bit platforms) in the `CborParser` (which there'll be just one of), then to do it in the `CborValue` (which there may be several of) or to use a `CborReader` object that itself carries two pointers (`ops` and the context, thus we'd need an extra 3 pointers).
Configuration menu - View commit details
-
Copy full SHA for ffb8c62 - Browse repository at this point
Copy the full SHA ffb8c62View commit details -
Configuration menu - View commit details
-
Copy full SHA for 14b1854 - Browse repository at this point
Copy the full SHA 14b1854View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f4a63c - Browse repository at this point
Copy the full SHA 0f4a63cView commit details -
WSHUB-458: reader unit tests: Simplify the example reader
We simplify this reader in two ways: 1. we remove the `consumed` member of `struct Input`, and instead use the `CborValue`'s `source.token` member, which we treat as an unsigned integer offset into our `QByteArray`. 2. we replace the reader-specific `struct Input` with the `QByteArray` it was wrapping, since that's the only thing now contained in our `struct Input`. If a `CborValue` gets cloned, the pointer referred to by `source.token` similarly gets cloned, thus when we advance the pointer on the clone, it leaves the original alone, so computing the length of unknown-length entities in the CBOR document can be done safely.
Configuration menu - View commit details
-
Copy full SHA for 8d1fa30 - Browse repository at this point
Copy the full SHA 8d1fa30View commit details -
WSHUB-458: cborencoder: Document the write callback function.
What is not known, is what the significance is of `CborEncoderAppendType`. It basically tells the writer the nature of the data being written, but the default implementation ignores this and just blindly appends it no matter what. That raises the question of why it's important enough that the writer function needs to know about it.
Configuration menu - View commit details
-
Copy full SHA for 2875d9e - Browse repository at this point
Copy the full SHA 2875d9eView commit details -
Configuration menu - View commit details
-
Copy full SHA for f2effc0 - Browse repository at this point
Copy the full SHA f2effc0View commit details -
WSHUB-458: examples: Add buffered reader example
This reads a CBOR file piece-wise, seeking backward and forward through the file if needed. Some seeking can be avoided by tuning the block size used in reads so that the read window shifts by smaller amounts.
Configuration menu - View commit details
-
Copy full SHA for d2c2fd1 - Browse repository at this point
Copy the full SHA d2c2fd1View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 4f8c8df...d2c2fd1