| Index: trunk/src/base/strings/string_util.cc
|
| ===================================================================
|
| --- trunk/src/base/strings/string_util.cc (revision 257532)
|
| +++ trunk/src/base/strings/string_util.cc (working copy)
|
| @@ -324,20 +324,8 @@
|
| return input.find_first_not_of(characters) == StringPiece16::npos;
|
| }
|
|
|
| -bool IsStringUTF8(const StringPiece& str) {
|
| - const char *src = str.data();
|
| - int32 src_len = static_cast<int32>(str.length());
|
| - int32 char_index = 0;
|
| +} // namespace base
|
|
|
| - while (char_index < src_len) {
|
| - int32 code_point;
|
| - CBU8_NEXT(src, char_index, src_len, code_point);
|
| - if (!IsValidCharacter(code_point))
|
| - return false;
|
| - }
|
| - return true;
|
| -}
|
| -
|
| template<class STR>
|
| static bool DoIsStringASCII(const STR& str) {
|
| for (size_t i = 0; i < str.length(); i++) {
|
| @@ -348,7 +336,7 @@
|
| return true;
|
| }
|
|
|
| -bool IsStringASCII(const StringPiece& str) {
|
| +bool IsStringASCII(const base::StringPiece& str) {
|
| return DoIsStringASCII(str);
|
| }
|
|
|
| @@ -356,8 +344,20 @@
|
| return DoIsStringASCII(str);
|
| }
|
|
|
| -} // namespace base
|
| +bool IsStringUTF8(const std::string& str) {
|
| + const char *src = str.data();
|
| + int32 src_len = static_cast<int32>(str.length());
|
| + int32 char_index = 0;
|
|
|
| + while (char_index < src_len) {
|
| + int32 code_point;
|
| + CBU8_NEXT(src, char_index, src_len, code_point);
|
| + if (!base::IsValidCharacter(code_point))
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| template<typename Iter>
|
| static inline bool DoLowerCaseEqualsASCII(Iter a_begin,
|
| Iter a_end,
|
|
|