Skip to content

Commit

Permalink
fix printf formats for 64 bit values
Browse files Browse the repository at this point in the history
  • Loading branch information
alex85k committed Oct 29, 2015
1 parent fa7d4da commit 9fc3a2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions node-ram-cache.cpp
Expand Up @@ -366,15 +366,11 @@ node_ram_cache::node_ram_cache( int strategy, int cacheSizeMB, int fixpointscale
}
}

#ifdef __MINGW_H
fprintf( stderr, "Node-cache: cache=%ldMB, maxblocks=%d*%d, allocation method=%i\n", (cacheSize >> 20), maxBlocks, PER_BLOCK*sizeof(ramNode), allocStrategy );
#else
fprintf( stderr, "Node-cache: cache=%ldMB, maxblocks=%d*%zd, allocation method=%i\n", (cacheSize >> 20), maxBlocks, PER_BLOCK*sizeof(ramNode), allocStrategy );
#endif
fprintf( stderr, "Node-cache: cache=%" PRId64 "MB, maxblocks=%d*%zu, allocation method=%i\n", (cacheSize >> 20), maxBlocks, PER_BLOCK*sizeof(ramNode), allocStrategy );
}

node_ram_cache::~node_ram_cache() {
fprintf( stderr, "node cache: stored: %" PRIdOSMID "(%.2f%%), storage efficiency: %.2f%% (dense blocks: %i, sparse nodes: %li), hit rate: %.2f%%\n",
fprintf( stderr, "node cache: stored: %" PRIdOSMID "(%.2f%%), storage efficiency: %.2f%% (dense blocks: %i, sparse nodes: %" PRId64 "), hit rate: %.2f%%\n",
storedNodes, 100.0f*storedNodes/totalNodes, 100.0f*storedNodes*sizeof(ramNode)/cacheUsed,
usedBlocks, sizeSparseTuples,
100.0f*nodesCacheHits/nodesCacheLookups );
Expand All @@ -399,8 +395,8 @@ node_ram_cache::~node_ram_cache() {

void node_ram_cache::set(osmid_t id, double lat, double lon, const taglist_t &) {
if ((id > 0 && id >> BLOCK_SHIFT >> 32) || (id < 0 && ~id >> BLOCK_SHIFT >> 32 )) {
fprintf(stderr, "\nAbsolute node IDs must not be larger than %lld (got %lld)\n",
1ULL << 42, (long long) id);
fprintf(stderr, "\nAbsolute node IDs must not be larger than %" PRId64 " (got%" PRId64 " )\n",
(int64_t) 1 << 42, (int64_t) id);
util::exit_nicely();
}
totalNodes++;
Expand Down
2 changes: 1 addition & 1 deletion osm2pgsql.cpp
Expand Up @@ -45,7 +45,7 @@

int main(int argc, char *argv[])
{
fprintf(stderr, "osm2pgsql SVN version %s (%lubit id space)\n\n", VERSION, 8 * sizeof(osmid_t));
fprintf(stderr, "osm2pgsql SVN version %s (%zu bit id space)\n\n", VERSION, 8 * sizeof(osmid_t));
try
{
//parse the args into the different options members
Expand Down

0 comments on commit 9fc3a2e

Please sign in to comment.