Commit 7a2e6e79 authored by Philipp A. Hartmann's avatar Philipp A. Hartmann Committed by Philipp A. Hartmann

StrLen: align implementations

There are two copies of `StrLen` in the RapidJSON code base
 * strfunc.h: rapidjson::internal::StrLen<Ch>
 * unittest.h: Strlen<Ch>

To hide a warning on MSVC, align both implementations to use
'unsigned/SizeType' as return type and add an explicit cast.
parent 4f40ed64
......@@ -13,8 +13,7 @@ namespace internal {
template <typename Ch>
inline SizeType StrLen(const Ch* s) {
const Ch* p = s;
while (*p != '\0')
++p;
while (*p) ++p;
return SizeType(p - s);
}
......
......@@ -27,10 +27,10 @@
#endif
template <typename Ch>
inline size_t StrLen(const Ch* s) {
inline unsigned StrLen(const Ch* s) {
const Ch* p = s;
while (*p) p++;
return p - s;
return unsigned(p - s);
}
template<typename Ch>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment