From: Michael Tremer Date: Sat, 19 Oct 2019 10:51:59 +0000 (+0100) Subject: Correct cast off_t to intmax_t before printing it X-Git-Tag: 0.9.0~25 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=2e2325a9aa4987d23fbc711234cbd20486143ef2 Correct cast off_t to intmax_t before printing it Signed-off-by: Michael Tremer --- diff --git a/src/database.c b/src/database.c index 3099dfc..3439b15 100644 --- a/src/database.c +++ b/src/database.c @@ -205,7 +205,7 @@ static int loc_database_read_countries_section_v0(struct loc_database* db, size_t countries_length = be32toh(header->countries_length); DEBUG(db->ctx, "Reading countries section from %jd (%zu bytes)\n", - countries_offset, countries_length); + (intmax_t)countries_offset, countries_length); if (countries_length > 0) { db->countries_v0 = mmap(NULL, countries_length, PROT_READ, @@ -614,7 +614,7 @@ static int loc_database_fetch_country(struct loc_database* db, if ((size_t)pos >= db->countries_count) return -EINVAL; - DEBUG(db->ctx, "Fetching country at position %jd\n", pos); + DEBUG(db->ctx, "Fetching country at position %jd\n", (intmax_t)pos); int r; switch (db->version) { @@ -844,7 +844,7 @@ static int loc_database_enumerator_stack_push_node( // Increase stack size int s = ++e->network_stack_depth; - DEBUG(e->ctx, "Added node %jd to stack (%d)\n", offset, depth); + DEBUG(e->ctx, "Added node %jd to stack (%d)\n", (intmax_t)offset, depth); e->network_stack[s].offset = offset; e->network_stack[s].i = i; @@ -884,7 +884,7 @@ LOC_EXPORT int loc_database_enumerator_next_network( in6_addr_set_bit(&enumerator->network_address, (node->depth > 0) ? node->depth - 1 : 0, node->i); - DEBUG(enumerator->ctx, "Looking at node %jd\n", node->offset); + DEBUG(enumerator->ctx, "Looking at node %jd\n", (intmax_t)node->offset); enumerator->networks_visited[node->offset]++; // Pop node from top of the stack @@ -908,7 +908,7 @@ LOC_EXPORT int loc_database_enumerator_next_network( if (__loc_database_node_is_leaf(n)) { off_t network_index = be32toh(n->network); - DEBUG(enumerator->ctx, "Node has a network at %jd\n", network_index); + DEBUG(enumerator->ctx, "Node has a network at %jd\n", (intmax_t)network_index); // Fetch the network object r = loc_database_fetch_network(enumerator->db, network, diff --git a/src/writer.c b/src/writer.c index c241e8b..15dbe08 100644 --- a/src/writer.c +++ b/src/writer.c @@ -444,7 +444,7 @@ static int loc_database_write_networks(struct loc_writer* writer, static int loc_database_write_countries(struct loc_writer* writer, struct loc_database_header_v0* header, off_t* offset, FILE* f) { - DEBUG(writer->ctx, "Countries section starts at %jd bytes\n", *offset); + DEBUG(writer->ctx, "Countries section starts at %jd bytes\n", (intmax_t)*offset); header->countries_offset = htobe32(*offset); size_t countries_length = 0;