Bugzilla Bug 295754: moved duplicate function subject_list_sort to
certificate.c and renamed it nssCertificate_SubjectListSort. r=relyea,nelsonb. Modified files: certificate.c pkim.h pkistore.c tdcache.c git-svn-id: svn://10.0.0.236/trunk@175181 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
1ba101d8ac
commit
b6f31e5070
@ -35,7 +35,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.53 $ $Date: 2005-01-20 02:25:48 $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: certificate.c,v $ $Revision: 1.54 $ $Date: 2005-06-27 21:50:06 $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef NSSPKI_H
|
||||
@ -767,6 +767,26 @@ NSSCertificate_IsPrivateKeyAvailable (
|
||||
return isUser;
|
||||
}
|
||||
|
||||
/* sort the subject cert list from newest to oldest */
|
||||
PRIntn
|
||||
nssCertificate_SubjectListSort (
|
||||
void *v1,
|
||||
void *v2
|
||||
)
|
||||
{
|
||||
NSSCertificate *c1 = (NSSCertificate *)v1;
|
||||
NSSCertificate *c2 = (NSSCertificate *)v2;
|
||||
nssDecodedCert *dc1 = nssCertificate_GetDecoding(c1);
|
||||
nssDecodedCert *dc2 = nssCertificate_GetDecoding(c2);
|
||||
if (!dc1) {
|
||||
return dc2 ? 1 : 0;
|
||||
} else if (!dc2) {
|
||||
return -1;
|
||||
} else {
|
||||
return dc1->isNewerThan(dc1, dc2) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
NSS_IMPLEMENT PRBool
|
||||
NSSUserCertificate_IsStillPresent (
|
||||
NSSUserCertificate *uc,
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
#define PKIM_H
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.26 $ $Date: 2005-03-04 04:32:04 $";
|
||||
static const char PKIM_CVS_ID[] = "@(#) $RCSfile: pkim.h,v $ $Revision: 1.27 $ $Date: 2005-06-27 21:50:06 $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef BASE_H
|
||||
@ -233,6 +233,13 @@ nssCertificate_GetDecoding
|
||||
NSSCertificate *c
|
||||
);
|
||||
|
||||
extern PRIntn
|
||||
nssCertificate_SubjectListSort
|
||||
(
|
||||
void *v1,
|
||||
void *v2
|
||||
);
|
||||
|
||||
NSS_EXTERN nssDecodedCert *
|
||||
nssDecodedCert_Create
|
||||
(
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.25 $ $Date: 2005-06-24 00:33:28 $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.26 $ $Date: 2005-06-27 21:50:06 $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef PKIM_H
|
||||
@ -89,25 +89,6 @@ struct certificate_hash_entry_str
|
||||
nssSMIMEProfile *profile;
|
||||
};
|
||||
|
||||
/* XXX This a common function that should be moved out, possibly an
|
||||
* nssSubjectCertificateList should be created?
|
||||
*/
|
||||
/* sort the subject list from newest to oldest */
|
||||
static PRIntn subject_list_sort(void *v1, void *v2)
|
||||
{
|
||||
NSSCertificate *c1 = (NSSCertificate *)v1;
|
||||
NSSCertificate *c2 = (NSSCertificate *)v2;
|
||||
nssDecodedCert *dc1 = nssCertificate_GetDecoding(c1);
|
||||
nssDecodedCert *dc2 = nssCertificate_GetDecoding(c2);
|
||||
if (!dc1) {
|
||||
return dc2 ? 1 : 0;
|
||||
} else if (!dc2) {
|
||||
return -1;
|
||||
} else {
|
||||
return dc1->isNewerThan(dc1, dc2) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
NSS_IMPLEMENT nssCertificateStore *
|
||||
nssCertificateStore_Create (
|
||||
NSSArena *arenaOpt
|
||||
@ -225,7 +206,7 @@ add_subject_entry (
|
||||
if (!subjectList) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
nssList_SetSortFunction(subjectList, subject_list_sort);
|
||||
nssList_SetSortFunction(subjectList, nssCertificate_SubjectListSort);
|
||||
/* Add the cert entry to this list of subjects */
|
||||
nssrv = nssList_Add(subjectList, cert);
|
||||
if (nssrv != PR_SUCCESS) {
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.41 $ $Date: 2005-06-24 00:33:28 $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: tdcache.c,v $ $Revision: 1.42 $ $Date: 2005-06-27 21:50:06 $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef PKIM_H
|
||||
@ -150,22 +150,6 @@ new_cache_entry(NSSArena *arena, void *value, PRBool ownArena)
|
||||
return ce;
|
||||
}
|
||||
|
||||
/* sort the subject list from newest to oldest */
|
||||
static PRIntn subject_list_sort(void *v1, void *v2)
|
||||
{
|
||||
NSSCertificate *c1 = (NSSCertificate *)v1;
|
||||
NSSCertificate *c2 = (NSSCertificate *)v2;
|
||||
nssDecodedCert *dc1 = nssCertificate_GetDecoding(c1);
|
||||
nssDecodedCert *dc2 = nssCertificate_GetDecoding(c2);
|
||||
if (!dc1) {
|
||||
return dc2 ? 1 : 0;
|
||||
} else if (!dc2) {
|
||||
return -1;
|
||||
} else {
|
||||
return dc1->isNewerThan(dc1, dc2) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* this should not be exposed in a header, but is here to keep the above
|
||||
* types/functions static
|
||||
*/
|
||||
@ -598,7 +582,7 @@ add_subject_entry (
|
||||
if (nickname) {
|
||||
ce->nickname = nssUTF8_Duplicate(nickname, arena);
|
||||
}
|
||||
nssList_SetSortFunction(list, subject_list_sort);
|
||||
nssList_SetSortFunction(list, nssCertificate_SubjectListSort);
|
||||
/* Add the cert entry to this list of subjects */
|
||||
nssrv = nssList_AddUnique(list, cert);
|
||||
if (nssrv != PR_SUCCESS) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user