Merge pull request #15510 from xpol/fixes-use-of-deprecated-cc-wcslen

Fixes warning about deprecated cc_wcslen.
This commit is contained in:
minggo 2016-04-26 16:02:57 +08:00
commit bad4ea4dc6
1 changed files with 14 additions and 7 deletions

View File

@ -354,14 +354,21 @@ bool StringUTF8::insert(std::size_t pos, const StringUTF8& insertStr)
} //namespace StringUtils {
namespace {
inline int wcslen_internal(const unsigned short* str)
{
if (str == nullptr)
return -1;
int i=0;
while(*str++) i++;
return i;
}
}
int cc_wcslen(const unsigned short* str)
{
if (str == nullptr)
return -1;
int i=0;
while(*str++) i++;
return i;
return wcslen_internal(str);
}
void cc_utf8_trim_ws(std::vector<unsigned short>* str)
@ -411,7 +418,7 @@ std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* st
if (str == nullptr)
return str_new;
int len = cc_wcslen(str);
int len = wcslen_internal(str);
for (int i = 0; i < len; ++i)
{
@ -454,7 +461,7 @@ char * cc_utf16_to_utf8 (const unsigned short *str,
std::u16string utf16;
int utf16Len = len < 0 ? cc_wcslen(str) : len;
int utf16Len = len < 0 ? wcslen_internal(str) : len;
for (int i = 0; i < utf16Len; ++i)
{