Elimate compiler warnings
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 20 Mar 2018 22:53:47 +0000 (16:53 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 20 Mar 2018 22:53:47 +0000 (16:53 -0600)
libctgraphics/pol.cpp
libctsim/imagefile.cpp
src/graph3dview.cpp

index e02cdec4fb68b7268584c306dca0bb8b12cdee8a..da43586cf38ca26aadfb285e969c6e77d0be3a11 100644 (file)
@@ -309,10 +309,11 @@ POL::tok (struct token_st *token)
 {
   if (token->ready == false)
     getpol_tok(token);
 {
   if (token->ready == false)
     getpol_tok(token);
-  else
+  else {
     if (token->type == TT_EOF && lookchar() != EOF)
       getpol_tok(token);
     if (token->type == TT_EOF && lookchar() != EOF)
       getpol_tok(token);
-    return (token->type);
+  }
+  return (token->type);
 }
 
 void
 }
 
 void
index eeda46d37d4300f4662d15ac2924fa88ebdaa311..8710e5a002eae10c85804ec1aee911b7c8e66d22 100644 (file)
@@ -1545,8 +1545,8 @@ ImageFile::readImagePNG (const char* const pszFile)
   if (!fp)
     return false;
   unsigned char header[8];
   if (!fp)
     return false;
   unsigned char header[8];
-  fread (header, 1, 8, fp);
-  if (png_sig_cmp (header, 0, 8)) {
+  int n = fread (header, 1, 8, fp);
+  if (n != 8 || png_sig_cmp (header, 0, 8)) {
     fclose (fp);
     return false;
   }
     fclose (fp);
     return false;
   }
index ee5147f4dc9e54e8caf9f14387a2c15d09302261..37a3dede7adf32c04d014802e3621ba2bcf20d0a 100644 (file)
@@ -451,10 +451,10 @@ Graph3dFileView::InitMaterials()
   int ny = GetDocument()->ny();
 
 #if 1
   int ny = GetDocument()->ny();
 
 #if 1
-  static float position0[] = {nx/2, ny*2, -ny*2, 0.0f,};
+  static float position0[] = {nx/2.0f, ny*2.0f, -ny*2.0f, 0.0f,};
   static float ambient0[] = {.1f, .1f, .1f, 1.0f};
   static float diffuse0[] = {1.0f, 1.0f, 1.0f, 1.0f};
   static float ambient0[] = {.1f, .1f, .1f, 1.0f};
   static float diffuse0[] = {1.0f, 1.0f, 1.0f, 1.0f};
-  static float position1[] = {-nx/2, -ny*2, -ny*2, 0.0f,};
+  static float position1[] = {-nx/2.0f, -ny*2.0f, -ny*2.0f, 0.0f,};
   static float ambient1[] = {.1f, .1f, .1f, .1f};
   static float diffuse1[] = {1.0f, 1.0f, 1.0f, 1.0f};
   //  static float position0[] = {0.0f, 0.0f, 20.0f, 0.0f};
   static float ambient1[] = {.1f, .1f, .1f, .1f};
   static float diffuse1[] = {1.0f, 1.0f, 1.0f, 1.0f};
   //  static float position0[] = {0.0f, 0.0f, 20.0f, 0.0f};