| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <ctype.h> | 9 #include <ctype.h> |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 bool IsStringUTF8(const std::string& str) { | 470 bool IsStringUTF8(const std::string& str) { |
| 471 const char *src = str.data(); | 471 const char *src = str.data(); |
| 472 int32 src_len = static_cast<int32>(str.length()); | 472 int32 src_len = static_cast<int32>(str.length()); |
| 473 int32 char_index = 0; | 473 int32 char_index = 0; |
| 474 | 474 |
| 475 while (char_index < src_len) { | 475 while (char_index < src_len) { |
| 476 int32 code_point; | 476 int32 code_point; |
| 477 CBU8_NEXT(src, char_index, src_len, code_point); | 477 CBU8_NEXT(src, char_index, src_len, code_point); |
| 478 if (!base::IsValidCharacter(code_point)) | 478 if (!base::IsValidCharacter(code_point)) |
| 479 return false; | 479 return false; |
| 480 } | 480 } |
| 481 return true; | 481 return true; |
| 482 } | 482 } |
| 483 | 483 |
| 484 template<typename Iter> | 484 template<typename Iter> |
| 485 static inline bool DoLowerCaseEqualsASCII(Iter a_begin, | 485 static inline bool DoLowerCaseEqualsASCII(Iter a_begin, |
| 486 Iter a_end, | 486 Iter a_end, |
| 487 const char* b) { | 487 const char* b) { |
| 488 for (Iter it = a_begin; it != a_end; ++it, ++b) { | 488 for (Iter it = a_begin; it != a_end; ++it, ++b) { |
| 489 if (!*b || base::ToLowerASCII(*it) != *b) | 489 if (!*b || base::ToLowerASCII(*it) != *b) |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 } // namespace | 1048 } // namespace |
| 1049 | 1049 |
| 1050 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1050 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
| 1051 return lcpyT<char>(dst, src, dst_size); | 1051 return lcpyT<char>(dst, src, dst_size); |
| 1052 } | 1052 } |
| 1053 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1053 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
| 1054 return lcpyT<wchar_t>(dst, src, dst_size); | 1054 return lcpyT<wchar_t>(dst, src, dst_size); |
| 1055 } | 1055 } |
| OLD | NEW |