Fix Coverity - High Impact defects:

. uninitialised vars in Debug & Win32Frame
This commit is contained in:
tomcw 2021-07-28 12:47:05 +01:00
parent f4650fb850
commit 405de2be14
2 changed files with 11 additions and 13 deletions

View File

@ -5416,14 +5416,14 @@ Update_t _CmdMemorySearch (int nArgs, bool bTextIsAscii = true )
// Get search "string" // Get search "string"
Arg_t *pArg = & g_aArgs[ iArgFirstByte ]; Arg_t *pArg = & g_aArgs[ iArgFirstByte ];
WORD nTarget;
for (iArg = iArgFirstByte; iArg <= nArgs; iArg++, pArg++ ) for (iArg = iArgFirstByte; iArg <= nArgs; iArg++, pArg++ )
{ {
MemorySearch_t ms; WORD nTarget = pArg->nValue;
nTarget = pArg->nValue; MemorySearch_t ms;
ms.m_nValue = nTarget & 0xFF; ms.m_nValue = nTarget & 0xFF;
ms.m_iType = MEM_SEARCH_BYTE_EXACT; ms.m_iType = MEM_SEARCH_BYTE_EXACT;
ms.m_bFound = false;
if (nTarget > 0xFF) // searching for 16-bit address if (nTarget > 0xFF) // searching for 16-bit address
{ {
@ -5810,7 +5810,8 @@ Update_t CmdOutputPrintf (int nArgs)
TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); TCHAR sText[ CONSOLE_WIDTH ] = TEXT("");
std::vector<Arg_t> aValues; std::vector<Arg_t> aValues;
Arg_t entry; Arg_t entry;
entry.sArg[0] = 0;
int iValue = 0; int iValue = 0;
int nValue = 0; int nValue = 0;
@ -5833,11 +5834,8 @@ Update_t CmdOutputPrintf (int nArgs)
continue; continue;
else else
{ {
// entry.eType = PS_LITERAL;
entry.nValue = g_aArgs[ iArg ].nValue; entry.nValue = g_aArgs[ iArg ].nValue;
aValues.push_back( entry ); aValues.push_back( entry );
// nValue = g_aArgs[ iArg ].nValue;
// aValues.push_back( nValue );
} }
} }
const int nParamValues = (int) aValues.size(); const int nParamValues = (int) aValues.size();

View File

@ -40,6 +40,11 @@ Win32Frame::Win32Frame()
m_bestHeightForFullScreen = 0; m_bestHeightForFullScreen = 0;
m_changedDisplaySettings = false; m_changedDisplaySettings = false;
g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * kDEFAULT_VIEWPORT_SCALE;
g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * kDEFAULT_VIEWPORT_SCALE;
g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE
g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
btnfacebrush = (HBRUSH)0; btnfacebrush = (HBRUSH)0;
btnfacepen = (HPEN)0; btnfacepen = (HPEN)0;
btnhighlightpen = (HPEN)0; btnhighlightpen = (HPEN)0;
@ -47,7 +52,7 @@ Win32Frame::Win32Frame()
buttonactive = -1; buttonactive = -1;
buttondown = -1; buttondown = -1;
buttonover = -1; buttonover = -1;
buttonx = BUTTONX; buttonx = BUTTONX; // NB. macro uses g_nViewportCX
buttony = BUTTONY; buttony = BUTTONY;
g_hFrameDC = (HDC)0; g_hFrameDC = (HDC)0;
memset(&framerect, 0, sizeof(framerect)); memset(&framerect, 0, sizeof(framerect));
@ -71,11 +76,6 @@ Win32Frame::Win32Frame()
g_eStatusDrive1 = DISK_STATUS_OFF; g_eStatusDrive1 = DISK_STATUS_OFF;
g_eStatusDrive2 = DISK_STATUS_OFF; g_eStatusDrive2 = DISK_STATUS_OFF;
g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * kDEFAULT_VIEWPORT_SCALE;
g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * kDEFAULT_VIEWPORT_SCALE;
g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE
g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
} }
void Win32Frame::videoCreateDIBSection(Video & video) void Win32Frame::videoCreateDIBSection(Video & video)