| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 TrimPositions TrimWhitespace(const std::wstring& input, | 432 TrimPositions TrimWhitespace(const std::wstring& input, |
| 433 TrimPositions positions, | 433 TrimPositions positions, |
| 434 std::wstring* output) { | 434 std::wstring* output) { |
| 435 return TrimStringT(input, kWhitespaceWide, positions, output); | 435 return TrimStringT(input, kWhitespaceWide, positions, output); |
| 436 } | 436 } |
| 437 | 437 |
| 438 TrimPositions TrimWhitespaceASCII(const std::string& input, | 438 TrimPositions TrimWhitespaceASCII(const std::string& input, |
| 439 TrimPositions positions, | 439 TrimPositions positions, |
| 440 std::string* output) { | 440 std::string* output) { |
| 441 DCHECK(IsStringASCII(input)); |
| 441 return TrimStringT(input, kWhitespaceASCII, positions, output); | 442 return TrimStringT(input, kWhitespaceASCII, positions, output); |
| 442 } | 443 } |
| 443 | 444 |
| 444 // This function is only for backward-compatibility. | 445 // This function is only for backward-compatibility. |
| 445 // To be removed when all callers are updated. | 446 // To be removed when all callers are updated. |
| 446 TrimPositions TrimWhitespace(const std::string& input, | 447 TrimPositions TrimWhitespace(const std::string& input, |
| 447 TrimPositions positions, | 448 TrimPositions positions, |
| 448 std::string* output) { | 449 std::string* output) { |
| 449 return TrimWhitespaceASCII(input, positions, output); | 450 return TrimWhitespaceASCII(input, positions, output); |
| 450 } | 451 } |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 // Each input byte creates two output hex characters. | 1666 // Each input byte creates two output hex characters. |
| 1666 std::string ret(size * 2, '\0'); | 1667 std::string ret(size * 2, '\0'); |
| 1667 | 1668 |
| 1668 for (size_t i = 0; i < size; ++i) { | 1669 for (size_t i = 0; i < size; ++i) { |
| 1669 char b = reinterpret_cast<const char*>(bytes)[i]; | 1670 char b = reinterpret_cast<const char*>(bytes)[i]; |
| 1670 ret[(i * 2)] = kHexChars[(b >> 4) & 0xf]; | 1671 ret[(i * 2)] = kHexChars[(b >> 4) & 0xf]; |
| 1671 ret[(i * 2) + 1] = kHexChars[b & 0xf]; | 1672 ret[(i * 2) + 1] = kHexChars[b & 0xf]; |
| 1672 } | 1673 } |
| 1673 return ret; | 1674 return ret; |
| 1674 } | 1675 } |
| OLD | NEW |