Skip to content

Commit

Permalink
Merge pull request #94 from slegouix/master
Browse files Browse the repository at this point in the history
add support for tags of 64 bits wide
  • Loading branch information
bergzand authored Jun 26, 2024
2 parents acbdd48 + bf309e0 commit 3e37004
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/nanocbor/nanocbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,18 @@ void nanocbor_leave_container(nanocbor_value_t *it,
*/
int nanocbor_get_tag(nanocbor_value_t *cvalue, uint32_t *tag);

/**
* @brief Retrieve a tag as positive uint64_t from the stream
*
* The resulting @p value is undefined if the result is an error condition
*
* @param[in] cvalue CBOR value to decode from
* @param[out] tag returned tag as positive integer
*
* @return NANOCBOR_OK on success
*/
int nanocbor_get_tag64(nanocbor_value_t *cvalue, uint64_t *tag);

/**
* @brief Retrieve a null value from the stream
*
Expand Down
5 changes: 5 additions & 0 deletions src/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ int nanocbor_get_tag(nanocbor_value_t *cvalue, uint32_t *tag)
return res;
}

int nanocbor_get_tag64(nanocbor_value_t *cvalue, uint64_t *tag)
{
return _get_and_advance_uint64(cvalue, tag, NANOCBOR_TYPE_TAG);
}

int nanocbor_get_decimal_frac(nanocbor_value_t *cvalue, int32_t *e, int32_t *m)
{
int res = NANOCBOR_NOT_FOUND;
Expand Down

0 comments on commit 3e37004

Please sign in to comment.