{"thread":{"id":"10399","subject":"[PATCH 1/2] Use PRIuMAX instead of 'unsigned long long' in show-index","startedAt":"2007-10-21T05:25:23Z","lastAt":"2007-10-21T05:25:23Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"56746","messageId":"20071021052523.GA31927@spearce.org","threadId":"10399","inReplyTo":null,"subject":"[PATCH 1/2] Use PRIuMAX instead of 'unsigned long long' in show-index","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-21T05:25:23Z","receivedAt":"2007-10-21T05:25:23Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Elsewhere in Git we already use PRIuMAX and cast to uintmax_t when\nwe need to display a value that is 'very big' and we're not exactly\nsure what the largest display size is for this platform.\n\nThis particular fix is needed so we can do the incredibly crazy\ntemporary hack of:\n\n    diff --git a/cache.h b/cache.h\n    index e0abcd6..6637fd8 100644\n    --- a/cache.h\n    +++ b/cache.h\n    @@ -6,6 +6,7 @@\n\n     #include SHA1_HEADER\n     #include <zlib.h>\n    +#define long long long\n\n     #if ZLIB_VERNUM < 0x1200\n     #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)\n\nallowing us to more easily look for locations where we are passing\na pointer to an 8 byte value to a function that expects a 4 byte\nvalue.  This can occur on some platforms where sizeof(long) == 8\nand sizeof(size_t) == 4.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n show-index.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/show-index.c b/show-index.c\nindex 57ed9e8..7253991 100644\n--- a/show-index.c\n+++ b/show-index.c\n@@ -68,7 +68,7 @@ int main(int argc, char **argv)\n \t\t\t\t\t\t     ntohl(off64[1]);\n \t\t\t\toff64_nr++;\n \t\t\t}\n-\t\t\tprintf(\"%llu %s (%08x)\\n\", (unsigned long long) offset,\n+\t\t\tprintf(\"%\" PRIuMAX \" %s (%08x)\\n\", (uintmax_t) offset,\n \t\t\t       sha1_to_hex(entries[i].sha1),\n \t\t\t       ntohl(entries[i].crc));\n \t\t}\n-- \n1.5.3.4.1270.g2fe543\n"}]}