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

Issue 18452: Adding a HexEncode function to string_utils.... (Closed)

Created:
11 years, 11 months ago by tommi (sloooow) - chröme
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Adding a HexEncode function to string_utils. This function takes a pointer to a chunk of memory and formats the bytes as hex. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=8420

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 10

Patch Set 3 : '' #

Total comments: 4

Patch Set 4 : '' #

Total comments: 1

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+46 lines, -1 line) Patch
M base/string_util.h View 1 2 3 4 1 chunk +9 lines, -1 line 0 comments Download
M base/string_util.cc View 1 2 3 4 1 chunk +29 lines, -0 lines 3 comments Download
M base/string_util_unittest.cc View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
tommi (sloooow) - chröme
11 years, 11 months ago (2009-01-21 18:43:49 UTC) #1
brettw
http://codereview.chromium.org/18452/diff/5/8 File base/string_util.cc (right): http://codereview.chromium.org/18452/diff/5/8#newcode1521 Line 1521: if (size > 0) { I'd probably just ...
11 years, 11 months ago (2009-01-21 19:02:18 UTC) #2
stoyan
http://codereview.chromium.org/18452/diff/5/8 File base/string_util.cc (right): http://codereview.chromium.org/18452/diff/5/8#newcode1515 Line 1515: static const char kHexChars[] = { array is ...
11 years, 11 months ago (2009-01-21 19:04:30 UTC) #3
tommi (sloooow) - chröme
also fixed new line issue (thanks maruel) http://codereview.chromium.org/18452/diff/5/8 File base/string_util.cc (right): http://codereview.chromium.org/18452/diff/5/8#newcode1515 Line 1515: static ...
11 years, 11 months ago (2009-01-21 19:17:31 UTC) #4
brettw
http://codereview.chromium.org/18452/diff/5/8 File base/string_util.cc (right): http://codereview.chromium.org/18452/diff/5/8#newcode1523 Line 1523: ret.resize(size * 2); What kind of input is ...
11 years, 11 months ago (2009-01-21 19:20:21 UTC) #5
Avi (use Gerrit)
http://codereview.chromium.org/18452/diff/207/15 File base/string_util.h (right): http://codereview.chromium.org/18452/diff/207/15#newcode535 Line 535: #endif // BASE_STRING_UTIL_H_ Lost the trailing newline http://codereview.chromium.org/18452/diff/207/14 ...
11 years, 11 months ago (2009-01-21 19:43:24 UTC) #6
tommi (sloooow) - chröme
http://codereview.chromium.org/18452/diff/207/15 File base/string_util.h (right): http://codereview.chromium.org/18452/diff/207/15#newcode535 Line 535: #endif // BASE_STRING_UTIL_H_ On 2009/01/21 19:43:24, Avi wrote: ...
11 years, 11 months ago (2009-01-21 19:52:56 UTC) #7
brettw
http://codereview.chromium.org/18452/diff/18/19 File base/string_util_unittest.cc (right): http://codereview.chromium.org/18452/diff/18/19#newcode1428 Line 1428: EXPECT_EQ(hex.length(), 0); I think your gcc problem is ...
11 years, 11 months ago (2009-01-21 20:16:16 UTC) #8
brettw
LGTM
11 years, 11 months ago (2009-01-21 21:27:05 UTC) #9
Dean McNamee
11 years, 11 months ago (2009-01-22 11:22:03 UTC) #10
http://codereview.chromium.org/18452/diff/214/217
File base/string_util.cc (right):

http://codereview.chromium.org/18452/diff/214/217#newcode1515
Line 1515: static const char kHexChars[] = {
Could you use "0123456789ABCDEF" instead?

http://codereview.chromium.org/18452/diff/214/217#newcode1522
Line 1522: std::string ret;
Why not:

std::string ret(size * 2, '\0'); or something?

http://codereview.chromium.org/18452/diff/214/217#newcode1533
Line 1533: write[0] = kHexChars[(b >> 4) & 0xf];
I find write[0] strange if you're treating it like a pointer, why not *write = ?

I personally would have just used an index, and done
write[(i * 2)] = blah
write[(i *  2) + 1] = blah

or something

Powered by Google App Engine
This is Rietveld 408576698