]> git.proxmox.com Git - libgit2.git/commitdiff
odb: fix printf formatter for git_off_t
authorPatrick Steinhardt <ps@pks.im>
Wed, 3 May 2017 10:38:55 +0000 (12:38 +0200)
committerPatrick Steinhardt <ps@pks.im>
Mon, 15 May 2017 05:34:04 +0000 (07:34 +0200)
The fields `declared_size` and `received_bytes` of the `git_odb_stream`
are both of type `git_off_t` which is defined as a signed integer. When
passing these values to a printf-style string in
`git_odb_stream__invalid_length`, though, we format these as PRIuZ,
which is unsigned.

Fix the issue by using PRIdZ instead, silencing warnings on macOS.

src/odb.c

index f28152bff9d6a8a65212a17f8c5b9937dbbcb2a2..b66324f87e9b043035ac1216c9e8ba3d6feb32e7 100644 (file)
--- a/src/odb.c
+++ b/src/odb.c
@@ -1326,9 +1326,9 @@ static int git_odb_stream__invalid_length(
 {
        giterr_set(GITERR_ODB,
                "cannot %s - "
-               "Invalid length. %"PRIuZ" was expected. The "
-               "total size of the received chunks amounts to %"PRIuZ".",
-               action, stream->declared_size, stream->received_bytes);         
+               "Invalid length. %"PRIdZ" was expected. The "
+               "total size of the received chunks amounts to %"PRIdZ".",
+               action, stream->declared_size, stream->received_bytes);
 
        return -1;
 }