summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2010-01-26 14:04:56 +0000
committerglx <glx@openttd.org>2010-01-26 14:04:56 +0000
commit918b3aff5e9a012b2cdaae30c6012be1aa9e595b (patch)
tree75d299fdc399bda22cf238b4e1c2de2528f66295 /src
parent078e1edabc8d59ea7364c77bfeb7c6d95417a7c5 (diff)
downloadopenttd-918b3aff5e9a012b2cdaae30c6012be1aa9e595b.tar.xz
(svn r18919) -Fix (r15371): strcasestr() return should not be const
Diffstat (limited to 'src')
-rw-r--r--src/string.cpp4
-rw-r--r--src/string_func.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/string.cpp b/src/string.cpp
index d9e27857d..2bd747535 100644
--- 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<char *>(haystack);
haystack++;
hay_len--;
diff --git a/src/string_func.h b/src/string_func.h
index e0280490f..2ff5f0439 100644
--- 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 */