From 4027e82360dd2b955301d35009822517a5fe50ea Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Jun 2011 18:06:00 +0200 Subject: [PATCH] Changed: #825 Remove all warnings when compiling Ryzom --- code/nel/include/nel/3d/track_keyframer.h | 1 + code/nel/include/nel/misc/diff_tool.h | 4 +- code/nel/samples/net/udp/bench_service.cpp | 8 ++-- code/nel/src/sound/sample_bank_manager.cpp | 2 +- code/nel/tools/3d/zviewer/zviewer.cpp | 2 +- code/ryzom/client/src/cdb_branch.cpp | 2 +- code/ryzom/client/src/character_cl.cpp | 6 ++- code/ryzom/client/src/connection.cpp | 4 +- .../client/src/interface_v3/group_tree.h | 2 +- .../src/interface_v3/interface_options.cpp | 4 +- .../client/src/interface_v3/player_trade.cpp | 6 +-- code/ryzom/client/src/light_cycle_manager.cpp | 2 +- .../client/src/string_manager_client.cpp | 6 +-- .../src/game_share/character_sync_itf.h | 4 +- code/ryzom/server/src/ai_share/world_map.cpp | 41 ++++++++++--------- code/ryzom/server/src/ai_share/world_map.h | 34 ++++++++------- .../game_item_manager/game_item.cpp | 2 +- .../game_item_manager/game_item.h | 4 +- .../tools/patch_gen/patch_gen_common.cpp | 18 +++++--- 19 files changed, 85 insertions(+), 67 deletions(-) diff --git a/code/nel/include/nel/3d/track_keyframer.h b/code/nel/include/nel/3d/track_keyframer.h index 2ae43c011..5f2cde6da 100644 --- a/code/nel/include/nel/3d/track_keyframer.h +++ b/code/nel/include/nel/3d/track_keyframer.h @@ -697,6 +697,7 @@ public: virtual bool addLinearFloatKey(const UKeyLinearFloat &key) { CKeyFloat k; + k.OODeltaTime= 0.f; k.Value= key.Value; addKey(k, key.Time); return true; diff --git a/code/nel/include/nel/misc/diff_tool.h b/code/nel/include/nel/misc/diff_tool.h index b8a8db327..64989fcaf 100644 --- a/code/nel/include/nel/misc/diff_tool.h +++ b/code/nel/include/nel/misc/diff_tool.h @@ -238,11 +238,11 @@ namespace STRING_MANAGER return false; } - bool findCol(ucstring colName, uint &colIndex) + bool findCol(const ucstring &colName, uint &colIndex) { if (Data.empty()) return false; - TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), ucstring(colName)); + TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), colName); if (it == Data[0].end()) return false; diff --git a/code/nel/samples/net/udp/bench_service.cpp b/code/nel/samples/net/udp/bench_service.cpp index 7b0789fc6..40786dd26 100644 --- a/code/nel/samples/net/udp/bench_service.cpp +++ b/code/nel/samples/net/udp/bench_service.cpp @@ -530,7 +530,7 @@ void handleReceivedPong (CClient *client, sint64 pongTime) // init the UDP connection if (client == NULL) { - uint32 session; + uint32 session = 0; msgin.serial (session); // Find a new udp connection, find the linked @@ -568,13 +568,13 @@ void handleReceivedPong (CClient *client, sint64 pongTime) } // Read the message - sint64 pingTime; + sint64 pingTime = 0; msgin.serial(pingTime); - uint32 pongNumber; + uint32 pongNumber = 0; msgin.serial(pongNumber); - uint32 blockNumber; + uint32 blockNumber = 0; msgin.serial(blockNumber); // nlinfo ("receive a pong from %s pongnb %d %"NL_I64"d", CurrentInMsg->AddrFrom.asString().c_str(), pongNumber, pongTime - pingTime); diff --git a/code/nel/src/sound/sample_bank_manager.cpp b/code/nel/src/sound/sample_bank_manager.cpp index 26b55b25d..374775972 100644 --- a/code/nel/src/sound/sample_bank_manager.cpp +++ b/code/nel/src/sound/sample_bank_manager.cpp @@ -36,7 +36,7 @@ using namespace NLMISC; namespace NLSOUND { -CSampleBankManager::CSampleBankManager(CAudioMixerUser *audioMixer) : m_AudioMixer(audioMixer), m_LoadedSize(NULL) +CSampleBankManager::CSampleBankManager(CAudioMixerUser *audioMixer) : m_AudioMixer(audioMixer), m_LoadedSize(0) { } diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index 3b2dca06a..da966b420 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -970,7 +970,7 @@ int main(int /* argc */, char ** /* argv */) initViewerConfig("zviewer.cfg"); // Init NELU - NL3D::CNELU::init(ViewerCfg.Width, ViewerCfg.Height, CViewport(), ViewerCfg.Depth, ViewerCfg.Windowed, NULL, false, false); + NL3D::CNELU::init(ViewerCfg.Width, ViewerCfg.Height, CViewport(), ViewerCfg.Depth, ViewerCfg.Windowed, EmptyWindow, false, false); NL3D::CNELU::Driver->setWindowTitle(ucstring("NeL ZViewer")); NL3D::CNELU::Camera->setTransformMode(ITransformable::DirectMatrix); diff --git a/code/ryzom/client/src/cdb_branch.cpp b/code/ryzom/client/src/cdb_branch.cpp index 06501e940..60c6b63f4 100644 --- a/code/ryzom/client/src/cdb_branch.cpp +++ b/code/ryzom/client/src/cdb_branch.cpp @@ -87,7 +87,7 @@ extern const char *CDBBankNames[INVALID_CDB_BANK+1]; // reset all static data void CCDBNodeBranch::reset() { - for ( uint b=0; b!=INVALID_CDB_BANK; ++b ) + for ( uint b=0; bprintfAt(x, y, "(Walk)Run Factor: %f", runFactor()); y += lineStep; // Display the current animation name(id)(offset)(nbloop) pour le channel MOVE. - TextContext->printfAt(x, y, "Current Animation: %s(%u)(%f)(%u loops)", animId(MOVE)==-1?"[NONE]":currentAnimationName().c_str(), animId(MOVE), animOffset(MOVE), _NbLoopAnim); + TextContext->printfAt(x, y, "Current Animation: %s(%u)(%lf)(%u loops)", animId(MOVE)==std::numeric_limits::max()?"[NONE]":currentAnimationName().c_str(), animId(MOVE), animOffset(MOVE), _NbLoopAnim); y += lineStep; // First Pos if(_First_Pos) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index bafee0086..1750d253b 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -1811,13 +1811,13 @@ string getTarget(CCtrlBase * /* ctrl */, const string &targetName) if (!elem) { nlwarning(" : Element is NULL"); - return false; + return ""; } const CReflectedProperty *pRP = CReflectSystem ::getProperty(elem->getReflectedClassName(), rTI.PropertyName); if (pRP->Type == CReflectedProperty::String) return ((elem->*(pRP->GetMethod.GetString))()); - return string(""); + return ""; } // ------------------------------------------------------------------------------------------------ diff --git a/code/ryzom/client/src/interface_v3/group_tree.h b/code/ryzom/client/src/interface_v3/group_tree.h index 556abab99..c2a299c01 100644 --- a/code/ryzom/client/src/interface_v3/group_tree.h +++ b/code/ryzom/client/src/interface_v3/group_tree.h @@ -106,7 +106,7 @@ public: void setOpened(bool opened) { Opened = opened; } bool getOpened() const { return Opened; } void setText(const ucstring &text) { Text = text; } - ucstring getText() const { return Text; } + const ucstring& getText() const { return Text; } sint32 getFontSize() const { return FontSize; } void setFontSize(sint32 value) { FontSize = value; } sint32 getYDecal() const { return YDecal; } diff --git a/code/ryzom/client/src/interface_v3/interface_options.cpp b/code/ryzom/client/src/interface_v3/interface_options.cpp index 0b3fc6f94..0a8135f71 100644 --- a/code/ryzom/client/src/interface_v3/interface_options.cpp +++ b/code/ryzom/client/src/interface_v3/interface_options.cpp @@ -78,7 +78,7 @@ bool CInterfaceOptions::parse (xmlNodePtr cur) CXMLAutoPtr ptr, val; ptr = xmlGetProp (cur, (xmlChar*)"name"); val = xmlGetProp (cur, (xmlChar*)"value"); - if ((ptr == NULL) || (val == NULL)) + if (!ptr || !val) { nlinfo("param with no name or no value"); ok = false; @@ -321,7 +321,7 @@ bool COptionsList::parse (xmlNodePtr cur) { CXMLAutoPtr ptr, val; val = xmlGetProp (cur, (xmlChar*)"value"); - if (val == NULL) + if (!val) { nlinfo("param with no name or no value"); ok = false; diff --git a/code/ryzom/client/src/interface_v3/player_trade.cpp b/code/ryzom/client/src/interface_v3/player_trade.cpp index 671d0047a..7307110d9 100644 --- a/code/ryzom/client/src/interface_v3/player_trade.cpp +++ b/code/ryzom/client/src/interface_v3/player_trade.cpp @@ -78,9 +78,9 @@ void CPlayerTrade::restoreItem(CDBCtrlSheet *exchangeSlot) // *** If not an AMMO, try to 'auto-stack', as server does bool canAutoStack= false; - uint32 autoStackSheetId; - sint32 autoStackQuality; - sint32 autoStackMaxQuantity; + uint32 autoStackSheetId = 0; + sint32 autoStackQuality = 0; + sint32 autoStackMaxQuantity = 0; const CItemSheet *itemSheet= exchangeSlot->asItemSheet(); // NB: cannot auto stack ammo because their full props (dammage etc...) are not sent to client if(itemSheet) diff --git a/code/ryzom/client/src/light_cycle_manager.cpp b/code/ryzom/client/src/light_cycle_manager.cpp index cb34c0dd0..4b0488dd5 100644 --- a/code/ryzom/client/src/light_cycle_manager.cpp +++ b/code/ryzom/client/src/light_cycle_manager.cpp @@ -442,7 +442,7 @@ bool CLightCycleManager::isInDayInterval(float startHour, float endHour, float d float CLightCycleManager::getLightLevel(float hour) const { H_AUTO_USE(RZ_LightCycleManager) - float lightValue; + float lightValue = 0.f; if (isInDayInterval(_Desc.NightTransitionStartHour, _Desc.NightTransitionEndHour, _Desc.NumHours, hour, lightValue)) return lightValue; if (isInDayInterval(_Desc.DawnTransitionStartHour, _Desc.DawnTransitionEndHour, _Desc.NumHours, hour, lightValue)) diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index ac016b299..40886d518 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1206,15 +1206,15 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) continue; // Get the women name index if possible. - uint womenNameColIndex; + uint womenNameColIndex = std::numeric_limits::max(); if( !ws.findCol(womenNameColIdent, womenNameColIndex) ) womenNameColIndex= std::numeric_limits::max(); // Get the description index if possible. - uint descColIndex; + uint descColIndex = std::numeric_limits::max(); if( !ws.findCol(descColIdent, descColIndex) ) descColIndex= std::numeric_limits::max(); - uint descColIndex2; + uint descColIndex2 = std::numeric_limits::max(); if( !ws.findCol(descColIdent2, descColIndex2) ) descColIndex2= std::numeric_limits::max(); diff --git a/code/ryzom/common/src/game_share/character_sync_itf.h b/code/ryzom/common/src/game_share/character_sync_itf.h index 840dd2845..459659732 100644 --- a/code/ryzom/common/src/game_share/character_sync_itf.h +++ b/code/ryzom/common/src/game_share/character_sync_itf.h @@ -1137,12 +1137,12 @@ namespace CHARSYNC } // - ucstring getFullName() const + const ucstring& getFullName() const { return _FullName; } - void setFullName(ucstring value) + void setFullName(const ucstring &value) { _FullName = value; diff --git a/code/ryzom/server/src/ai_share/world_map.cpp b/code/ryzom/server/src/ai_share/world_map.cpp index e0d03bc6f..38bed3b30 100644 --- a/code/ryzom/server/src/ai_share/world_map.cpp +++ b/code/ryzom/server/src/ai_share/world_map.cpp @@ -218,24 +218,27 @@ private: void CDirectionLayer::serial(NLMISC::IStream& f) { - uint i; - for (i=0; i<9; ++i) + uint i, j; + for (i=0; i<3; ++i) { - if (f.isReading()) - { - delete Grid[0][i]; - Grid[0][i] = NULL; - } - - bool present = (Grid[0][i] != NULL); - f.serial(present); - - if (present) + for (j=0; j<3; ++j) { if (f.isReading()) - Grid[0][i] = I16x16Layer::load(f); - else - I16x16Layer::save(f, Grid[0][i]); + { + delete Grid[i][j]; + Grid[i][j] = NULL; + } + + bool present = (Grid[i][j] != NULL); + f.serial(present); + + if (present) + { + if (f.isReading()) + Grid[i][j] = I16x16Layer::load(f); + else + I16x16Layer::save(f, Grid[i][j]); + } } } } @@ -1360,7 +1363,7 @@ void CWorldMap::countCells(uint &compute, uint &white, uint &simple, uint &multi const uint32 startMasterTopo=startTopoNode.getMasterTopo(possibleFlag); const uint32 endMasterTopo=endTopoNode.getMasterTopo(possibleFlag); if ( (startMasterTopo^endMasterTopo)!=0 - || startMasterTopo==~0) // if not same masterTopo or invalid masterTopo then bypass .. + || startMasterTopo == std::numeric_limits::max()) // if not same masterTopo or invalid masterTopo then bypass .. continue; res.set(possibleFlag, startMasterTopo); @@ -1489,14 +1492,14 @@ bool CWorldMap::findAStarPath(CWorldPosition const& start, CWorldPosition const& ++nbHeapSteps; // Get best node (popping it) - father = ~0; // :TODO: Remove that useless statement (since do while first loop ALWAYS overwrite it) + father = std::numeric_limits::max(); // :TODO: Remove that useless statement (since do while first loop ALWAYS overwrite it) do { father = heap.pop(); } while (!nodes[father].isOpened() && !heap.empty()); - if (father==~0) + if (father == std::numeric_limits::max()) break; // Mark current node as closed @@ -2238,7 +2241,7 @@ bool CWorldMap::setWorldPosition(sint32 z, CWorldPosition &wpos, const CAIVector sint32 minDistZ = INT_MAX; CSlot bestSlot; - sint32 bestZ; + sint32 bestZ = 0; // Find best slot for (uint32 s=0; s<3; ++s) { diff --git a/code/ryzom/server/src/ai_share/world_map.h b/code/ryzom/server/src/ai_share/world_map.h index b7c3eb76d..b6ff63626 100644 --- a/code/ryzom/server/src/ai_share/world_map.h +++ b/code/ryzom/server/src/ai_share/world_map.h @@ -1173,9 +1173,10 @@ private: inline CDirectionLayer::CDirectionLayer() { - uint i; - for (i=0; i<9; ++i) - Grid[0][i] = NULL; + uint i, j; + for (i=0; i<3; ++i) + for (j=0; j<3; ++j) + Grid[i][j] = NULL; } inline @@ -1205,39 +1206,42 @@ void CDirectionLayer::dump() if (gridDirectionLayer) motion = gridDirectionLayer->getDirection(y,x); + char c = ' '; + switch (motion.getVal()) { case CDirection::N: - output[y+i*16][x+j*16] = '^'; + c = '^'; break; case CDirection::S: - output[y+i*16][x+j*16] = 'v'; + c = 'v'; break; case CDirection::E: - output[y+i*16][x+j*16] = '>'; + c = '>'; break; case CDirection::W: - output[y+i*16][x+j*16] = '<'; + c = '<'; break; case CDirection::NE: - output[y+i*16][x+j*16] = '7'; + c = '7'; break; case CDirection::SW: - output[y+i*16][x+j*16] = 'L'; + c = 'L'; break; case CDirection::NW: - output[y+i*16][x+j*16] = 'r'; + c = 'r'; break; case CDirection::SE: - output[y+i*16][x+j*16] = '\\'; - break; - case 255: - output[y+i*16][x+j*16] = ' '; + c = '\\'; break; +// case 255: +// c = ' '; +// break; default: - output[y+i*16][x+j*16] = 'o'; + c = 'o'; break; } + output[y+i*16][x+j*16] = c; } char op[256]; diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp index da14bf244..725aa7493 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp @@ -2694,7 +2694,7 @@ void CGameItem::addHp( double hpGain ) //----------------------------------------------- // changes the custom text of an item //----------------------------------------------- -void CGameItem::setCustomText(ucstring val) +void CGameItem::setCustomText(const ucstring &val) { _CustomText = val; // getInventory()->onItemChanged(getInventorySlot(), INVENTORIES::TItemChangeFlags(INVENTORIES::itc_custom_text)); diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.h b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.h index 5a73e09dd..a8ab8e197 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.h +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item.h @@ -702,9 +702,9 @@ public : const CItemCraftParameters * getCraftParameters() const { return _CraftParameters; } /// get custom string (for scroll-like items) - ucstring getCustomText() const { return _CustomText; } + const ucstring& getCustomText() const { return _CustomText; } /// set custom string (for scroll-like items) - void setCustomText(ucstring val); + void setCustomText(const ucstring &val); protected: friend class CFaberPhrase; diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index be58a37f9..fc39e9fcf 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -44,37 +44,43 @@ void normalisePackageDescriptionFileName(std::string& fileName) void GeneratePatch(const std::string& srcFileName,const std::string& destFileName,const std::string& patchFileName) { - std::string cmd="xdelta.exe delta"; + std::string cmd="xdelta delta"; cmd+=" "+srcFileName+" "+destFileName+" "+patchFileName; nlinfo("executing system command: %s",cmd.c_str()); #ifdef NL_OS_WINDOWS _spawnlp(_P_WAIT, "xdelta.exe","xdelta.exe","delta",srcFileName.c_str(),destFileName.c_str(),patchFileName.c_str(),NULL); #else // NL_OS_WINDOWS - system (cmd.c_str()); + sint error = system (cmd.c_str()); + if (error) + nlwarning("'%s' failed with error code %d", cmd.c_str(), error); #endif // NL_OS_WINDOWS } void ApplyPatch(const std::string& srcFileName,const std::string& destFileName,const std::string& patchFileName=std::string()) { - std::string cmd="xdelta.exe patch"; + std::string cmd="xdelta patch"; cmd+=" "+patchFileName+" "+srcFileName+" "+destFileName; nlinfo("executing system command: %s",cmd.c_str()); #ifdef NL_OS_WINDOWS _spawnlp(_P_WAIT, "xdelta.exe","xdelta.exe","patch",patchFileName.c_str(),srcFileName.c_str(),destFileName.c_str(),NULL); #else // NL_OS_WINDOWS - system (cmd.c_str()); + sint error = system (cmd.c_str()); + if (error) + nlwarning("'%s' failed with error code %d", cmd.c_str(), error); #endif // NL_OS_WINDOWS } void GenerateLZMA(const std::string sourceFile, const std::string &outputFile) { - std::string cmd="lzma.exe e "; + std::string cmd="lzma e "; cmd+=" "+sourceFile+" "+outputFile; nlinfo("executing system command: %s",cmd.c_str()); #ifdef NL_OS_WINDOWS _spawnlp(_P_WAIT, "lzma.exe","lzma.exe", "e", sourceFile.c_str(), outputFile.c_str(), NULL); #else // NL_OS_WINDOWS - system (cmd.c_str()); + sint error = system (cmd.c_str()); + if (error) + nlwarning("'%s' failed with error code %d", cmd.c_str(), error); #endif // NL_OS_WINDOWS }