# HG changeset patch # User glx # Date 2010-01-26 14:04:56 # Node ID 2d48e17549d14a6aa4d57a96877adc533bc9ea86 # Parent 220440a85eb3fa172be82a485ac8579f225f98b9 (svn r18919) -Fix (r15371): strcasestr() return should not be const diff --git a/src/string.cpp b/src/string.cpp --- a/src/string.cpp +++ b/src/string.cpp @@ -385,12 +385,12 @@ char *strndup(const char *s, size_t len) #endif /* !_GNU_SOURCE */ #ifdef DEFINE_STRCASESTR -const char *strcasestr(const char *haystack, const char *needle) +char *strcasestr(const char *haystack, const char *needle) { size_t hay_len = strlen(haystack); size_t needle_len = strlen(needle); while (hay_len >= needle_len) { - if (strncasecmp(haystack, needle, needle_len) == 0) return haystack; + if (strncasecmp(haystack, needle, needle_len) == 0) return const_cast(haystack); haystack++; hay_len--; diff --git a/src/string_func.h b/src/string_func.h --- a/src/string_func.h +++ b/src/string_func.h @@ -256,7 +256,7 @@ char *strndup(const char *s, size_t len) # undef DEFINE_STRCASESTR #else # define DEFINE_STRCASESTR -const char *strcasestr(const char *haystack, const char *needle); +char *strcasestr(const char *haystack, const char *needle); #endif /* strcasestr is available */ #endif /* STRING_FUNC_H */