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

Side by Side Diff: base/string_number_conversions.cc

Issue 9296027: Revert 119540 - Add StringToSizeT to base/string_number_conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months 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
« no previous file with comments | « base/string_number_conversions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_number_conversions.h" 5 #include "base/string_number_conversions.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <wctype.h> 10 #include <wctype.h>
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 bool StringToInt(const StringPiece& input, int* output) { 397 bool StringToInt(const StringPiece& input, int* output) {
398 return StringToIntImpl(input, output); 398 return StringToIntImpl(input, output);
399 } 399 }
400 400
401 bool StringToInt(const StringPiece16& input, int* output) { 401 bool StringToInt(const StringPiece16& input, int* output) {
402 return String16ToIntImpl(input, output); 402 return String16ToIntImpl(input, output);
403 } 403 }
404 404
405 bool StringToUint(const StringPiece& input, unsigned* output) {
406 return StringToIntImpl(input, output);
407 }
408
409 bool StringToUint(const StringPiece16& input, unsigned* output) {
410 return String16ToIntImpl(input, output);
411 }
412
405 bool StringToInt64(const StringPiece& input, int64* output) { 413 bool StringToInt64(const StringPiece& input, int64* output) {
406 return StringToIntImpl(input, output); 414 return StringToIntImpl(input, output);
407 } 415 }
408 416
409 bool StringToInt64(const StringPiece16& input, int64* output) { 417 bool StringToInt64(const StringPiece16& input, int64* output) {
410 return String16ToIntImpl(input, output); 418 return String16ToIntImpl(input, output);
411 } 419 }
412 420
413 bool StringToSizeT(const StringPiece& input, size_t* output) { 421 bool StringToUint64(const StringPiece& input, uint64* output) {
414 return StringToIntImpl(input, output); 422 return StringToIntImpl(input, output);
415 } 423 }
416 424
417 bool StringToSizeT(const StringPiece16& input, size_t* output) { 425 bool StringToUint64(const StringPiece16& input, uint64* output) {
418 return String16ToIntImpl(input, output); 426 return String16ToIntImpl(input, output);
419 } 427 }
420 428
421 bool StringToDouble(const std::string& input, double* output) { 429 bool StringToDouble(const std::string& input, double* output) {
422 errno = 0; // Thread-safe? It is on at least Mac, Linux, and Windows. 430 errno = 0; // Thread-safe? It is on at least Mac, Linux, and Windows.
423 char* endptr = NULL; 431 char* endptr = NULL;
424 *output = dmg_fp::strtod(input.c_str(), &endptr); 432 *output = dmg_fp::strtod(input.c_str(), &endptr);
425 433
426 // Cases to return false: 434 // Cases to return false:
427 // - If errno is ERANGE, there was an overflow or underflow. 435 // - If errno is ERANGE, there was an overflow or underflow.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 bool HexStringToInt(const StringPiece& input, int* output) { 471 bool HexStringToInt(const StringPiece& input, int* output) {
464 return IteratorRangeToNumber<HexIteratorRangeToIntTraits>::Invoke( 472 return IteratorRangeToNumber<HexIteratorRangeToIntTraits>::Invoke(
465 input.begin(), input.end(), output); 473 input.begin(), input.end(), output);
466 } 474 }
467 475
468 bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) { 476 bool HexStringToBytes(const std::string& input, std::vector<uint8>* output) {
469 return HexStringToBytesT(input, output); 477 return HexStringToBytesT(input, output);
470 } 478 }
471 479
472 } // namespace base 480 } // namespace base
OLDNEW
« no previous file with comments | « base/string_number_conversions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698