On Sat, Mar 02, 2013 at 09:44:39AM +0100, Andreas Schwab wrote:

> > +   return *a - *b;
> 
> You should always cast to unsigned char when determining the order of
> characters, to be consistent with strcmp/memcmp.

Thanks, I hadn't heard that advice before, but it makes obvious sense.
Junio, do you want to squash this on top?

diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index 1ddbff4..06296d4 100644
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
@@ -143,12 +143,12 @@ static int maildir_filename_cmp(const char *a, const char 
*b)
                }
                else {
                        if (*a != *b)
-                               return *a - *b;
+                               return (unsigned char)*a - (unsigned char)*b;
                        a++;
                        b++;
                }
        }
-       return *a - *b;
+       return (unsigned char)*a - (unsigned char)*b;
 }
 
 static int split_maildir(const char *maildir, const char *dir,

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to