Check of a pointer. Use NULL instead of 0. Issue found thanks to Coccinelle: http... 56/2956/3
Sylvestre Ledru [Wed, 19 Jan 2011 16:13:38 +0000 (17:13 +0100)]
Change-Id: I187ea78a7f2f2047b16b13c1850f38dccc71bbb8

scilab/modules/graphics/sci_gateway/c/sci_drawaxis.c
scilab/modules/gui/sci_gateway/c/sci_messagebox.c
scilab/modules/gui/sci_gateway/c/sci_uigetfont.c
scilab/modules/gui/sci_gateway/c/sci_waitbar.c

index 1cce98e..358449c 100644 (file)
@@ -187,7 +187,7 @@ int sci_drawaxis( char * fname, unsigned long fname_len )
     return 0;
   }
 
-  if ( val != 0) 
+  if (val != NULL) 
   {
     CheckLength( opts[8].position, opts[8].m*opts[8].n,ntics);
     nb_tics_labels = opts[8].m*opts[8].n;
index 675509d..dd0f8e2 100644 (file)
@@ -68,7 +68,7 @@ int sci_messagebox(char *fname,unsigned long fname_len)
           if (isModalOption(getStringMatrixFromStack((size_t)titleAdr)[0]))
             {
               modalOptionAdr = titleAdr;
-              titleAdr = 0;
+              titleAdr = NULL;
             }
         }
       else
@@ -90,14 +90,14 @@ int sci_messagebox(char *fname,unsigned long fname_len)
               if (isModalOption(getStringMatrixFromStack((size_t)iconAdr)[0]))
                 {
                   modalOptionAdr = (char **)iconAdr;
-                  iconAdr = 0;
+                  iconAdr = NULL;
                 }
               else if(!isIconName(getStringMatrixFromStack((size_t)iconAdr)[0]))
                 {
                   buttonsTextAdr = (char **)iconAdr;
                   nbRowButtons = nbRow;
                   nbColButtons = nbCol;
-                  iconAdr = 0;
+                  iconAdr = NULL;
                 }
             }
           else  /* More than one string --> buttons names */
@@ -105,7 +105,7 @@ int sci_messagebox(char *fname,unsigned long fname_len)
               buttonsTextAdr = (char **)iconAdr;
               nbRowButtons = nbRow;
               nbColButtons = nbCol;
-              iconAdr = 0;
+              iconAdr = NULL;
             }
 
         }
@@ -128,7 +128,7 @@ int sci_messagebox(char *fname,unsigned long fname_len)
               if (isModalOption(getStringMatrixFromStack((size_t)buttonsTextAdr)[0]))
                 {
                   modalOptionAdr = buttonsTextAdr;
-                  buttonsTextAdr = 0;
+                  buttonsTextAdr = NULL;
                 }
             }
         }
@@ -164,7 +164,7 @@ int sci_messagebox(char *fname,unsigned long fname_len)
   setMessageBoxMultiLineMessage(messageBoxID, getStringMatrixFromStack((size_t)messageAdr), nbColMessage*nbRowMessage);
 
   /* Title */
-  if (titleAdr != 0)
+  if (titleAdr != NULL)
     {
       setMessageBoxTitle(messageBoxID, getStringMatrixFromStack((size_t)titleAdr)[0]);
     }
@@ -174,19 +174,19 @@ int sci_messagebox(char *fname,unsigned long fname_len)
     }
 
   /* Icon */
-  if (iconAdr != 0)
+  if (iconAdr != NULL)
     {
       setMessageBoxIcon(messageBoxID, getStringMatrixFromStack((size_t)iconAdr)[0]);
     }
     
   /* Buttons */
-  if (buttonsTextAdr != 0)
+  if (buttonsTextAdr != NULL)
     {
       setMessageBoxButtonsLabels(messageBoxID, getStringMatrixFromStack((size_t)buttonsTextAdr), nbColButtons*nbRowButtons);
     }
 
   /* Modal ? */
-  if (modalOptionAdr != 0)
+  if (modalOptionAdr != NULL)
     {
       setMessageBoxModal(messageBoxID, !stricmp(getStringMatrixFromStack((size_t)modalOptionAdr)[0],"modal"));
     }
index b92a170..ccac156 100644 (file)
@@ -129,7 +129,7 @@ int sci_uigetfont(char *fname,unsigned long fname_len)
   fontChooserID = createFontChooser();
 
   /* Default font */
-  if (fontNameAdr != 0)
+  if (fontNameAdr != NULL)
     {
       setFontChooserFontName(fontChooserID, getStringMatrixFromStack((size_t)fontNameAdr)[0]);
     }
index e53e2f6..27c8280 100644 (file)
@@ -73,7 +73,7 @@ int sci_waitbar(char *fname,unsigned long fname_len)
         {
           setWaitBarValue(waitbarID, (int)(getDoubleFromStack(fractionAdr) * 100));
         }
-      else if (messageAdr != 0)
+      else if (messageAdr != NULL)
         {
           setWaitBarMessage(waitbarID, getStringMatrixFromStack((size_t)messageAdr), nbColMessage*nbRowMessage);
           freeArrayOfString(messageAdr, nbColMessage*nbRowMessage);