Download raw body.
gotadmin.c printf specifier/type fixes
The usual problem, off_t has a different underlying type depending on
the platform:
gotadmin.c:786:7: warning: format specifies type 'unsigned long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
base_offset) == -1) {
^~~~~~~~~~~
gotadmin.c:817:57: warning: format specifies type 'unsigned long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
printf("%s %s at %llu size %s%s\n", id_str, type_str, offset,
~~~~ ^~~~~~
%ld
gotadmin.c:820:59: warning: format specifies type 'unsigned long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
printf("%s %s at %llu size %llu%s\n", id_str, type_str, offset,
~~~~ ^~~~~~
%ld
gotadmin.c:821:7: warning: format specifies type 'unsigned long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
size, delta_str ? delta_str : "");
^~~~
Also, off_t is implied to be a signed type by POSIX since lseek
returns -1 on failure.
OK?
diff 474b498221b19828b2bcb8e5c5b2ced63acbd1a6 /home/naddy/got
blob - a6398ccb64350775f2db703c7520234c180aefd1
file + gotadmin/gotadmin.c
--- gotadmin/gotadmin.c
+++ gotadmin/gotadmin.c
@@ -780,8 +780,8 @@ list_pack_cb(void *arg, struct got_object_id *id, int
break;
case GOT_OBJ_TYPE_OFFSET_DELTA:
type_str = "offset-delta";
- if (asprintf(&delta_str, " base-offset %llu",
- base_offset) == -1) {
+ if (asprintf(&delta_str, " base-offset %lld",
+ (long long)base_offset) == -1) {
err = got_error_from_errno("asprintf");
goto done;
}
@@ -812,11 +812,12 @@ list_pack_cb(void *arg, struct got_object_id *id, int
s = scaled;
while (isspace((unsigned char)*s))
s++;
- printf("%s %s at %llu size %s%s\n", id_str, type_str, offset,
- s, delta_str ? delta_str : "");
+ printf("%s %s at %lld size %s%s\n", id_str, type_str,
+ (long long)offset, s, delta_str ? delta_str : "");
} else {
- printf("%s %s at %llu size %llu%s\n", id_str, type_str, offset,
- size, delta_str ? delta_str : "");
+ printf("%s %s at %lld size %lld%s\n", id_str, type_str,
+ (long long)offset, (long long)size,
+ delta_str ? delta_str : "");
}
done:
free(id_str);
--
Christian "naddy" Weisgerber naddy@mips.inka.de
gotadmin.c printf specifier/type fixes