fix findings.

pull/1730/head
Kim Kulling 2018-01-23 13:02:13 +01:00
parent 98c053a9b9
commit ebaa8be106
2 changed files with 26 additions and 55 deletions

View File

@ -134,8 +134,7 @@ void HandleCommandLine(char* p_szCommand)
if (strlen(sz) < 2)return;
if (*sz == '\"')
{
if (*sz == '\"') {
char* sz2 = strrchr(sz,'\"');
if (sz2)*sz2 = 0;
sz++; // skip the starting quote
@ -151,23 +150,17 @@ void HandleCommandLine(char* p_szCommand)
SaveHistory();
}
//-------------------------------------------------------------------------------
// Load the light colors from the registry
//-------------------------------------------------------------------------------
void LoadLightColors()
{
DWORD dwTemp = 4;
RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL,
(BYTE*)&g_avLightColors[0],&dwTemp);
RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL,
(BYTE*)&g_avLightColors[1],&dwTemp);
RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL,
(BYTE*)&g_avLightColors[2],&dwTemp);
return;
RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL, (BYTE*)&g_avLightColors[0],&dwTemp);
RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL, (BYTE*)&g_avLightColors[1],&dwTemp);
RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL, (BYTE*)&g_avLightColors[2],&dwTemp);
}
//-------------------------------------------------------------------------------
// Save the light colors to the registry
//-------------------------------------------------------------------------------
@ -178,7 +171,6 @@ void SaveLightColors()
RegSetValueExA(g_hRegistry,"LightColor2",0,REG_DWORD,(const BYTE*)&g_avLightColors[2],4);
}
//-------------------------------------------------------------------------------
// Save the checker pattern colors to the registry
//-------------------------------------------------------------------------------

View File

@ -787,9 +787,17 @@ int ShutdownD3D(void)
return 1;
}
template<class TComPtr>
inline
void SafeRelease(TComPtr *ptr) {
if (nullptr != g_piPassThroughEffect) {
g_piPassThroughEffect->Release();
g_piPassThroughEffect = nullptr;
}
}
//-------------------------------------------------------------------------------
// Shutdown the D3D devie object and all resources associated with it
// Shutdown the D3D device object and all resources associated with it
// NOTE: Assumes that the asset has already been deleted
//-------------------------------------------------------------------------------
int ShutdownDevice(void)
@ -798,49 +806,20 @@ int ShutdownDevice(void)
CBackgroundPainter::Instance().ReleaseNativeResource();
CLogDisplay::Instance().ReleaseNativeResource();
// release global shaders that have been allocazed
if (NULL != g_piDefaultEffect)
{
g_piDefaultEffect->Release();
g_piDefaultEffect = NULL;
}
if (NULL != g_piNormalsEffect)
{
g_piNormalsEffect->Release();
g_piNormalsEffect = NULL;
}
if (NULL != g_piPassThroughEffect)
{
g_piPassThroughEffect->Release();
g_piPassThroughEffect = NULL;
}
if (NULL != g_piPatternEffect)
{
g_piPatternEffect->Release();
g_piPatternEffect = NULL;
}
if (NULL != g_pcTexture)
{
g_pcTexture->Release();
g_pcTexture = NULL;
}
if( NULL != gDefaultVertexDecl)
{
gDefaultVertexDecl->Release();
gDefaultVertexDecl = NULL;
}
// release global shaders that have been allocated
SafeRelease(g_piDefaultEffect);
SafeRelease(g_piNormalsEffect);
SafeRelease(g_piPassThroughEffect);
SafeRelease(g_piPatternEffect);
SafeRelease(g_pcTexture);
SafeRelease(gDefaultVertexDecl);
// delete the main D3D device object
if (NULL != g_piDevice)
{
g_piDevice->Release();
g_piDevice = NULL;
}
SafeRelease(g_piDevice);
// deleted the one channel image allocated to hold the HUD mask
delete[] g_szImageMask;
g_szImageMask = NULL;
g_szImageMask = nullptr;
return 1;
}