]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
Correct cast off_t to intmax_t before printing it
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Oct 2019 10:51:59 +0000 (11:51 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Oct 2019 10:51:59 +0000 (11:51 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c
src/writer.c

index 3099dfc64172800977c71ea6edb940abc7c1b9ce..3439b1534dbb30872f6226986ac8f5e6dd1980c2 100644 (file)
@@ -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,
index c241e8b49584bf0cb82f7534e78a12255cc5f5e3..15dbe084cef02116f2b112cd8590cc389f1b76cc 100644 (file)
@@ -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;