{"thread":{"id":"14278","subject":"[PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","startedAt":"2008-07-03T15:52:09Z","lastAt":"2008-07-08T22:21:22Z","messageCount":7,"participants":["Ramsay Jones","Junio C Hamano","Steffen Prohaska"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"82136","messageId":"486CF5A9.5060104@ramsay1.demon.co.uk","threadId":"14278","inReplyTo":null,"subject":"[PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2008-07-03T15:52:09Z","receivedAt":"2008-07-03T15:52:09Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nDespite the subject line, this should be useful on any system for\nwhich uint32_t is defined to be unsigned long rather than\nunsigned int. (and where the return type of htonl() is similarly\ndefined).\n\nNote that this was built on the v1.5.6 tarball, so will probably\nnot apply cleanly to the git repo! (hey, it's been more than a\nfew days). Hence, the RFC in the subject line. (is there a better\nTLA for \"so old it won't apply\" ;-)\n\nAlso, note that git-compat-compat-util.h contains an #ifdef'ed\ndefinition of PRIuMAX despite an unconditional #include of\ninttypes.h; this seems a bit odd.  This seems to imply a system\nwith a pre-standard header file, missing the PRIuMAX #define.\nIf so, then similar definitions for PRIu32 and PRIx32 may need\nto be added.\n\nATB,\nRamsay\n\n builtin-fast-export.c    |    4 ++--\n builtin-fetch-pack.c     |    3 ++-\n builtin-pack-objects.c   |   15 ++++++++++-----\n builtin-unpack-objects.c |    3 ++-\n index-pack.c             |    6 ++++--\n pack-check.c             |    4 ++--\n receive-pack.c           |    3 ++-\n sha1_file.c              |   12 ++++++------\n show-index.c             |    3 ++-\n 9 files changed, 32 insertions(+), 21 deletions(-)\n\ndiff --git a/builtin-fast-export.c b/builtin-fast-export.c\nindex d0a462f..3500ff0 100644\n--- a/builtin-fast-export.c\n+++ b/builtin-fast-export.c\n@@ -102,7 +102,7 @@ static void handle_object(const unsigned char *sha1)\n \n \tmark_object(object);\n \n-\tprintf(\"blob\\nmark :%d\\ndata %lu\\n\", last_idnum, size);\n+\tprintf(\"blob\\nmark :%\"PRIu32\"\\ndata %lu\\n\", last_idnum, size);\n \tif (size && fwrite(buf, size, 1, stdout) != 1)\n \t\tdie (\"Could not write blob %s\", sha1_to_hex(sha1));\n \tprintf(\"\\n\");\n@@ -190,7 +190,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)\n \t\treencoded = reencode_string(message, \"UTF-8\", encoding);\n \tif (!commit->parents)\n \t\tprintf(\"reset %s\\n\", (const char*)commit->util);\n-\tprintf(\"commit %s\\nmark :%d\\n%.*s\\n%.*s\\ndata %u\\n%s\",\n+\tprintf(\"commit %s\\nmark :%\"PRIu32\"\\n%.*s\\n%.*s\\ndata %u\\n%s\",\n \t       (const char *)commit->util, last_idnum,\n \t       (int)(author_end - author), author,\n \t       (int)(committer_end - committer), committer,\ndiff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c\nindex de1e8d1..e094e2d 100644\n--- a/builtin-fetch-pack.c\n+++ b/builtin-fetch-pack.c\n@@ -519,7 +519,8 @@ static int get_pack(int xd[2], char **pack_lockfile)\n \n \t\tif (read_pack_header(demux.out, &header))\n \t\t\tdie(\"protocol error: bad pack header\");\n-\t\tsnprintf(hdr_arg, sizeof(hdr_arg), \"--pack_header=%u,%u\",\n+\t\tsnprintf(hdr_arg, sizeof(hdr_arg),\n+\t\t\t \"--pack_header=%\"PRIu32\",%\"PRIu32,\n \t\t\t ntohl(header.hdr_version), ntohl(header.hdr_entries));\n \t\tif (ntohl(header.hdr_entries) < unpack_limit)\n \t\t\tdo_keep = 0;\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 447d492..5e97355 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -590,7 +590,8 @@ static void write_pack_file(void)\n \tfree(written_list);\n \tstop_progress(&progress_state);\n \tif (written != nr_result)\n-\t\tdie(\"wrote %u objects while expecting %u\", written, nr_result);\n+\t\tdie(\"wrote %\"PRIu32\" objects while expecting %\"PRIu32,\n+\t\t\twritten, nr_result);\n \t/*\n \t * We have scanned through [0 ... i).  Since we have written\n \t * the correct number of objects,  the remaining [i ... nr_objects)\n@@ -602,7 +603,8 @@ static void write_pack_file(void)\n \t\tj += !e->idx.offset && !e->preferred_base;\n \t}\n \tif (j)\n-\t\tdie(\"wrote %u objects as expected but %u unwritten\", written, j);\n+\t\tdie(\"wrote %\"PRIu32\" objects as expected but %\"PRIu32\n+\t\t\t\" unwritten\", written, j);\n }\n \n static int locate_object_entry_hash(const unsigned char *sha1)\n@@ -1718,7 +1720,8 @@ static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, vo\n static void prepare_pack(int window, int depth)\n {\n \tstruct object_entry **delta_list;\n-\tuint32_t i, n, nr_deltas;\n+\tuint32_t i, nr_deltas;\n+\tunsigned n;\n \n \tget_object_details();\n \n@@ -1809,7 +1812,8 @@ static int git_pack_config(const char *k, const char *v, void *cb)\n \tif (!strcmp(k, \"pack.indexversion\")) {\n \t\tpack_idx_default_version = git_config_int(k, v);\n \t\tif (pack_idx_default_version > 2)\n-\t\t\tdie(\"bad pack.indexversion=%d\", pack_idx_default_version);\n+\t\t\tdie(\"bad pack.indexversion=%\"PRIu32,\n+\t\t\t\tpack_idx_default_version);\n \t\treturn 0;\n \t}\n \tif (!strcmp(k, \"pack.packsizelimit\")) {\n@@ -2243,7 +2247,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \t\tprepare_pack(window, depth);\n \twrite_pack_file();\n \tif (progress)\n-\t\tfprintf(stderr, \"Total %u (delta %u), reused %u (delta %u)\\n\",\n+\t\tfprintf(stderr, \"Total %\"PRIu32\" (delta %\"PRIu32\"),\"\n+\t\t\t\" reused %\"PRIu32\" (delta %\"PRIu32\")\\n\",\n \t\t\twritten, written_delta, reused, reused_delta);\n \treturn 0;\n }\ndiff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c\nindex 85043d1..a891866 100644\n--- a/builtin-unpack-objects.c\n+++ b/builtin-unpack-objects.c\n@@ -471,7 +471,8 @@ static void unpack_all(void)\n \tif (ntohl(hdr->hdr_signature) != PACK_SIGNATURE)\n \t\tdie(\"bad pack file\");\n \tif (!pack_version_ok(hdr->hdr_version))\n-\t\tdie(\"unknown pack file version %d\", ntohl(hdr->hdr_version));\n+\t\tdie(\"unknown pack file version %\"PRIu32,\n+\t\t\tntohl(hdr->hdr_version));\n \tuse(sizeof(struct pack_header));\n \n \tif (!quiet)\ndiff --git a/index-pack.c b/index-pack.c\nindex 5ac91ba..25db5db 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -190,7 +190,8 @@ static void parse_pack_header(void)\n \tif (hdr->hdr_signature != htonl(PACK_SIGNATURE))\n \t\tdie(\"pack signature mismatch\");\n \tif (!pack_version_ok(hdr->hdr_version))\n-\t\tdie(\"pack version %d unsupported\", ntohl(hdr->hdr_version));\n+\t\tdie(\"pack version %\"PRIu32\" unsupported\",\n+\t\t\tntohl(hdr->hdr_version));\n \n \tnr_objects = ntohl(hdr->hdr_entries);\n \tuse(sizeof(struct pack_header));\n@@ -771,7 +772,8 @@ static int git_index_pack_config(const char *k, const char *v, void *cb)\n \tif (!strcmp(k, \"pack.indexversion\")) {\n \t\tpack_idx_default_version = git_config_int(k, v);\n \t\tif (pack_idx_default_version > 2)\n-\t\t\tdie(\"bad pack.indexversion=%d\", pack_idx_default_version);\n+\t\t\tdie(\"bad pack.indexversion=%\"PRIu32,\n+\t\t\t\tpack_idx_default_version);\n \t\treturn 0;\n \t}\n \treturn git_default_config(k, v, cb);\ndiff --git a/pack-check.c b/pack-check.c\nindex f489873..98a6d56 100644\n--- a/pack-check.c\n+++ b/pack-check.c\n@@ -146,11 +146,11 @@ static void show_pack_info(struct packed_git *p)\n \tfor (i = 0; i <= MAX_CHAIN; i++) {\n \t\tif (!chain_histogram[i])\n \t\t\tcontinue;\n-\t\tprintf(\"chain length = %d: %d object%s\\n\", i,\n+\t\tprintf(\"chain length = %\"PRIu32\": %\"PRIu32\" object%s\\n\", i,\n \t\t       chain_histogram[i], chain_histogram[i] > 1 ? \"s\" : \"\");\n \t}\n \tif (chain_histogram[0])\n-\t\tprintf(\"chain length > %d: %d object%s\\n\", MAX_CHAIN,\n+\t\tprintf(\"chain length > %d: %\"PRIu32\" object%s\\n\", MAX_CHAIN,\n \t\t       chain_histogram[0], chain_histogram[0] > 1 ? \"s\" : \"\");\n }\n \ndiff --git a/receive-pack.c b/receive-pack.c\nindex b26f2e3..fa653b4 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -370,7 +370,8 @@ static const char *unpack(void)\n \thdr_err = parse_pack_header(&hdr);\n \tif (hdr_err)\n \t\treturn hdr_err;\n-\tsnprintf(hdr_arg, sizeof(hdr_arg), \"--pack_header=%u,%u\",\n+\tsnprintf(hdr_arg, sizeof(hdr_arg),\n+\t\t\t\"--pack_header=%\"PRIu32\",%\"PRIu32,\n \t\t\tntohl(hdr.hdr_version), ntohl(hdr.hdr_entries));\n \n \tif (ntohl(hdr.hdr_entries) < unpack_limit) {\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 191f814..7610c43 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -471,7 +471,7 @@ static int check_packed_git_idx(const char *path,  struct packed_git *p)\n \t\tversion = ntohl(hdr->idx_version);\n \t\tif (version < 2 || version > 2) {\n \t\t\tmunmap(idx_map, idx_size);\n-\t\t\treturn error(\"index file %s is version %d\"\n+\t\t\treturn error(\"index file %s is version %\"PRIu32\n \t\t\t\t     \" and is not supported by this binary\"\n \t\t\t\t     \" (try upgrading GIT to a newer version)\",\n \t\t\t\t     path, version);\n@@ -682,14 +682,14 @@ static int open_packed_git_1(struct packed_git *p)\n \tif (hdr.hdr_signature != htonl(PACK_SIGNATURE))\n \t\treturn error(\"file %s is not a GIT packfile\", p->pack_name);\n \tif (!pack_version_ok(hdr.hdr_version))\n-\t\treturn error(\"packfile %s is version %u and not supported\"\n-\t\t\t\" (try upgrading GIT to a newer version)\",\n+\t\treturn error(\"packfile %s is version %\"PRIu32\" and not\"\n+\t\t\t\" supported (try upgrading GIT to a newer version)\",\n \t\t\tp->pack_name, ntohl(hdr.hdr_version));\n \n \t/* Verify the pack matches its index. */\n \tif (p->num_objects != ntohl(hdr.hdr_entries))\n-\t\treturn error(\"packfile %s claims to have %u objects\"\n-\t\t\t     \" while index indicates %u objects\",\n+\t\treturn error(\"packfile %s claims to have %\"PRIu32\" objects\"\n+\t\t\t     \" while index indicates %\"PRIu32\" objects\",\n \t\t\t     p->pack_name, ntohl(hdr.hdr_entries),\n \t\t\t     p->num_objects);\n \tif (lseek(p->pack_fd, p->pack_size - sizeof(sha1), SEEK_SET) == -1)\n@@ -1719,7 +1719,7 @@ off_t find_pack_entry_one(const unsigned char *sha1,\n \t}\n \n \tif (debug_lookup)\n-\t\tprintf(\"%02x%02x%02x... lo %u hi %u nr %u\\n\",\n+\t\tprintf(\"%02x%02x%02x... lo %u hi %u nr %\"PRIu32\"\\n\",\n \t\t       sha1[0], sha1[1], sha1[2], lo, hi, p->num_objects);\n \n \tif (use_lookup < 0)\ndiff --git a/show-index.c b/show-index.c\nindex 7253991..45bb535 100644\n--- a/show-index.c\n+++ b/show-index.c\n@@ -68,7 +68,8 @@ 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(\"%\" PRIuMAX \" %s (%08x)\\n\", (uintmax_t) offset,\n+\t\t\tprintf(\"%\" PRIuMAX \" %s (%08\"PRIx32\")\\n\",\n+\t\t\t       (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.6\n"},{"id":"82212","messageId":"7vskuquisp.fsf@gitster.siamese.dyndns.org","threadId":"14278","inReplyTo":"486CF5A9.5060104@ramsay1.demon.co.uk","subject":"Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-04T08:59:02Z","receivedAt":"2008-07-04T08:59:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> Despite the subject line, this should be useful on any system for\n> which uint32_t is defined to be unsigned long rather than\n> unsigned int. (and where the return type of htonl() is similarly\n> defined).\n\nCorrect.  Perhaps \"Use %PRIu32 and such to print integers of fixed length\"?\n\nThe only worry I have with this patch is with systems with not-so-ANSI\nheaders; as you noticed, we already have:\n\n        #ifndef PRIuMAX\n        #define PRIuMAX \"llu\"\n        #endif\n\nin git-compat-util.h, which does include <inttypes.h>, so PRIu32 and\nfriends could be problematic on these platforms.\n\n> @@ -1718,7 +1720,8 @@ static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, vo\n>  static void prepare_pack(int window, int depth)\n>  {\n>  \tstruct object_entry **delta_list;\n> -\tuint32_t i, n, nr_deltas;\n> +\tuint32_t i, nr_deltas;\n> +\tunsigned n;\n\nHmm.  Is this change necessary?\n"},{"id":"82220","messageId":"E4D3A379-9EB2-49D1-AD42-CFFC453A2B08@zib.de","threadId":"14278","inReplyTo":"486CF5A9.5060104@ramsay1.demon.co.uk","subject":"Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-07-04T09:46:36Z","receivedAt":"2008-07-04T09:46:36Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Jul 3, 2008, at 5:52 PM, Ramsay Jones wrote:\n\n>\n> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> ---\n>\n> Despite the subject line, this should be useful on any system for\n> which uint32_t is defined to be unsigned long rather than\n> unsigned int. (and where the return type of htonl() is similarly\n> defined).\n\nFor MINGW, we fixed these warnings in the compat layer, see cd800eecc2:\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex a87cc96..6bc049a 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -186,6 +186,10 @@ pid_t mingw_spawnvpe(const char *cmd, const char  \n**argv, char **env);\n  void mingw_execvp(const char *cmd, char *const *argv);\n  #define execvp mingw_execvp\n\n+static inline unsigned int git_ntohl(unsigned int x)\n+{ return (unsigned int)ntohl(x); }\n+#define ntohl git_ntohl\n+\n  sig_handler_t mingw_signal(int sig, sig_handler_t handler);\n  #define signal mingw_signal\n\n\tSteffen\n"},{"id":"82312","messageId":"486FDB2F.3050800@ramsay1.demon.co.uk","threadId":"14278","inReplyTo":"7vskuquisp.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2008-07-05T20:35:59Z","receivedAt":"2008-07-05T20:35:59Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Junio C Hamano wrote:\n> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n> \n>> Despite the subject line, this should be useful on any system for\n>> which uint32_t is defined to be unsigned long rather than\n>> unsigned int. (and where the return type of htonl() is similarly\n>> defined).\n> \n> Correct.  Perhaps \"Use %PRIu32 and such to print integers of fixed length\"?\n> \n> The only worry I have with this patch is with systems with not-so-ANSI\n> headers; as you noticed, we already have:\n> \n>         #ifndef PRIuMAX\n>         #define PRIuMAX \"llu\"\n>         #endif\n> \n> in git-compat-util.h, which does include <inttypes.h>, so PRIu32 and\n> friends could be problematic on these platforms.\n> \n\nYes, I had the same worry, since I did not know which system(s) required\nthe above #ifdef and, perhaps more important, why.  Having said that, I\nsuspect (hope?) that the affected system(s) are somewhat rare.  I guess\nit would not be long before someone complained otherwise...\n\n[Note: I can't just blame the above #ifdef because I don't have a real\ngit repo ;-) - it would simply blame me!]\n\n>> @@ -1718,7 +1720,8 @@ static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, vo\n>>  static void prepare_pack(int window, int depth)\n>>  {\n>>  \tstruct object_entry **delta_list;\n>> -\tuint32_t i, n, nr_deltas;\n>> +\tuint32_t i, nr_deltas;\n>> +\tunsigned n;\n> \n> Hmm.  Is this change necessary?\n> \n\nYes, otherwise:\n\nbuiltin-pack-objects.c: In function `prepare_pack':\nbuiltin-pack-objects.c:1760: warning: passing arg 2 of `find_deltas' from incompatible pointer type\nmake: *** [builtin-pack-objects.o] Error 1\n\nNote that ll_find_deltas() is #defined to find_deltas() in the #else arm\nof #ifdef THREADED_DELTA_SEARCH, and find_deltas() takes an \"unsigned *\"\n\nATB,\n\nRamsay Jones\n"},{"id":"82311","messageId":"486FE00C.7020207@ramsay1.demon.co.uk","threadId":"14278","inReplyTo":"E4D3A379-9EB2-49D1-AD42-CFFC453A2B08@zib.de","subject":"Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2008-07-05T20:56:44Z","receivedAt":"2008-07-05T20:56:44Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Steffen Prohaska wrote:\n> On Jul 3, 2008, at 5:52 PM, Ramsay Jones wrote:\n> \n>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n>> ---\n>>\n>> Despite the subject line, this should be useful on any system for\n>> which uint32_t is defined to be unsigned long rather than\n>> unsigned int. (and where the return type of htonl() is similarly\n>> defined).\n> \n> For MINGW, we fixed these warnings in the compat layer, see cd800eecc2:\n> \n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index a87cc96..6bc049a 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -186,6 +186,10 @@ pid_t mingw_spawnvpe(const char *cmd, const char  \n> **argv, char **env);\n>   void mingw_execvp(const char *cmd, char *const *argv);\n>   #define execvp mingw_execvp\n> \n> +static inline unsigned int git_ntohl(unsigned int x)\n> +{ return (unsigned int)ntohl(x); }\n> +#define ntohl git_ntohl\n> +\n>   sig_handler_t mingw_signal(int sig, sig_handler_t handler);\n>   #define signal mingw_signal\n> \n\nYes, I had something similar at one point (but not in compat).\nHowever, not all of these warnings are solved by the above.\nFor example, the changes to builtin-fast-export.c, builtin-pack-objects.c,\nand pack-check.c do not involve ntohl() at all. (some hunks in other\nfiles do not involve ntohl() either).\n\nWhen the PRIu32 macro idea was suggested (I think it was Simon 'corecode' Schubert\nwho first mentioned it), I thought it would look so ugly, no one would\nagree to such a patch...  Having implemented it, well I guess it's not\nquite as bad as I feared ;-) YMMV!\n\nATB,\n\nRamsay Jones\n"},{"id":"82315","messageId":"7vhcb3rfro.fsf@gitster.siamese.dyndns.org","threadId":"14278","inReplyTo":"486FDB2F.3050800@ramsay1.demon.co.uk","subject":"Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-06T00:57:15Z","receivedAt":"2008-07-06T00:57:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> Junio C Hamano wrote:\n> ...\n>>> @@ -1718,7 +1720,8 @@ static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, vo\n>>>  static void prepare_pack(int window, int depth)\n>>>  {\n>>>  \tstruct object_entry **delta_list;\n>>> -\tuint32_t i, n, nr_deltas;\n>>> +\tuint32_t i, nr_deltas;\n>>> +\tunsigned n;\n>> \n>> Hmm.  Is this change necessary?\n>\n> Yes, otherwise:\n>\n> builtin-pack-objects.c: In function `prepare_pack':\n> builtin-pack-objects.c:1760: warning: passing arg 2 of `find_deltas' from incompatible pointer type\n> make: *** [builtin-pack-objects.o] Error 1\n>\n> Note that ll_find_deltas() is #defined to find_deltas() in the #else arm\n> of #ifdef THREADED_DELTA_SEARCH, and find_deltas() takes an \"unsigned *\"\n\nAh, I missed that.  So it is not just warning squelch but is a bugfix in\ncase unsigned and uint32_t are of different sizes.\n"},{"id":"82735","messageId":"4873E862.5070501@ramsay1.demon.co.uk","threadId":"14278","inReplyTo":"7vhcb3rfro.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2008-07-08T22:21:22Z","receivedAt":"2008-07-08T22:21:22Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Junio C Hamano wrote:\n> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n> \n>> Junio C Hamano wrote:\n>> ...\n>>>> @@ -1718,7 +1720,8 @@ static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, vo\n>>>>  static void prepare_pack(int window, int depth)\n>>>>  {\n>>>>  \tstruct object_entry **delta_list;\n>>>> -\tuint32_t i, n, nr_deltas;\n>>>> +\tuint32_t i, nr_deltas;\n>>>> +\tunsigned n;\n>>> Hmm.  Is this change necessary?\n>> Yes, otherwise:\n>>\n>> builtin-pack-objects.c: In function `prepare_pack':\n>> builtin-pack-objects.c:1760: warning: passing arg 2 of `find_deltas' from incompatible pointer type\n>> make: *** [builtin-pack-objects.o] Error 1\n>>\n>> Note that ll_find_deltas() is #defined to find_deltas() in the #else arm\n>> of #ifdef THREADED_DELTA_SEARCH, and find_deltas() takes an \"unsigned *\"\n> \n> Ah, I missed that.  So it is not just warning squelch but is a bugfix in\n> case unsigned and uint32_t are of different sizes.\n> \n\nYes, but I didn't think about that when I \"fixed\" it ;-)\n\nATB,\n\nRamsay Jones\n"}]}