path.c: char is not (always) signed
authorTorsten Bögershausen <tboegi@web.de>
Thu, 25 Oct 2018 16:13:08 +0000 (18:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Oct 2018 02:20:01 +0000 (11:20 +0900)
If a "char" in C is signed or unsigned is not specified, because it is
out of tradition "implementation dependent".
Therefore constructs like "if (name[i] < 0)" are not portable,
use "if (name[i] & 0x80)" instead.

Detected by "gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516" when
setting
DEVELOPER = 1
DEVOPTS = extra-all

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path.c
diff --git a/path.c b/path.c
index 4c4a751539aa30d134da09dd6ad1f00988818e88..cd3173470034cd9d29946a8eaf090220b7e94c3c 100644 (file)
--- a/path.c
+++ b/path.c
@@ -1368,7 +1368,7 @@ static int is_ntfs_dot_generic(const char *name,
                        saw_tilde = 1;
                } else if (i >= 6)
                        return 0;
-               else if (name[i] 0) {
+               else if (name[i] & 0x80) {
                        /*
                         * We know our needles contain only ASCII, so we clamp
                         * here to make the results of tolower() sane.