Skip to content

Commit

Permalink
Replace %u with %PRIu32
Browse files Browse the repository at this point in the history
  • Loading branch information
ludocode committed Jan 9, 2023
1 parent 661194f commit e55dcd5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/mpack/mpack-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static void mpack_tag_debug_pseudo_json_bin(mpack_tag_t tag, char* buffer, size_
const char* prefix, size_t prefix_size)
{
mpack_assert(mpack_tag_type(&tag) == mpack_type_bin);
size_t length = (size_t)mpack_snprintf(buffer, buffer_size, "<binary data of length %u", tag.v.l);
size_t length = (size_t)mpack_snprintf(buffer, buffer_size, "<binary data of length %" PRIu32 "", tag.v.l);
mpack_tag_debug_complete_bin_ext(tag, length, buffer, buffer_size, prefix, prefix_size);
}

Expand All @@ -212,7 +212,7 @@ static void mpack_tag_debug_pseudo_json_ext(mpack_tag_t tag, char* buffer, size_
const char* prefix, size_t prefix_size)
{
mpack_assert(mpack_tag_type(&tag) == mpack_type_ext);
size_t length = (size_t)mpack_snprintf(buffer, buffer_size, "<ext data of type %i and length %u",
size_t length = (size_t)mpack_snprintf(buffer, buffer_size, "<ext data of type %i and length %" PRIu32 "",
mpack_tag_ext_exttype(&tag), mpack_tag_ext_length(&tag));
mpack_tag_debug_complete_bin_ext(tag, length, buffer, buffer_size, prefix, prefix_size);
}
Expand Down Expand Up @@ -253,7 +253,7 @@ static void mpack_tag_debug_pseudo_json_impl(mpack_tag_t tag, char* buffer, size
return;

case mpack_type_str:
mpack_snprintf(buffer, buffer_size, "<string of %u bytes>", tag.v.l);
mpack_snprintf(buffer, buffer_size, "<string of %" PRIu32 " bytes>", tag.v.l);
return;
case mpack_type_bin:
mpack_tag_debug_pseudo_json_bin(tag, buffer, buffer_size, prefix, prefix_size);
Expand All @@ -265,10 +265,10 @@ static void mpack_tag_debug_pseudo_json_impl(mpack_tag_t tag, char* buffer, size
#endif

case mpack_type_array:
mpack_snprintf(buffer, buffer_size, "<array of %u elements>", tag.v.n);
mpack_snprintf(buffer, buffer_size, "<array of %" PRIu32 " elements>", tag.v.n);
return;
case mpack_type_map:
mpack_snprintf(buffer, buffer_size, "<map of %u key-value pairs>", tag.v.n);
mpack_snprintf(buffer, buffer_size, "<map of %" PRIu32 " key-value pairs>", tag.v.n);
return;
}

Expand Down Expand Up @@ -320,22 +320,22 @@ static void mpack_tag_debug_describe_impl(mpack_tag_t tag, char* buffer, size_t
#endif
return;
case mpack_type_str:
mpack_snprintf(buffer, buffer_size, "str of %u bytes", tag.v.l);
mpack_snprintf(buffer, buffer_size, "str of %" PRIu32 " bytes", tag.v.l);
return;
case mpack_type_bin:
mpack_snprintf(buffer, buffer_size, "bin of %u bytes", tag.v.l);
mpack_snprintf(buffer, buffer_size, "bin of %" PRIu32 " bytes", tag.v.l);
return;
#if MPACK_EXTENSIONS
case mpack_type_ext:
mpack_snprintf(buffer, buffer_size, "ext of type %i, %u bytes",
mpack_snprintf(buffer, buffer_size, "ext of type %i, %" PRIu32 " bytes",
mpack_tag_ext_exttype(&tag), mpack_tag_ext_length(&tag));
return;
#endif
case mpack_type_array:
mpack_snprintf(buffer, buffer_size, "array of %u elements", tag.v.n);
mpack_snprintf(buffer, buffer_size, "array of %" PRIu32 " elements", tag.v.n);
return;
case mpack_type_map:
mpack_snprintf(buffer, buffer_size, "map of %u key-value pairs", tag.v.n);
mpack_snprintf(buffer, buffer_size, "map of %" PRIu32 " key-value pairs", tag.v.n);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/mpack/mpack-node.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static bool mpack_tree_reserve_fill(mpack_tree_t* tree) {
return false;
}

mpack_log("read %u more bytes\n", (uint32_t)read);
mpack_log("read %" PRIu32 " more bytes\n", (uint32_t)read);
tree->data_length += read;
tree->parser.possible_nodes_left += read;
} while (tree->parser.possible_nodes_left < bytes);
Expand Down
2 changes: 1 addition & 1 deletion src/mpack/mpack-reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void mpack_skip_bytes(mpack_reader_t* reader, size_t count) {
// check if we have enough in the buffer already
size_t left = (size_t)(reader->end - reader->data);
if (left >= count) {
mpack_log("skipping %u bytes still in buffer\n", (uint32_t)count);
mpack_log("skipping %" PRIu32 " bytes still in buffer\n", (uint32_t)count);
reader->data += count;
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/mpack/mpack-writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static inline void mpack_writer_track_element(mpack_writer_t* writer) {
if (build->nested_compound_elements == 0) {
if (build->type != mpack_type_map) {
++build->count;
mpack_log("adding element to build %p, now %u elements\n", (void*)build, build->count);
mpack_log("adding element to build %p, now %" PRIu32 " elements\n", (void*)build, build->count);
} else if (build->key_needs_value) {
build->key_needs_value = false;
++build->count;
Expand Down Expand Up @@ -1103,7 +1103,7 @@ void mpack_write_timestamp(mpack_writer_t* writer, int64_t seconds, uint32_t nan
#endif

if (nanoseconds > MPACK_TIMESTAMP_NANOSECONDS_MAX) {
mpack_break("timestamp nanoseconds out of bounds: %u", nanoseconds);
mpack_break("timestamp nanoseconds out of bounds: %" PRIu32 , nanoseconds);
mpack_writer_flag_error(writer, mpack_error_bug);
return;
}
Expand Down Expand Up @@ -1686,7 +1686,7 @@ static void mpack_builder_resolve(mpack_writer_t* writer) {
while (true) {

// write out the container tag
mpack_log("writing out an %s with count %u followed by %zi bytes\n",
mpack_log("writing out an %s with count %" PRIu32 " followed by %zi bytes\n",
mpack_type_to_string(build->type), build->count, build->bytes);
switch (build->type) {
case mpack_type_map:
Expand Down

0 comments on commit e55dcd5

Please sign in to comment.