Mercurial > hg > openttd
changeset 14362:2026bc4bec9f draft
(svn r18919) -Fix (r15371): strcasestr() return should not be const
author | glx <glx@openttd.org> |
---|---|
date | Tue, 26 Jan 2010 14:04:56 +0000 |
parents | 9240f3ddd50d |
children | 15f1f0c4f677 |
files | src/string.cpp src/string_func.h |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/string.cpp +++ b/src/string.cpp @@ -385,12 +385,12 @@ #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<char *>(haystack); haystack++; hay_len--;
--- a/src/string_func.h +++ b/src/string_func.h @@ -256,7 +256,7 @@ # 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 */