git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Barr <davidbarr@google.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>, David Barr <davidbarr@google.com>
Subject: [PATCH v2 5/6] vcs-svn: fix signedness warnings
Date: Fri,  1 Jun 2012 00:41:29 +1000	[thread overview]
Message-ID: <1338475290-22644-6-git-send-email-davidbarr@google.com> (raw)
In-Reply-To: <1338475290-22644-1-git-send-email-davidbarr@google.com>

Stop mixing off_t and size_t.

Signed-off-by: David Barr <davidbarr@google.com>
---
 vcs-svn/fast_export.c    |    4 ++--
 vcs-svn/sliding_window.c |    2 +-
 vcs-svn/svndiff.c        |    2 +-
 vcs-svn/svndump.c        |    4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index cda37dd..6ded98b 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -259,7 +259,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,
 	}
 
 	/* Mode. */
-	if (response_end - response < strlen("100644") ||
+	if (response_end - response < (signed) strlen("100644") ||
 	    response[strlen("100644")] != ' ')
 		die("invalid ls response: missing mode: %s", response);
 	*mode = 0;
@@ -272,7 +272,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,
 	}
 
 	/* ' blob ' or ' tree ' */
-	if (response_end - response < strlen(" blob ") ||
+	if (response_end - response < (signed) strlen(" blob ") ||
 	    (response[1] != 'b' && response[1] != 't'))
 		die("unexpected ls response: not a tree or blob: %s", response);
 	response += strlen(" blob ");
diff --git a/vcs-svn/sliding_window.c b/vcs-svn/sliding_window.c
index ec2707c..f11d490 100644
--- a/vcs-svn/sliding_window.c
+++ b/vcs-svn/sliding_window.c
@@ -54,7 +54,7 @@ int move_window(struct sliding_view *view, off_t off, size_t width)
 		return -1;
 	if (off < view->off || off + width < view->off + view->width)
 		return error("invalid delta: window slides left");
-	if (view->max_off >= 0 && view->max_off < off + width)
+	if (view->max_off >= 0 && view->max_off < off + (off_t) width)
 		return error("delta preimage ends early");
 
 	file_offset = view->off + view->buf.len;
diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index 11a0e38..f061fae 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -78,7 +78,7 @@ static int read_chunk(struct line_buffer *delta, off_t *delta_len,
 		      struct strbuf *buf, size_t len)
 {
 	strbuf_reset(buf);
-	if (len > *delta_len ||
+	if ((off_t) len > *delta_len ||
 	    buffer_read_binary(delta, buf, len) != len)
 		return error_short_read(delta);
 	*delta_len -= buf->len;
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 8d0ae9c..6d1e3cd 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -40,8 +40,8 @@
 static struct line_buffer input = LINE_BUFFER_INIT;
 
 static struct {
-	uint32_t action, propLength, srcRev, type;
-	off_t text_length;
+	uint32_t action, srcRev, type;
+	off_t propLength, text_length;
 	struct strbuf src, dst;
 	uint32_t text_delta, prop_delta;
 } node_ctx;
-- 
1.7.10.2

  parent reply	other threads:[~2012-05-31 14:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31 14:41 [PATCH v2 0/6] vcs-svn: housekeeping David Barr
2012-05-31 14:41 ` [PATCH v2 1/6] vcs-svn: fix clang-analyzer error David Barr
2012-05-31 14:41 ` [PATCH v2 2/6] vcs-svn: simplify cleanup in apply_one_window() David Barr
2012-05-31 14:41 ` [PATCH v2 3/6] vcs-svn: prefer constcmp to prefixcmp David Barr
2012-06-01 16:27   ` Junio C Hamano
2012-06-01 16:43     ` David Michael Barr
2012-05-31 14:41 ` [PATCH v2 4/6] vcs-svn: prefer strstr over memmem David Barr
2012-05-31 14:41 ` David Barr [this message]
2012-05-31 14:41 ` [PATCH v2 6/6] vcs-svn: drop no-op reset methods David Barr
2012-06-01  4:26   ` David Michael Barr

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=1338475290-22644-6-git-send-email-davidbarr@google.com \
    --to=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@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).