From fe061b8d0a393e4a68d084503872b551e08ac91c Mon Sep 17 00:00:00 2001 From: Phillip Date: Fri, 13 Nov 2015 22:12:39 -0800 Subject: [PATCH] Squash MSVC warnings --- lib/graphicsdev/D3D11.cpp | 6 +++--- lib/win/Win32Common.hpp | 2 +- lib/win/WindowWin32.cpp | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/graphicsdev/D3D11.cpp b/lib/graphicsdev/D3D11.cpp index b623792..e3196d2 100644 --- a/lib/graphicsdev/D3D11.cpp +++ b/lib/graphicsdev/D3D11.cpp @@ -369,7 +369,7 @@ struct D3D11ShaderDataBinding : IShaderDataBinding { D3D11GraphicsBufferD* cbuf = static_cast(m_vbuf); ID3D11Buffer* buf[] = {cbuf->m_bufs[b].Get()}; - UINT strides[] = {cbuf->m_stride}; + UINT strides[] = {UINT(cbuf->m_stride)}; UINT offsets[] = {0}; ctx->IASetVertexBuffers(0, 1, buf, strides, offsets); } @@ -377,7 +377,7 @@ struct D3D11ShaderDataBinding : IShaderDataBinding { D3D11GraphicsBufferS* cbuf = static_cast(m_vbuf); ID3D11Buffer* buf[] = {cbuf->m_buf.Get()}; - UINT strides[] = {cbuf->m_stride}; + UINT strides[] = {UINT(cbuf->m_stride)}; UINT offsets[] = {0}; ctx->IASetVertexBuffers(0, 1, buf, strides, offsets); } @@ -573,7 +573,7 @@ struct D3D11CommandQueue : IGraphicsCommandQueue void setViewport(const SWindowRect& rect) { - D3D11_VIEWPORT vp = {rect.location[0], rect.location[1], rect.size[0], rect.size[1], 0.0, 1.0}; + D3D11_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(rect.location[1]), FLOAT(rect.size[0]), FLOAT(rect.size[1]), 0.0, 1.0}; m_deferredCtx->RSSetViewports(1, &vp); } diff --git a/lib/win/Win32Common.hpp b/lib/win/Win32Common.hpp index 33a96fb..d359819 100644 --- a/lib/win/Win32Common.hpp +++ b/lib/win/Win32Common.hpp @@ -140,7 +140,7 @@ struct Boo3DAppContext D3D11Context::Window& win = m_ctx11.m_windows[window]; BOOL isFScr; win.m_swapChain->GetFullscreenState(&isFScr, nullptr); - return isFScr; + return isFScr != 0; } OGLContext::Window& win = m_ctxOgl.m_windows[window]; return win.m_fs; diff --git a/lib/win/WindowWin32.cpp b/lib/win/WindowWin32.cpp index 6a9ad0f..7ff051c 100644 --- a/lib/win/WindowWin32.cpp +++ b/lib/win/WindowWin32.cpp @@ -404,11 +404,11 @@ static uint32_t translateKeysym(WPARAM sym, int& specialSym, int& modifierSym) static int translateModifiers(UINT msg) { int retval = 0; - if (GetKeyState(VK_LSHIFT) & 0x8000 != 0 || GetKeyState(VK_RSHIFT) & 0x8000 != 0) + if ((GetKeyState(VK_LSHIFT) & 0x8000) != 0 || (GetKeyState(VK_RSHIFT) & 0x8000) != 0) retval |= MKEY_SHIFT; - if (GetKeyState(VK_LCONTROL) & 0x8000 != 0 || GetKeyState(VK_RCONTROL) & 0x8000 != 0) + if ((GetKeyState(VK_LCONTROL) & 0x8000) != 0 || (GetKeyState(VK_RCONTROL) & 0x8000) != 0) retval |= MKEY_CTRL; - if (GetKeyState(VK_MENU) & 0x8000 != 0) + if ((GetKeyState(VK_MENU) & 0x8000) != 0) retval |= MKEY_ALT; if (msg == WM_SYSKEYDOWN || msg == WM_SYSKEYUP) retval |= MKEY_ALT; @@ -627,11 +627,11 @@ public: uint32_t charCode = translateKeysym(e.wParam, specialKey, modifierKey); int modifierMask = translateModifiers(e.uMsg); if (charCode) - m_callback->charKeyDown(charCode, EModifierKey(modifierMask), e.lParam & 0xffff != 0); + m_callback->charKeyDown(charCode, EModifierKey(modifierMask), (e.lParam & 0xffff) != 0); else if (specialKey) - m_callback->specialKeyDown(ESpecialKey(specialKey), EModifierKey(modifierMask), e.lParam & 0xffff != 0); + m_callback->specialKeyDown(ESpecialKey(specialKey), EModifierKey(modifierMask), (e.lParam & 0xffff) != 0); else if (modifierKey) - m_callback->modKeyDown(EModifierKey(modifierKey), e.lParam & 0xffff != 0); + m_callback->modKeyDown(EModifierKey(modifierKey), (e.lParam & 0xffff) != 0); } return; } @@ -793,11 +793,11 @@ public: { LONG sty = GetWindowLong(m_hwnd, GWL_STYLE); unsigned retval = STYLE_NONE; - if (sty & WS_CAPTION != 0) + if ((sty & WS_CAPTION) != 0) retval |= STYLE_TITLEBAR; - if (sty & WS_THICKFRAME != 0) + if ((sty & WS_THICKFRAME) != 0) retval |= STYLE_RESIZE; - if (sty & WS_SYSMENU) + if ((sty & WS_SYSMENU)) retval |= STYLE_CLOSE; return EWindowStyle(retval); }