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

Side by Side Diff: net/base/x509_cert_types.cc

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix call syntax of StringToInt() in Chrome OS code. Created 9 years 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
« no previous file with comments | « net/base/net_util.cc ('k') | net/ftp/ftp_ctrl_response_buffer.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 (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/x509_cert_types.h" 5 #include "net/base/x509_cert_types.h"
6 6
7 #include "net/base/x509_certificate.h" 7 #include "net/base/x509_certificate.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 // Helper for ParseCertificateDate. |*field| must contain at least 17 // Helper for ParseCertificateDate. |*field| must contain at least
18 // |field_len| characters. |*field| will be advanced by |field_len| on exit. 18 // |field_len| characters. |*field| will be advanced by |field_len| on exit.
19 // |*ok| is set to false if there is an error in parsing the number, but left 19 // |*ok| is set to false if there is an error in parsing the number, but left
20 // untouched otherwise. Returns the parsed integer. 20 // untouched otherwise. Returns the parsed integer.
21 int ParseIntAndAdvance(const char** field, size_t field_len, bool* ok) { 21 int ParseIntAndAdvance(const char** field, size_t field_len, bool* ok) {
22 int result = 0; 22 int result = 0;
23 *ok &= base::StringToInt(*field, *field + field_len, &result); 23 *ok &= base::StringToInt(base::StringPiece(*field, field_len), &result);
24 *field += field_len; 24 *field += field_len;
25 return result; 25 return result;
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 CertPrincipal::CertPrincipal() { 30 CertPrincipal::CertPrincipal() {
31 } 31 }
32 32
33 CertPrincipal::CertPrincipal(const std::string& name) : common_name(name) {} 33 CertPrincipal::CertPrincipal(const std::string& name) : common_name(name) {}
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 valid &= exploded.HasValidValues(); 117 valid &= exploded.HasValidValues();
118 118
119 if (!valid) 119 if (!valid)
120 return false; 120 return false;
121 121
122 *time = base::Time::FromUTCExploded(exploded); 122 *time = base::Time::FromUTCExploded(exploded);
123 return true; 123 return true;
124 } 124 }
125 125
126 } // namespace net 126 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | net/ftp/ftp_ctrl_response_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698