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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/url_canon_host.cc ('k') | src/url_canon_ip.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007, Google Inc. 1 // Copyright 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (repl_source.path) source->path = utf8_buffer->data(); 379 if (repl_source.path) source->path = utf8_buffer->data();
380 if (repl_source.query) source->query = utf8_buffer->data(); 380 if (repl_source.query) source->query = utf8_buffer->data();
381 if (repl_source.ref) source->ref = utf8_buffer->data(); 381 if (repl_source.ref) source->ref = utf8_buffer->data();
382 382
383 return success; 383 return success;
384 } 384 }
385 385
386 #ifndef WIN32 386 #ifndef WIN32
387 387
388 int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix) { 388 int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix) {
389 if (radix != 10) 389 const char* format_str;
390 if (radix == 10)
391 format_str = "%d";
392 else if (radix == 16)
393 format_str = "%x";
394 else
390 return EINVAL; 395 return EINVAL;
391 396
392 int written = snprintf(buffer, size_in_chars, "%d", value); 397 int written = snprintf(buffer, size_in_chars, format_str, value);
393 if (static_cast<size_t>(written) >= size_in_chars) { 398 if (static_cast<size_t>(written) >= size_in_chars) {
394 // Output was truncated, or written was negative. 399 // Output was truncated, or written was negative.
395 return EINVAL; 400 return EINVAL;
396 } 401 }
397 return 0; 402 return 0;
398 } 403 }
399 404
400 int _itow_s(int value, char16* buffer, size_t size_in_chars, int radix) { 405 int _itow_s(int value, char16* buffer, size_t size_in_chars, int radix) {
401 if (radix != 10) 406 if (radix != 10)
402 return EINVAL; 407 return EINVAL;
(...skipping 10 matching lines...) Expand all
413 for (int i = 0; i < written; ++i) { 418 for (int i = 0; i < written; ++i) {
414 buffer[i] = static_cast<char16>(temp[i]); 419 buffer[i] = static_cast<char16>(temp[i]);
415 } 420 }
416 buffer[written] = '\0'; 421 buffer[written] = '\0';
417 return 0; 422 return 0;
418 } 423 }
419 424
420 #endif // !WIN32 425 #endif // !WIN32
421 426
422 } // namespace url_canon 427 } // namespace url_canon
OLDNEW
« 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