From 5ad2940670b06e0d9ed2db03ea362385d73e86cb Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 27 May 2009 16:22:23 +0200 Subject: Fix gcc warnings. 500815 --- pfind.c | 2 +- pobject.c | 5 +++-- prsa.c | 3 +-- psession.c | 15 +++++++-------- pslot.c | 4 +--- util.c | 2 +- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/pfind.c b/pfind.c index 0c6a9a7..1c82fef 100644 --- a/pfind.c +++ b/pfind.c @@ -517,7 +517,7 @@ pem_FindObjectsInit CK_RV * pError ) { - NSSArena *arena; + NSSArena *arena = NULL; NSSCKMDFindObjects *rv = (NSSCKMDFindObjects *) NULL; struct pemFOStr *fo = (struct pemFOStr *) NULL; pemInternalObject **temp = (pemInternalObject **) NULL; diff --git a/pobject.c b/pobject.c index 0e968dc..96204e9 100644 --- a/pobject.c +++ b/pobject.c @@ -915,7 +915,7 @@ pem_mdObject_GetObjectSize CK_RV * pError ) { - pemInternalObject *io = (pemInternalObject *) mdObject->etc; + /* pemInternalObject *io = (pemInternalObject *) mdObject->etc; */ CK_ULONG rv = 1; /* size is irrelevant to this token */ @@ -980,7 +980,8 @@ pem_CreateObject CK_BBOOL cacert; char *filename; SECItem **derlist = NULL; - int nobjs, i; + int nobjs = 0; + int i; int objid, count, size; pemToken *token; int cipher; diff --git a/prsa.c b/prsa.c index 1391dd3..0b79cd8 100644 --- a/prsa.c +++ b/prsa.c @@ -303,7 +303,7 @@ pem_mdCryptoOperationRSAPriv_Create return &iOperation->mdOperation; } -static CK_RV +static void pem_mdCryptoOperationRSAPriv_Destroy ( NSSCKMDCryptoOperation * mdOperation, @@ -319,7 +319,6 @@ pem_mdCryptoOperationRSAPriv_Destroy nssItem_Destroy(iOperation->buffer); } nss_ZFreeIf(iOperation); - return CKR_OK; } static CK_ULONG diff --git a/psession.c b/psession.c index a25b70a..aa9cfe1 100644 --- a/psession.c +++ b/psession.c @@ -166,7 +166,7 @@ pem_mdSession_CopyObject NSSCKFWToken * fwToken, NSSCKMDInstance * mdInstance, NSSCKFWInstance * fwInstance, - NSSCKFWObject * mdOldObject, + NSSCKMDObject * mdOldObject, NSSCKFWObject * fwOldObject, NSSArena * arena, CK_ATTRIBUTE_PTR pTemplate, @@ -174,8 +174,7 @@ pem_mdSession_CopyObject CK_RV * pError ) { - CK_OBJECT_CLASS objClass; - pemInternalObject *new; + pemInternalObject *new = NULL; NSSCKMDObject *mdObject = nssCKFWObject_GetMDObject(fwOldObject); pemInternalObject *old = (pemInternalObject *) mdObject->etc; CK_RV error = CKR_OK; @@ -195,7 +194,7 @@ pem_mdSession_CopyObject goto loser; } memset(&new->u.cert, 0, sizeof(new->u.cert)); - new->objClass = objClass; + new->objClass = CKO_CERTIFICATE; new->type = pemCert; new->derCert = nss_ZNEW(NULL, SECItem); new->derCert->data = @@ -256,7 +255,7 @@ pem_mdSession_CopyObject goto loser; } memset(&new->u.trust, 0, sizeof(new->u.trust)); - new->objClass = objClass; + new->objClass = CKO_CERTIFICATE; new->type = pemTrust; new->derCert = nss_ZNEW(NULL, SECItem); new->derCert->data = @@ -308,10 +307,10 @@ pem_mdSession_Login { NSSCKFWSlot *fwSlot; CK_SLOT_ID slotID; - pemInternalObject *io; - unsigned char *iv; + pemInternalObject *io = NULL; + unsigned char *iv = 0; unsigned char mykey[32]; - unsigned char *output; + unsigned char *output = NULL; DESContext *cx = NULL; SECStatus rv; unsigned int len = 0; diff --git a/pslot.c b/pslot.c index 587e237..1a7d062 100644 --- a/pslot.c +++ b/pslot.c @@ -138,7 +138,6 @@ pem_NewSlot { NSSArena *arena; NSSCKMDSlot *mdSlot; - pemToken *token = NULL; plog("pem_NewSlot\n"); arena = NSSCKFWInstance_GetArena(fwInstance, pError); @@ -154,9 +153,8 @@ pem_NewSlot return (NSSCKMDSlot *) NULL; } - token = pem_NewToken(fwInstance, pError); + mdSlot->etc = pem_NewToken(fwInstance, pError); - mdSlot->etc = token; mdSlot->GetSlotDescription = pem_mdSlot_GetSlotDescription; mdSlot->GetManufacturerID = pem_mdSlot_GetManufacturerID; mdSlot->GetHardwareVersion = pem_mdSlot_GetHardwareVersion; diff --git a/util.c b/util.c index 338b89d..2ea4f96 100644 --- a/util.c +++ b/util.c @@ -138,7 +138,7 @@ ReadDERFromFile(SECItem *** derlist, char *filename, PRBool ascii, SECStatus rv; PRFileDesc *inFile; int count = 0, size = 0; - SECItem *der; + SECItem *der = NULL; int error; SECItem filedata; char *c, *iv; -- cgit