Fixed signed/unsigned mismatch in comparisons

No more 'comparison of integers of different signs' warnings reported by GCC/Clang
This commit is contained in:
alexey.lysiuk 2017-01-05 15:45:15 +02:00 committed by Christoph Oelckers
parent e0540c6b37
commit 9ed2da176e
12 changed files with 22 additions and 22 deletions

View file

@ -302,9 +302,9 @@ static void PrepareSectorData()
static void PrepareTransparentDoors(sector_t * sector) static void PrepareTransparentDoors(sector_t * sector)
{ {
bool solidwall=false; bool solidwall=false;
int notextures=0; unsigned int notextures=0;
int nobtextures=0; unsigned int nobtextures=0;
int selfref=0; unsigned int selfref=0;
sector_t * nextsec=NULL; sector_t * nextsec=NULL;
#ifdef _DEBUG #ifdef _DEBUG

View file

@ -125,7 +125,7 @@ int gl_CheckSpriteGlow(sector_t *sector, int lightlevel, const DVector3 &pos)
} }
} }
} }
else if (c != -1) else if (uint32(-1) != c)
{ {
bottomglowcolor[0] = c.r / 255.f; bottomglowcolor[0] = c.r / 255.f;
bottomglowcolor[1] = c.g / 255.f; bottomglowcolor[1] = c.g / 255.f;
@ -171,7 +171,7 @@ bool gl_GetWallGlow(sector_t *sector, float *topglowcolor, float *bottomglowcolo
} }
} }
} }
else if (c != -1) else if (uint32(-1) != c)
{ {
topglowcolor[0] = c.r / 255.f; topglowcolor[0] = c.r / 255.f;
topglowcolor[1] = c.g / 255.f; topglowcolor[1] = c.g / 255.f;
@ -195,7 +195,7 @@ bool gl_GetWallGlow(sector_t *sector, float *topglowcolor, float *bottomglowcolo
} }
} }
} }
else if (c != -1) else if (uint32(-1) != c)
{ {
bottomglowcolor[0] = c.r / 255.f; bottomglowcolor[0] = c.r / 255.f;
bottomglowcolor[1] = c.g / 255.f; bottomglowcolor[1] = c.g / 255.f;

View file

@ -5,7 +5,7 @@
#include "v_palette.h" #include "v_palette.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
extern DWORD gl_fixedcolormap; extern int gl_fixedcolormap;
struct lightlist_t; struct lightlist_t;

View file

@ -35,7 +35,7 @@ inline bool gl_isWhite(PalEntry color)
return color.r + color.g + color.b == 3*0xff; return color.r + color.g + color.b == 3*0xff;
} }
extern DWORD gl_fixedcolormap; extern int gl_fixedcolormap;
inline bool gl_isFullbright(PalEntry color, int lightlevel) inline bool gl_isFullbright(PalEntry color, int lightlevel)
{ {

View file

@ -323,7 +323,7 @@ void FGLRenderer::UpdateCameraExposure()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// Find the average value: // Find the average value:
for (int i = 0; i + 1 < mBuffers->ExposureLevels.Size(); i++) for (unsigned int i = 0; i + 1 < mBuffers->ExposureLevels.Size(); i++)
{ {
const auto &level = mBuffers->ExposureLevels[i]; const auto &level = mBuffers->ExposureLevels[i];
const auto &next = mBuffers->ExposureLevels[i + 1]; const auto &next = mBuffers->ExposureLevels[i + 1];

View file

@ -448,7 +448,7 @@ void FGLRenderBuffers::CreateExposureLevels(int width, int height)
void FGLRenderBuffers::CreateEyeBuffers(int eye) void FGLRenderBuffers::CreateEyeBuffers(int eye)
{ {
if (mEyeFBs.Size() > eye) if (mEyeFBs.Size() > unsigned(eye))
return; return;
GLint activeTex, textureBinding, frameBufferBinding; GLint activeTex, textureBinding, frameBufferBinding;
@ -457,7 +457,7 @@ void FGLRenderBuffers::CreateEyeBuffers(int eye)
glGetIntegerv(GL_TEXTURE_BINDING_2D, &textureBinding); glGetIntegerv(GL_TEXTURE_BINDING_2D, &textureBinding);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &frameBufferBinding); glGetIntegerv(GL_FRAMEBUFFER_BINDING, &frameBufferBinding);
while (mEyeFBs.Size() <= eye) while (mEyeFBs.Size() <= unsigned(eye))
{ {
GLuint texture = Create2DTexture("EyeTexture", GL_RGBA16F, mWidth, mHeight); GLuint texture = Create2DTexture("EyeTexture", GL_RGBA16F, mWidth, mHeight);
mEyeTextures.Push(texture); mEyeTextures.Push(texture);

View file

@ -88,7 +88,7 @@ extern int viewpitch;
extern bool NoInterpolateView; extern bool NoInterpolateView;
extern bool r_showviewer; extern bool r_showviewer;
DWORD gl_fixedcolormap; int gl_fixedcolormap;
area_t in_area; area_t in_area;
TArray<BYTE> currentmapsection; TArray<BYTE> currentmapsection;
int camtexcount; int camtexcount;

View file

@ -1245,7 +1245,7 @@ void GLWall::ClipFFloors(seg_t * seg, F3DFloor * ffloor, sector_t * frontsector,
{ {
TArray<F3DFloor *> & frontffloors = frontsector->e->XFloor.ffloors; TArray<F3DFloor *> & frontffloors = frontsector->e->XFloor.ffloors;
int flags = ffloor->flags & (FF_SWIMMABLE | FF_TRANSLUCENT); const unsigned int flags = ffloor->flags & (FF_SWIMMABLE | FF_TRANSLUCENT);
for (unsigned int i = 0; i < frontffloors.Size(); i++) for (unsigned int i = 0; i < frontffloors.Size(); i++)
{ {

View file

@ -143,7 +143,7 @@ void FGLDebug::SetupBreakpointMode()
void FGLDebug::UpdateLoggingLevel() void FGLDebug::UpdateLoggingLevel()
{ {
int level = gl_debug_level; const GLenum level = gl_debug_level;
if (level != mCurrentLevel) if (level != mCurrentLevel)
{ {
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, nullptr, level > 0); glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, nullptr, level > 0);

View file

@ -285,7 +285,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
if (translation <= 0) translation = -translation; if (translation <= 0) translation = -translation;
else else
{ {
alphatrans = (gl.legacyMode && translation == TRANSLATION(TRANSLATION_Standard, 8)); alphatrans = (gl.legacyMode && DWORD(translation) == TRANSLATION(TRANSLATION_Standard, 8));
translation = GLTranslationPalette::GetInternalTranslation(translation); translation = GLTranslationPalette::GetInternalTranslation(translation);
} }

View file

@ -3088,7 +3088,7 @@ line_t** linebuffer;
static void P_GroupLines (bool buildmap) static void P_GroupLines (bool buildmap)
{ {
cycle_t times[16]; cycle_t times[16];
int* linesDoneInEachSector; unsigned int* linesDoneInEachSector;
int i; int i;
int total; int total;
line_t* li; line_t* li;
@ -3156,7 +3156,7 @@ static void P_GroupLines (bool buildmap)
times[3].Clock(); times[3].Clock();
linebuffer = new line_t *[total]; linebuffer = new line_t *[total];
line_t **lineb_p = linebuffer; line_t **lineb_p = linebuffer;
linesDoneInEachSector = new int[numsectors]; linesDoneInEachSector = new unsigned int[numsectors];
memset (linesDoneInEachSector, 0, sizeof(int)*numsectors); memset (linesDoneInEachSector, 0, sizeof(int)*numsectors);
for (sector = sectors, i = 0; i < numsectors; i++, sector++) for (sector = sectors, i = 0; i < numsectors; i++, sector++)

View file

@ -1695,7 +1695,7 @@ public:
sec->ceilingplane.set(n.X, n.Y, n.Z, cp[3]); sec->ceilingplane.set(n.X, n.Y, n.Z, cp[3]);
} }
if (lightcolor == -1 && fadecolor == -1 && desaturation == -1 && fogdensity == -1) if (lightcolor == uint32(-1) && fadecolor == uint32(-1) && desaturation == -1 && fogdensity == -1)
{ {
// [RH] Sectors default to white light with the default fade. // [RH] Sectors default to white light with the default fade.
// If they are outside (have a sky ceiling), they use the outside fog. // If they are outside (have a sky ceiling), they use the outside fog.
@ -1714,8 +1714,8 @@ public:
} }
else else
{ {
if (lightcolor == -1) lightcolor = PalEntry(255,255,255); if (uint32(-1) == lightcolor) lightcolor = PalEntry(255,255,255);
if (fadecolor == -1) if (uint32(-1) == fadecolor)
{ {
if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside)) if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
fadecolor = level.outsidefog; fadecolor = level.outsidefog;