| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 #include <stdarg.h> | 10 #include <stdarg.h> |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 525 |
| 526 char buf[64]; | 526 char buf[64]; |
| 527 if (bytes != 0 && dimension > 0 && unit_amount < 100) { | 527 if (bytes != 0 && dimension > 0 && unit_amount < 100) { |
| 528 base::snprintf(buf, arraysize(buf), "%.1lf%s", unit_amount, | 528 base::snprintf(buf, arraysize(buf), "%.1lf%s", unit_amount, |
| 529 kByteStringsUnlocalized[dimension]); | 529 kByteStringsUnlocalized[dimension]); |
| 530 } else { | 530 } else { |
| 531 base::snprintf(buf, arraysize(buf), "%.0lf%s", unit_amount, | 531 base::snprintf(buf, arraysize(buf), "%.0lf%s", unit_amount, |
| 532 kByteStringsUnlocalized[dimension]); | 532 kByteStringsUnlocalized[dimension]); |
| 533 } | 533 } |
| 534 | 534 |
| 535 return ASCIIToUTF16(buf); | 535 return base::ASCIIToUTF16(buf); |
| 536 } | 536 } |
| 537 | 537 |
| 538 template<class StringType> | 538 template<class StringType> |
| 539 void DoReplaceSubstringsAfterOffset(StringType* str, | 539 void DoReplaceSubstringsAfterOffset(StringType* str, |
| 540 typename StringType::size_type start_offset, | 540 typename StringType::size_type start_offset, |
| 541 const StringType& find_this, | 541 const StringType& find_this, |
| 542 const StringType& replace_with, | 542 const StringType& replace_with, |
| 543 bool replace_all) { | 543 bool replace_all) { |
| 544 if ((start_offset == StringType::npos) || (start_offset >= str->length())) | 544 if ((start_offset == StringType::npos) || (start_offset >= str->length())) |
| 545 return; | 545 return; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 } | 928 } |
| 929 | 929 |
| 930 } // namespace | 930 } // namespace |
| 931 | 931 |
| 932 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 932 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
| 933 return lcpyT<char>(dst, src, dst_size); | 933 return lcpyT<char>(dst, src, dst_size); |
| 934 } | 934 } |
| 935 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 935 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
| 936 return lcpyT<wchar_t>(dst, src, dst_size); | 936 return lcpyT<wchar_t>(dst, src, dst_size); |
| 937 } | 937 } |
| OLD | NEW |