From 65fffec5208208965004159b4925c3c1b34911ad Mon Sep 17 00:00:00 2001 From: kervala <none@none> Date: Sun, 24 Oct 2010 20:23:15 +0200 Subject: [PATCH] Changed: #825 Remove all warning when compiling Ryzom --- code/ryzom/client/src/animation_state.cpp | 2 +- .../ryzom/client/src/bg_downloader_access.cpp | 2 + code/ryzom/client/src/cdb_branch.cpp | 3 ++ code/ryzom/client/src/debug_client.cpp | 2 +- code/ryzom/client/src/http_client_curl.cpp | 5 ++ code/ryzom/client/src/impulse_decoder.cpp | 2 + code/ryzom/client/src/login.cpp | 10 ++-- code/ryzom/client/src/login_patch.cpp | 54 ++++++++++++++++--- .../client/src/login_progress_post_thread.cpp | 2 +- code/ryzom/client/src/main_loop.cpp | 2 +- code/ryzom/client/src/micro_life_manager.cpp | 4 +- .../ryzom/client/src/motion/user_controls.cpp | 9 ++++ code/ryzom/client/src/net_manager.cpp | 7 ++- code/ryzom/client/src/progress.cpp | 2 + .../ryzom/client/src/session_browser_impl.cpp | 2 +- .../client/src/string_manager_client.cpp | 2 +- .../client/src/weather_manager_client.cpp | 2 +- 17 files changed, 89 insertions(+), 23 deletions(-) diff --git a/code/ryzom/client/src/animation_state.cpp b/code/ryzom/client/src/animation_state.cpp index cd823c1cc..91bd8753a 100644 --- a/code/ryzom/client/src/animation_state.cpp +++ b/code/ryzom/client/src/animation_state.cpp @@ -275,7 +275,7 @@ CAnimation::TAnimId CAnimationState::chooseAnim(uint32 jobSpecialisation, EGSPD: else { uint i; - uint best; + uint best = 0; const uint count = (uint)_Animations.size (); double bestAng = 1000.0; // Big value to be > to the first element. for (i=0; i<count; i++) diff --git a/code/ryzom/client/src/bg_downloader_access.cpp b/code/ryzom/client/src/bg_downloader_access.cpp index 15d98569b..df95c6454 100644 --- a/code/ryzom/client/src/bg_downloader_access.cpp +++ b/code/ryzom/client/src/bg_downloader_access.cpp @@ -868,6 +868,7 @@ CBGDownloaderAccess::~CBGDownloaderAccess() bool CBGDownloaderAccess::getPatchCompletionFlag(bool clearFlag) { // TODO for Linux + return false; } //===================================================== @@ -880,6 +881,7 @@ void CBGDownloaderAccess::startTask(const BGDownloader::CTaskDesc &taskDesc, con bool CBGDownloaderAccess::isTaskEnded(BGDownloader::TTaskResult &result, ucstring &errorMsg) const { // TODO for Linux + return false; } //===================================================== diff --git a/code/ryzom/client/src/cdb_branch.cpp b/code/ryzom/client/src/cdb_branch.cpp index 3426ccce3..ece4866c0 100644 --- a/code/ryzom/client/src/cdb_branch.cpp +++ b/code/ryzom/client/src/cdb_branch.cpp @@ -518,7 +518,10 @@ void CCDBNodeBranch::readDelta( NLMISC::TGameCycle gc, CBitMemStream & f ) if ( bitfield[i] ) { if(VerboseDatabase) + { nldebug( "CDB/ATOM: Reading prop[%u] of atom", i ); + } + atomIndex = i; CCDBNodeLeaf *leaf = findLeafAtCount( atomIndex ); if ( leaf ) diff --git a/code/ryzom/client/src/debug_client.cpp b/code/ryzom/client/src/debug_client.cpp index 9e42dffc8..70c138cb6 100644 --- a/code/ryzom/client/src/debug_client.cpp +++ b/code/ryzom/client/src/debug_client.cpp @@ -490,7 +490,7 @@ string getDebugInformation() if (IsInRingSession) { if (getEditor().isInitialized()) - str += toString("SessionId: %u\n", getEditor().getDMC().getEditionModule().getCurrentAdventureId()); + str += toString("SessionId: %u\n", getEditor().getDMC().getEditionModule().getCurrentAdventureId().asInt()); extern R2::TUserRole UserRoleInSession; str += toString("Role: %s\n", UserRoleInSession.toString().c_str()); } diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index e829cd930..85b8f4ee7 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -119,7 +119,9 @@ bool CCurlHttpClient::sendRequest(const std::string& methodWB, const std::string long r; curl_easy_getinfo(_Curl, CURLINFO_RESPONSE_CODE, &r); if (verbose) + { nldebug("%u", r); + } return true; } @@ -157,7 +159,10 @@ bool CCurlHttpClient::sendPostWithCookie(const string &url, const string &name, bool CCurlHttpClient::receive(string &res, bool verbose) { if (verbose) + { nldebug("Receiving %u bytes", _ReceiveBuffer.size()); + } + res.clear(); if (_ReceiveBuffer.size()) res.assign((const char*)&(*(_ReceiveBuffer.begin())), _ReceiveBuffer.size()); diff --git a/code/ryzom/client/src/impulse_decoder.cpp b/code/ryzom/client/src/impulse_decoder.cpp index fc9da0f9e..01efc4b58 100644 --- a/code/ryzom/client/src/impulse_decoder.cpp +++ b/code/ryzom/client/src/impulse_decoder.cpp @@ -89,7 +89,9 @@ void CImpulseDecoder::decode(CBitMemStream &inbox, TPacketNumber receivedPacket, } if (checkOnce) + { nldebug("CLIMPD: at level %d (channel %d), %d actions%s (ReceivedAck=%d/lastAck=%d/nextSentPacket=%d)", level, channel, num, (keep) ? "" : " (discarded)", receivedAck, lastAck, nextSentPacket); + } } } diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 35d7e00be..cf3df21b7 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -1814,7 +1814,7 @@ class CAHOpenURL : public IActionHandler LocalFree( lpMsgBuf ); } #else -# pragma message(Install tag not supported) + // TODO: for Linux and Mac OS #endif /* @@ -2823,7 +2823,7 @@ string checkLogin(const string &login, const string &password, const string &cli if(pPM->isVerboseLog()) { - nlinfo ("Exploded, with nl, %zu res", lines.size()); + nlinfo ("Exploded, with nl, %u res", (uint)lines.size()); /* for (uint i = 0; i < lines.size(); i++) { nlinfo (" > '%s'", lines[i].c_str()); @@ -2832,7 +2832,7 @@ string checkLogin(const string &login, const string &password, const string &cli if(lines.size() != nbs+1) { - nlwarning("bad shard lines number %zu != %d", lines.size(), nbs+1); + nlwarning("bad shard lines number %u != %d", (uint)lines.size(), nbs+1); nlwarning("'%s'", res.c_str()); return "bad lines numbers (error code 5)"; } @@ -2844,7 +2844,7 @@ string checkLogin(const string &login, const string &password, const string &cli if(pPM->isVerboseLog()) { - nlinfo ("Exploded with '%s', %zu res", "|", res.size()); + nlinfo ("Exploded with '%s', %u res", "|", (uint)res.size()); /* for (uint i = 0; i < res.size(); i++) { nlinfo (" > '%s'", res[i].c_str()); @@ -2853,7 +2853,7 @@ string checkLogin(const string &login, const string &password, const string &cli if (res.size() < 7 && res.size() > 8) { - nlwarning("bad | numbers %zu != %d", res.size(), 8); + nlwarning("bad | numbers %u != %d", (uint)res.size(), 8); nlwarning("'%s'", lines[i].c_str()); return "bad pipe numbers (error code 6)"; } diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 3a8cac886..912249d6b 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -254,7 +254,7 @@ void CPatchManager::init(const std::vector<std::string>& patchURIs, const std::s } srand(NLMISC::CTime::getSecondsSince1970()); - UsedServer = rand() * (sint)PatchServers.size() / (RAND_MAX+1); + UsedServer = (sint)((float)(rand() / (RAND_MAX+1)) * (sint)PatchServers.size()); ServerPath = CPath::standardizePath (sServerPath); ServerVersion = sServerVersion; @@ -1700,29 +1700,58 @@ bool CPatchManager::readBNPHeader(const string &SourceName, vector<SBNPFile> &Fi nlfseek64 (f, 0, SEEK_END); uint32 nFileSize = NLMISC::CFile::getFileSize (SourceName); nlfseek64 (f, nFileSize-sizeof(uint32), SEEK_SET); + uint32 nOffsetFromBegining; - fread (&nOffsetFromBegining, sizeof(uint32), 1, f); - if (nlfseek64 (f, nOffsetFromBegining, SEEK_SET) != 0) + if (fread (&nOffsetFromBegining, sizeof(uint32), 1, f) != 1) + { + fclose(f); return false; + } + + if (nlfseek64 (f, nOffsetFromBegining, SEEK_SET) != 0) + { + fclose(f); + return false; + } uint32 nNbFile; if (fread (&nNbFile, sizeof(uint32), 1, f) != 1) + { + fclose(f); return false; + } + for (uint32 i = 0; i < nNbFile; ++i) { uint8 nStringSize; - char sName[256]; if (fread (&nStringSize, 1, 1, f) != 1) + { + fclose(f); return false; + } + + char sName[256]; if (fread (sName, 1, nStringSize, f) != nStringSize) + { + fclose(f); return false; + } sName[nStringSize] = 0; + SBNPFile tmpBNPFile; tmpBNPFile.Name = sName; if (fread (&tmpBNPFile.Size, sizeof(uint32), 1, f) != 1) + { + fclose(f); return false; + } + if (fread (&tmpBNPFile.Pos, sizeof(uint32), 1, f) != 1) + { + fclose(f); return false; + } + Files.push_back (tmpBNPFile); } fclose (f); @@ -1778,7 +1807,13 @@ bool CPatchManager::bnpUnpack(const string &srcBigfile, const string &dstPath, v { nlfseek64 (bnp, rBNPFile.Pos, SEEK_SET); uint8 *ptr = new uint8[rBNPFile.Size]; - fread (ptr, rBNPFile.Size, 1, bnp); + + if (fread (ptr, rBNPFile.Size, 1, bnp) != 1) + { + fclose(out); + return false; + } + bool writeError = fwrite (ptr, rBNPFile.Size, 1, out) != 1; if (writeError) { @@ -2399,7 +2434,12 @@ void CCheckThread::run () CHashKey sha1BNPFile; nlfseek64 (bnp, rBNPFile.Pos, SEEK_SET); uint8 *pPtr = new uint8[rBNPFile.Size]; - fread (pPtr, rBNPFile.Size, 1, bnp); + if (fread (pPtr, rBNPFile.Size, 1, bnp) != 1) + { + delete [] pPtr; + break; + } + sha1BNPFile = getSHA1(pPtr, rBNPFile.Size); delete [] pPtr; CHashKey sha1RealFile = getSHA1(sRealFilename, true); @@ -3196,7 +3236,7 @@ bool CPatchManager::download(const std::string& patchFullname, const std::string pPM->deleteFile(sourceFullname); } // file will be save to a .tmp file - std::string extension = ""; + std::string extension; if (patchFullname.size() >= zsStrLength && patchFullname.substr(patchFullname.size() - zsStrLength) == zsStr) { extension = zsStr; diff --git a/code/ryzom/client/src/login_progress_post_thread.cpp b/code/ryzom/client/src/login_progress_post_thread.cpp index 9b6e351da..1c38fdd88 100644 --- a/code/ryzom/client/src/login_progress_post_thread.cpp +++ b/code/ryzom/client/src/login_progress_post_thread.cpp @@ -34,7 +34,7 @@ using namespace NLMISC; static std::string uint64ToHex(uint64 size) { char data[256]; - sprintf(data, "%llX", size); + sprintf(data, "%"NL_I64"X", size); return std::string(data); } diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index f085844dc..3e7fefdd3 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -1071,7 +1071,7 @@ void renderAll(bool forceFullDetail) uint maxFullDetailChar = Scene->getMaxSkeletonsInNotCLodForm(); UScene *skyScene = getSkyScene(); UScene::TPolygonBalancingMode oldBalancingMode = Scene->getPolygonBalancingMode(); - UScene::TPolygonBalancingMode oldSkyBalancingMode; + UScene::TPolygonBalancingMode oldSkyBalancingMode = UScene::PolygonBalancingOff; if (skyScene) { oldSkyBalancingMode = skyScene->getPolygonBalancingMode(); diff --git a/code/ryzom/client/src/micro_life_manager.cpp b/code/ryzom/client/src/micro_life_manager.cpp index 3dc00d6c0..59bfce76d 100644 --- a/code/ryzom/client/src/micro_life_manager.cpp +++ b/code/ryzom/client/src/micro_life_manager.cpp @@ -602,7 +602,7 @@ void CMicroLifeManager::tileAdded(const NL3D::CTileAddedInfo &infos) // K ^ Normal resolves to [-y x 0] // if z is near from 1.f or -1.f then no rotation is performed (because [-y x 0] tends to 0 and can't be normalized) CVector rotAxis; // rotation axis to match Z of model with normal - float angle; // angle of rotation to match Z of model with normal + float angle = 0.f; // angle of rotation to match Z of model with normal // see if want rotation if (!sfs.DontRotate) { @@ -623,7 +623,7 @@ void CMicroLifeManager::tileAdded(const NL3D::CTileAddedInfo &infos) } } - float angleAroundNormal; + float angleAroundNormal = 0.f; // see if want rotation around normal if (!sfs.DontRotateAroundLocalZ) { diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index d681fd9cd..0ab04ae10 100644 --- a/code/ryzom/client/src/motion/user_controls.cpp +++ b/code/ryzom/client/src/motion/user_controls.cpp @@ -247,6 +247,9 @@ void CUserControls::update() case ThirdMode: thirdMode(); break; + + default: + break; } _LastFrameForward = Actions.valide("forward") && !_NeedReleaseForward; @@ -1094,6 +1097,9 @@ void CUserControls::mode(const TMoveMode mode) case ThirdMode: thirdModeStop(); break; + + default: + break; } // Backup the last Mode. @@ -1127,6 +1133,9 @@ void CUserControls::mode(const TMoveMode mode) case ThirdMode: thirdModeStart(); break; + + default: + break; } }// mode // diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index dc9d3d756..46c7bbed9 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -881,7 +881,7 @@ void CInterfaceChatDisplayer::clearChannel(CChatGroup::TGroupType mode, uint32 d else if (mode == CChatGroup::dyn_chat) { // if correct dbIndex, clear - if(dynChatDbIndex>=0 && dynChatDbIndex<CChatGroup::MaxDynChanPerPlayer) + if(dynChatDbIndex<CChatGroup::MaxDynChanPerPlayer) PeopleInterraction.ChatInput.DynamicChat[dynChatDbIndex].clearMessages(); else nlwarning("Dynamic chat %d not found for clearing", dynChatDbIndex); @@ -925,7 +925,7 @@ void impulseDynString(NLMISC::CBitMemStream &impulse) void inpulseDynStringInChatGroup(NLMISC::CBitMemStream &impulse) { - CChatGroup::TGroupType type; + CChatGroup::TGroupType type = CChatGroup::say; impulse.serialEnum(type); ChatMngr.processChatStringWithNoSender(impulse, type, InterfaceChatDisplayer); } @@ -1566,6 +1566,7 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) case R2::TPContext_Mainland: tpIcon = "cancel_tp_main_land.tga"; break; case R2::TPContext_Edit: tpIcon = "cancel_tp_edit.tga"; break; case R2::TPContext_IslandOwner: tpIcon = "cancel_tp_island_owner.tga"; break; + default: break; } ProgressBar.setTPMessages(tpReason, tpCancelText, tpIcon); } @@ -1620,6 +1621,8 @@ void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) case R2::TPContext_IslandOwner: CInterfaceManager::getInstance()->runActionHandler("r2_stop_live", NULL); break; + default: + break; } } diff --git a/code/ryzom/client/src/progress.cpp b/code/ryzom/client/src/progress.cpp index dc164ef8e..14c62795c 100644 --- a/code/ryzom/client/src/progress.cpp +++ b/code/ryzom/client/src/progress.cpp @@ -127,10 +127,12 @@ void drawLoadingBitmap (float progress) float y2 = 1; if ((ww > 1024) || (wh > 768)) + { if ((ww - 1024) > (wh - 768)) x1 = ((ww - (wh * 1024.f) / 768.f) / 2.f) / ww; else y1 = ((wh - (ww * 768.f) / 1024.f) / 2.f) / wh; + } if (x1 != 0) x2 = 1 - x1; diff --git a/code/ryzom/client/src/session_browser_impl.cpp b/code/ryzom/client/src/session_browser_impl.cpp index 692b60838..4f39db901 100644 --- a/code/ryzom/client/src/session_browser_impl.cpp +++ b/code/ryzom/client/src/session_browser_impl.cpp @@ -655,7 +655,7 @@ void CSessionBrowserImpl::charsFill(const std::vector <RSMGR::TCharDesc > &chars // **************************************************************************** -inline double ecoRingPoints(const std::string & ecoPoints, char * c) +inline double ecoRingPoints(const std::string & ecoPoints, const char * c) { std::string::size_type cPlace = ecoPoints.find(c); if(cPlace==string::npos) diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index 3e93c7957..90df72bec 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1199,7 +1199,7 @@ void CStringManagerClient::initI18NSpecialWords(const std::string &languageCode) STRING_MANAGER::readExcelSheet(ucs, ws); // Get the Key and Data ColIndex. - uint nameColIndex, keyColIndex; + uint nameColIndex = 0, keyColIndex = 0; if( !ws.findCol(ucstring("name"), nameColIndex) ) continue; if( !ws.findCol(ucstring(specialWords[i*3+1]), keyColIndex) ) diff --git a/code/ryzom/client/src/weather_manager_client.cpp b/code/ryzom/client/src/weather_manager_client.cpp index 7ff6edfa7..fc32dae1c 100644 --- a/code/ryzom/client/src/weather_manager_client.cpp +++ b/code/ryzom/client/src/weather_manager_client.cpp @@ -604,7 +604,7 @@ void CWeatherManagerClient::updateThunder(uint64 day, float hour, const CWeather CThunderTime t1; - float manualThunderThreshold; + float manualThunderThreshold = 0.f; if (manual) { if (wc.WF)