fnmatch: avoid compiler warning
authorEric Blake <ebb9@byu.net>
Sat, 14 Nov 2009 22:25:49 +0000 (15:25 -0700)
committerEric Blake <ebb9@byu.net>
Sat, 14 Nov 2009 22:41:06 +0000 (15:41 -0700)
cond ? (size_t) : (char* - char* + 1) varies in signedness, but
using 1LU coerces the latter half to unsigned math.

* lib/fnmatch_loop.c (NEW_PATTERN): Coerce addition to unsigned,
to silence compiler warning about mismatch signedness in ?:.
Reported by Robert Millan.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/fnmatch_loop.c

index 4ff76e7..a241c5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-11-14  Eric Blake  <ebb9@byu.net>
 
+       fnmatch: avoid compiler warning
+       * lib/fnmatch_loop.c (NEW_PATTERN): Coerce addition to unsigned,
+       to silence compiler warning about mismatch signedness in ?:.
+       Reported by Robert Millan.
+
        intprops: add double-inclusion guard
        * lib/intprops.h: Allow idempotent includes.
        Suggested by Bruce Korb.
index d1008c2..ad58bb2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
+/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -1071,7 +1071,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
                                                                              \
            plen = (opt == L_('?') || opt == L_('@')                          \
                    ? pattern_len                                             \
-                   : p - startp + 1);                                        \
+                   : p - startp + 1UL);                                      \
            plensize = plen * sizeof (CHAR);                                  \
            newpsize = offsetof (struct patternlist, str) + plensize;         \
            if ((size_t) -1 / sizeof (CHAR) < plen                            \