intel / intel/tinycbor

cbor_value_byte_string_equals ?

Open
#223 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
630
Forks
222
Avg merge
1d 3h
Merged PRs (30d)
1

Description

Hi,

There is a function in `cborparser.c`: `cbor_value_text_string_equals` which checks if a char array is equal to the cbor value string. It would be helpful to also have this for a byte string, ie:

```
CborError cbor_value_byte_string_equals(const CborValue *value, const char *string, size_t len, bool *result)
{
CborValue copy = *value;
CborError err = cbor_value_skip_tag(©);
if (err)
return err;
if (!cbor_value_is_byte_string(©)) {
*result = false;
return CborNoError;
}

return iterate_string_chunks(©, CONST_CAST(char *, string), &len, result, NULL, iterate_memcmp);
}
```

This can't easily be implemented outside of the `cborparser.c` file because `iterate_string_chunks` is a static method contained to just this file.

I am happy to create a PR with this if that would help (I'm also happy to have someone else add it too), but I just wanted to check if this would be accepted?

Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.