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

Side by Side Diff: nss/mozilla/security/nss/lib/util/secitem.c

Issue 10540165: Update NSS to NSS 3.13.5 (from NSS 3.13.3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 6 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 19 matching lines...) Expand all
30 * decision by deleting the provisions above and replace them with the notice 30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete 31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under 32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL. 33 * the terms of any one of the MPL, the GPL or the LGPL.
34 * 34 *
35 * ***** END LICENSE BLOCK ***** */ 35 * ***** END LICENSE BLOCK ***** */
36 36
37 /* 37 /*
38 * Support routines for SECItem data structure. 38 * Support routines for SECItem data structure.
39 * 39 *
40 * $Id: secitem.c,v 1.16 2011/07/22 21:22:40 wtc%google.com Exp $ 40 * $Id: secitem.c,v 1.17 2012/03/23 03:12:16 wtc%google.com Exp $
41 */ 41 */
42 42
43 #include "seccomon.h" 43 #include "seccomon.h"
44 #include "secitem.h" 44 #include "secitem.h"
45 #include "base64.h" 45 #include "base64.h"
46 #include "secerr.h" 46 #include "secerr.h"
47 47
48 SECItem * 48 SECItem *
49 SECITEM_AllocItem(PRArenaPool *arena, SECItem *item, unsigned int len) 49 SECITEM_AllocItem(PRArenaPool *arena, SECItem *item, unsigned int len)
50 { 50 {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return SECFailure; 146 return SECFailure;
147 } 147 }
148 148
149 return SECSuccess; 149 return SECSuccess;
150 } 150 }
151 151
152 SECComparison 152 SECComparison
153 SECITEM_CompareItem(const SECItem *a, const SECItem *b) 153 SECITEM_CompareItem(const SECItem *a, const SECItem *b)
154 { 154 {
155 unsigned m; 155 unsigned m;
156 SECComparison rv; 156 int rv;
157 157
158 if (a == b) 158 if (a == b)
159 return SECEqual; 159 return SECEqual;
160 if (!a || !a->len || !a->data) 160 if (!a || !a->len || !a->data)
161 return (!b || !b->len || !b->data) ? SECEqual : SECLessThan; 161 return (!b || !b->len || !b->data) ? SECEqual : SECLessThan;
162 if (!b || !b->len || !b->data) 162 if (!b || !b->len || !b->data)
163 return SECGreaterThan; 163 return SECGreaterThan;
164 164
165 m = ( ( a->len < b->len ) ? a->len : b->len ); 165 m = ( ( a->len < b->len ) ? a->len : b->len );
166 166
167 rv = (SECComparison) PORT_Memcmp(a->data, b->data, m); 167 rv = PORT_Memcmp(a->data, b->data, m);
168 if (rv) { 168 if (rv) {
169 » return rv; 169 » return rv < 0 ? SECLessThan : SECGreaterThan;
170 } 170 }
171 if (a->len < b->len) { 171 if (a->len < b->len) {
172 return SECLessThan; 172 return SECLessThan;
173 } 173 }
174 if (a->len == b->len) { 174 if (a->len == b->len) {
175 return SECEqual; 175 return SECEqual;
176 } 176 }
177 return SECGreaterThan; 177 return SECGreaterThan;
178 } 178 }
179 179
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 * but heck it's only used internally by the hash table anyway. 319 * but heck it's only used internally by the hash table anyway.
320 */ 320 */
321 PRIntn PR_CALLBACK 321 PRIntn PR_CALLBACK
322 SECITEM_HashCompare ( const void *k1, const void *k2) 322 SECITEM_HashCompare ( const void *k1, const void *k2)
323 { 323 {
324 const SECItem *i1 = (const SECItem *)k1; 324 const SECItem *i1 = (const SECItem *)k1;
325 const SECItem *i2 = (const SECItem *)k2; 325 const SECItem *i2 = (const SECItem *)k2;
326 326
327 return SECITEM_ItemsAreEqual(i1,i2); 327 return SECITEM_ItemsAreEqual(i1,i2);
328 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698