{"thread":{"id":"6717","subject":"[RFC/PATCH] fast-import: Fix compile warnings","startedAt":"2007-02-07T11:38:21Z","lastAt":"2007-02-08T07:16:03Z","messageCount":8,"participants":["Johannes Schindelin","Alex Riesen","Junio C Hamano","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"33795","messageId":"Pine.LNX.4.63.0702071237360.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6717","inReplyTo":null,"subject":"[RFC/PATCH] fast-import: Fix compile warnings","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-07T11:38:21Z","receivedAt":"2007-02-07T11:38:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nNot on all platforms are size_t and unsigned long equivalent.\nSince I do not know how portable %z is, I play safe, and just\ncast the respective variables to unsigned long.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tI have no idea how portable %z is, but there are so many\n\texperts on this list. Care to enlighten me?\n\n fast-import.c |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex bc95a0d..2813ceb 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -882,7 +882,8 @@ static int store_object(\n \tSHA_CTX c;\n \tz_stream s;\n \n-\thdrlen = sprintf((char*)hdr,\"%s %lu\",type_names[type],datlen) + 1;\n+\thdrlen = sprintf((char*)hdr,\"%s %lu\", type_names[type],\n+\t\t(unsigned long)datlen) + 1;\n \tSHA1_Init(&c);\n \tSHA1_Update(&c, hdr, hdrlen);\n \tSHA1_Update(&c, dat, datlen);\n@@ -1427,7 +1428,8 @@ static void *cmd_data (size_t *size)\n \t\twhile (n < length) {\n \t\t\tsize_t s = fread(buffer + n, 1, length - n, stdin);\n \t\t\tif (!s && feof(stdin))\n-\t\t\t\tdie(\"EOF in data (%lu bytes remaining)\", length - n);\n+\t\t\t\tdie(\"EOF in data (%lu bytes remaining)\",\n+\t\t\t\t\t(unsigned long)(length - n));\n \t\t\tn += s;\n \t\t}\n \t}\n@@ -2028,7 +2030,8 @@ int main(int argc, const char **argv)\n \tfprintf(stderr, \"      marks:     %10ju (%10ju unique    )\\n\", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);\n \tfprintf(stderr, \"      atoms:     %10u\\n\", atom_cnt);\n \tfprintf(stderr, \"Memory total:    %10ju KiB\\n\", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);\n-\tfprintf(stderr, \"       pools:    %10lu KiB\\n\", total_allocd/1024);\n+\tfprintf(stderr, \"       pools:    %10lu KiB\\n\",\n+\t\t(unsigned long)(total_allocd / 1024));\n \tfprintf(stderr, \"     objects:    %10ju KiB\\n\", (alloc_count*sizeof(struct object_entry))/1024);\n \tfprintf(stderr, \"---------------------------------------------------------------------\\n\");\n \tpack_report();\n-- \n1.5.0.rc3.2124.g3861-dirty\n"},{"id":"33799","messageId":"81b0412b0702070419t2293f776wb4f3f7beb76c986c@mail.gmail.com","threadId":"6717","inReplyTo":"Pine.LNX.4.63.0702071237360.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-02-07T12:19:00Z","receivedAt":"2007-02-07T12:19:00Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 2/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n>         I have no idea how portable %z is, but there are so many\n>         experts on this list. Care to enlighten me?\n>\n\nIEEE Std 1003.1[1] mentions it, but I never was able to rely on it:\nAIX, Solaris, QNX-libc at least didn't have it, last time I checked.\nMicro$oft doesn't have it, of course.\n\n[1] http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html\n"},{"id":"33827","messageId":"7vzm7p7uf9.fsf@assigned-by-dhcp.cox.net","threadId":"6717","inReplyTo":"Pine.LNX.4.63.0702071237360.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-07T17:24:10Z","receivedAt":"2007-02-07T17:24:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Not on all platforms are size_t and unsigned long equivalent.\n> Since I do not know how portable %z is, I play safe, and just\n> cast the respective variables to unsigned long.\n\nThe format \"%s %lu\" is consistent with what write_sha1_file_prepare()\nand unpack_sha1_header() uses, so that should be safe enough.\n\nHowever, your patch does not apply.\n"},{"id":"33830","messageId":"Pine.LNX.4.63.0702071829450.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6717","inReplyTo":"7vzm7p7uf9.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-07T17:35:30Z","receivedAt":"2007-02-07T17:35:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Not on all platforms are size_t and unsigned long equivalent.\n> > Since I do not know how portable %z is, I play safe, and just\n> > cast the respective variables to unsigned long.\n> \n> The format \"%s %lu\" is consistent with what write_sha1_file_prepare()\n> and unpack_sha1_header() uses, so that should be safe enough.\n\nSo, should we cast to (unsigned long) to make the gcc warning go away, or \ndo we not care at all?\n\n> However, your patch does not apply.\n\nHmm. Strange, I thought that I only changed the in_merge_bases() line... \nWill have a look tomorrow.\n\nCiao,\nDscho\n"},{"id":"33831","messageId":"7vveid7tce.fsf@assigned-by-dhcp.cox.net","threadId":"6717","inReplyTo":"Pine.LNX.4.63.0702071829450.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-07T17:47:29Z","receivedAt":"2007-02-07T17:47:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> However, your patch does not apply.\n>\n> Hmm. Strange, I thought that I only changed the in_merge_bases() line... \n> Will have a look tomorrow.\n\nSorry, but not to worry.  It was because Shawn had a few updates\nahead of you.\n"},{"id":"33914","messageId":"20070208070342.GA3746@spearce.org","threadId":"6717","inReplyTo":"Pine.LNX.4.63.0702071237360.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-08T07:03:42Z","receivedAt":"2007-02-08T07:03:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Not on all platforms are size_t and unsigned long equivalent.\n> Since I do not know how portable %z is, I play safe, and just\n> cast the respective variables to unsigned long.\n\nWe do this elsewhere in Git.  blobs are using unsigned long in\nsha1_file.c for their length; I chose to size_t in gfi as that's\nwhat the type is for...  but then look at the mess.\n\nI applied this patch to my tree and pushed it to repo.or.cz.\nThis last hunk:\n \n> @@ -2028,7 +2030,8 @@ int main(int argc, const char **argv)\n>  \tfprintf(stderr, \"      marks:     %10ju (%10ju unique    )\\n\", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);\n>  \tfprintf(stderr, \"      atoms:     %10u\\n\", atom_cnt);\n>  \tfprintf(stderr, \"Memory total:    %10ju KiB\\n\", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);\n> -\tfprintf(stderr, \"       pools:    %10lu KiB\\n\", total_allocd/1024);\n> +\tfprintf(stderr, \"       pools:    %10lu KiB\\n\",\n> +\t\t(unsigned long)(total_allocd / 1024));\n>  \tfprintf(stderr, \"     objects:    %10ju KiB\\n\", (alloc_count*sizeof(struct object_entry))/1024);\n>  \tfprintf(stderr, \"---------------------------------------------------------------------\\n\");\n>  \tpack_report();\n\nwas the only part that did not apply cleanly, but that was easily\nfixed by tossing an extra tab at the start of each line, as this\nhunk was shifted in one level by a recent commit that Junio has\nnot pushed out to master.\n\n-- \nShawn.\n"},{"id":"33915","messageId":"7vejp12kh5.fsf@assigned-by-dhcp.cox.net","threadId":"6717","inReplyTo":"20070208070342.GA3746@spearce.org","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T07:10:14Z","receivedAt":"2007-02-08T07:10:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> was the only part that did not apply cleanly, but that was easily\n> fixed by tossing an extra tab at the start of each line, as this\n> hunk was shifted in one level by a recent commit that Junio has\n> not pushed out to master.\n\nActually it has been pushed out quite a while ago, but as usual\nkernel.org is taking its sweet time to mirror it out.\n"},{"id":"33916","messageId":"20070208071603.GB3746@spearce.org","threadId":"6717","inReplyTo":"7vejp12kh5.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFC/PATCH] fast-import: Fix compile warnings","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-08T07:16:03Z","receivedAt":"2007-02-08T07:16:03Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> \n> > was the only part that did not apply cleanly, but that was easily\n> > fixed by tossing an extra tab at the start of each line, as this\n> > hunk was shifted in one level by a recent commit that Junio has\n> > not pushed out to master.\n> \n> Actually it has been pushed out quite a while ago, but as usual\n> kernel.org is taking its sweet time to mirror it out.\n\nNice.  OK.  So don't pull in my repo.or.cz branch right now. :-)\n\n-- \nShawn.\n"}]}