vcs-svn: suppress a signed/unsigned comparison warning
All callers pass a nonnegative delta_len, so the code is already safe. Add an assertion to ensure that remains so and add a cast to keep clang and gcc -Wsign-compare from worrying. Reported-by: David Barr <davidbarr@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
This commit is contained in:
parent
c68038effe
commit
96a60a8709
@ -77,8 +77,9 @@ static int error_short_read(struct line_buffer *input)
|
|||||||
static int read_chunk(struct line_buffer *delta, off_t *delta_len,
|
static int read_chunk(struct line_buffer *delta, off_t *delta_len,
|
||||||
struct strbuf *buf, size_t len)
|
struct strbuf *buf, size_t len)
|
||||||
{
|
{
|
||||||
|
assert(*delta_len >= 0);
|
||||||
strbuf_reset(buf);
|
strbuf_reset(buf);
|
||||||
if (len > *delta_len ||
|
if (len > (uintmax_t) *delta_len ||
|
||||||
buffer_read_binary(delta, buf, len) != len)
|
buffer_read_binary(delta, buf, len) != len)
|
||||||
return error_short_read(delta);
|
return error_short_read(delta);
|
||||||
*delta_len -= buf->len;
|
*delta_len -= buf->len;
|
||||||
@ -290,7 +291,7 @@ error_out:
|
|||||||
int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
|
int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
|
||||||
struct sliding_view *preimage, FILE *postimage)
|
struct sliding_view *preimage, FILE *postimage)
|
||||||
{
|
{
|
||||||
assert(delta && preimage && postimage);
|
assert(delta && preimage && postimage && delta_len >= 0);
|
||||||
|
|
||||||
if (read_magic(delta, &delta_len))
|
if (read_magic(delta, &delta_len))
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user