From aac8745abf3f72a13ccf7bc6cf305da637a61b12 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Tue, 16 Feb 2016 00:37:15 +0100 Subject: Cast when using %llu format strings --- c_src/filebuffer.c | 2 +- c_src/permdb.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/c_src/filebuffer.c b/c_src/filebuffer.c index 2ca76de..70d7827 100644 --- a/c_src/filebuffer.c +++ b/c_src/filebuffer.c @@ -139,7 +139,7 @@ unsigned char * bf_read(buffered_file *file, uint64_t offset, size_t length, char **error) { unsigned char *result = malloc(length); - dprintf(READ, (stderr, "reading data: offset %llu\n", offset)); + dprintf(READ, (stderr, "reading data: offset %llu\n", (unsigned long long) offset)); if (offset >= file->filesize) { uint64_t writebufferoffset = offset - file->filesize; diff --git a/c_src/permdb.c b/c_src/permdb.c index dde863b..5b25abb 100644 --- a/c_src/permdb.c +++ b/c_src/permdb.c @@ -507,7 +507,7 @@ unsigned char * read_internal_data(permdb_object *state, node_offset offset, size_t length) { buffered_file *file = state->datafile; - dprintf(READ, (stderr, "reading data: offset %llu\n", offset)); + dprintf(READ, (stderr, "reading data: offset %llu\n", (unsigned long long) offset)); return bf_read(file, offset, length, &state->error); } @@ -524,7 +524,7 @@ iserrornode(node_object node) node_object readnode(permdb_object *state, node_offset offset, const char *cachekey) { - dprintf(READ, (stderr, "reading node: offset %llu cachekey '%s'\n", offset, cachekey ? cachekey : "none")); + dprintf(READ, (stderr, "reading node: offset %llu cachekey '%s'\n", (unsigned long long) offset, cachekey ? cachekey : "none")); if (cachekey) { node_object dirtynode = get_node_from_dirtynodes(state, cachekey); @@ -686,7 +686,7 @@ writenode(permdb_object *state, node_object node, const char *cachekey) put_node_in_cache(state, cachekey, node); - dprintf(WRITE, (stderr, "writing node: offset %llu\n", offset)); + dprintf(WRITE, (stderr, "writing node: offset %llu\n", (unsigned long long) offset)); bf_add(state->indexfile, &index_node_cookie, sizeof(index_node_cookie)); bf_add(state->indexfile, &node, sizeof(node_object)); @@ -772,7 +772,7 @@ writedata(permdb_object *state, const unsigned char *key, const unsigned char *d } node_offset offset = bf_total_length(state->datafile); - dprintf(WRITE, (stderr, "writing data: offset %llu\n", offset)); + dprintf(WRITE, (stderr, "writing data: offset %llu\n", (unsigned long long) offset)); bf_add(state->datafile, &data_entry_cookie, sizeof(data_entry_cookie)); bf_add(state->datafile, key, keylen); bf_add_be16(state->datafile, 1); @@ -1015,7 +1015,7 @@ committree(permdb_object *state) return -1; } - dprintf(WRITE, (stderr, "committing %d dirty nodes at offset %llu\n", HASH_COUNT(state->dirtynodes), bf_total_length(state->indexfile))); + dprintf(WRITE, (stderr, "committing %d dirty nodes at offset %llu\n", HASH_COUNT(state->dirtynodes), (unsigned long long) bf_total_length(state->indexfile))); struct nodecache *node, *tmp; HASH_ITER(hh, state->dirtynodes, node, tmp) { assert(get_entry_in_node(node->value, 0) != NODE_ENTRY_DIRTY_NODE); @@ -1035,7 +1035,7 @@ committree(permdb_object *state) } } - dprintf(WRITE, (stderr, "writing data commit trailer at offset %llu\n", bf_total_length(state->datafile))); + dprintf(WRITE, (stderr, "writing data commit trailer at offset %llu\n", (unsigned long long) bf_total_length(state->datafile))); int data_commit_padding_size = calc_padding(bf_total_length(state->datafile), 4); uint8_t padding[4] = {0, 0, 0, 0}; @@ -1047,14 +1047,14 @@ committree(permdb_object *state) bf_add(state->datafile, data_commit_checksum, SHA256_DIGEST_SIZE); bf_add(state->datafile, &data_commit_end_cookie, sizeof(data_commit_end_cookie)); - dprintf(WRITE, (stderr, "finished writing data commit trailer at offset %llu\n", bf_total_length(state->datafile))); + dprintf(WRITE, (stderr, "finished writing data commit trailer at offset %llu\n", (unsigned long long) bf_total_length(state->datafile))); if (bf_flush(state->datafile) == -1) { set_error(&state->error, "data file flushing failed\n"); return -1; } - dprintf(WRITE, (stderr, "writing index commit trailer at offset %llu\n", bf_total_length(state->indexfile))); + dprintf(WRITE, (stderr, "writing index commit trailer at offset %llu\n", (unsigned long long) bf_total_length(state->indexfile))); uint64_t index_commit_length = bf_total_length(state->indexfile) - bf_lastcommit(state->indexfile) + sizeof(uint64_t); unsigned char index_commit_checksum[SHA256_DIGEST_SIZE]; @@ -1063,7 +1063,7 @@ committree(permdb_object *state) bf_add(state->indexfile, index_commit_checksum, SHA256_DIGEST_SIZE); bf_add(state->indexfile, &index_commit_cookie, sizeof(index_commit_cookie)); - dprintf(WRITE, (stderr, "finished writing index commit trailer at offset %llu\n", bf_total_length(state->indexfile))); + dprintf(WRITE, (stderr, "finished writing index commit trailer at offset %llu\n", (unsigned long long) bf_total_length(state->indexfile))); if (bf_flush(state->indexfile) == -1) { set_error(&state->error, "index file flushing failed\n"); -- cgit v1.1