Bug 1661378 - pkix: Do not use NULL where 0 is needed
authorKhem Raj <raj.khem@gmail.com>
Wed, 02 Sep 2020 10:45:48 -0700
changeset 15744 9213848965f624055e3f2147f584e2433c355432
parent 15743 c100e11991f68f60d53b2ebe1975c39ddf8bf784
child 15745 e03296e73ba666329bd9c1257038353bc9074466
push id3833
push userkjacobs@mozilla.com
push dateWed, 02 Sep 2020 18:31:07 +0000
bugs1661378
Bug 1661378 - pkix: Do not use NULL where 0 is needed Clang finds this error pkix_logger.c:316:32: error: cast to smaller integer type 'PKIX_ERRORCLASS' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast] logger->logComponent = (PKIX_ERRORCLASS)NULL; ^~~~~~~~~~~~~~~~~~~~~ pkix_logger.c:617:32: error: cast to smaller integer type 'PKIX_ERRORCLASS' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast] logger->logComponent = (PKIX_ERRORCLASS)NULL; ^~~~~~~~~~~~~~~~~~~~~ 2 errors generated. Signed-off-by: Khem Raj <raj.khem@gmail.com>
lib/libpkix/pkix/util/pkix_logger.c
--- a/lib/libpkix/pkix/util/pkix_logger.c
+++ b/lib/libpkix/pkix/util/pkix_logger.c
@@ -308,17 +308,17 @@ pkix_Logger_Destroy(
                     PKIX_OBJECTNOTLOGGER);
 
         logger = (PKIX_Logger *)object;
 
         /* We have a valid logger. DecRef its item and recurse on next */
 
         logger->callback = NULL;
         PKIX_DECREF(logger->context);
-        logger->logComponent = (PKIX_ERRORCLASS)NULL;
+        logger->logComponent = (PKIX_ERRORCLASS)0;
 
 cleanup:
 
         PKIX_RETURN(LOGGER);
 }
 
 /*
  * FUNCTION: pkix_Logger_ToString
@@ -609,17 +609,17 @@ PKIX_Logger_Create(
                     (PKIX_LOGGER_TYPE,
                     sizeof (PKIX_Logger),
                     (PKIX_PL_Object **)&logger,
                     plContext),
                     PKIX_COULDNOTCREATELOGGEROBJECT);
 
         logger->callback = callback;
         logger->maxLevel = 0;
-        logger->logComponent = (PKIX_ERRORCLASS)NULL;
+        logger->logComponent = (PKIX_ERRORCLASS)0;
 
         PKIX_INCREF(loggerContext);
         logger->context = loggerContext;
 
         *pLogger = logger;
         logger = NULL;
 
 cleanup: