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.
This commit is contained in:
parent
4f40ed64b6
commit
7a2e6e79c6
@ -13,8 +13,7 @@ namespace internal {
|
|||||||
template <typename Ch>
|
template <typename Ch>
|
||||||
inline SizeType StrLen(const Ch* s) {
|
inline SizeType StrLen(const Ch* s) {
|
||||||
const Ch* p = s;
|
const Ch* p = s;
|
||||||
while (*p != '\0')
|
while (*p) ++p;
|
||||||
++p;
|
|
||||||
return SizeType(p - s);
|
return SizeType(p - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Ch>
|
template <typename Ch>
|
||||||
inline size_t StrLen(const Ch* s) {
|
inline unsigned StrLen(const Ch* s) {
|
||||||
const Ch* p = s;
|
const Ch* p = s;
|
||||||
while (*p) p++;
|
while (*p) p++;
|
||||||
return p - s;
|
return unsigned(p - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ch>
|
template<typename Ch>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user