OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 506 } |
507 | 507 |
508 #if !defined(WCHAR_T_IS_UTF16) | 508 #if !defined(WCHAR_T_IS_UTF16) |
509 bool LowerCaseEqualsASCII(string16::const_iterator a_begin, | 509 bool LowerCaseEqualsASCII(string16::const_iterator a_begin, |
510 string16::const_iterator a_end, | 510 string16::const_iterator a_end, |
511 const char* b) { | 511 const char* b) { |
512 return DoLowerCaseEqualsASCII(a_begin, a_end, b); | 512 return DoLowerCaseEqualsASCII(a_begin, a_end, b); |
513 } | 513 } |
514 #endif | 514 #endif |
515 | 515 |
| 516 // TODO(port): Resolve wchar_t/iterator issues that require OS_ANDROID here. |
| 517 #if !defined(OS_ANDROID) |
516 bool LowerCaseEqualsASCII(const char* a_begin, | 518 bool LowerCaseEqualsASCII(const char* a_begin, |
517 const char* a_end, | 519 const char* a_end, |
518 const char* b) { | 520 const char* b) { |
519 return DoLowerCaseEqualsASCII(a_begin, a_end, b); | 521 return DoLowerCaseEqualsASCII(a_begin, a_end, b); |
520 } | 522 } |
521 | 523 |
522 bool LowerCaseEqualsASCII(const wchar_t* a_begin, | 524 bool LowerCaseEqualsASCII(const wchar_t* a_begin, |
523 const wchar_t* a_end, | 525 const wchar_t* a_end, |
524 const char* b) { | 526 const char* b) { |
525 return DoLowerCaseEqualsASCII(a_begin, a_end, b); | 527 return DoLowerCaseEqualsASCII(a_begin, a_end, b); |
526 } | 528 } |
527 | 529 |
528 #if !defined(WCHAR_T_IS_UTF16) | 530 #if !defined(WCHAR_T_IS_UTF16) |
529 bool LowerCaseEqualsASCII(const char16* a_begin, | 531 bool LowerCaseEqualsASCII(const char16* a_begin, |
530 const char16* a_end, | 532 const char16* a_end, |
531 const char* b) { | 533 const char* b) { |
532 return DoLowerCaseEqualsASCII(a_begin, a_end, b); | 534 return DoLowerCaseEqualsASCII(a_begin, a_end, b); |
533 } | 535 } |
534 #endif | 536 #endif |
535 | 537 |
| 538 #endif // !defined(OS_ANDROID) |
| 539 |
536 bool EqualsASCII(const string16& a, const base::StringPiece& b) { | 540 bool EqualsASCII(const string16& a, const base::StringPiece& b) { |
537 if (a.length() != b.length()) | 541 if (a.length() != b.length()) |
538 return false; | 542 return false; |
539 return std::equal(b.begin(), b.end(), a.begin()); | 543 return std::equal(b.begin(), b.end(), a.begin()); |
540 } | 544 } |
541 | 545 |
542 bool StartsWithASCII(const std::string& str, | 546 bool StartsWithASCII(const std::string& str, |
543 const std::string& search, | 547 const std::string& search, |
544 bool case_sensitive) { | 548 bool case_sensitive) { |
545 if (case_sensitive) | 549 if (case_sensitive) |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } | 1032 } |
1029 | 1033 |
1030 } // namespace | 1034 } // namespace |
1031 | 1035 |
1032 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1036 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
1033 return lcpyT<char>(dst, src, dst_size); | 1037 return lcpyT<char>(dst, src, dst_size); |
1034 } | 1038 } |
1035 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1039 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
1036 return lcpyT<wchar_t>(dst, src, dst_size); | 1040 return lcpyT<wchar_t>(dst, src, dst_size); |
1037 } | 1041 } |
OLD | NEW |