summaryrefslogtreecommitdiffstats
path: root/base/string_number_conversions.cc
Commit message (Collapse)AuthorAgeFilesLines
* Standardize StringToInt{,64} interface.tedvessenes@gmail.com2011-12-191-115/+34
| | | | | | | | | | | | | | | | | | | | | | | These changes address issue #106655. All variants of StringToInt have been converted to use the StringPiece class. One instance of conversion, in chrome/browser/history/text_database.cc, required copying an underlying string. This is because the string type in question could use 8 or 16 bit characters depending on the OS type, and because StringPiece is not implemented as a template, the code cannot specify whether to create a StringPiece or StringPiece16. This should be remedied in a future CL. R=erikwright@chromium.org BUG=106655 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114929 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114944 Review URL: http://codereview.chromium.org/8921006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114993 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 114944 - Standardize StringToInt{,64} interface.battre@chromium.org2011-12-181-34/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | Revert due to compile breakage on ChromeOS. These changes address issue #106655. All variants of StringToInt have been converted to use the StringPiece class. One instance of conversion, in chrome/browser/history/text_database.cc, required copying an underlying string. This is because the string type in question could use 8 or 16 bit characters depending on the OS type, and because StringPiece is not implemented as a template, the code cannot specify whether to create a StringPiece or StringPiece16. This should be remedied in a future CL. R=erikwright@chromium.org BUG=106655 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114929 Review URL: http://codereview.chromium.org/8921006 TBR=tedvessenes@gmail.com Review URL: http://codereview.chromium.org/8990002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114945 0039d316-1c4b-4281-b951-d872f2087c98
* Standardize StringToInt{,64} interface.tedvessenes@gmail.com2011-12-181-115/+34
| | | | | | | | | | | | | | | | | | | | | These changes address issue #106655. All variants of StringToInt have been converted to use the StringPiece class. One instance of conversion, in chrome/browser/history/text_database.cc, required copying an underlying string. This is because the string type in question could use 8 or 16 bit characters depending on the OS type, and because StringPiece is not implemented as a template, the code cannot specify whether to create a StringPiece or StringPiece16. This should be remedied in a future CL. R=erikwright@chromium.org BUG=106655 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114929 Review URL: http://codereview.chromium.org/8921006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114944 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 114929 - Standardize StringToInt{,64} interface.rsleevi@chromium.org2011-12-171-34/+115
| | | | | | | | | | | | | | | | | | | | | | These changes address issue #106655. All variants of StringToInt have been converted to use the StringPiece class. One instance of conversion, in chrome/browser/history/text_database.cc, required copying an underlying string. This is because the string type in question could use 8 or 16 bit characters depending on the OS type, and because StringPiece is not implemented as a template, the code cannot specify whether to create a StringPiece or StringPiece16. This should be remedied in a future CL. R=erikwright@chromium.org BUG=106655 TEST= Review URL: http://codereview.chromium.org/8921006 TBR=tedvessenes@gmail.com Review URL: http://codereview.chromium.org/8984007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114930 0039d316-1c4b-4281-b951-d872f2087c98
* Standardize StringToInt{,64} interface.tedvessenes@gmail.com2011-12-171-115/+34
| | | | | | | | | | | | | | | | | | | These changes address issue #106655. All variants of StringToInt have been converted to use the StringPiece class. One instance of conversion, in chrome/browser/history/text_database.cc, required copying an underlying string. This is because the string type in question could use 8 or 16 bit characters depending on the OS type, and because StringPiece is not implemented as a template, the code cannot specify whether to create a StringPiece or StringPiece16. This should be remedied in a future CL. R=erikwright@chromium.org BUG=106655 TEST= Review URL: http://codereview.chromium.org/8921006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114929 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes a corner case bug in the HexStringToInt conversion function which ↵ali.akbar@gmail.com2011-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | caused the string "0x" to be treated as a valid hexadecimal number. Although the parsed result was 0, the boolean flag returned indicated that the hex number was in proper format The IteratorRangeToNumber class's Invoke function increments the string pointer by 2 if the string starts with "0x" or "0X" and the length is greater than *or equal* to 2 If the length of the string is 2, i.e "0x", after the pointer increment, the string would be empty and the function returns true as the parse result Changed the condition from "greater than or equal to" to "greater than" Added another test cases which now properly treats "0x" as an invalid hex string Contributed by ali.akbar@gmail.com BUG=92054 Review URL: http://codereview.chromium.org/7584031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96605 0039d316-1c4b-4281-b951-d872f2087c98
* Upstream android debug and log related filesmichaelbai@google.com2011-07-071-0/+1
| | | | | | | | | BUG= TEST= Review URL: http://codereview.chromium.org/7238012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91748 0039d316-1c4b-4281-b951-d872f2087c98
* Upstream android string implementation etc.michaelbai@google.com2011-06-271-0/+10
| | | | | | | | | BUG= TEST= Review URL: http://codereview.chromium.org/7238018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90616 0039d316-1c4b-4281-b951-d872f2087c98
* Adding missing inclusionstzik@chromium.org2011-06-181-2/+2
| | | | | | | | | | BUG=None TEST='LoggingTest.*,FileUtilTest.*,PlatformFile.*,StringNumberConversionsTest.*,Time,TimeTicks,TimeDelta' Review URL: http://codereview.chromium.org/7108033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89595 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a bug that could occur when converting strings with leading characters ↵erikwright@chromium.org2010-11-021-1/+1
| | | | | | | | | | | above 127. BUG=None TEST=base_unittests --gtest_filter=*StringToInt* Review URL: http://codereview.chromium.org/4129012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64789 0039d316-1c4b-4281-b951-d872f2087c98
* Add StringToInt and HexStringToInt for iterator ranges.erikwright@chromium.org2010-10-211-170/+303
| | | | | | | | BUG=52601 TEST=base_unittests / StringNumberConversionsTest.*StringToInt Review URL: http://codereview.chromium.org/3866001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63357 0039d316-1c4b-4281-b951-d872f2087c98
* Convert more callers of the integer/string functions to usingbrettw@chromium.org2010-07-311-0/+1
| | | | | | | | | | string_number_conversions.h TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3013046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54454 0039d316-1c4b-4281-b951-d872f2087c98
* Move the number conversions from string_util to a new file.brettw@chromium.org2010-07-301-0/+400
Use the base namespace in the new file. Update callers. I removed all wstring variants and also the string->number ones that ignore the return value. That encourages people to write code and forget about error handling. TEST=included unit tests BUG=none Review URL: http://codereview.chromium.org/3056029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54355 0039d316-1c4b-4281-b951-d872f2087c98