off_t as_offset = be32toh(header->as_offset);
size_t as_length = be32toh(header->as_length);
- DEBUG(db->ctx, "Reading AS section from %jd (%zu bytes)\n", as_offset, as_length);
+ DEBUG(db->ctx, "Reading AS section from %jd (%zu bytes)\n", (intmax_t)as_offset, as_length);
if (as_length > 0) {
db->as_v0 = mmap(NULL, as_length, PROT_READ,
size_t network_nodes_length = be32toh(header->network_tree_length);
DEBUG(db->ctx, "Reading network nodes section from %jd (%zu bytes)\n",
- network_nodes_offset, network_nodes_length);
+ (intmax_t)network_nodes_offset, network_nodes_length);
if (network_nodes_length > 0) {
db->network_nodes_v0 = mmap(NULL, network_nodes_length, PROT_READ,
size_t networks_length = be32toh(header->network_data_length);
DEBUG(db->ctx, "Reading networks section from %jd (%zu bytes)\n",
- networks_offset, networks_length);
+ (intmax_t)networks_offset, networks_length);
if (networks_length > 0) {
db->networks_v0 = mmap(NULL, networks_length, PROT_READ,
if ((size_t)pos >= db->as_count)
return -EINVAL;
- DEBUG(db->ctx, "Fetching AS at position %jd\n", pos);
+ DEBUG(db->ctx, "Fetching AS at position %jd\n", (intmax_t)pos);
int r;
switch (db->version) {
if ((size_t)pos >= db->networks_count)
return -EINVAL;
- DEBUG(db->ctx, "Fetching network at position %jd\n", pos);
+ DEBUG(db->ctx, "Fetching network at position %jd\n", (intmax_t)pos);
int r;
switch (db->version) {
const struct loc_database_network_node_v0* node) {
off_t network_index = be32toh(node->network);
- DEBUG(db->ctx, "Handling leaf node at %jd (%jd)\n", node - db->network_nodes_v0, network_index);
+ DEBUG(db->ctx, "Handling leaf node at %jd (%jd)\n", (intmax_t)(node - db->network_nodes_v0), (intmax_t)network_index);
// Fetch the network
int r = loc_database_fetch_network(db, network,
network_address, prefix, network_index);
if (r) {
- ERROR(db->ctx, "Could not fetch network %jd from database\n", network_index);
+ ERROR(db->ctx, "Could not fetch network %jd from database\n", (intmax_t)network_index);
return r;
}
if (pool->mode != STRINGPOOL_MMAP)
return -EINVAL;
- DEBUG(pool->ctx, "Reading string pool starting from %zu (%zu bytes)\n", offset, length);
+ DEBUG(pool->ctx, "Reading string pool starting from %jd (%zu bytes)\n", (intmax_t)offset, length);
// Map file content into memory
pool->data = pool->pos = mmap(NULL, length, PROT_READ,
LOC_EXPORT off_t loc_stringpool_add(struct loc_stringpool* pool, const char* string) {
off_t offset = loc_stringpool_find(pool, string);
if (offset >= 0) {
- DEBUG(pool->ctx, "Found '%s' at position %jd\n", string, offset);
+ DEBUG(pool->ctx, "Found '%s' at position %jd\n", string, (intmax_t)offset);
return offset;
}
if (!string)
break;
- printf("%jd (%zu): %s\n", offset, strlen(string), string);
+ printf("%jd (%zu): %s\n", (intmax_t)offset, strlen(string), string);
offset = loc_stringpool_get_next_offset(pool, offset);
}
static int loc_database_write_pool(struct loc_writer* writer,
struct loc_database_header_v0* header, off_t* offset, FILE* f) {
// Save the offset of the pool section
- DEBUG(writer->ctx, "Pool starts at %jd bytes\n", *offset);
+ DEBUG(writer->ctx, "Pool starts at %jd bytes\n", (intmax_t)*offset);
header->pool_offset = htobe32(*offset);
// Write the pool
static int loc_database_write_as_section(struct loc_writer* writer,
struct loc_database_header_v0* header, off_t* offset, FILE* f) {
- DEBUG(writer->ctx, "AS section starts at %jd bytes\n", *offset);
+ DEBUG(writer->ctx, "AS section starts at %jd bytes\n", (intmax_t)*offset);
header->as_offset = htobe32(*offset);
size_t as_length = 0;
static int loc_database_write_networks(struct loc_writer* writer,
struct loc_database_header_v0* header, off_t* offset, FILE* f) {
// Write the network tree
- DEBUG(writer->ctx, "Network tree starts at %jd bytes\n", *offset);
+ DEBUG(writer->ctx, "Network tree starts at %jd bytes\n", (intmax_t)*offset);
header->network_tree_offset = htobe32(*offset);
size_t network_tree_length = 0;
align_page_boundary(offset, f);
- DEBUG(writer->ctx, "Networks data section starts at %jd bytes\n", *offset);
+ DEBUG(writer->ctx, "Networks data section starts at %jd bytes\n", (intmax_t)*offset);
header->network_data_offset = htobe32(*offset);
// We have now written the entire tree and have all networks