Bug 433177: fixed GCC compiler warnings. r=julien.pierre
authorwtc%google.com
Tue, 13 May 2008 01:20:05 +0000
changeset 8592 c709cdf9151b363bb0b0b43710ad3360950cf886
parent 8591 cccb207e44c53ff4279ccfe42a1efe51753f8d33
child 8593 0b86f95a811519d5f1fc656bb53d7edcbeb17dbc
push idunknown
push userunknown
push dateunknown
reviewersjulien.pierre
bugs433177
Bug 433177: fixed GCC compiler warnings. r=julien.pierre Modified Files: freebl/ec.c freebl/genload.c freebl/ldvector.c util/dertime.c util/oidstring.c
security/nss/lib/freebl/ec.c
security/nss/lib/freebl/genload.c
security/nss/lib/freebl/ldvector.c
security/nss/lib/util/dertime.c
security/nss/lib/util/oidstring.c
--- a/security/nss/lib/freebl/ec.c
+++ b/security/nss/lib/freebl/ec.c
@@ -349,16 +349,17 @@ EC_NewKeyFromSeed(ECParams *ecParams, EC
 #ifdef NSS_ENABLE_ECC
     rv = ec_NewKey(ecParams, privKey, seed, seedlen);
 #else
     PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
 #endif /* NSS_ENABLE_ECC */
     return rv;
 }
 
+#ifdef NSS_ENABLE_ECC
 /* Generate a random private key using the algorithm A.4.1 of ANSI X9.62,
  * modified a la FIPS 186-2 Change Notice 1 to eliminate the bias in the
  * random number generator.
  *
  * Parameters
  * - order: a buffer that holds the curve's group order
  * - len: the length in octets of the order buffer
  *
@@ -404,16 +405,17 @@ cleanup:
 	rv = SECFailure;
     }
     if (rv != SECSuccess && privKeyBytes) {
 	PORT_Free(privKeyBytes);
 	privKeyBytes = NULL;
     }
     return privKeyBytes;
 }
+#endif /* NSS_ENABLE_ECC */
 
 /* Generates a new EC key pair. The private key is a random value and
  * the public key is the result of performing a scalar point multiplication
  * of that value with the curve's base point.
  */
 SECStatus 
 EC_NewKey(ECParams *ecParams, ECPrivateKey **privKey)
 {
--- a/security/nss/lib/freebl/genload.c
+++ b/security/nss/lib/freebl/genload.c
@@ -148,17 +148,17 @@ loader_LoadLibrary(const char *nameToLoa
     /* Get the pathname for nameOfAlreadyLoadedLib, i.e. /usr/lib/libnss3.so
      * PR_GetLibraryFilePathname works with either the base library name or a
      * function pointer, depending on the platform. We can't query an exported
      * symbol such as NSC_GetFunctionList, because on some platforms we can't
      * find symbols in loaded implicit dependencies.
      * But we can just get the address of this function !
      */
     fullPath = PR_GetLibraryFilePathname(NameOfThisSharedLib,
-                                         &loader_LoadLibrary);
+                                         (PRFuncPtr)&loader_LoadLibrary);
 
     if (fullPath) {
         lib = loader_LoadLibInReferenceDir(fullPath, nameToLoad);
 #ifdef XP_UNIX
         if (!lib) {
             /*
              * If fullPath is a symbolic link, resolve the symbolic
              * link and try again.
--- a/security/nss/lib/freebl/ldvector.c
+++ b/security/nss/lib/freebl/ldvector.c
@@ -242,13 +242,14 @@ static const struct FREEBLVectorStr vect
 
 const FREEBLVector * 
 FREEBL_GetVector(void)
 {
     extern const char __nss_freebl_rcsid[];
     extern const char __nss_freebl_sccsid[];
 
     /* force a reference that won't get optimized away */
-    volatile char c = __nss_freebl_rcsid[0] + __nss_freebl_sccsid[0]; 
+    volatile char c;
 
+    c = __nss_freebl_rcsid[0] + __nss_freebl_sccsid[0]; 
     return &vector;
 }
 
--- a/security/nss/lib/util/dertime.c
+++ b/security/nss/lib/util/dertime.c
@@ -38,48 +38,24 @@
 #include "prtime.h"
 #include "secder.h"
 #include "prlong.h"
 #include "secerr.h"
 
 #define HIDIGIT(v) (((v) / 10) + '0')
 #define LODIGIT(v) (((v) % 10) + '0')
 
-#define C_SINGLE_QUOTE '\047'
-
-#define DIGITHI(dig) (((dig) - '0') * 10)
-#define DIGITLO(dig) ((dig) - '0')
 #define ISDIGIT(dig) (((dig) >= '0') && ((dig) <= '9'))
 #define CAPTURE(var,p,label)				  \
 {							  \
     if (!ISDIGIT((p)[0]) || !ISDIGIT((p)[1])) goto label; \
     (var) = ((p)[0] - '0') * 10 + ((p)[1] - '0');	  \
     p += 2; \
 }
 
-#define SECMIN  60L            /* seconds in a minute        */
-#define SECHOUR (60L*SECMIN)   /* seconds in an hour         */
-#define SECDAY  (24L*SECHOUR)  /* seconds in a day           */
-#define SECYEAR (365L*SECDAY)  /* seconds in a non-leap year */
-
-static long monthToDayInYear[12] = {
-    0,
-    31,
-    31+28,
-    31+28+31,
-    31+28+31+30,
-    31+28+31+30+31,
-    31+28+31+30+31+30,
-    31+28+31+30+31+30+31,
-    31+28+31+30+31+30+31+31,
-    31+28+31+30+31+30+31+31+30,
-    31+28+31+30+31+30+31+31+30+31,
-    31+28+31+30+31+30+31+31+30+31+30,
-};
-
 static const PRTime January1st1     = (PRTime) LL_INIT(0xff234001U, 0x00d44000U);
 static const PRTime January1st1950  = (PRTime) LL_INIT(0xfffdc1f8U, 0x793da000U);
 static const PRTime January1st2050  = LL_INIT(0x0008f81e, 0x1b098000);
 static const PRTime January1st10000 = LL_INIT(0x0384440c, 0xcc736000);
 
 /* gmttime must contains UTC time in micro-seconds unit */
 SECStatus
 DER_TimeToUTCTimeArena(PRArenaPool* arenaOpt, SECItem *dst, int64 gmttime)
--- a/security/nss/lib/util/oidstring.c
+++ b/security/nss/lib/util/oidstring.c
@@ -50,17 +50,16 @@
  * The length of the input string is given in len.  If len == 0, then 
  * len will be computed as strlen(from), meaning it must be NUL terminated.
  * It is an error if from == NULL, or if *from == '\0'.
  */
 
 SECStatus
 SEC_StringToOID(PLArenaPool *pool, SECItem *to, const char *from, PRUint32 len)
 {
-    PRUint32 result_len = 0;
     PRUint32 decimal_numbers = 0;
     PRUint32 result_bytes = 0;
     SECStatus rv;
     PRUint8 result[1024];
 
     static const PRUint32 max_decimal = (0xffffffff / 10);
     static const char OIDstring[] = {"OID."};