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

Issue 2696003004: Added integer parsing functions in base/string_to_number.h (Closed)

Created:
3 years, 10 months ago by ossu
Modified:
3 years, 8 months ago
Reviewers:
kwiberg-webrtc
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Added integer parsing functions in base/string_to_number.h They provide parsing of numbers from char* and std::string into any of the fundamental integer types. Values are returned in an rtc::Optional, which is left empty if parsing was unsuccessful. BUG=webrtc:5806 Review-Url: https://codereview.webrtc.org/2696003004 Cr-Commit-Position: refs/heads/master@{#17557} Committed: https://chromium.googlesource.com/external/webrtc/+/a280f7c02647e80052ce344703a1557f52e924da

Patch Set 1 #

Patch Set 2 : Added more debug printing to invalid inputs tests. #

Total comments: 24

Patch Set 3 : Removed float support, moved template instances into .cc, made parsing stricter. #

Total comments: 6

Patch Set 4 : Separated implementation from templates. Made parsing stricter. Added a couple of specific tests. #

Total comments: 13

Patch Set 5 : long long int -> long long and some clang-formatting. #

Patch Set 6 : Rebase #

Patch Set 7 : Rebase #

Patch Set 8 : Added work-around for (unsigned) long long int being banned by lint. #

Total comments: 28

Patch Set 9 : Addressed comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+268 lines, -0 lines) Patch
M webrtc/base/BUILD.gn View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
A webrtc/base/string_to_number.h View 1 2 3 4 5 6 7 8 1 chunk +101 lines, -0 lines 0 comments Download
A webrtc/base/string_to_number.cc View 1 2 3 4 5 6 7 8 1 chunk +49 lines, -0 lines 0 comments Download
A webrtc/base/string_to_number_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +115 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 53 (34 generated)
ossu
Hey Karl, PTAL at this CL as a work-in-progress - both at design and implementation. ...
3 years, 10 months ago (2017-02-15 16:47:54 UTC) #7
kwiberg-webrtc
I like the approach. 1. Have you made sure that we can't just steal similar ...
3 years, 10 months ago (2017-02-16 00:27:24 UTC) #9
ossu
On 2017/02/16 00:27:24, kwiberg-webrtc wrote: > I like the approach. > > 1. Have you ...
3 years, 10 months ago (2017-02-16 10:19:26 UTC) #10
kwiberg-webrtc
https://codereview.webrtc.org/2696003004/diff/40001/webrtc/base/string_to_number.h File webrtc/base/string_to_number.h (right): https://codereview.webrtc.org/2696003004/diff/40001/webrtc/base/string_to_number.h#newcode47 webrtc/base/string_to_number.h:47: StringToNumber(const char* str, int base = 10) { On ...
3 years, 10 months ago (2017-02-16 11:59:42 UTC) #11
ossu
I've removed support for floats, since I don't need them and they're too much of ...
3 years, 10 months ago (2017-02-17 15:18:11 UTC) #17
kwiberg-webrtc
https://codereview.webrtc.org/2696003004/diff/80001/webrtc/base/string_to_number.cc File webrtc/base/string_to_number.cc (right): https://codereview.webrtc.org/2696003004/diff/80001/webrtc/base/string_to_number.cc#newcode20 webrtc/base/string_to_number.cc:20: sizeof(long long int) >= sizeof(T), Compare std::numeric_limits<>::min() and ::max() ...
3 years, 10 months ago (2017-02-18 12:28:53 UTC) #18
kwiberg-webrtc
On 2017/02/17 15:18:11, ossu wrote: > I've removed support for floats, since I don't need ...
3 years, 10 months ago (2017-02-18 12:33:10 UTC) #19
ossu
I've made the implementation regular functions, with smaller templates in the header to do conversion ...
3 years, 10 months ago (2017-02-20 12:57:26 UTC) #20
kwiberg-webrtc
lgtm nits are all optional https://codereview.webrtc.org/2696003004/diff/100001/webrtc/base/string_to_number.h File webrtc/base/string_to_number.h (right): https://codereview.webrtc.org/2696003004/diff/100001/webrtc/base/string_to_number.h#newcode44 webrtc/base/string_to_number.h:44: namespace string_to_number_internal { Bonus ...
3 years, 10 months ago (2017-02-20 13:27:20 UTC) #21
ossu
https://codereview.webrtc.org/2696003004/diff/100001/webrtc/base/string_to_number.h File webrtc/base/string_to_number.h (right): https://codereview.webrtc.org/2696003004/diff/100001/webrtc/base/string_to_number.h#newcode44 webrtc/base/string_to_number.h:44: namespace string_to_number_internal { On 2017/02/20 13:27:20, kwiberg-webrtc wrote: > ...
3 years, 10 months ago (2017-02-20 14:09:06 UTC) #22
kwiberg-webrtc
https://codereview.webrtc.org/2696003004/diff/100001/webrtc/base/string_to_number.h File webrtc/base/string_to_number.h (right): https://codereview.webrtc.org/2696003004/diff/100001/webrtc/base/string_to_number.h#newcode58 webrtc/base/string_to_number.h:58: "long long int"); On 2017/02/20 14:09:06, ossu wrote: > ...
3 years, 10 months ago (2017-02-20 16:51:27 UTC) #28
ossu
Preparing to start landing all the stuff depending on this. Had to do some minor ...
3 years, 8 months ago (2017-04-04 16:26:33 UTC) #35
kwiberg-webrtc
https://codereview.webrtc.org/2696003004/diff/180001/webrtc/base/string_to_number.cc File webrtc/base/string_to_number.cc (right): https://codereview.webrtc.org/2696003004/diff/180001/webrtc/base/string_to_number.cc#newcode21 webrtc/base/string_to_number.cc:21: const signed_type value = std::strtoll(str, &end, base); #include <cstdlib>? ...
3 years, 8 months ago (2017-04-05 09:01:16 UTC) #38
ossu
https://codereview.webrtc.org/2696003004/diff/180001/webrtc/base/string_to_number.cc File webrtc/base/string_to_number.cc (right): https://codereview.webrtc.org/2696003004/diff/180001/webrtc/base/string_to_number.cc#newcode21 webrtc/base/string_to_number.cc:21: const signed_type value = std::strtoll(str, &end, base); On 2017/04/05 ...
3 years, 8 months ago (2017-04-05 10:15:36 UTC) #39
kwiberg-webrtc
https://codereview.webrtc.org/2696003004/diff/180001/webrtc/base/string_to_number.cc File webrtc/base/string_to_number.cc (right): https://codereview.webrtc.org/2696003004/diff/180001/webrtc/base/string_to_number.cc#newcode22 webrtc/base/string_to_number.cc:22: if (end && *end == '\0' && end != ...
3 years, 8 months ago (2017-04-05 10:55:39 UTC) #40
ossu
I've addressed your comments, except for the cast one, since I still don't see what ...
3 years, 8 months ago (2017-04-05 14:04:04 UTC) #45
kwiberg-webrtc
lgtm
3 years, 8 months ago (2017-04-05 23:23:01 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2696003004/240001
3 years, 8 months ago (2017-04-06 08:59:57 UTC) #50
commit-bot: I haz the power
3 years, 8 months ago (2017-04-06 09:02:20 UTC) #53
Message was sent while issue was closed.
Committed patchset #9 (id:240001) as
https://chromium.googlesource.com/external/webrtc/+/a280f7c02647e80052ce34470...

Powered by Google App Engine
This is Rietveld 408576698