From e9f75e639d0f7278f03e7ed75453789f14795646 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 28 Jun 2012 11:08:36 +0200 Subject: [PATCH] Fixed: Valgrind warnings --- code/nel/src/3d/point_light.cpp | 1 + code/nel/src/3d/render_trav.cpp | 1 + code/nel/src/3d/visual_collision_mesh.cpp | 3 ++- code/nel/src/misc/fixed_size_allocator.cpp | 2 +- code/nel/src/misc/path.cpp | 2 +- code/nel/src/sound/complex_source.cpp | 3 ++- .../client/src/interface_v3/group_html.cpp | 23 ++++++++++--------- code/ryzom/common/src/game_share/fame.cpp | 4 ++-- 8 files changed, 22 insertions(+), 17 deletions(-) diff --git a/code/nel/src/3d/point_light.cpp b/code/nel/src/3d/point_light.cpp index a67125e21..e441e198e 100644 --- a/code/nel/src/3d/point_light.cpp +++ b/code/nel/src/3d/point_light.cpp @@ -40,6 +40,7 @@ CPointLight::CPointLight() : _LightedModels(/*&_LightedModelListMemory*/) _Diffuse= _Specular= CRGBA::White; // Default setup. this is arbitrary + _Type= PointLight; _AttenuationBegin= 10; _AttenuationEnd= 30; diff --git a/code/nel/src/3d/render_trav.cpp b/code/nel/src/3d/render_trav.cpp index 229c5846c..a8965f60e 100644 --- a/code/nel/src/3d/render_trav.cpp +++ b/code/nel/src/3d/render_trav.cpp @@ -69,6 +69,7 @@ CRenderTrav::CRenderTrav() _CurrentPassOpaque = true; _CacheLightContribution= NULL; + _LastLocalAttenuation= false; // Default light Setup. LightingSystemEnabled= false; diff --git a/code/nel/src/3d/visual_collision_mesh.cpp b/code/nel/src/3d/visual_collision_mesh.cpp index b5c58dc98..3217a560f 100644 --- a/code/nel/src/3d/visual_collision_mesh.cpp +++ b/code/nel/src/3d/visual_collision_mesh.cpp @@ -512,7 +512,8 @@ void CVisualCollisionMesh::receiveShadowMap(const NLMISC::CMatrix &instanceMatr } // 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. ibPtr[currentTriIdx++]= (uint16) triId[0]; diff --git a/code/nel/src/misc/fixed_size_allocator.cpp b/code/nel/src/misc/fixed_size_allocator.cpp index 0744951a9..f16e87dd4 100644 --- a/code/nel/src/misc/fixed_size_allocator.cpp +++ b/code/nel/src/misc/fixed_size_allocator.cpp @@ -100,7 +100,7 @@ CFixedSizeAllocator::CChunk::~CChunk() nlassert(NumFreeObjs == 0); nlassert(Allocator->_NumChunks > 0); -- (Allocator->_NumChunks); - delete Mem; + delete[] Mem; } // ***************************************************************************************************************** diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 59d887295..bcef9bdeb 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -83,7 +83,7 @@ CFileContainer::~CFileContainer() { if( _AllFileNames ) { - delete _AllFileNames; + delete[] _AllFileNames; _AllFileNames = NULL; } } diff --git a/code/nel/src/sound/complex_source.cpp b/code/nel/src/sound/complex_source.cpp index 685897413..103c6cc60 100644 --- a/code/nel/src/sound/complex_source.cpp +++ b/code/nel/src/sound/complex_source.cpp @@ -28,7 +28,8 @@ namespace NLSOUND CComplexSource::CComplexSource (CComplexSound *soundPattern, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) : CSourceCommon(soundPattern, spawn, cb, cbUserParam, cluster, groupController), _Source1(NULL), - _Source2(NULL) + _Source2(NULL), + _Muted(false) { nlassert(soundPattern->getSoundType() == CSound::SOUND_COMPLEX); _PatternSound = static_cast(soundPattern); diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index 7a599ff4b..166a26f63 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -223,7 +223,7 @@ bool CGroupHTML::addBnpDownload(const string &url, const string &action, const s #ifdef LOG_DL nlwarning("add to download '%s' dest '%s'", url.c_str(), dest.c_str()); #endif - + // erase the tmp file if exists if (NLMISC::CFile::fileExists(tmpdest)) NLMISC::CFile::deleteFile(tmpdest); @@ -622,7 +622,7 @@ void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTCh _LinkTitle.push_back(""); } - + } } } @@ -948,7 +948,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c typedef pair TTmplParam; vector tmplParams; - + string templateName; 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]); setBackgroundColor (bgColor); } - + string style; if (present[HTML_BODY_STYLE] && value[HTML_BODY_STYLE]) style = value[HTML_BODY_STYLE]; - - + + if (!style.empty()) { TStyle styles = parseStyle(style); @@ -1057,7 +1057,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c it = styles.find("background-repeat"); bool repeat = (it != styles.end() && it->second == "1"); - + // Webig only it = styles.find("background-scale"); 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") reloadImg = true; } - + addImage (value[MY_HTML_IMG_SRC], globalColor, reloadImg); } } @@ -1838,6 +1838,7 @@ CGroupHTML::CGroupHTML(const TCtorParam ¶m) _GroupHtmlByUID[_GroupHtmlUID]= this; // init + _TrustedDomain = false; _ParsingLua = false; _IgnoreText = false; _BrowseNextTime = false; @@ -2469,7 +2470,7 @@ void CGroupHTML::addString(const ucstring &str) getParagraph()->addChild (buttonGroup); paragraphChange (); } - + } else { @@ -3706,14 +3707,14 @@ int CGroupHTML::luaRemoveContent(CLuaState &ls) } // *************************************************************************** -int CGroupHTML::luaInsertText(CLuaState &ls) +int CGroupHTML::luaInsertText(CLuaState &ls) { const char *funcName = "insertText"; CLuaIHM::checkArgCount(ls, funcName, 3); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN); - + string name = ls.toString(1); ucstring text; diff --git a/code/ryzom/common/src/game_share/fame.cpp b/code/ryzom/common/src/game_share/fame.cpp index b3634f979..541a2e8d9 100644 --- a/code/ryzom/common/src/game_share/fame.cpp +++ b/code/ryzom/common/src/game_share/fame.cpp @@ -320,9 +320,9 @@ CStaticFames::CStaticFames() //---------------------------------------------------------------------------- CStaticFames::~CStaticFames() { - delete _FameTable; + delete[] _FameTable; _FameTable = NULL; - delete _PropagationFactorTable; + delete[] _PropagationFactorTable; _PropagationFactorTable = NULL; }