Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-22 Thread René Scharfe
Am 22.09.2017 um 07:47 schrieb Jeff King: > On Thu, Sep 21, 2017 at 05:48:38PM +0100, Ramsay Jones wrote: > >> diff --git a/cache.h b/cache.h >> index a916bc79e..a0e3e362c 100644 >> --- a/cache.h >> +++ b/cache.h >> @@ -1243,8 +1243,8 @@ static inline unsigned int hexval(unsigned char c) >>*/

Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-22 Thread Ramsay Jones
On 22/09/17 17:11, Jeff King wrote: > On Fri, Sep 22, 2017 at 05:05:03PM +0100, Ramsay Jones wrote: > >>> As an aside, I also see some uses of hexval() that don't appear to be >>> quite as rigorous in checking for invalid characters. A few >>> unconditionally shift the first nibble and assume th

Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-22 Thread Jeff King
On Fri, Sep 22, 2017 at 12:18:17PM -0400, Jeff King wrote: > > I think if this function is fed an empty string that it will also read > > past the end of the buffer for in[1]. It shouldn't matter, since the NUL > > in in[0] would cause us to return an error regardless, but it's still > > undefined

Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-22 Thread Jeff King
On Fri, Sep 22, 2017 at 12:11:59PM -0400, Jeff King wrote: > On Fri, Sep 22, 2017 at 05:05:03PM +0100, Ramsay Jones wrote: > > > > As an aside, I also see some uses of hexval() that don't appear to be > > > quite as rigorous in checking for invalid characters. A few > > > unconditionally shift th

Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-22 Thread Jeff King
On Fri, Sep 22, 2017 at 05:05:03PM +0100, Ramsay Jones wrote: > > As an aside, I also see some uses of hexval() that don't appear to be > > quite as rigorous in checking for invalid characters. A few > > unconditionally shift the first nibble and assume that there will still > > be high bits set.

Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-22 Thread Ramsay Jones
On 22/09/17 06:47, Jeff King wrote: > On Thu, Sep 21, 2017 at 05:48:38PM +0100, Ramsay Jones wrote: > >> diff --git a/cache.h b/cache.h >> index a916bc79e..a0e3e362c 100644 >> --- a/cache.h >> +++ b/cache.h >> @@ -1243,8 +1243,8 @@ static inline unsigned int hexval(unsigned char c) >> */ >> s

Re: [PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-21 Thread Jeff King
On Thu, Sep 21, 2017 at 05:48:38PM +0100, Ramsay Jones wrote: > diff --git a/cache.h b/cache.h > index a916bc79e..a0e3e362c 100644 > --- a/cache.h > +++ b/cache.h > @@ -1243,8 +1243,8 @@ static inline unsigned int hexval(unsigned char c) > */ > static inline int hex2chr(const char *s) > { > -

[PATCH 3/4] cache.h: hex2chr() - avoid -Wsign-compare warnings

2017-09-21 Thread Ramsay Jones
Signed-off-by: Ramsay Jones --- cache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index a916bc79e..a0e3e362c 100644 --- a/cache.h +++ b/cache.h @@ -1243,8 +1243,8 @@ static inline unsigned int hexval(unsigned char c) */ static inline int hex2chr