From 25696c44363c28538ea5bd746e2d89dc8532b5dd Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 11 Jan 2021 19:27:54 +0100 Subject: [PATCH] Enable msvc signed/unsigned mismatch warnings and fix remaining cases --- BBGE/Base.h | 4 ++-- BBGE/ParticleManager.cpp | 15 +++------------ BBGE/Particles.h | 3 +-- BBGE/Texture.cpp | 4 ++-- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/BBGE/Base.h b/BBGE/Base.h index 9559c51..3fe5382 100644 --- a/BBGE/Base.h +++ b/BBGE/Base.h @@ -66,7 +66,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning(disable:4005) #pragma warning(disable:4305) -#pragma warning(disable:4018) // signed/unsigned mismatch +//#pragma warning(disable:4018) // signed/unsigned mismatch #pragma warning(disable:4244) // conversion from types with possible loss of data #pragma warning(disable:4800) // forcing value to bool 'true' or 'false (performance warning) @@ -77,7 +77,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning(disable:4127) // conditional expression is constant #pragma warning(disable:4706) // assignment within conditional expression -#pragma warning(disable:4389) // signed/unsigned mismatch +//#pragma warning(disable:4389) // signed/unsigned mismatch #pragma warning(disable:4189) // UqqqqSEFUL: local variable is initialized but not referenced #endif diff --git a/BBGE/ParticleManager.cpp b/BBGE/ParticleManager.cpp index ac67281..82caad9 100644 --- a/BBGE/ParticleManager.cpp +++ b/BBGE/ParticleManager.cpp @@ -198,22 +198,13 @@ void ParticleManager::endParticle(Particle *p) p->reset(); } -void ParticleManager::nextFree(int jump) +void ParticleManager::nextFree(size_t jump) { free+=jump; if (free >= size) free -= size; } -void ParticleManager::prevFree(int jump) -{ - if(free < jump) { - free = free + size - jump; - } else { - free -= jump; - } -} - void ParticleManager::setFree(size_t free) { if (free != ~0UL) @@ -222,8 +213,8 @@ void ParticleManager::setFree(size_t free) } } -const int spread = 8; -const int spreadCheck = 128; +static const size_t spread = 8; +static const size_t spreadCheck = 128; // travel the list until you find an empty or give up Particle *ParticleManager::stomp() diff --git a/BBGE/Particles.h b/BBGE/Particles.h index 7ce9503..14ce8f3 100644 --- a/BBGE/Particles.h +++ b/BBGE/Particles.h @@ -237,8 +237,7 @@ protected: size_t numActive; Particle* stomp(); - void nextFree(int f=1); - void prevFree(int f=1); + void nextFree(size_t f=1); size_t oldFree; diff --git a/BBGE/Texture.cpp b/BBGE/Texture.cpp index 92dfbc4..472c691 100644 --- a/BBGE/Texture.cpp +++ b/BBGE/Texture.cpp @@ -449,7 +449,7 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size) ByteBuffer bb(mem, size, ByteBuffer::REUSE); ImageTGA *pImageData = NULL; // This stores our important image data - WORD width = 0, height = 0; // The dimensions of the image + uint16_t width = 0, height = 0; // The dimensions of the image byte length = 0; // The length in bytes to the pixels byte imageType = 0; // The image type (RLE, RGB, Alpha...) byte bits = 0; // The bits per pixel for the image (16, 24, 32) @@ -604,7 +604,7 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size) byte *pColors = new byte [channels]; // Load in all the pixel data - while(i < width*height) + while(i < size_t(width)*height) { // Read in the current color count + 1 bb >> rleID;