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

Side by Side Diff: net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp

Issue 6602049: Pure pedantry: Replace all ".size() == 0" with ".empty()". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 /* ***** BEGIN LICENSE BLOCK ***** 1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 * 3 *
4 * The contents of this file are subject to the Mozilla Public License Version 4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with 5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at 6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/ 7 * http://www.mozilla.org/MPL/
8 * 8 *
9 * Software distributed under the License is distributed on an "AS IS" basis, 9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 int rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, false, 270 int rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, false,
271 slot); 271 slot);
272 272
273 // When the user entered a zero length password: 273 // When the user entered a zero length password:
274 // An empty password should be represented as an empty 274 // An empty password should be represented as an empty
275 // string (a SECItem that contains a single terminating 275 // string (a SECItem that contains a single terminating
276 // NULL UTF16 character), but some applications use a 276 // NULL UTF16 character), but some applications use a
277 // zero length SECItem. 277 // zero length SECItem.
278 // We try both variations, zero length item and empty string, 278 // We try both variations, zero length item and empty string,
279 // without giving a user prompt when trying the different empty password fla vors. 279 // without giving a user prompt when trying the different empty password fla vors.
280 if (rv == net::ERR_PKCS12_IMPORT_BAD_PASSWORD && password.size() == 0) { 280 if (rv == net::ERR_PKCS12_IMPORT_BAD_PASSWORD && password.empty()) {
281 rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, true, 281 rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, true,
282 slot); 282 slot);
283 } 283 }
284 return rv; 284 return rv;
285 } 285 }
286 286
287 // Based on nsPKCS12Blob::ExportToFile 287 // Based on nsPKCS12Blob::ExportToFile
288 // 288 //
289 // Having already loaded the certs, form them into a blob (loading the keys 289 // Having already loaded the certs, form them into a blob (loading the keys
290 // also), encode the blob, and stuff it into the file. 290 // also), encode the blob, and stuff it into the file.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 finish: 387 finish:
388 if (srv) 388 if (srv)
389 LOG(ERROR) << "PKCS#12 export failed with error " << PORT_GetError(); 389 LOG(ERROR) << "PKCS#12 export failed with error " << PORT_GetError();
390 if (ecx) 390 if (ecx)
391 SEC_PKCS12DestroyExportContext(ecx); 391 SEC_PKCS12DestroyExportContext(ecx);
392 SECITEM_ZfreeItem(&unicodePw, PR_FALSE); 392 SECITEM_ZfreeItem(&unicodePw, PR_FALSE);
393 return return_count; 393 return return_count;
394 } 394 }
395 395
396 } // namespace mozilla_security_manager 396 } // namespace mozilla_security_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698