Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: base/string_number_conversions.cc

Issue 4129012: Fix a bug that could occur when converting strings with leading characters ab... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_number_conversions.h" 5 #include "base/string_number_conversions.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // There is an IsWhitespace for wchars defined in string_util.h, but it is 136 // There is an IsWhitespace for wchars defined in string_util.h, but it is
137 // locale independent, whereas the functions we are replacing were 137 // locale independent, whereas the functions we are replacing were
138 // locale-dependent. TBD what is desired, but for the moment let's not introduce 138 // locale-dependent. TBD what is desired, but for the moment let's not introduce
139 // a change in behaviour. 139 // a change in behaviour.
140 template<typename CHAR> class WhitespaceHelper { 140 template<typename CHAR> class WhitespaceHelper {
141 }; 141 };
142 142
143 template<> class WhitespaceHelper<char> { 143 template<> class WhitespaceHelper<char> {
144 public: 144 public:
145 static bool Invoke(char c) { 145 static bool Invoke(char c) {
146 return 0 != isspace(c); 146 return 0 != isspace(static_cast<unsigned char>(c));
147 } 147 }
148 }; 148 };
149 149
150 template<> class WhitespaceHelper<char16> { 150 template<> class WhitespaceHelper<char16> {
151 public: 151 public:
152 static bool Invoke(char16 c) { 152 static bool Invoke(char16 c) {
153 return 0 != iswspace(c); 153 return 0 != iswspace(c);
154 } 154 }
155 }; 155 };
156 156
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 end, 525 end,
526 output); 526 output);
527 } 527 }
528 528
529 bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) { 529 bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) {
530 return HexStringToBytesT(input, output); 530 return HexStringToBytesT(input, output);
531 } 531 }
532 532
533 } // namespace base 533 } // namespace base
534 534
OLDNEW
« no previous file with comments | « no previous file | base/string_number_conversions_unittest.cc » ('j') | base/string_number_conversions_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698