This was the dominant style already, but some places used %llu
instead. Since off_t/pgoff_t are signed types, using %lld seems a
better match, and it might handle obscure error conditions with
negative values better.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/
20ce62fa-47fc-457b-b504-
12f3c1651726%40eisentraut.org
if (fstat(s->fd, &sb) < 0)
pg_fatal("could not stat file \"%s\": %m", s->filename);
if (sb.st_size < s->highest_offset_read)
- pg_fatal("file \"%s\" is too short: expected %llu, found %llu",
+ pg_fatal("file \"%s\" is too short: expected %lld, found %lld",
s->filename,
- (unsigned long long) s->highest_offset_read,
- (unsigned long long) sb.st_size);
+ (long long) s->highest_offset_read,
+ (long long) sb.st_size);
}
}
}
if (rb < 0)
pg_fatal("could not read from file \"%s\": %m", s->filename);
else
- pg_fatal("could not read from file \"%s\", offset %llu: read %d of %d",
- s->filename, (unsigned long long) off, rb, BLCKSZ);
+ pg_fatal("could not read from file \"%s\", offset %lld: read %d of %d",
+ s->filename, (long long) off, rb, BLCKSZ);
}
}
len = read_tar_number(&h[TAR_OFFSET_SIZE], 12);
- pg_log_debug("TOC Entry %s at %llu (length %llu, checksum %d)",
- tag, (unsigned long long) hPos, (unsigned long long) len, sum);
+ pg_log_debug("TOC Entry %s at %lld (length %lld, checksum %d)",
+ tag, (long long) hPos, (long long) len, sum);
if (chk != sum)
- pg_fatal("corrupt tar header found in %s (expected %d, computed %d) file position %llu",
- tag, sum, chk, (unsigned long long) ftello(ctx->tarFH));
+ pg_fatal("corrupt tar header found in %s (expected %d, computed %d) file position %lld",
+ tag, sum, chk, (long long) ftello(ctx->tarFH));
th->targetFile = pg_strdup(tag);
th->fileLen = len;
}
appendArrayEscapedString(&src->paths, rq->path);
- appendStringInfo(&src->offsets, INT64_FORMAT, (int64) rq->offset);
+ appendStringInfo(&src->offsets, "%lld", (long long int) rq->offset);
appendStringInfo(&src->lengths, "%zu", rq->length);
}
appendStringInfoChar(&src->paths, '}');
if (m->size != member->size)
{
report_backup_error(mystreamer->context,
- "file \"%s\" has size %llu in archive \"%s\" but size %" PRIu64 " in the manifest",
+ "file \"%s\" has size %lld in archive \"%s\" but size %" PRIu64 " in the manifest",
member->pathname,
- (unsigned long long) member->size,
+ (long long) member->size,
mystreamer->archive_name,
m->size);
m->bad = true;
if (m->size != sb.st_size)
{
report_backup_error(context,
- "\"%s\" has size %llu on disk but size %llu in the manifest",
- relpath, (unsigned long long) sb.st_size,
- (unsigned long long) m->size);
+ "\"%s\" has size %lld on disk but size %" PRIu64 " in the manifest",
+ relpath, (long long) sb.st_size,
+ m->size);
m->bad = true;
}