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

Unified Diff: src/url_canon_internal.cc

Issue 99183: Canonicalize IPv6 addresses. (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: address pmarks comments Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/url_canon_host.cc ('k') | src/url_canon_ip.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/url_canon_internal.cc
===================================================================
--- src/url_canon_internal.cc (revision 103)
+++ src/url_canon_internal.cc (working copy)
@@ -386,10 +386,15 @@
#ifndef WIN32
int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix) {
- if (radix != 10)
+ const char* format_str;
+ if (radix == 10)
+ format_str = "%d";
+ else if (radix == 16)
+ format_str = "%x";
+ else
return EINVAL;
- int written = snprintf(buffer, size_in_chars, "%d", value);
+ int written = snprintf(buffer, size_in_chars, format_str, value);
if (static_cast<size_t>(written) >= size_in_chars) {
// Output was truncated, or written was negative.
return EINVAL;
« no previous file with comments | « src/url_canon_host.cc ('k') | src/url_canon_ip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698