Skip to content

Commit

Permalink
Fix more compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
PJK committed Dec 28, 2022
1 parent d96b0be commit 0dba37c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions examples/create_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ int main(void) {
/* Preallocate the map structure */
cbor_item_t* root = cbor_new_definite_map(2);
/* Add the content */
cbor_map_add(root,
(struct cbor_pair){
.key = cbor_move(cbor_build_string("Is CBOR awesome?")),
.value = cbor_move(cbor_build_bool(true))});
cbor_map_add(root,
(struct cbor_pair){
.key = cbor_move(cbor_build_uint8(42)),
.value = cbor_move(cbor_build_string("Is the answer"))});
bool success = cbor_map_add(
root, (struct cbor_pair){
.key = cbor_move(cbor_build_string("Is CBOR awesome?")),
.value = cbor_move(cbor_build_bool(true))});
success &= cbor_map_add(
root, (struct cbor_pair){
.key = cbor_move(cbor_build_uint8(42)),
.value = cbor_move(cbor_build_string("Is the answer"))});
if (!success) return 1;
/* Output: `length` bytes of data in the `buffer` */
unsigned char* buffer;
size_t buffer_size,
Expand Down
2 changes: 1 addition & 1 deletion examples/streaming_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void usage(void) {
const char* key = "a secret key";
bool key_found = false;

void find_string(void* UNUSED(_ctx), cbor_data buffer, size_t len) {
void find_string(void* UNUSED(_ctx), cbor_data buffer, uint64_t len) {
if (key_found) {
printf("Found the value: %.*s\n", (int)len, buffer);
key_found = false;
Expand Down

0 comments on commit 0dba37c

Please sign in to comment.