From 50d1413d5caef989d54ebb07a679dea4186a17d2 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Sun, 2 Aug 2015 19:41:02 +0200 Subject: [PATCH] fix some warnings Removed homebrew round() - now we just use the math library. --- source/src/crypto.cpp | 2 +- source/src/jpegenc.h | 2 +- source/src/tools.h | 2 -- source/src/weapon.cpp | 2 +- source/src/worldio.cpp | 4 ++-- source/src/worldocull.cpp | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/src/crypto.cpp b/source/src/crypto.cpp index 7380acdd..f8b38cf9 100644 --- a/source/src/crypto.cpp +++ b/source/src/crypto.cpp @@ -870,7 +870,7 @@ uint randomMT() else next = 0; } uint y = (state[cur] & 0x80000000U) | (state[next] & 0x7FFFFFFFU); - state[cur] = y = state[cur < N-M ? cur + M : cur + M-N] ^ (y >> 1) ^ (-(y & 1U) & K); + state[cur] = y = state[cur < N-M ? cur + M : cur + M-N] ^ (y >> 1) ^ (-int(y & 1U) & K); y ^= (y >> 11); y ^= (y << 7) & 0x9D2C5680U; y ^= (y << 15) & 0xEFC60000U; diff --git a/source/src/jpegenc.h b/source/src/jpegenc.h index 8478930a..ad9e6ad3 100644 --- a/source/src/jpegenc.h +++ b/source/src/jpegenc.h @@ -506,7 +506,7 @@ void jpegenc::write_comment(BYTE *comment) { WORD i, length; writeword(0xFFFE); - length = strlen((const char *)comment); + length = (WORD) strlen((const char *)comment); writeword(length + 2); for (i=0; i inline T pow2(T x) { return x*x; } -static inline float round(float x) { return floor(x + 0.5f); } - #define clamp(x,minval,maxval) (max(minval, min(x, maxval))) #define rnd(x) ((int)(randomMT()&0xFFFFFF)%(x)) #define rndscale(x) (float((randomMT()&0xFFFFFF)*double(x)/double(0xFFFFFF))) diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index c724261f..8e3cdfdd 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -595,7 +595,7 @@ void raydamage(vec &from, vec &to, playerent *d) int dam = d->weaponsel->info.damage; int hitzone = -1; playerent *o = NULL; - float dist, hitdist; + float dist, hitdist = 0.0f; bool hitted=false; int rayscount = 0, hitscount = 0; if(d->weaponsel->type==GUN_SHOTGUN) diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index d9365f80..9ff406c1 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -195,7 +195,7 @@ void rldecodecubes(ucharbuf &f, sqr *s, int len, int version, bool silent) // ru { case -1: { - if(!silent) conoutf("while reading map at %ld: unexpected end of file", cubicsize - (e - s)); + if(!silent) conoutf("while reading map at %d: unexpected end of file", int(cubicsize - (e - s))); f.forceoverread(); silent = true; sqrdefault(s); @@ -231,7 +231,7 @@ void rldecodecubes(ucharbuf &f, sqr *s, int len, int version, bool silent) // ru { if(type<0 || type>=MAXTYPE) { - if(!silent) conoutf("while reading map at %ld: type %d out of range", cubicsize - (e - s), type); + if(!silent) conoutf("while reading map at %d: type %d out of range", int(cubicsize - (e - s)), type); f.overread(); continue; } diff --git a/source/src/worldocull.cpp b/source/src/worldocull.cpp index f4871943..a4b31392 100644 --- a/source/src/worldocull.cpp +++ b/source/src/worldocull.cpp @@ -72,7 +72,7 @@ void computeraytable(float vx, float vy, float fov) { float dist = (float)(fabs(sx-vx)+fabs(sy-vy)); if(firstquarter || dist > rdist[k]) rdist[k] = dist; - if(firstquarter) ndist[k] = max(abs(sx-vx), abs(sy-vy)); + if(firstquarter) ndist[k] = max(abs(int(sx-vx)), abs(int(sy-vy))); break; } }