[PATCH 6/9] vcs-svn: suppress signed/unsigned comparison warnings
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jul 6, 2012, 17:21 UTC
- Message-ID
- <20120706172121.GG31001@burratino>
- In-Reply-To
- <20120706171040.GA31001@burratino>
From: David Barr <davidbarr@google.com> Date: Fri, 1 Jun 2012 00:41:29 +1000
These are already safe because both sides of the comparison are nonnegative.
This would normally not be important because Git is not -Wsign-compare clean anyway, but we like to keep the vcs-svn/ lib to a higher standard for convenience using it in other projects.
Signed-off-by: David Barr <davidbarr@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- This is the easy part of what is a larger patch[1] in v2, split out and given a new description for easier review.
[1] http://thread.gmane.org/gmane.comp.version-control.git/198909/focus=198914
vcs-svn/fast_export.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c index 854b328d..1f046978 100644 --- a/vcs-svn/fast_export.c +++ b/vcs-svn/fast_export.c @@ -254,7 +254,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; @@ -267,7 +267,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 ");
-- 1.7.10.4