From f161139c375cdfd558dbd2d6c6a4f3ae63c8e3e2 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 20 Mar 2018 16:53:47 -0600 Subject: [PATCH] Elimate compiler warnings --- libctgraphics/pol.cpp | 5 +++-- libctsim/imagefile.cpp | 4 ++-- src/graph3dview.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libctgraphics/pol.cpp b/libctgraphics/pol.cpp index e02cdec..da43586 100644 --- a/libctgraphics/pol.cpp +++ b/libctgraphics/pol.cpp @@ -309,10 +309,11 @@ POL::tok (struct token_st *token) { if (token->ready == false) getpol_tok(token); - else + else { if (token->type == TT_EOF && lookchar() != EOF) getpol_tok(token); - return (token->type); + } + return (token->type); } void diff --git a/libctsim/imagefile.cpp b/libctsim/imagefile.cpp index eeda46d..8710e5a 100644 --- a/libctsim/imagefile.cpp +++ b/libctsim/imagefile.cpp @@ -1545,8 +1545,8 @@ ImageFile::readImagePNG (const char* const pszFile) 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; } diff --git a/src/graph3dview.cpp b/src/graph3dview.cpp index ee5147f..37a3ded 100644 --- a/src/graph3dview.cpp +++ b/src/graph3dview.cpp @@ -451,10 +451,10 @@ Graph3dFileView::InitMaterials() 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 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}; -- 2.34.1