mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-10-27 19:10:24 +01:00
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:
committed by
Philipp A. Hartmann
parent
4f40ed64b6
commit
7a2e6e79c6
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user