{"thread":{"id":"31286","subject":"[PATCH] fast_export.c: Fix a compiler warning","startedAt":"2012-08-19T15:29:02Z","lastAt":"2012-08-21T18:58:33Z","messageCount":4,"participants":["Ramsay Jones","Florian Achleitner","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"197296","messageId":"5031063E.3090405@ramsay1.demon.co.uk","threadId":"31286","inReplyTo":null,"subject":"[PATCH] fast_export.c: Fix a compiler warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-08-19T15:29:02Z","receivedAt":"2012-08-19T15:29:02Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nIn particular, gcc complains thus:\n\n        CC vcs-svn/fast_export.o\n    vcs-svn/fast_export.c: In function 'fast_export_begin_note':\n    vcs-svn/fast_export.c:77: warning: long long unsigned int format, \\\n        different type arg (arg 2)\n\nIn order to fix the warning, we cast the second size_t argument in\nthe call to printf to uintmax_t.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Florian,\n\nIf you need to re-roll your patches in the 'fa/remote-svn' branch, could\nyou please squash this fix into them. [This was implemented on top of\ncommit 2ce959ba, but you will probably want to make the equivalent change\nto commit d319a37c (\"Create a note for every imported commit containing\nsvn metadata\", 17-08-2012) instead. Note that, because of the context\nlines in the patch, it won't apply as-is.]\n\nThanks!\n\nATB,\nRamsay Jones\n\n vcs-svn/fast_export.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex c780d32..dd09c7d 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -74,7 +74,7 @@ void fast_export_begin_note(uint32_t revision, const char *author,\n \tsize_t loglen = strlen(log);\n \tprintf(\"commit %s\\n\", note_ref);\n \tprintf(\"committer %s <%s@%s> %ld +0000\\n\", author, author, \"local\", timestamp);\n-\tprintf(\"data %\"PRIuMAX\"\\n\", loglen);\n+\tprintf(\"data %\"PRIuMAX\"\\n\", (uintmax_t) loglen);\n \tfwrite(log, loglen, 1, stdout);\n \tif (firstnote) {\n \t\tif (revision > 1)\n-- \n1.7.11.2\n"},{"id":"197322","messageId":"2715225.vOk3BtNY6o@flomedio","threadId":"31286","inReplyTo":"5031063E.3090405@ramsay1.demon.co.uk","subject":"Re: [PATCH] fast_export.c: Fix a compiler warning","fromName":"Florian Achleitner","fromEmail":"florian.achleitner.2.6.31@gmail.com","sentAt":"2012-08-20T06:19:25Z","receivedAt":"2012-08-20T06:19:25Z","isPatch":true,"sender":{"key":"florian.achleitner.2.6.31@gmail.com","avatar":"https://avatars.githubusercontent.com/u/880777?v=4"},"body":"On Sunday 19 August 2012 16:29:02 Ramsay Jones wrote:\n> In particular, gcc complains thus:\n> \n>         CC vcs-svn/fast_export.o\n>     vcs-svn/fast_export.c: In function 'fast_export_begin_note':\n>     vcs-svn/fast_export.c:77: warning: long long unsigned int format, \\\n>         different type arg (arg 2)\n> \n> In order to fix the warning, we cast the second size_t argument in\n> the call to printf to uintmax_t.\n> \n> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> ---\n> \n> Hi Florian,\n> \n> If you need to re-roll your patches in the 'fa/remote-svn' branch, could\n> you please squash this fix into them. [This was implemented on top of\n> commit 2ce959ba, but you will probably want to make the equivalent change\n> to commit d319a37c (\"Create a note for every imported commit containing\n> svn metadata\", 17-08-2012) instead. Note that, because of the context\n> lines in the patch, it won't apply as-is.]\n\nOk, I'll add it to the next version. This warning only occurs when building \nfor 32bit, thus I never saw it. There would be a format flag for printf that \nsprecifies the platform's size_t integer type: \"z\". \nProbalby we should use it instead? I don't know how widely supported it is.\n> \n> Thanks!\n> \n> ATB,\n> Ramsay Jones\n\nThanks,\nFlorian\n\n> \n>  vcs-svn/fast_export.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\n> index c780d32..dd09c7d 100644\n> --- a/vcs-svn/fast_export.c\n> +++ b/vcs-svn/fast_export.c\n> @@ -74,7 +74,7 @@ void fast_export_begin_note(uint32_t revision, const char\n> *author, size_t loglen = strlen(log);\n>  \tprintf(\"commit %s\\n\", note_ref);\n>  \tprintf(\"committer %s <%s@%s> %ld +0000\\n\", author, author, \"local\",\n> timestamp); -\tprintf(\"data %\"PRIuMAX\"\\n\", loglen);\n> +\tprintf(\"data %\"PRIuMAX\"\\n\", (uintmax_t) loglen);\n>  \tfwrite(log, loglen, 1, stdout);\n>  \tif (firstnote) {\n>  \t\tif (revision > 1)\n"},{"id":"197325","messageId":"7vfw7im4zs.fsf@alter.siamese.dyndns.org","threadId":"31286","inReplyTo":"2715225.vOk3BtNY6o@flomedio","subject":"Re: [PATCH] fast_export.c: Fix a compiler warning","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-20T06:50:31Z","receivedAt":"2012-08-20T06:50:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Florian Achleitner <florian.achleitner.2.6.31@gmail.com> writes:\n\n>> If you need to re-roll your patches in the 'fa/remote-svn' branch, could\n>> you please squash this fix into them. [This was implemented on top of\n>> commit 2ce959ba, but you will probably want to make the equivalent change\n>> to commit d319a37c (\"Create a note for every imported commit containing\n>> svn metadata\", 17-08-2012) instead. Note that, because of the context\n>> lines in the patch, it won't apply as-is.]\n>\n> Ok, I'll add it to the next version. This warning only occurs when building \n> for 32bit, thus I never saw it. There would be a format flag for printf that \n> sprecifies the platform's size_t integer type: \"z\". \n\nYeah, I also queued 05ce866 (fixup: add missing cast to\nvcs-svn/fast_export.c, 2012-08-18) on top of your series before\npushing 'pu' out yesterday.  Have you had a chance to look at these\nfixups?  There are others you would find in my tree, including minor\nlog message typofixes.\n"},{"id":"197548","messageId":"5033DA59.7010403@ramsay1.demon.co.uk","threadId":"31286","inReplyTo":"2715225.vOk3BtNY6o@flomedio","subject":"Re: [PATCH] fast_export.c: Fix a compiler warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-08-21T18:58:33Z","receivedAt":"2012-08-21T18:58:33Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Florian Achleitner wrote:\n> On Sunday 19 August 2012 16:29:02 Ramsay Jones wrote:\n\n> Ok, I'll add it to the next version. This warning only occurs when building \n> for 32bit, thus I never saw it. There would be a format flag for printf that \n> sprecifies the platform's size_t integer type: \"z\". \n> Probalby we should use it instead? I don't know how widely supported it is.\n\nThe git codebase is actually moving in the other direction! :-D\nI think the last \"%z\" modifier was removed by commit 28bd70d8 (\"unbreak and\neliminate NO_C99_FORMAT\", 16-03-2011).\n\nATB,\nRamsay Jones\n"}]}