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

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

Issue 9845017: Fix a few warnings that -Wnull-conversion of a future clang will complain about. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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
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/base/x509_util_mac.h" 5 #include "net/base/x509_util_mac.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/apple_apsl/cssmapplePriv.h" 8 #include "third_party/apple_apsl/cssmapplePriv.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (status) 126 if (status)
127 return status; 127 return status;
128 CFArrayAppendValue(policies, crl_policy); 128 CFArrayAppendValue(policies, crl_policy);
129 CFRelease(crl_policy); 129 CFRelease(crl_policy);
130 } 130 }
131 131
132 return status; 132 return status;
133 } 133 }
134 134
135 CSSMFieldValue::CSSMFieldValue() 135 CSSMFieldValue::CSSMFieldValue()
136 : cl_handle_(NULL), 136 : cl_handle_(0),
Mark Mentovai 2012/03/27 21:09:59 CSSM_INVALID_HANDLE in this file.
137 oid_(NULL), 137 oid_(NULL),
138 field_(NULL) { 138 field_(NULL) {
139 } 139 }
140 CSSMFieldValue::CSSMFieldValue(CSSM_CL_HANDLE cl_handle, 140 CSSMFieldValue::CSSMFieldValue(CSSM_CL_HANDLE cl_handle,
141 const CSSM_OID* oid, 141 const CSSM_OID* oid,
142 CSSM_DATA_PTR field) 142 CSSM_DATA_PTR field)
143 : cl_handle_(cl_handle), 143 : cl_handle_(cl_handle),
144 oid_(const_cast<CSSM_OID_PTR>(oid)), 144 oid_(const_cast<CSSM_OID_PTR>(oid)),
145 field_(field) { 145 field_(field) {
146 } 146 }
147 147
148 CSSMFieldValue::~CSSMFieldValue() { 148 CSSMFieldValue::~CSSMFieldValue() {
149 Reset(NULL, NULL, NULL); 149 Reset(0, NULL, NULL);
150 } 150 }
151 151
152 void CSSMFieldValue::Reset(CSSM_CL_HANDLE cl_handle, 152 void CSSMFieldValue::Reset(CSSM_CL_HANDLE cl_handle,
153 CSSM_OID_PTR oid, 153 CSSM_OID_PTR oid,
154 CSSM_DATA_PTR field) { 154 CSSM_DATA_PTR field) {
155 if (cl_handle_ && oid_ && field_) 155 if (cl_handle_ && oid_ && field_)
156 CSSM_CL_FreeFieldValue(cl_handle_, oid_, field_); 156 CSSM_CL_FreeFieldValue(cl_handle_, oid_, field_);
157 cl_handle_ = cl_handle; 157 cl_handle_ = cl_handle;
158 oid_ = oid; 158 oid_ = oid;
159 field_ = field; 159 field_ = field;
160 } 160 }
161 161
162 CSSMCachedCertificate::CSSMCachedCertificate() 162 CSSMCachedCertificate::CSSMCachedCertificate()
163 : cl_handle_(NULL), 163 : cl_handle_(0),
164 cached_cert_handle_(NULL) { 164 cached_cert_handle_(0) {
165 } 165 }
166 CSSMCachedCertificate::~CSSMCachedCertificate() { 166 CSSMCachedCertificate::~CSSMCachedCertificate() {
167 if (cl_handle_ && cached_cert_handle_) 167 if (cl_handle_ && cached_cert_handle_)
168 CSSM_CL_CertAbortCache(cl_handle_, cached_cert_handle_); 168 CSSM_CL_CertAbortCache(cl_handle_, cached_cert_handle_);
169 } 169 }
170 170
171 OSStatus CSSMCachedCertificate::Init(SecCertificateRef os_cert_handle) { 171 OSStatus CSSMCachedCertificate::Init(SecCertificateRef os_cert_handle) {
172 DCHECK(!cl_handle_ && !cached_cert_handle_); 172 DCHECK(!cl_handle_ && !cached_cert_handle_);
173 DCHECK(os_cert_handle); 173 DCHECK(os_cert_handle);
174 CSSM_DATA cert_data; 174 CSSM_DATA cert_data;
(...skipping 12 matching lines...) Expand all
187 return status; 187 return status;
188 } 188 }
189 189
190 OSStatus CSSMCachedCertificate::GetField(const CSSM_OID* field_oid, 190 OSStatus CSSMCachedCertificate::GetField(const CSSM_OID* field_oid,
191 CSSMFieldValue* field) const { 191 CSSMFieldValue* field) const {
192 DCHECK(cl_handle_); 192 DCHECK(cl_handle_);
193 DCHECK(cached_cert_handle_); 193 DCHECK(cached_cert_handle_);
194 194
195 CSSM_OID_PTR oid = const_cast<CSSM_OID_PTR>(field_oid); 195 CSSM_OID_PTR oid = const_cast<CSSM_OID_PTR>(field_oid);
196 CSSM_DATA_PTR field_ptr = NULL; 196 CSSM_DATA_PTR field_ptr = NULL;
197 CSSM_HANDLE results_handle = NULL; 197 CSSM_HANDLE results_handle = 0;
198 uint32 field_value_count = 0; 198 uint32 field_value_count = 0;
199 CSSM_RETURN status = CSSM_CL_CertGetFirstCachedFieldValue( 199 CSSM_RETURN status = CSSM_CL_CertGetFirstCachedFieldValue(
200 cl_handle_, cached_cert_handle_, oid, &results_handle, 200 cl_handle_, cached_cert_handle_, oid, &results_handle,
201 &field_value_count, &field_ptr); 201 &field_value_count, &field_ptr);
202 if (status) 202 if (status)
203 return status; 203 return status;
204 204
205 // Note: |field_value_count| may be > 1, indicating that more than one 205 // Note: |field_value_count| may be > 1, indicating that more than one
206 // value is present. This may happen with extensions, but for current 206 // value is present. This may happen with extensions, but for current
207 // usages, only the first value is returned. 207 // usages, only the first value is returned.
208 CSSM_CL_CertAbortQuery(cl_handle_, results_handle); 208 CSSM_CL_CertAbortQuery(cl_handle_, results_handle);
209 field->Reset(cl_handle_, oid, field_ptr); 209 field->Reset(cl_handle_, oid, field_ptr);
210 return CSSM_OK; 210 return CSSM_OK;
211 } 211 }
212 212
213 } // namespace x509_util 213 } // namespace x509_util
214 214
215 } // namespace net 215 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698