Chromium Code Reviews| Index: core/src/fxcrt/fx_basic_wstring.cpp |
| diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp |
| index 192579fe547e1dda087542b83f4a1a4a59135203..36b0ad001ea5d3a789760ec5488d0e5b874c7146 100644 |
| --- a/core/src/fxcrt/fx_basic_wstring.cpp |
| +++ b/core/src/fxcrt/fx_basic_wstring.cpp |
| @@ -401,12 +401,7 @@ CFX_WideString CFX_WideString::FromUTF8(const char* str, FX_STRSIZE len) |
| if (!str) { |
|
palmer
2014/07/12 00:54:39
You could say:
if (!str || 0 == len)
to avoi
Bo Xu
2014/07/12 05:18:04
Done.
|
| return CFX_WideString(); |
| } |
| - if (len < 0) { |
| - len = 0; |
| - while (str[len]) { |
| - len ++; |
| - } |
| - } |
| + |
| CFX_UTF8Decoder decoder; |
| for (FX_STRSIZE i = 0; i < len; i ++) { |
| decoder.Input(str[i]); |
| @@ -418,12 +413,7 @@ CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr, FX_STRSIZ |
| if (!wstr || !wlen) { |
| return CFX_WideString(); |
| } |
| - if (wlen < 0) { |
| - wlen = 0; |
| - while (wstr[wlen]) { |
| - wlen ++; |
| - } |
| - } |
| + |
| CFX_WideString result; |
| FX_WCHAR* buf = result.GetBuffer(wlen); |
| for (int i = 0; i < wlen; i ++) { |