From: David Barr <david.barr@cordelta.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
David Barr <david.barr@cordelta.com>
Subject: [PATCH] vcs-svn: Avoid %z in format string
Date: Sat, 4 Sep 2010 21:58:59 +1000 [thread overview]
Message-ID: <1283601539-4477-1-git-send-email-david.barr@cordelta.com> (raw)
In-Reply-To: <1283586214-31204-2-git-send-email-artagnon@gmail.com>
In the spirit of v1.6.4-rc0~124 (MinGW: Fix compiler warning in
merge-recursive, 2009-05-23), use a 64-bit integer instead.
---
vcs-svn/svndiff.c | 41 +++++++++++++++++++++++++----------------
1 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index 901fc1a..12b7459 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -57,7 +57,7 @@ size_t read_one_instruction(struct svndiff_instruction *op)
bits; the remaining 6 bits may contain the length */
action = (c >> 6) & 3;
if (action >= 3)
- die("Invalid instruction %d", action);
+ die("Invalid instruction %"PRIu64, (uint64_t) action);
op->action_code = (enum svndiff_action)(action);
@@ -93,39 +93,44 @@ size_t read_instructions(struct svndiff_window *window, size_t *ninst)
bsize += read_one_instruction(op);
if (DEBUG)
- fprintf(stderr, "Instruction: %d %d %d (%d)\n",
- op->action_code, op->length, op->offset, bsize);
+ fprintf(stderr,
+ "Instruction: %"PRIu64" %"PRIu64" %"PRIu64" (%"PRIu64")\n",
+ (uint64_t) op->action_code,
+ (uint64_t) op->length,
+ (uint64_t) op->offset,
+ (uint64_t) bsize);
if (op == NULL)
die("Invalid diff stream: "
- "instruction %d cannot be decoded", *ninst);
+ "instruction %"PRIu64" cannot be decoded", (uint64_t) *ninst);
else if (op->length == 0)
die("Invalid diff stream: "
- "instruction %d has length zero", *ninst);
+ "instruction %"PRIu64" has length zero", (uint64_t) *ninst);
else if (op->length > window->tview_len - tpos)
die("Invalid diff stream: "
- "instruction %d overflows the target view", *ninst);
+ "instruction %"PRIu64" overflows the target view",
+ (uint64_t) *ninst);
switch (op->action_code)
{
case copyfrom_source:
if (op->length > window->sview_len - op->offset ||
- op->offset > window->sview_len)
+ op->offset > window->sview_len)
die("Invalid diff stream: "
- "[src] instruction %d overflows "
- " the source view", *ninst);
+ "[src] instruction %"PRIu64" overflows "
+ " the source view", (uint64_t) *ninst);
break;
case copyfrom_target:
if (op->offset >= tpos)
die("Invalid diff stream: "
- "[tgt] instruction %d starts "
- "beyond the target view position", *ninst);
+ "[tgt] instruction %"PRIu64" starts "
+ "beyond the target view position", (uint64_t) *ninst);
break;
case copyfrom_new:
if (op->length > window->newdata_len - npos)
die("Invalid diff stream: "
- "[new] instruction %d overflows "
- "the new data section", *ninst);
+ "[new] instruction %"PRIu64" overflows "
+ "the new data section", (uint64_t) *ninst);
npos += op->length;
break;
}
@@ -163,9 +168,13 @@ size_t read_window_header(struct svndiff_window *window)
die("Svndiff contains corrupt window header");
if (DEBUG)
- fprintf(stderr, "Window header: %d %d %d %d %d\n",
- window->sview_offset, window->sview_len,
- window->tview_len, window->ins_len, window->newdata_len);
+ fprintf(stderr,
+ "Window header: %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64"\n",
+ (uint64_t) window->sview_offset,
+ (uint64_t) window->sview_len,
+ (uint64_t) window->tview_len,
+ (uint64_t) window->ins_len,
+ (uint64_t) window->newdata_len);
return bsize;
}
--
1.7.2.2
next prev parent reply other threads:[~2010-09-04 12:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-04 7:43 [PATCH] Mockup an svndiff version 0 parser Ramkumar Ramachandra
2010-09-04 7:43 ` [WIP PATCH] vcs-svn: Add an svndiff0 parser Ramkumar Ramachandra
2010-09-04 11:58 ` David Barr [this message]
2010-09-04 12:20 ` [PATCH] vcs-svn: Avoid %z in format string Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1283601539-4477-1-git-send-email-david.barr@cordelta.com \
--to=david.barr@cordelta.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).