From a88b22e54711803943f5a67bce8b6263b4eae68e Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 21 Jul 2009 23:38:19 +0000 Subject: [PATCH] increase visual studio warning level and deal with the consequences. --- desmume/src/SPU.cpp | 2 +- desmume/src/bios.cpp | 2 +- desmume/src/gfx3d.cpp | 10 +++++----- desmume/src/lua-engine.cpp | 6 +++--- desmume/src/mc.cpp | 4 ++-- desmume/src/rasterize.cpp | 14 +++++++------- desmume/src/windows/CWindow.cpp | 4 ++-- desmume/src/windows/main.cpp | 4 ++-- desmume/src/windows/replay.cpp | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/desmume/src/SPU.cpp b/desmume/src/SPU.cpp index 948bb1dea..7333dbf77 100644 --- a/desmume/src/SPU.cpp +++ b/desmume/src/SPU.cpp @@ -679,7 +679,7 @@ template static FORCEINLINE s32 Interpola ratio = ratio - (int)ratio; double ratio2 = ((1.0 - cos(ratio * M_PI)) * 0.5); //double ratio2 = (1.0f - cos_lut[((int)(ratio*256.0))&0xFF]) / 2.0f; - return (((1-ratio2)*a) + (ratio2*b)); + return (s32)(((1-ratio2)*a) + (ratio2*b)); } else { diff --git a/desmume/src/bios.cpp b/desmume/src/bios.cpp index 238a3425c..2ae04a9ac 100644 --- a/desmume/src/bios.cpp +++ b/desmume/src/bios.cpp @@ -327,7 +327,7 @@ TEMPLATE static u32 divide() cpu->R[0] = (u32)(num / dnum); cpu->R[1] = (u32)(num % dnum); - cpu->R[3] = (u32) (((s32)cpu->R[0])<0 ? -cpu->R[0] : cpu->R[0]); + cpu->R[3] = (u32) (((s32)cpu->R[0])<0 ? -(s32)cpu->R[0] : cpu->R[0]); return 6; } diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 73d5ede2e..53b90558e 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -1363,7 +1363,7 @@ void gfx3d_glLoadIdentity() BOOL gfx3d_glLoadMatrix4x4(s32 v) { - mtxCurrent[mode][ML4x4ind] = v; + mtxCurrent[mode][ML4x4ind] = (float)v; ++ML4x4ind; if(ML4x4ind<16) return FALSE; @@ -1380,7 +1380,7 @@ BOOL gfx3d_glLoadMatrix4x4(s32 v) BOOL gfx3d_glLoadMatrix4x3(s32 v) { - mtxCurrent[mode][ML4x3ind] = v; + mtxCurrent[mode][ML4x3ind] = (float)v; ML4x3ind++; if((ML4x3ind & 0x03) == 3) ML4x3ind++; @@ -1402,7 +1402,7 @@ BOOL gfx3d_glLoadMatrix4x3(s32 v) BOOL gfx3d_glMultMatrix4x4(s32 v) { - mtxTemporal[MM4x4ind] = v; + mtxTemporal[MM4x4ind] = (float)v; MM4x4ind++; if(MM4x4ind<16) return FALSE; @@ -1426,7 +1426,7 @@ BOOL gfx3d_glMultMatrix4x4(s32 v) BOOL gfx3d_glMultMatrix4x3(s32 v) { - mtxTemporal[MM4x3ind] = v; + mtxTemporal[MM4x3ind] = (float)v; MM4x3ind++; if((MM4x3ind & 0x03) == 3) MM4x3ind++; @@ -1456,7 +1456,7 @@ BOOL gfx3d_glMultMatrix4x3(s32 v) BOOL gfx3d_glMultMatrix3x3(s32 v) { - mtxTemporal[MM3x3ind] = v; + mtxTemporal[MM3x3ind] = (float)v; MM3x3ind++; diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp index 22dbf88eb..2c1b2c43e 100644 --- a/desmume/src/lua-engine.cpp +++ b/desmume/src/lua-engine.cpp @@ -3266,7 +3266,7 @@ static int arc(lua_State *L) { static int star(lua_State *L) { - double cx,cy,r1,r2,startAngle,numRays; + lua_Integer cx,cy,r1,r2,startAngle,numRays; cx = luaL_checkinteger(L,1); cy = luaL_checkinteger(L,2); r1 = luaL_checkinteger(L,3); @@ -3314,7 +3314,7 @@ static const struct luaL_reg aggbasicshapes [] = static int fillColor(lua_State *L) { - double r,g,b,a; + lua_Integer r,g,b,a; r = luaL_checkinteger(L,1); g = luaL_checkinteger(L,2); b = luaL_checkinteger(L,3); @@ -3333,7 +3333,7 @@ static int noFill(lua_State *L) { static int lineColor(lua_State *L) { - double r,g,b,a; + lua_Integer r,g,b,a; r = luaL_checkinteger(L,1); g = luaL_checkinteger(L,2); b = luaL_checkinteger(L,3); diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index b949623d2..e267c43c4 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -577,7 +577,7 @@ void BackupDevice::loadfile() else { //scan for desmume save footer - const u32 cookieLen = strlen(kDesmumeSaveCookie); + const s32 cookieLen = (s32)strlen(kDesmumeSaveCookie); char *sigbuf = new char[cookieLen]; fseek(inf, -cookieLen, SEEK_END); fread(sigbuf,1,cookieLen,inf); @@ -780,7 +780,7 @@ bool BackupDevice::load_duc(const char* filename) bool BackupDevice::load_movie(std::istream* is) { - const u32 cookieLen = strlen(kDesmumeSaveCookie); + const s32 cookieLen = (s32)strlen(kDesmumeSaveCookie); is->seekg(-cookieLen, std::ios::end); is->seekg(-4, std::ios::cur); diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index 37ea79865..2f584327e 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -706,8 +706,8 @@ struct edge_fx_fl { }; FORCEINLINE edge_fx_fl::edge_fx_fl(int Top, int Bottom) { - Y = Ceil28_4(verts[Top]->y); - int YEnd = Ceil28_4(verts[Bottom]->y); + Y = Ceil28_4((fixed28_4)verts[Top]->y); + int YEnd = Ceil28_4((fixed28_4)verts[Bottom]->y); Height = YEnd - Y; if(Height) @@ -715,13 +715,13 @@ FORCEINLINE edge_fx_fl::edge_fx_fl(int Top, int Bottom) { long dN = long(verts[Bottom]->y - verts[Top]->y); long dM = long(verts[Bottom]->x - verts[Top]->x); - long InitialNumerator = dM*16*Y - dM*verts[Top]->y + dN*verts[Top]->x - 1 + dN*16; + long InitialNumerator = (long)(dM*16*Y - dM*verts[Top]->y + dN*verts[Top]->x - 1 + dN*16); FloorDivMod(InitialNumerator,dN*16,X,ErrorTerm); FloorDivMod(dM*16,dN*16,XStep,Numerator); Denominator = dN*16; - float YPrestep = Fixed28_4ToFloat(Y*16 - verts[Top]->y); - float XPrestep = Fixed28_4ToFloat(X*16 - verts[Top]->x); + float YPrestep = Fixed28_4ToFloat((fixed28_4)(Y*16 - verts[Top]->y)); + float XPrestep = Fixed28_4ToFloat((fixed28_4)(X*16 - verts[Top]->x)); float dy = 1/Fixed28_4ToFloat(dN); float dx = 1/Fixed28_4ToFloat(dM); @@ -1042,7 +1042,7 @@ static void SoftRastConvertFramebuffer() template static T interpolate(const float ratio, const T& x0, const T& x1) { - return x0 + (float)(x1-x0) * (ratio); + return (T)(x0 + (float)(x1-x0) * (ratio)); } @@ -1381,7 +1381,7 @@ static void SoftRastRender() //which is currently just a float for(int j=0;jpolyAttr); diff --git a/desmume/src/windows/CWindow.cpp b/desmume/src/windows/CWindow.cpp index e7896bb65..11a18b838 100644 --- a/desmume/src/windows/CWindow.cpp +++ b/desmume/src/windows/CWindow.cpp @@ -137,7 +137,7 @@ void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, BOOL keepRatio) case WMSZ_BOTTOMRIGHT: { float ratio = ((rect->right - rect->left - xborder - xborder) / (float)minWidth); - rect->bottom = (rect->top + ycaption + yborder + ymenu + (minHeight * ratio) + yborder); + rect->bottom = (LONG)((rect->top + ycaption + yborder + ymenu + (minHeight * ratio) + yborder)); } break; @@ -145,7 +145,7 @@ void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, BOOL keepRatio) case WMSZ_BOTTOM: { float ratio = ((rect->bottom - rect->top - ycaption - yborder - ymenu - yborder) / (float)minHeight); - rect->right = (rect->left + xborder + (minWidth * ratio) + xborder); + rect->right = (LONG)((rect->left + xborder + (minWidth * ratio) + xborder)); } break; } diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 2ed92cf58..2d217bb35 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -390,7 +390,7 @@ void ScaleScreen(float factor) factor = 1.5f; else if(factor==65534) factor = 2.5f; - MainWindow->setClientSize((video.rotatedwidthgap() * factor), (video.rotatedheightgap() * factor)); + MainWindow->setClientSize((int)(video.rotatedwidthgap() * factor), (int)(video.rotatedheightgap() * factor)); } } @@ -1854,7 +1854,7 @@ void UpdateWndRects(HWND hwnd) } ratio = ((float)wndHeight / (float)defHeight); - oneScreenHeight = ((video.height/2) * ratio); + oneScreenHeight = (int)((video.height/2) * ratio); gapHeight = (wndHeight - (oneScreenHeight * 2)); if((video.rotation == 90) || (video.rotation == 270)) diff --git a/desmume/src/windows/replay.cpp b/desmume/src/windows/replay.cpp index 5e5c55f84..bcf9c49c9 100644 --- a/desmume/src/windows/replay.cpp +++ b/desmume/src/windows/replay.cpp @@ -37,8 +37,8 @@ void Describe(HWND hwndDlg) u32 num_frames = md.records.size(); double tempCount = num_frames / (33513982.0/6/355/263); - int num_seconds = tempCount; - int fraction = (tempCount - num_seconds) * 100; + int num_seconds = (int)tempCount; + int fraction = ((int)tempCount - num_seconds) * 100; int seconds = num_seconds % 60; int minutes = (num_seconds / 60) % 60; int hours = (num_seconds / 60 / 60) % 60;