diff options
Diffstat (limited to 'contrib/binutils/libiberty/fnmatch.c')
-rw-r--r-- | contrib/binutils/libiberty/fnmatch.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/binutils/libiberty/fnmatch.c b/contrib/binutils/libiberty/fnmatch.c index 685d9e4..0a9bfe6 100644 --- a/contrib/binutils/libiberty/fnmatch.c +++ b/contrib/binutils/libiberty/fnmatch.c @@ -15,7 +15,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #if defined (CONFIG_BROKETS) @@ -71,7 +72,7 @@ fnmatch (pattern, string, flags) int flags; { register const char *p = pattern, *n = string; - register char c; + register unsigned char c; /* Note that this evalutes C many times. */ #define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) @@ -98,7 +99,7 @@ fnmatch (pattern, string, flags) c = *p++; c = FOLD (c); } - if (FOLD (*n) != c) + if (FOLD ((unsigned char)*n) != c) return FNM_NOMATCH; break; @@ -116,10 +117,10 @@ fnmatch (pattern, string, flags) return 0; { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; c1 = FOLD (c1); for (--p; *n != '\0'; ++n) - if ((c == '[' || FOLD (*n) == c1) && + if ((c == '[' || FOLD ((unsigned char)*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) return 0; return FNM_NOMATCH; @@ -144,7 +145,7 @@ fnmatch (pattern, string, flags) c = *p++; for (;;) { - register char cstart = c, cend = c; + register unsigned char cstart = c, cend = c; if (!(flags & FNM_NOESCAPE) && c == '\\') cstart = cend = *p++; @@ -174,7 +175,8 @@ fnmatch (pattern, string, flags) c = *p++; } - if (FOLD (*n) >= cstart && FOLD (*n) <= cend) + if (FOLD ((unsigned char)*n) >= cstart + && FOLD ((unsigned char)*n) <= cend) goto matched; if (c == ']') @@ -203,7 +205,7 @@ fnmatch (pattern, string, flags) break; default: - if (c != FOLD (*n)) + if (c != FOLD ((unsigned char)*n)) return FNM_NOMATCH; } |