summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-05-29 12:02:05 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-05-29 12:02:10 +0200
commitf5585675581043d63141c6e33c2518f3ddae21ba (patch)
tree01d7b43c45583fb6c1609dc63b4403b93188f00b /sal
parent9155210d0ad8c9c79c9a493527452b52e7aceb98 (diff)
loplugin:redundantcast: Work around OS X memchr bug
...where in C++ memchr does not have exactly the two overloads void const * memchr(void const *, int, size_t) void * memchr(void *, int, size_t) but rather the C void * memchr(void const *, int, size_t) shining through (see bugreport.apple.com issue 21128245 "non-conforming memchr in C++"), which gets in the way of the upcoming improved redundant const_cast check in loplugin:redundantcast. Change-Id: I7001e74e03429ef23682d52da28fca435130d775
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/strtmpl.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 1dba94baf6e3..58e07585d41b 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -26,7 +26,7 @@
#include <cassert>
#include <limits>
-#include <string.h>
+#include <cstring>
#include <wchar.h>
#include <sal/log.hxx>
#include <rtl/character.hxx>
@@ -387,7 +387,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_ST
// assert(nLen >= 0);
#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
- IMPL_RTL_STRCODE* p = static_cast<IMPL_RTL_STRCODE*>(const_cast<void *>(memchr(pStr, c, nLen)));
+ IMPL_RTL_STRCODE* p = static_cast<IMPL_RTL_STRCODE*>(std::memchr(const_cast<IMPL_RTL_STRCODE *>(pStr), c, nLen));
return p ? p - pStr : -1;
#else
const IMPL_RTL_STRCODE* pTempStr = pStr;