More minor static analysis warning fixes.

This commit is contained in:
Unknown W. Brackets 2012-12-21 16:57:44 -08:00
parent 17750c7c80
commit 15793fe532
7 changed files with 43 additions and 45 deletions

View File

@ -318,9 +318,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
Text += 10;
}
SetConsoleTextAttribute(hConsole, Color);
size_t len = strlen(Text);
if (Text[len-1] == '\n' && Text[len-1] == '\r')
len--;
size_t len = strlen(Text);
WriteConsole(hConsole, Text, (DWORD)len, &cCharsWritten, NULL);
#else
char ColorAttr[16] = "";

View File

@ -283,7 +283,7 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32
int i;
for (i = 0; i < num_views; i++)
{
const MemoryView &view = views[i];
const MemoryView &view = views[i];
SKIP(flags, view.flags);
if (view.flags & MV_MIRROR_PREVIOUS) {
position = last_position;

View File

@ -211,7 +211,7 @@ void hleCheckCurrentCallbacks()
void hleReSchedule(const char *reason)
{
_dbg_assert_msg_(HLE, reason != 0, "hleReSchedule: Expecting a valid reason.");
_dbg_assert_msg_(HLE, strlen(reason) < 256, "hleReSchedule: Not too long reason.");
_dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "hleReSchedule: Not too long reason.");
hleAfterSyscall |= HLE_AFTER_RESCHED;

View File

@ -587,7 +587,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff)
case GE_CMD_CALL:
{
u32 retval = dcontext.pc + 4;
if (stackptr == ARRAY_SIZE(stack)) {
if (stackptr == ARRAY_SIZE(stack) - 1) {
ERROR_LOG(G3D, "CALL: Stack full!");
} else {
stack[stackptr++] = retval;

View File

@ -234,7 +234,7 @@ void VertexDecoder::Step_Color5551Morph() const
col[0] += w * (cdata & 0x1f) / 31.f;
col[1] += w * ((cdata>>5) & 0x1f) / 31.f;
col[2] += w * ((cdata>>10) & 0x1f) / 31.f;
col[3] += w * (cdata>>15) ? 1.0f : 0.0f;
col[3] += w * ((cdata>>15) ? 1.0f : 0.0f);
}
u8 *c = decoded_ + decFmt.c0off;
for (int i = 0; i < 4; i++) {

View File

@ -29,7 +29,8 @@ DWORD TheThread(LPVOID x);
void EmuThread_Start(const char *filename)
{
// _dbg_clear_();
_tcscpy(fileToStart, filename);
_tcsncpy(fileToStart, filename, sizeof(fileToStart) - 1);
fileToStart[sizeof(fileToStart) - 1] = 0;
unsigned int i;
emuThread = (HANDLE)_beginthreadex(0,0,(unsigned int (__stdcall *)(void *))TheThread,(LPVOID)0,0,&i);

View File

@ -37,7 +37,7 @@
#endif
BOOL g_bFullScreen = FALSE;
RECT rc = {0};
RECT g_normalRC = {0};
namespace MainWindow
{
@ -705,51 +705,50 @@ namespace MainWindow
}
void _ViewNormal(HWND hWnd)
{
// put caption and border styles back
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME;
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
// put caption and border styles back
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME;
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
// put back the menu bar
::SetMenu(hWnd, menu);
// put back the menu bar
::SetMenu(hWnd, menu);
// resize to normal view
// NOTE: use SWP_FRAMECHANGED to force redraw non-client
const int x = rc.left;
const int y = rc.top;
const int cx = rc.right - rc.left;
const int cy = rc.bottom - rc.top;
::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// resize to normal view
// NOTE: use SWP_FRAMECHANGED to force redraw non-client
const int x = g_normalRC.left;
const int y = g_normalRC.top;
const int cx = g_normalRC.right - g_normalRC.left;
const int cy = g_normalRC.bottom - g_normalRC.top;
::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// reset full screen indicator
g_bFullScreen = FALSE;
// reset full screen indicator
g_bFullScreen = FALSE;
}
void _ViewFullScreen(HWND hWnd)
{
// keep in mind normal window rectangle
::GetWindowRect(hWnd, &rc);
void _ViewFullScreen(HWND hWnd)
{
// keep in mind normal window rectangle
::GetWindowRect(hWnd, &g_normalRC);
// remove caption and border styles
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME);
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
// remove caption and border styles
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME);
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
// remove the menu bar
::SetMenu(hWnd, NULL);
// remove the menu bar
::SetMenu(hWnd, NULL);
// resize to full screen view
// NOTE: use SWP_FRAMECHANGED to force redraw non-client
const int x = 0;
const int y = 0;
const int cx = ::GetSystemMetrics(SM_CXSCREEN);
const int cy = ::GetSystemMetrics(SM_CYSCREEN);
::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// set full screen indicator
g_bFullScreen = TRUE;
}
// resize to full screen view
// NOTE: use SWP_FRAMECHANGED to force redraw non-client
const int x = 0;
const int y = 0;
const int cx = ::GetSystemMetrics(SM_CXSCREEN);
const int cy = ::GetSystemMetrics(SM_CYSCREEN);
::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
// set full screen indicator
g_bFullScreen = TRUE;
}
void SetPlaying(const char *text)
{