Commit 8d93a11cffa8199d212124401fdca64b5ae3bacc

Patrick Steinhardt 2017-05-03T12:38:55

odb: fix printf formatter for git_off_t 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/odb.c b/src/odb.c
index f28152b..b66324f 100644
--- 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;
 }