comparison lib/fnmatch_loop.c @ 12293:9eca5d75491d

fnmatch: avoid compiler warning 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>
author Eric Blake <ebb9@byu.net>
date Sat, 14 Nov 2009 15:25:49 -0700
parents c9127d50c750
children e8d2c6fc33ad
comparison
equal deleted inserted replaced
12292:3fd0a39c1a0b 12293:9eca5d75491d
1 /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 1 /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2009
2 Free Software Foundation, Inc. 2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
1069 size_t plensize; \ 1069 size_t plensize; \
1070 size_t newpsize; \ 1070 size_t newpsize; \
1071 \ 1071 \
1072 plen = (opt == L_('?') || opt == L_('@') \ 1072 plen = (opt == L_('?') || opt == L_('@') \
1073 ? pattern_len \ 1073 ? pattern_len \
1074 : p - startp + 1); \ 1074 : p - startp + 1UL); \
1075 plensize = plen * sizeof (CHAR); \ 1075 plensize = plen * sizeof (CHAR); \
1076 newpsize = offsetof (struct patternlist, str) + plensize; \ 1076 newpsize = offsetof (struct patternlist, str) + plensize; \
1077 if ((size_t) -1 / sizeof (CHAR) < plen \ 1077 if ((size_t) -1 / sizeof (CHAR) < plen \
1078 || newpsize < offsetof (struct patternlist, str) \ 1078 || newpsize < offsetof (struct patternlist, str) \
1079 || ALLOCA_LIMIT <= newpsize) \ 1079 || ALLOCA_LIMIT <= newpsize) \