Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: intel/tinycbor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4f8c8df
Choose a base ref
...
head repository: intel/tinycbor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d2c2fd1
Choose a head ref
  • 11 commits
  • 6 files changed
  • 1 contributor

Commits on Sep 4, 2021

  1. 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.
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    a08f379 View commit details
    Browse the repository at this point in the history
  2. 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.
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    caa6ff9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0e2fac6 View commit details
    Browse the repository at this point in the history
  4. 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.
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    a46de1b View commit details
    Browse the repository at this point in the history
  5. WSHUB-458: cborparser: Move ops outside of union

    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).
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    ffb8c62 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    14b1854 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0f4a63c View commit details
    Browse the repository at this point in the history
  8. 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.
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    8d1fa30 View commit details
    Browse the repository at this point in the history
  9. 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.
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    2875d9e View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f2effc0 View commit details
    Browse the repository at this point in the history
  11. 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.
    sjlongland committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    d2c2fd1 View commit details
    Browse the repository at this point in the history
Loading