[Patches] ParseFile.c: reduce compiler warnings

Steve White steve.white at aei.mpg.de
Mon Feb 13 07:48:40 CST 2006


Hello,

This is part of a project to reduce the compiler warnings generated by
Cactus Flesh code.

Intel icc complains of the usual fgetc() return value conversion,
several times in
	src/util/ParseFile.c

The attached patch fixes these issues, so that the file now compiles
with no warnings in gcc or icc.

I ran the full set of testsuites with the modified and unmodified code,
and got identical results.

Cheers!

-- 
Steve White : Programmer
Max-Planck-Institut für Gravitationsphysik      Albert-Einstein-Institut
Am Mühlenberg 1, D-14476 Golm, Germany                  +49-331-567-7625
-------------- next part --------------
Index: src/util/ParseFile.c
===================================================================
RCS file: /cactusdevcvs/Cactus/src/util/ParseFile.c,v
retrieving revision 1.23
diff -u -r1.23 ParseFile.c
--- src/util/ParseFile.c	4 Aug 2005 12:52:09 -0000	1.23
+++ src/util/ParseFile.c	13 Feb 2006 11:03:50 -0000
@@ -186,7 +186,7 @@
     /* Token character */
     if (intoken && c != '=')
     {
-      tokens[intoken++] = c;
+      tokens[intoken++] = (char)c;
       CheckBuf(intoken,lineno);
     }
 
@@ -195,7 +195,7 @@
     if (c != ' ' && c != '\t' && c != '\n' && c != '\r' && !inval && !intoken)
     {
       intoken = 0;
-      tokens[intoken++] = c;
+      tokens[intoken++] = (char)c;
     }
 
     /* End of a token signified by an = */
@@ -257,7 +257,7 @@
             /* Make an important decision NOT to include
              * line feeds in the string parameters
              */
-            if (c != '\n') value[p++] = c;
+            if (c != '\n') value[p++] = (char)c;
             if (c == '\n')
             {
               printf ("Warning: Quoted string contains newline for token %s\n",
@@ -314,7 +314,7 @@
         {
 
           int p = 0;
-          value[p++] = c;
+          value[p++] = (char)c;
           if (ntokens == 1)
           {
             /* Simple case. We have an int
@@ -326,7 +326,7 @@
 #endif
             while (!(c==' ' || c=='\t' || c == '\n' || c == '\r' || c == EOF))
             {
-              value[p++] = c;
+              value[p++] = (char)c;
               CheckBuf(p,lineno);
               c = fgetc(ifp);
 #ifdef DEBUG
@@ -354,7 +354,7 @@
             int pp=0, i;
             int pt, pv;
 
-            value[pp++] = c;
+            value[pp++] = (char)c;
             /* OK, since we only have numbers in the
                old input stream, we can go along getting
                ntokens-1 commas, stripping spaces, and
@@ -368,7 +368,7 @@
             {
               if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
               {
-                value[pp++] = c;
+                value[pp++] = (char)c;
                 CheckBuf(pp,lineno);
               }
               if (c == ',') ncommas ++;
@@ -396,7 +396,7 @@
             }
 
             /* And tack the rest on */
-            value[pp++] = c;
+            value[pp++] = (char)c;
             CheckBuf(p,lineno);
 
             c = fgetc(ifp);
@@ -405,7 +405,7 @@
 #endif
             while (c != ' ' && c != '\t' && c != '\n' && c != '\r' && c != EOF)
             {
-              value[pp++] = c;
+              value[pp++] = (char)c;
               CheckBuf(pp,lineno);
               c = fgetc(ifp);
 #ifdef DEBUG


More information about the Patches mailing list