From df4c34bc2ce685a335404acfba56fb30393fec29 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Thu, 12 Feb 2015 17:35:15 +0600 Subject: [PATCH] Fix code analizer's warning. --- GLSLCombiner.cpp | 2 +- OpenGL.cpp | 2 +- Textures.cpp | 8 ++++---- windows/CommonAPIImpl_windows.cpp | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/GLSLCombiner.cpp b/GLSLCombiner.cpp index d60a1023..40ddc413 100644 --- a/GLSLCombiner.cpp +++ b/GLSLCombiner.cpp @@ -593,7 +593,7 @@ void ShaderCombiner::_locateUniforms() { if (config.generalEmulation.enableHWLighting) { // locate lights uniforms char buf[32]; - for (u32 i = 0; i < 8; ++i) { + for (s32 i = 0; i < 8; ++i) { sprintf(buf, "uLightDirection[%d]", i); m_uniforms.uLightDirection[i].loc = glGetUniformLocation(m_program, buf); sprintf(buf, "uLightColor[%d]", i); diff --git a/OpenGL.cpp b/OpenGL.cpp index a52cbb3b..1dedc486 100644 --- a/OpenGL.cpp +++ b/OpenGL.cpp @@ -1077,7 +1077,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params) struct { float s0, t0, s1, t1; - } texST[2]; //struct for texture coordinates + } texST[2] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; //struct for texture coordinates if (currentCombiner()->usesT0() && cache.current[0] && gSP.textureTile[0]) { texST[0].s0 = _params.uls * cache.current[0]->shiftScaleS - gSP.textureTile[0]->fuls; diff --git a/Textures.cpp b/Textures.cpp index 7aafc14a..a6127595 100644 --- a/Textures.cpp +++ b/Textures.cpp @@ -940,11 +940,11 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture) if (wid_64 & 15) wid_64 += 16; wid_64 &= 0xFFFFFFF0; wid_64 >>= 3; - int line = tmptex.line << 1; - line = (line - wid_64) << 3; + int line32 = tmptex.line << 1; + line32 = (line32 - wid_64) << 3; if (wid_64 < 1) wid_64 = 1; int width = wid_64 << 1; - line = width + (line >> 2); + line32 = width + (line32 >> 2); u16 gr, ab; @@ -954,7 +954,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture) if (y & mirrorTBit) ty ^= maskTMask; - u32 tline = tbase + line * ty; + u32 tline = tbase + line32 * ty; u32 xorval = (ty & 1) ? 3 : 1; for (x = 0; x < tmptex.realWidth; ++x) { diff --git a/windows/CommonAPIImpl_windows.cpp b/windows/CommonAPIImpl_windows.cpp index 47e1caaf..5da382f1 100644 --- a/windows/CommonAPIImpl_windows.cpp +++ b/windows/CommonAPIImpl_windows.cpp @@ -8,10 +8,10 @@ EXTERN_C IMAGE_DOS_HEADER __ImageBase; #endif -BOOL CALLBACK FindToolBarProc( HWND hWnd, LPARAM lParam ) +BOOL CALLBACK FindToolBarProc( HWND _hWnd, LPARAM lParam ) { - if (GetWindowLong( hWnd, GWL_STYLE ) & RBS_VARHEIGHT) { - hToolBar = hWnd; + if (GetWindowLong( _hWnd, GWL_STYLE ) & RBS_VARHEIGHT) { + hToolBar = _hWnd; return FALSE; } return TRUE; @@ -35,6 +35,7 @@ void PluginAPI::FindPluginPath(wchar_t * _strPath) return; #ifdef OS_WINDOWS TCHAR strDLLPath[PLUGIN_PATH_SIZE]; + memset(strDLLPath, 0, sizeof(strDLLPath)); ::GetModuleFileName((HINSTANCE)&__ImageBase, strDLLPath, PLUGIN_PATH_SIZE); ::mbstowcs(_strPath, strDLLPath, PLUGIN_PATH_SIZE); #else