Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bugs 166734 and 166785: fixed compiler warnings reported by gcc on Li…
…nux.

The patch for this checkin is attached to bug 166785.
  • Loading branch information
wtc%netscape.com committed Sep 6, 2002
1 parent 616f3fc commit 66d991d
Show file tree
Hide file tree
Showing 34 changed files with 36 additions and 111 deletions.
16 changes: 8 additions & 8 deletions security/nss/cmd/lib/secutil.c
Expand Up @@ -684,7 +684,7 @@ static void secu_Newline(FILE *out)
}

void
SECU_PrintAsHex(FILE *out, SECItem *data, char *m, int level)
SECU_PrintAsHex(FILE *out, SECItem *data, const char *m, int level)
{
unsigned i;
int column;
Expand Down Expand Up @@ -1931,7 +1931,8 @@ SECU_PrintCRLInfo(FILE *out, CERTCrl *crl, char *m, int level)
** Pretty print a PKCS7 signed data type (up to version 1).
*/
static int
secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src, char *m, int level)
secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src,
const char *m, int level)
{
SECAlgorithmID *digAlg; /* digest algorithms */
SECItem *aCert; /* certificate */
Expand Down Expand Up @@ -2010,7 +2011,7 @@ secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src, char *m, int level)
*/
static void
secu_PrintPKCS7Enveloped(FILE *out, SEC_PKCS7EnvelopedData *src,
char *m, int level)
const char *m, int level)
{
SEC_PKCS7RecipientInfo *recInfo; /* pointer for signer information */
int iv;
Expand Down Expand Up @@ -2041,7 +2042,7 @@ secu_PrintPKCS7Enveloped(FILE *out, SEC_PKCS7EnvelopedData *src,
static int
secu_PrintPKCS7SignedAndEnveloped(FILE *out,
SEC_PKCS7SignedAndEnvelopedData *src,
char *m, int level)
const char *m, int level)
{
SECAlgorithmID *digAlg; /* pointer for digest algorithms */
SECItem *aCert; /* pointer for certificate */
Expand Down Expand Up @@ -2161,7 +2162,7 @@ SECU_PrintCrl (FILE *out, SECItem *der, char *m, int level)
*/
static void
secu_PrintPKCS7Encrypted(FILE *out, SEC_PKCS7EncryptedData *src,
char *m, int level)
const char *m, int level)
{
SECU_Indent(out, level); fprintf(out, "%s:\n", m);
SECU_PrintInteger(out, &(src->version), "Version", level + 1);
Expand All @@ -2176,7 +2177,7 @@ secu_PrintPKCS7Encrypted(FILE *out, SEC_PKCS7EncryptedData *src,
*/
static void
secu_PrintPKCS7Digested(FILE *out, SEC_PKCS7DigestedData *src,
char *m, int level)
const char *m, int level)
{
SECU_Indent(out, level); fprintf(out, "%s:\n", m);
SECU_PrintInteger(out, &(src->version), "Version", level + 1);
Expand All @@ -2197,7 +2198,7 @@ static int
secu_PrintPKCS7ContentInfo(FILE *out, SEC_PKCS7ContentInfo *src,
char *m, int level)
{
char *desc;
const char *desc;
SECOidTag kind;
int rv;

Expand Down Expand Up @@ -2590,7 +2591,6 @@ void
SECU_PrintPRandOSError(char *progName)
{
char buffer[513];
PRErrorCode err = PR_GetError();
PRInt32 errLen = PR_GetErrorTextLength();
if (errLen > 0 && errLen < sizeof buffer) {
PR_GetErrorText(buffer);
Expand Down
2 changes: 1 addition & 1 deletion security/nss/cmd/lib/secutil.h
Expand Up @@ -183,7 +183,7 @@ extern void SECU_PrintAlgorithmID(FILE *out, SECAlgorithmID *a, char *m,
int level);

/* Print SECItem as hex */
extern void SECU_PrintAsHex(FILE *out, SECItem *i, char *m, int level);
extern void SECU_PrintAsHex(FILE *out, SECItem *i, const char *m, int level);

/* dump a buffer in hex and ASCII */
extern void SECU_PrintBuf(FILE *out, const char *msg, const void *vp, int len);
Expand Down
6 changes: 6 additions & 0 deletions security/nss/cmd/modutil/install.c
Expand Up @@ -40,6 +40,12 @@
#include <prsystem.h>
#include <prproces.h>

#ifdef XP_UNIX
/* for chmod */
#include <sys/types.h>
#include <sys/stat.h>
#endif

/*extern "C" {*/
#include <jar.h>
/*}*/
Expand Down
9 changes: 1 addition & 8 deletions security/nss/cmd/pk12util/pk12util.c
Expand Up @@ -558,9 +558,8 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, PK11SlotInfo *inSlot,
SEC_PKCS12ExportContext *p12ecx = NULL;
SEC_PKCS12SafeInfo *keySafe = NULL, *certSafe = NULL;
SECItem *pwitem = NULL;
PK11SlotInfo *slot = NULL;
p12uContext *p12cxt = NULL;
CERTCertificate *cert;
CERTCertificate *cert = NULL;

if (P12U_InitSlot(inSlot, slotPw) != SECSuccess) {
SECU_PrintError(progName,"Failed to authenticate to \"%s\"",
Expand Down Expand Up @@ -641,9 +640,6 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, PK11SlotInfo *inSlot,
p12u_DestroyExportFileInfo(&p12cxt, PR_FALSE);
SECITEM_ZfreeItem(pwitem, PR_TRUE);
CERT_DestroyCertificate(cert);
if(slot) {
PK11_FreeSlot(slot);
}

fprintf(stdout, "%s: PKCS12 EXPORT SUCCESSFUL\n", progName);
SEC_PKCS12DestroyExportContext(p12ecx);
Expand All @@ -659,9 +655,6 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, PK11SlotInfo *inSlot,
if (p12FilePw)
PR_Free(p12FilePw->data);

if(slot && (slot != cert->slot)) {
PK11_FreeSlot(slot);
}
if(cert) {
CERT_DestroyCertificate(cert);
}
Expand Down
2 changes: 0 additions & 2 deletions security/nss/cmd/sdrtest/sdrtest.c
Expand Up @@ -100,7 +100,6 @@ main (int argc, char **argv)
{
int retval = 0; /* 0 - test succeeded. -1 - test failed */
SECStatus rv;
const char *certDir = ".";
PLOptState *optstate;
char *program_name;
const char *input_file = NULL; /* read encrypted data from here (or create) */
Expand Down Expand Up @@ -236,7 +235,6 @@ main (int argc, char **argv)
}
if (slot) {
PK11_FreeSlot(slot);
slot == NULL;
}

rv = PK11SDR_Encrypt(&keyid, &data, &result, 0);
Expand Down
3 changes: 2 additions & 1 deletion security/nss/cmd/smimetools/cmsutil.c
Expand Up @@ -47,6 +47,7 @@
#include "cms.h"
#include "nss.h"
#include "smime.h"
#include "pk11func.h"

#if defined(XP_UNIX)
#include <unistd.h>
Expand Down Expand Up @@ -195,7 +196,7 @@ struct encryptOptionsStr {

static NSSCMSMessage *
decode(FILE *out, SECItem *output, SECItem *input,
struct decodeOptionsStr *decodeOptions)
const struct decodeOptionsStr *decodeOptions)
{
NSSCMSDecoderContext *dcx;
NSSCMSMessage *cmsg;
Expand Down
8 changes: 1 addition & 7 deletions security/nss/cmd/ssltap/ssltap.c
Expand Up @@ -347,18 +347,12 @@ void partial_packet(int thispacket, int size, int needed)

char * get_time_string(void)
{
struct tm *tm;
char *cp;
char *eol;
time_t tt;

time(&tt);
#if 0
tm = localtime(&tt);
cp = asctime(tm);
#else
cp = ctime(&tt);
#endif
eol = strchr(cp, '\n');
if (eol)
*eol = 0;
Expand Down Expand Up @@ -1060,7 +1054,7 @@ showErr(const char * msg) {

int main(int argc, char *argv[])
{
char *hostname;
char *hostname=NULL;
PRUint16 rendport=DEFPORT,port;
PRHostEnt hp;
PRStatus r;
Expand Down
3 changes: 1 addition & 2 deletions security/nss/cmd/swfort/instinit/instinit.c
Expand Up @@ -148,7 +148,7 @@ usage(char *prog) {
exit(1);
}

main(int argc, char ** argv)
int main(int argc, char ** argv)
{

FORTSignedSWFile * swfile;
Expand All @@ -166,7 +166,6 @@ main(int argc, char ** argv)
char * pass;
SECStatus rv;
int i;
SECMODModule *module;
int64 now; /* XXXX */
char *issuer;
char *transport_pass = NULL;
Expand Down
3 changes: 0 additions & 3 deletions security/nss/lib/certdb/alg1485.c
Expand Up @@ -717,8 +717,6 @@ CERT_NameToAscii(CERTName *name)
CERTAVA** avas;
CERTAVA* ava;
PRBool first = PR_TRUE;
char *buf = NULL;
unsigned buflen = 0;
stringBuf strBuf = { NULL, 0, 0 };

rdns = name->rdns;
Expand Down Expand Up @@ -836,7 +834,6 @@ char *
CERT_GetCertificateEmailAddress(CERTCertificate *cert)
{
char *rawEmailAddr = NULL;
char *emailAddr = NULL;
SECItem subAltName;
SECStatus rv;
CERTGeneralName *nameList = NULL;
Expand Down
4 changes: 0 additions & 4 deletions security/nss/lib/certdb/crl.c
Expand Up @@ -1055,7 +1055,6 @@ PRBool CRLStillExists(CERTSignedCrl* crl)
CK_ULONG crl_class;
PRStatus status;
PK11SlotInfo* slot = NULL;
NSSToken* token = NULL;
nssCryptokiObject instance;
NSSArena* arena;
PRBool xstatus = PR_TRUE;
Expand Down Expand Up @@ -1391,9 +1390,6 @@ SECStatus DPCache_Update(CRLDPCache* cache, CERTCertificate* issuer, int64 t,
SECStatus DPCache_Initialize(CRLDPCache* cache, CERTCertificate* issuer,
SECItem* subject, SECItem* dp)
{
CK_OBJECT_HANDLE crloid = 0;
SECItem* crlder = NULL;

PORT_Assert(cache);
if (!cache) {
return SECFailure;
Expand Down
2 changes: 2 additions & 0 deletions security/nss/lib/certhigh/certhigh.c
Expand Up @@ -388,8 +388,10 @@ CollectNicknames( NSSCertificate *c, void *data)
PRBool saveit = PR_FALSE;
stringNode *node;
int len;
#ifdef notdef
NSSTrustDomain *td;
NSSTrust *trust;
#endif
char *stanNickname;
char *nickname = NULL;

Expand Down
2 changes: 0 additions & 2 deletions security/nss/lib/certhigh/certvfy.c
Expand Up @@ -1192,8 +1192,6 @@ CERT_VerifyCertificate(CERTCertDBHandle *handle, CERTCertificate *cert,
PRBool checkedChain = PR_FALSE;
PRInt32 i;
SECCertUsage certUsage = 0;
PRBool doOCSP = PR_FALSE;
PRBool checkedCRL = PR_FALSE;
PRBool checkedOCSP = PR_FALSE;
PRBool checkAllUsages = PR_FALSE;
PRBool revoked = PR_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion security/nss/lib/ckfw/builtins/nssckbi.h
Expand Up @@ -61,4 +61,4 @@
#define NSS_BUILTINS_FIRMWARE_VERSION_MAJOR 1
#define NSS_BUILTINS_FIRMWARE_VERSION_MINOR 0

#endif NSSCKBI_H
#endif /* NSSCKBI_H */
8 changes: 0 additions & 8 deletions security/nss/lib/ckfw/find.c
Expand Up @@ -135,7 +135,6 @@ nssCKFWFindObjects_Create
)
{
NSSCKFWFindObjects *fwFindObjects = NULL;
NSSArena *arena;
NSSCKMDSession *mdSession;
NSSCKMDToken *mdToken;
NSSCKMDInstance *mdInstance;
Expand All @@ -144,13 +143,6 @@ nssCKFWFindObjects_Create
mdToken = nssCKFWToken_GetMDToken(fwToken);
mdInstance = nssCKFWInstance_GetMDInstance(fwInstance);

#ifdef notdef
arena = nssCKFWSession_GetArena(fwSession, pError);
if( (NSSArena *)NULL == arena ) {
goto loser;
}
#endif

fwFindObjects = nss_ZNEW(NULL, NSSCKFWFindObjects);
if( (NSSCKFWFindObjects *)NULL == fwFindObjects ) {
*pError = CKR_HOST_MEMORY;
Expand Down
8 changes: 0 additions & 8 deletions security/nss/lib/ckfw/wrap.c
Expand Up @@ -2500,7 +2500,6 @@ NSSCKFWC_FindObjects
NSSCKFWSession *fwSession;
NSSCKFWFindObjects *fwFindObjects;
CK_ULONG i;
NSSArena *arena;

if( (NSSCKFWInstance *)NULL == fwInstance ) {
error = CKR_CRYPTOKI_NOT_INITIALIZED;
Expand All @@ -2513,13 +2512,6 @@ NSSCKFWC_FindObjects
goto loser;
}

#ifdef notdef
arena = nssCKFWSession_GetArena(fwSession, &error);
if( (NSSArena *)NULL == arena ) {
goto loser;
}
#endif

if( (CK_OBJECT_HANDLE_PTR)CK_NULL_PTR == phObject ) {
error = CKR_ARGUMENTS_BAD;
goto loser;
Expand Down
2 changes: 1 addition & 1 deletion security/nss/lib/dev/devslot.c
Expand Up @@ -91,6 +91,7 @@ static PRIntervalTime s_token_delay_time = 0;
/* The flags needed to open a read-only session. */
static const CK_FLAGS s_ck_readonly_flags = CKF_SERIAL_SESSION;

#ifdef PURE_STAN_BUILD
/* In pk11slot.c, this was a no-op. So it is here also. */
static CK_RV PR_CALLBACK
nss_ck_slot_notify
Expand All @@ -103,7 +104,6 @@ nss_ck_slot_notify
return CKR_OK;
}

#ifdef PURE_STAN_BUILD
NSS_IMPLEMENT NSSSlot *
nssSlot_Create
(
Expand Down
2 changes: 1 addition & 1 deletion security/nss/lib/fortcrypt/swfort/swfparse.c
Expand Up @@ -334,7 +334,7 @@ FORT_GetSWFile(SECItem *initBits)

/* copy the DER into the arena, since Quick DER returns data that points
into the DER input, which may get freed by the caller */
rv = SECITEM_CopyItem(arena, &newInitBits, &initBits);
rv = SECITEM_CopyItem(arena, &newInitBits, initBits);
if ( rv != SECSuccess ) {
goto fail;
}
Expand Down
4 changes: 2 additions & 2 deletions security/nss/lib/pk11wrap/pk11cert.c
Expand Up @@ -792,6 +792,7 @@ typedef struct pk11DoCertCallbackStr {
void *callbackArg;
} pk11DoCertCallback;

#ifdef NSS_CLASSIC
/*
* callback to map object handles to certificate structures.
*/
Expand Down Expand Up @@ -823,6 +824,7 @@ pk11_DoCerts(PK11SlotInfo *slot, CK_OBJECT_HANDLE certID, void *arg)

return SECSuccess;
}
#endif

static SECStatus
pk11_CollectCrls(PK11SlotInfo *slot, CK_OBJECT_HANDLE crlID, void *arg)
Expand Down Expand Up @@ -2264,8 +2266,6 @@ PK11_FindCertAndKeyByRecipientList(PK11SlotInfo **slotPtr,
SEC_PKCS7RecipientInfo **array, SEC_PKCS7RecipientInfo **rip,
SECKEYPrivateKey**privKey, void *wincx)
{
CK_OBJECT_HANDLE certHandle = CK_INVALID_HANDLE;
CK_OBJECT_HANDLE keyHandle = CK_INVALID_HANDLE;
CERTCertificate *cert = NULL;
SECStatus rv;

Expand Down
4 changes: 2 additions & 2 deletions security/nss/lib/pk11wrap/pk11load.c
Expand Up @@ -46,13 +46,13 @@ extern void FC_GetFunctionList(void);
extern void NSC_GetFunctionList(void);
extern void NSC_ModuleDBFunc(void);

static char *modToDBG = NULL;

#ifdef DEBUG
#define DEBUG_MODULE 1
#endif

#ifdef DEBUG_MODULE
static char *modToDBG = NULL;

#include "debug_module.c"
#endif

Expand Down
1 change: 0 additions & 1 deletion security/nss/lib/pk11wrap/pk11pqg.c
Expand Up @@ -58,7 +58,6 @@ PK11_PQG_ParamGenSeedLen( unsigned int j, unsigned int seedBytes,
CK_MECHANISM mechanism;
CK_OBJECT_HANDLE objectID = CK_INVALID_HANDLE;
CK_RV crv;
CK_BBOOL cktrue = CK_TRUE;
CK_ATTRIBUTE pTemplate[] = {
{ CKA_PRIME, NULL, 0 },
{ CKA_SUBPRIME, NULL, 0 },
Expand Down
1 change: 0 additions & 1 deletion security/nss/lib/pk11wrap/pk11slot.c
Expand Up @@ -536,7 +536,6 @@ SECMOD_HasRootCerts(void)
SECMODModuleList *modules = SECMOD_GetDefaultModuleList();
SECMODListLock *moduleLock = SECMOD_GetDefaultModuleListLock();
int i;
PK11SlotInfo *slot = NULL;
PRBool found = PR_FALSE;

/* work through all the slots */
Expand Down
2 changes: 1 addition & 1 deletion security/nss/lib/pk11wrap/pk11util.c
Expand Up @@ -708,5 +708,5 @@ SECMOD_DestroyModuleList(SECMODModuleList *list) {
PRBool
SECMOD_CanDeleteInternalModule(void)
{
return (PRBool) pendingModule == NULL;
return (PRBool) (pendingModule == NULL);
}

0 comments on commit 66d991d

Please sign in to comment.