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

Side by Side Diff: net/cert/x509_cert_types_win.cc

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « net/cert/jwk_serializer_openssl.cc ('k') | net/cert/x509_certificate_openssl.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cert/x509_cert_types.h" 5 #include "net/cert/x509_cert_types.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (chars_needed == 1) { 43 if (chars_needed == 1) {
44 // The value is actually an empty string (chars_needed includes a single 44 // The value is actually an empty string (chars_needed includes a single
45 // char for a NULL value). Don't bother converting - just clear the 45 // char for a NULL value). Don't bother converting - just clear the
46 // string. 46 // string.
47 value->clear(); 47 value->clear();
48 return true; 48 return true;
49 } 49 }
50 std::wstring wide_name; 50 std::wstring wide_name;
51 DWORD chars_written = CertRDNValueToStrW( 51 DWORD chars_written = CertRDNValueToStrW(
52 attribute->dwValueType, &attribute->Value, 52 attribute->dwValueType, &attribute->Value,
53 WriteInto(&wide_name, chars_needed), chars_needed); 53 base::WriteInto(&wide_name, chars_needed), chars_needed);
54 if (chars_written <= 1) 54 if (chars_written <= 1)
55 return false; 55 return false;
56 wide_name.resize(chars_written - 1); 56 wide_name.resize(chars_written - 1);
57 *value = base::WideToUTF8(wide_name); 57 *value = base::WideToUTF8(wide_name);
58 return true; 58 return true;
59 } 59 }
60 60
61 // Adds a type+value pair to the appropriate vector from a C array. 61 // Adds a type+value pair to the appropriate vector from a C array.
62 // The array is keyed by the matching OIDs from kOIDS[]. 62 // The array is keyed by the matching OIDs from kOIDS[].
63 bool AddTypeValuePair(PCERT_RDN_ATTR attribute, 63 bool AddTypeValuePair(PCERT_RDN_ATTR attribute,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 SetSingle(common_names, &this->common_name); 132 SetSingle(common_names, &this->common_name);
133 SetSingle(locality_names, &this->locality_name); 133 SetSingle(locality_names, &this->locality_name);
134 SetSingle(state_names, &this->state_or_province_name); 134 SetSingle(state_names, &this->state_or_province_name);
135 SetSingle(country_names, &this->country_name); 135 SetSingle(country_names, &this->country_name);
136 return true; 136 return true;
137 } 137 }
138 138
139 } // namespace net 139 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/jwk_serializer_openssl.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698