X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmbscasestr.c;h=c419b35011484af20452089e1cb14ec7351cf982;hb=cd56634a4a8179fd5a4419fbb3e27211b042ab1c;hp=fa09307fa3f37177e4091d1c0a71911adc0cc4dd;hpb=3030c5b5e0a5199e16b05927da72c43c42f211c3;p=gnulib.git diff --git a/lib/mbscasestr.c b/lib/mbscasestr.c index fa09307fa..c419b3501 100644 --- a/lib/mbscasestr.c +++ b/lib/mbscasestr.c @@ -1,5 +1,5 @@ /* Case-insensitive searching in a string. - Copyright (C) 2005-2009 Free Software Foundation, Inc. + Copyright (C) 2005-2014 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software: you can redistribute it and/or modify @@ -30,6 +30,7 @@ #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) /* Knuth-Morris-Pratt algorithm. */ +#define UNIT unsigned char #define CANON_ELEMENT(c) TOLOWER (c) #include "str-kmp.h" @@ -368,10 +369,12 @@ mbscasestr (const char *haystack, const char *needle) if (needle_last_ccount == NULL) { /* Try the Knuth-Morris-Pratt algorithm. */ - const char *result; + const unsigned char *result; bool success = - knuth_morris_pratt_unibyte (haystack, needle - 1, - &result); + knuth_morris_pratt ((const unsigned char *) haystack, + (const unsigned char *) (needle - 1), + strlen (needle - 1), + &result); if (success) return (char *) result; try_kmp = false;