Fixed: Valgrind warnings

This commit is contained in:
kaetemi 2012-06-28 11:08:36 +02:00
parent 2e01e8c4bf
commit 0d4f6da330
8 changed files with 22 additions and 17 deletions

View file

@ -40,6 +40,7 @@ CPointLight::CPointLight() : _LightedModels(/*&_LightedModelListMemory*/)
_Diffuse= _Specular= CRGBA::White; _Diffuse= _Specular= CRGBA::White;
// Default setup. this is arbitrary // Default setup. this is arbitrary
_Type= PointLight;
_AttenuationBegin= 10; _AttenuationBegin= 10;
_AttenuationEnd= 30; _AttenuationEnd= 30;

View file

@ -69,6 +69,7 @@ CRenderTrav::CRenderTrav()
_CurrentPassOpaque = true; _CurrentPassOpaque = true;
_CacheLightContribution= NULL; _CacheLightContribution= NULL;
_LastLocalAttenuation= false;
// Default light Setup. // Default light Setup.
LightingSystemEnabled= false; LightingSystemEnabled= false;

View file

@ -512,7 +512,8 @@ void CVisualCollisionMesh::receiveShadowMap(const NLMISC::CMatrix &instanceMatr
} }
// if triangle not clipped, add the triangle // if triangle not clipped, add the triangle
if( (triFlag & NL3D_VCM_SHADOW_NUM_CLIP_PLANE_MASK)==0 ) // if( (triFlag & NL3D_VCM_SHADOW_NUM_CLIP_PLANE_MASK)==0 )
if (triFlag == 0) // previous line not useful due to init
{ {
// Add the 3 index to the index buffer. // Add the 3 index to the index buffer.
ibPtr[currentTriIdx++]= (uint16) triId[0]; ibPtr[currentTriIdx++]= (uint16) triId[0];

View file

@ -100,7 +100,7 @@ CFixedSizeAllocator::CChunk::~CChunk()
nlassert(NumFreeObjs == 0); nlassert(NumFreeObjs == 0);
nlassert(Allocator->_NumChunks > 0); nlassert(Allocator->_NumChunks > 0);
-- (Allocator->_NumChunks); -- (Allocator->_NumChunks);
delete Mem; delete[] Mem;
} }
// ***************************************************************************************************************** // *****************************************************************************************************************

View file

@ -83,7 +83,7 @@ CFileContainer::~CFileContainer()
{ {
if( _AllFileNames ) if( _AllFileNames )
{ {
delete _AllFileNames; delete[] _AllFileNames;
_AllFileNames = NULL; _AllFileNames = NULL;
} }
} }

View file

@ -28,7 +28,8 @@ namespace NLSOUND
CComplexSource::CComplexSource (CComplexSound *soundPattern, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) CComplexSource::CComplexSource (CComplexSound *soundPattern, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController)
: CSourceCommon(soundPattern, spawn, cb, cbUserParam, cluster, groupController), : CSourceCommon(soundPattern, spawn, cb, cbUserParam, cluster, groupController),
_Source1(NULL), _Source1(NULL),
_Source2(NULL) _Source2(NULL),
_Muted(false)
{ {
nlassert(soundPattern->getSoundType() == CSound::SOUND_COMPLEX); nlassert(soundPattern->getSoundType() == CSound::SOUND_COMPLEX);
_PatternSound = static_cast<CComplexSound*>(soundPattern); _PatternSound = static_cast<CComplexSound*>(soundPattern);

View file

@ -223,7 +223,7 @@ bool CGroupHTML::addBnpDownload(const string &url, const string &action, const s
#ifdef LOG_DL #ifdef LOG_DL
nlwarning("add to download '%s' dest '%s'", url.c_str(), dest.c_str()); nlwarning("add to download '%s' dest '%s'", url.c_str(), dest.c_str());
#endif #endif
// erase the tmp file if exists // erase the tmp file if exists
if (NLMISC::CFile::fileExists(tmpdest)) if (NLMISC::CFile::fileExists(tmpdest))
NLMISC::CFile::deleteFile(tmpdest); NLMISC::CFile::deleteFile(tmpdest);
@ -622,7 +622,7 @@ void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTCh
_LinkTitle.push_back(""); _LinkTitle.push_back("");
} }
} }
} }
} }
@ -948,7 +948,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c
typedef pair<string, string> TTmplParam; typedef pair<string, string> TTmplParam;
vector<TTmplParam> tmplParams; vector<TTmplParam> tmplParams;
string templateName; string templateName;
if (!style.empty()) if (!style.empty())
{ {
@ -1044,12 +1044,12 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c
CRGBA bgColor = getColor (value[HTML_BODY_BGCOLOR]); CRGBA bgColor = getColor (value[HTML_BODY_BGCOLOR]);
setBackgroundColor (bgColor); setBackgroundColor (bgColor);
} }
string style; string style;
if (present[HTML_BODY_STYLE] && value[HTML_BODY_STYLE]) if (present[HTML_BODY_STYLE] && value[HTML_BODY_STYLE])
style = value[HTML_BODY_STYLE]; style = value[HTML_BODY_STYLE];
if (!style.empty()) if (!style.empty())
{ {
TStyle styles = parseStyle(style); TStyle styles = parseStyle(style);
@ -1057,7 +1057,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c
it = styles.find("background-repeat"); it = styles.find("background-repeat");
bool repeat = (it != styles.end() && it->second == "1"); bool repeat = (it != styles.end() && it->second == "1");
// Webig only // Webig only
it = styles.find("background-scale"); it = styles.find("background-scale");
bool scale = (it != styles.end() && it->second == "1"); bool scale = (it != styles.end() && it->second == "1");
@ -1187,7 +1187,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c
if (it != styles.end() && (*it).second == "1") if (it != styles.end() && (*it).second == "1")
reloadImg = true; reloadImg = true;
} }
addImage (value[MY_HTML_IMG_SRC], globalColor, reloadImg); addImage (value[MY_HTML_IMG_SRC], globalColor, reloadImg);
} }
} }
@ -1838,6 +1838,7 @@ CGroupHTML::CGroupHTML(const TCtorParam &param)
_GroupHtmlByUID[_GroupHtmlUID]= this; _GroupHtmlByUID[_GroupHtmlUID]= this;
// init // init
_TrustedDomain = false;
_ParsingLua = false; _ParsingLua = false;
_IgnoreText = false; _IgnoreText = false;
_BrowseNextTime = false; _BrowseNextTime = false;
@ -2469,7 +2470,7 @@ void CGroupHTML::addString(const ucstring &str)
getParagraph()->addChild (buttonGroup); getParagraph()->addChild (buttonGroup);
paragraphChange (); paragraphChange ();
} }
} }
else else
{ {
@ -3706,14 +3707,14 @@ int CGroupHTML::luaRemoveContent(CLuaState &ls)
} }
// *************************************************************************** // ***************************************************************************
int CGroupHTML::luaInsertText(CLuaState &ls) int CGroupHTML::luaInsertText(CLuaState &ls)
{ {
const char *funcName = "insertText"; const char *funcName = "insertText";
CLuaIHM::checkArgCount(ls, funcName, 3); CLuaIHM::checkArgCount(ls, funcName, 3);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN);
string name = ls.toString(1); string name = ls.toString(1);
ucstring text; ucstring text;

View file

@ -320,9 +320,9 @@ CStaticFames::CStaticFames()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
CStaticFames::~CStaticFames() CStaticFames::~CStaticFames()
{ {
delete _FameTable; delete[] _FameTable;
_FameTable = NULL; _FameTable = NULL;
delete _PropagationFactorTable; delete[] _PropagationFactorTable;
_PropagationFactorTable = NULL; _PropagationFactorTable = NULL;
} }