From cdc1dde0aae2b6202e3589b04a66006b1047b70f Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:27:35 +0200 Subject: [PATCH 1/5] Fixed: #897 Missing ; after two nlassert calls (patch provided by vhelsing) --- code/nel/tools/3d/build_clodtex/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/tools/3d/build_clodtex/main.cpp b/code/nel/tools/3d/build_clodtex/main.cpp index 3074032c3..d857af17b 100644 --- a/code/nel/tools/3d/build_clodtex/main.cpp +++ b/code/nel/tools/3d/build_clodtex/main.cpp @@ -83,7 +83,7 @@ bool computeOneShape(const char *lodFile, const char *shapeIn, const char *shape throw Exception("The shape %s is not a Mesh, a MeshMRM or MeshMMRMSkinned", shapeIn); // store in mesh - nlassert (base) + nlassert (base); base->setupLodCharacterTexture(lodTexture); // serial From cb39bf549d623a497c3c09d41fef349b73b825eb Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:29:42 +0200 Subject: [PATCH 2/5] Changed: #825 Remove all warning when compiling Ryzom on Linux --- code/nel/tools/3d/build_shadow_skin/main.cpp | 6 ++--- code/nel/tools/3d/cluster_viewer/view_cs.cpp | 2 +- code/nel/tools/3d/file_info/main.cpp | 2 +- code/nel/tools/3d/ig_lighter/ig_lighter.cpp | 2 +- .../3d/ig_lighter_lib/ig_lighter_lib.cpp | 4 +-- .../panoply_maker/hls_bank_texture_info.cpp | 2 +- .../tools/3d/panoply_maker/panoply_maker.cpp | 2 +- .../zone_dependencies/zone_dependencies.cpp | 2 +- code/nel/tools/3d/zviewer/zviewer.cpp | 4 +-- code/nel/tools/misc/bnp_make/main.cpp | 4 +-- .../misc/make_sheet_id/make_sheet_id.cpp | 4 +-- code/nel/tools/misc/xml_packer/xml_packer.cpp | 2 +- .../tools/pacs/build_indoor_rbank/mouline.cpp | 4 +-- .../tools/pacs/build_rbank/build_rbank.cpp | 26 +++++++++---------- .../nel/tools/pacs/build_rbank/build_surf.cpp | 14 +++++----- .../pacs/build_rbank/surface_splitter.cpp | 6 ++--- .../tools/pacs/build_rbank/surface_splitter.h | 4 +-- .../admin_executor_service/log_report.cpp | 8 +++--- .../nelns/admin_executor_service/log_report.h | 2 +- 19 files changed, 50 insertions(+), 50 deletions(-) diff --git a/code/nel/tools/3d/build_shadow_skin/main.cpp b/code/nel/tools/3d/build_shadow_skin/main.cpp index a8e57967a..cb9df595c 100644 --- a/code/nel/tools/3d/build_shadow_skin/main.cpp +++ b/code/nel/tools/3d/build_shadow_skin/main.cpp @@ -110,7 +110,7 @@ void addShadowMesh(T *meshIn, float paramFaceRatio, sint paramMaxFace, const st map shadowVertexMap; uint numMerged= 0; // Skip Geomorphs. - for(i=geomorphs.size();igetNbMaterial(); - uint nLms= meshBase->_LightInfos.size(); + uint nLms= (uint)meshBase->_LightInfos.size(); MaxNumLightMap= max(MaxNumLightMap, nLms); if(nLms) { diff --git a/code/nel/tools/3d/ig_lighter/ig_lighter.cpp b/code/nel/tools/3d/ig_lighter/ig_lighter.cpp index 0876d0cc3..bc00ba718 100644 --- a/code/nel/tools/3d/ig_lighter/ig_lighter.cpp +++ b/code/nel/tools/3d/ig_lighter/ig_lighter.cpp @@ -80,7 +80,7 @@ public: pgId= min(pgId, (uint)(BAR_LENGTH-1)); sprintf (msg, "\r%s: %s", message, progressbar[pgId]); uint i; - for (i=strlen(msg); i<79; i++) + for (i=(uint)strlen(msg); i<79; i++) msg[i]=' '; msg[i]=0; printf (msg); diff --git a/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp b/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp index 4095e2494..36f1c462f 100644 --- a/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp +++ b/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp @@ -256,7 +256,7 @@ void CIgLighterLib::lightIg(CInstanceLighter &instanceLighter, // For any retreiverInstance with this identifier. //---------------- - uint numInstances= globalRetriever->getInstances().size(); + uint numInstances= (uint)globalRetriever->getInstances().size(); for(uint instanceId=0; instanceIdgetInstance(instanceId); @@ -286,7 +286,7 @@ void CIgLighterLib::lightIg(CInstanceLighter &instanceLighter, CIGSurfaceLightBuild::CRetrieverLightGrid &rlg= itRgm->second; // Resize Grids. - uint numSurfaces= localRetriever.getSurfaces().size(); + uint numSurfaces= (uint)localRetriever.getSurfaces().size(); rlg.Grids.resize( numSurfaces ); // Compute the bbox for all surfaces. (NB: local to the localRetriever). diff --git a/code/nel/tools/3d/panoply_maker/hls_bank_texture_info.cpp b/code/nel/tools/3d/panoply_maker/hls_bank_texture_info.cpp index b16f3a724..443a62b3c 100644 --- a/code/nel/tools/3d/panoply_maker/hls_bank_texture_info.cpp +++ b/code/nel/tools/3d/panoply_maker/hls_bank_texture_info.cpp @@ -96,7 +96,7 @@ void CHLSBankTextureInfo::CDXTCBitmap::build(const NLMISC::CBitmap &src) void CHLSBankTextureInfo::CDXTCBitmap::buildBitmap(NLMISC::CBitmap &dst) { CMemStream memStream(true); - memStream.fill(&_Data[0], _Data.size()); + memStream.fill(&_Data[0], (uint32)_Data.size()); // load the DXTC5 from memStream dst.reset(); dst.load(memStream); diff --git a/code/nel/tools/3d/panoply_maker/panoply_maker.cpp b/code/nel/tools/3d/panoply_maker/panoply_maker.cpp index a943f3168..fcc0e097f 100644 --- a/code/nel/tools/3d/panoply_maker/panoply_maker.cpp +++ b/code/nel/tools/3d/panoply_maker/panoply_maker.cpp @@ -760,7 +760,7 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str std::string outputFileName = fileName; // Add an instance entry to the hlsInfo - uint instId= hlsInfo.Instances.size(); + uint instId= (uint)hlsInfo.Instances.size(); hlsInfo.Instances.resize(instId+1); CHLSBankTextureInfo::CTextureInstance &hlsTextInstance= hlsInfo.Instances[instId]; hlsTextInstance.Mods.resize(masks.size()); diff --git a/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp b/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp index aa66d8abe..504058f07 100644 --- a/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp +++ b/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp @@ -79,7 +79,7 @@ void progress (const char *message, float progress) pgId= min(pgId, (uint)(BAR_LENGTH-1)); sprintf (msg, "\r%s: %s", message, progressbar[pgId]); uint i; - for (i=strlen(msg); i<79; i++) + for (i=(uint)strlen(msg); i<79; i++) msg[i]=' '; msg[i]=0; printf (msg); diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index fd149b84d..a89123af0 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -173,7 +173,7 @@ string getZoneNameByCoord(float x, float y) string zoneName; char ych[32]; sprintf(ych,"%d",(sint)ycount); - sint sz = strlen(ych); + sint sz = (sint)strlen(ych); for(sint i = 0; iLandscape.TileBank.makeAllPathRelative(); - sint idx = ViewerCfg.Bank.find("."); + sint idx = (sint)ViewerCfg.Bank.find("."); string farBank = ViewerCfg.Bank.substr(0,idx); farBank += ".farbank"; diff --git a/code/nel/tools/misc/bnp_make/main.cpp b/code/nel/tools/misc/bnp_make/main.cpp index e8b84fdee..c1fb19a65 100644 --- a/code/nel/tools/misc/bnp_make/main.cpp +++ b/code/nel/tools/misc/bnp_make/main.cpp @@ -78,11 +78,11 @@ struct BNPHeader FILE *f = fopen (filename.c_str(), "ab"); if (f == NULL) return false; - uint32 nNbFile = Files.size(); + uint32 nNbFile = (uint32)Files.size(); fwrite (&nNbFile, sizeof(uint32), 1, f); for (uint32 i = 0; i < nNbFile; ++i) { - uint8 nStringSize = Files[i].Name.size(); + uint8 nStringSize = (uint8)Files[i].Name.size(); fwrite (&nStringSize, 1, 1, f); fwrite (Files[i].Name.c_str(), 1, nStringSize, f); fwrite (&Files[i].Size, sizeof(uint32), 1, f); diff --git a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp index 57f66e751..2755e2a96 100644 --- a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp +++ b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp @@ -112,7 +112,7 @@ sint16 getFirstFreeFileTypeId() { for( sint16 id=0; id<256; ++id ) { - if( IdToFileType.find(id) == IdToFileType.end() ) + if( IdToFileType.find((uint8)id) == IdToFileType.end() ) { return id; } @@ -609,7 +609,7 @@ int main( int argc, char ** argv ) { //string outputLine = "type: " + toString((*it1).first.FormIDInfos.Type) +" id: " + toString((*it1).first.FormIDInfos.Id) + " file: " + (*it1).second +"\n"; string outputLine = " id: " + toString((*it1).first.Id) + " file: " + (*it1).second +"\n"; - output.serialBuffer((uint8*)(const_cast(outputLine.data())),outputLine.size()); + output.serialBuffer((uint8*)(const_cast(outputLine.data())),(uint)outputLine.size()); } nlinfo ("------------- results ----------------"); diff --git a/code/nel/tools/misc/xml_packer/xml_packer.cpp b/code/nel/tools/misc/xml_packer/xml_packer.cpp index 35a4bfbe8..f6f806e69 100644 --- a/code/nel/tools/misc/xml_packer/xml_packer.cpp +++ b/code/nel/tools/misc/xml_packer/xml_packer.cpp @@ -394,7 +394,7 @@ int main(int argc, char *argv[]) CPath::getPathContent(dirName, false, true, false, subDirs); // filter the directories - for (uint i=subDirs.size(); i>0; --i) + for (uint i=(uint)subDirs.size(); i>0; --i) { if (!isExcludedDir(subDirs[i-1])) dirStack.push_back(subDirs[i-1]); diff --git a/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp b/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp index cf5f00e0c..a33a9bfbd 100644 --- a/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp +++ b/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp @@ -182,7 +182,7 @@ void buildExteriorMesh(CCollisionMeshBuild &cmb, CExteriorMesh &em) bool allowThis = true; uint numLink = 0; - uint firstEdge = edges.size(); + uint firstEdge = (uint)edges.size(); vector loop; @@ -224,7 +224,7 @@ void buildExteriorMesh(CCollisionMeshBuild &cmb, CExteriorMesh &em) // this way, collisions won't be checked in the pacs engine if (loop.size() >= 3) { - uint n = loop.size(); + uint n = (uint)loop.size(); while (loop.front().Link >= 0 && loop.back().Link >= 0 && n > 0) { loop.push_back(loop.front()); diff --git a/code/nel/tools/pacs/build_rbank/build_rbank.cpp b/code/nel/tools/pacs/build_rbank/build_rbank.cpp index 0abf61463..c2e997be5 100644 --- a/code/nel/tools/pacs/build_rbank/build_rbank.cpp +++ b/code/nel/tools/pacs/build_rbank/build_rbank.cpp @@ -629,7 +629,7 @@ void fixFaultyLinks(map &faultyInstances, CChainRef cr; cr.Chain = chain; cr.Previous = chain; - cr.From = fci.Vertices.size(); + cr.From = (uint)fci.Vertices.size(); cr.BorderId = NLPACS::CChain::convertBorderChainId(retriever.getChain(chain).getRight()); while (!it.end()) @@ -638,7 +638,7 @@ void fixFaultyLinks(map &faultyInstances, ++it; } - cr.To = fci.Vertices.size()-1; + cr.To = (uint)fci.Vertices.size()-1; if (l < inst.Reconstructed[j].Chains.size()-1) fci.Vertices.pop_back(); @@ -654,7 +654,7 @@ void fixFaultyLinks(map &faultyInstances, CChainRef cr; cr.Chain = chain; cr.Previous = chain; - cr.From = fcn.Vertices.size(); + cr.From = (uint)fcn.Vertices.size(); cr.BorderId = NLPACS::CChain::convertBorderChainId(nretriever.getChain(chain).getRight()); while (!it.end()) @@ -663,7 +663,7 @@ void fixFaultyLinks(map &faultyInstances, ++it; } - cr.To = fcn.Vertices.size()-1; + cr.To = (uint)fcn.Vertices.size()-1; if (l < neighb.Reconstructed[k].Chains.size()-1) fcn.Vertices.pop_back(); @@ -692,8 +692,8 @@ void fixFaultyLinks(map &faultyInstances, if (l ifreeBorderIds, nfreeBorderIds; @@ -701,18 +701,18 @@ void fixFaultyLinks(map &faultyInstances, for (l=0; l=0 && fcn.Chains[m].From>splitAt; --m) + for (m=(uint)fcn.Chains.size()-1; (sint)m>=0 && fcn.Chains[m].From>splitAt; --m) ; // no split ? @@ -729,9 +729,9 @@ void fixFaultyLinks(map &faultyInstances, // generate splits from second chain on first chain for (l=0; l=0 && fci.Chains[m].From>splitAt; --m) + for (m=(uint)fci.Chains.size()-1; (sint)m>=0 && fci.Chains[m].From>splitAt; --m) ; // no split ? @@ -862,7 +862,7 @@ void fixFaultyLinks(map &faultyInstances, // force links between instances (border chain links) for (l=0; l(instance)).forceBorderChainLink(fci.Chains[l].BorderId, neighb.Instance, fcn.Chains[m].BorderId, diff --git a/code/nel/tools/pacs/build_rbank/build_surf.cpp b/code/nel/tools/pacs/build_rbank/build_surf.cpp index 4e3d9d057..98e452a03 100644 --- a/code/nel/tools/pacs/build_rbank/build_surf.cpp +++ b/code/nel/tools/pacs/build_rbank/build_surf.cpp @@ -467,7 +467,7 @@ void NLPACS::CComputableSurfaceBorder::smooth(float val) } } - before = Vertices.size(); + before = (uint)Vertices.size(); while (Vertices.size()>3) // don't smooth blow 3 vertices to avoid degenrated surfaces { minArea = val; @@ -496,7 +496,7 @@ void NLPACS::CComputableSurfaceBorder::smooth(float val) break; } } - after = Vertices.size(); + after = (uint)Vertices.size(); if (Verbose) nlinfo("smoothed border %d-%d: %d -> %d", Left, Right, before, after); @@ -622,7 +622,7 @@ void NLPACS::CComputableSurface::buildBorders(CZoneTessellation *zoneTessel) if ((Elements[elem]->EdgeLinks[edge] == NULL || Elements[elem]->EdgeLinks[edge]->SurfaceId != SurfaceId) && !Elements[elem]->EdgeFlag[edge]) { - BorderIds.push_back(BorderKeeper->size()); + BorderIds.push_back((uint16)BorderKeeper->size()); BorderKeeper->resize(BorderKeeper->size()+1); CComputableSurfaceBorder &border = BorderKeeper->back(); @@ -1225,7 +1225,7 @@ void NLPACS::CZoneTessellation::build() // if doesn't exist, create a new vertex if ((vremapit = vremap.find(v[i])) == vremap.end()) { - element.Tri[i] = _Vertices.size(); + element.Tri[i] = (uint32)_Vertices.size(); _Vertices.push_back(*(v[i])); vremap.insert(make_pair(v[i], element.Tri[i])); } @@ -1633,13 +1633,13 @@ void NLPACS::CZoneTessellation::generateBorders(float smooth) } float smScale = (Borders[border].Right < 0) ? 0.2f : 1.0f; - uint before = Borders[border].Vertices.size(); + uint before = (uint)Borders[border].Vertices.size(); if (SmoothBorders && !Borders[border].DontSmooth) { Borders[border].smooth(smooth*smScale); } Borders[border].computeLength(); - uint after = Borders[border].Vertices.size(); + uint after = (uint)Borders[border].Vertices.size(); totalBefore += before; totalAfter += after; @@ -1678,7 +1678,7 @@ void NLPACS::CZoneTessellation::saveTessellation(COFile &output) for (i=0; i<_Tessellation.size(); ++i) _Tessellation[i].ElemId = i; - uint32 numTessel = _Tessellation.size(); + uint32 numTessel = (uint32)_Tessellation.size(); output.serial(numTessel); for (i=0; i<_Tessellation.size(); ++i) diff --git a/code/nel/tools/pacs/build_rbank/surface_splitter.cpp b/code/nel/tools/pacs/build_rbank/surface_splitter.cpp index 8f2eaba7f..a82cf66ec 100644 --- a/code/nel/tools/pacs/build_rbank/surface_splitter.cpp +++ b/code/nel/tools/pacs/build_rbank/surface_splitter.cpp @@ -49,8 +49,8 @@ void CSurfaceSplitter::build(CLocalRetriever &lr) buildSurface(lr, i); nlinfo("converted %d chains & %d surfaces", lr.getChains().size(), lr.getSurfaces().size()); - _NumSurfaces = lr.getSurfaces().size(); - _NumChains = lr.getChains().size(); + _NumSurfaces = (uint)lr.getSurfaces().size(); + _NumChains = (uint)lr.getChains().size(); //splitChains(); @@ -502,7 +502,7 @@ void CSurfaceSplitter::replaceChain(CChainId chainId, const vector &ch { it = ploop.Chains.erase(it); sint i; - for (i=chains.size()-1; i>=0; --i) + for (i=(sint)chains.size()-1; i>=0; --i) { it = ploop.Chains.insert(it, chains[i]); } diff --git a/code/nel/tools/pacs/build_rbank/surface_splitter.h b/code/nel/tools/pacs/build_rbank/surface_splitter.h index 237503d75..3d74659a4 100644 --- a/code/nel/tools/pacs/build_rbank/surface_splitter.h +++ b/code/nel/tools/pacs/build_rbank/surface_splitter.h @@ -367,7 +367,7 @@ public: Direction = forward ? +1 : -1; if (splitter == NULL || pLoop == NULL) return; - Chain = (Direction>0 ? 0 : pLoop->Chains.size()-1); + Chain = (Direction>0 ? 0 : (sint)pLoop->Chains.size()-1); resetChain(); } iterator(const iterator &it) @@ -420,7 +420,7 @@ public: } pChain = pSplitter->getChain(pLoop->Chains[Chain]); ChainDirection = (pChain->Left == pLoop->Surface ? Direction : -Direction); - ChainVertex = (ChainDirection>0 ? 0 : pChain->Vertices.size()-1); + ChainVertex = (ChainDirection>0 ? 0 : (sint)pChain->Vertices.size()-1); } CVector2s64 operator * () const diff --git a/code/nelns/admin_executor_service/log_report.cpp b/code/nelns/admin_executor_service/log_report.cpp index afcc39e7e..46e27b77e 100644 --- a/code/nelns/admin_executor_service/log_report.cpp +++ b/code/nelns/admin_executor_service/log_report.cpp @@ -37,7 +37,7 @@ enum TLogLineHeader { LHDate, LHTime, LHType, LHThread, LHService, LHCodeFile, L /// bool isLogFile( const std::string& filename ) { - uint len = filename.size(); + uint len = (uint)filename.size(); return (len >= 4 ) && (filename.substr( len-4 ) == ".log"); } @@ -180,7 +180,7 @@ const uint CurrentVersion = ~0; // Return true and logVersion, or false if not a log with version bool getLogVersion( const std::string& filename, uint& logVersion ) { - uint len = filename.size(); + uint len = (uint)filename.size(); if ( (len > 4) && (filename.substr( len-4 ) == ".log") ) { if ( filename.substr(0, 3) == "log" ) @@ -242,7 +242,7 @@ void CMakeLogTask::run() { // Parse log target uint targetVersion = CurrentVersion; - uint lts = _LogTarget.size(); + uint lts = (uint)_LogTarget.size(); if ( _LogTarget.empty() || (_LogTarget == "v") ) { targetMode = TTMMatchExactV; @@ -314,7 +314,7 @@ void CMakeLogTask::run() CIFile logfile; if ( logfile.open( *ilf, true ) ) { - _OutputLogReport->setProgress( ilf-filenames.begin(), filenames.size() ); + _OutputLogReport->setProgress( (uint)(ilf-filenames.begin()), (uint)filenames.size() ); while ( ! logfile.eof() ) { logfile.getline( line, MAX_LOG_LINE_SIZE ); diff --git a/code/nelns/admin_executor_service/log_report.h b/code/nelns/admin_executor_service/log_report.h index acd50d09c..e611f9761 100644 --- a/code/nelns/admin_executor_service/log_report.h +++ b/code/nelns/admin_executor_service/log_report.h @@ -149,7 +149,7 @@ public: std::string service() { return _Service; } - virtual uint getNbDistinctLines() const { return _LogLineInfo.size(); } + virtual uint getNbDistinctLines() const { return (uint)_LogLineInfo.size(); } virtual uint getNbTotalLines( NLMISC::CLog::TLogType logType ); From 2c88d837e3765dfb903115876a66ec1bee5ead5c Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:31:05 +0200 Subject: [PATCH 3/5] Fixed: removed MFC dependencies --- code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.rc | 2 +- code/nel/tools/misc/multi_cd_setup_fix/resource.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.rc b/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.rc index 6f5cd6645..2249f5130 100644 --- a/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.rc +++ b/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/code/nel/tools/misc/multi_cd_setup_fix/resource.h b/code/nel/tools/misc/multi_cd_setup_fix/resource.h index 247b4414b..7cff9b6b1 100644 --- a/code/nel/tools/misc/multi_cd_setup_fix/resource.h +++ b/code/nel/tools/misc/multi_cd_setup_fix/resource.h @@ -2,6 +2,7 @@ // Microsoft Developer Studio generated include file. // Used by multi_cd_setup_fix.rc // +#define IDC_STATIC -1 #define IDI_ICON1 101 #define IDI_ICON2 102 #define IDI_ICON3 103 From cecb9d646be96c450c02439f918adb5dd0d709b4 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:33:22 +0200 Subject: [PATCH 4/5] Changed: #853 Compilation on 64-bits platforms --- code/nel/tools/3d/build_interface/main.cpp | 8 +++---- .../tools/3d/zone_check_bind/zone_utility.cpp | 6 ++--- code/nel/tools/3d/zone_lib/zone_utility.cpp | 6 ++--- .../extract_filename/extract_filename.cpp | 22 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index c332f0063..09c327db6 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -146,9 +146,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo string getBaseName (const string &fullname) { string sTmp2 = ""; - int pos = fullname.rfind('_'); - for (int j = 0; j <= pos; ++j) - sTmp2 += fullname[j]; + string::size_type pos = fullname.rfind('_'); + if (pos != string::npos) + sTmp2 = fullname.substr(0, pos+1); return sTmp2; } @@ -214,7 +214,7 @@ int main(int nNbArg, char **ppArgs) } string fmtName; - uint iNumDirs = inputDirs.size(); + uint iNumDirs = (uint)inputDirs.size(); if( iNumDirs ) { fmtName = inputDirs.front(); diff --git a/code/nel/tools/3d/zone_check_bind/zone_utility.cpp b/code/nel/tools/3d/zone_check_bind/zone_utility.cpp index 0d349dfc8..106427d53 100644 --- a/code/nel/tools/3d/zone_check_bind/zone_utility.cpp +++ b/code/nel/tools/3d/zone_check_bind/zone_utility.cpp @@ -40,8 +40,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) std::string zoneName(name); // y - uint ind1 = zoneName.find("_"); - if(ind1>=zoneName.length()) + string::size_type ind1 = zoneName.find("_"); + if(ind1 == string::npos || ind1>=zoneName.length()) { nlwarning("bad file name"); return false; @@ -59,7 +59,7 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) // x x = 0; - uint ind2 = zoneName.length(); + uint ind2 = (uint)zoneName.length(); if((ind2-ind1-1)!=2) { nlwarning("x code size is not a 2 characters code"); diff --git a/code/nel/tools/3d/zone_lib/zone_utility.cpp b/code/nel/tools/3d/zone_lib/zone_utility.cpp index 5d104e856..63570aa39 100644 --- a/code/nel/tools/3d/zone_lib/zone_utility.cpp +++ b/code/nel/tools/3d/zone_lib/zone_utility.cpp @@ -101,8 +101,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) std::string zoneName(name); // y - uint ind1 = zoneName.find("_"); - if(ind1>=zoneName.length()) + string::size_type ind1 = zoneName.find("_"); + if(ind1 == string::npos || ind1>=zoneName.length()) { nlwarning("bad file name"); return false; @@ -120,7 +120,7 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) // x x = 0; - uint ind2 = zoneName.length(); + uint ind2 = (uint)zoneName.length(); if((ind2-ind1-1)!=2) { nlwarning("x code size is not a 2 characters code"); diff --git a/code/nel/tools/misc/extract_filename/extract_filename.cpp b/code/nel/tools/misc/extract_filename/extract_filename.cpp index 310e91bd2..926ac359c 100644 --- a/code/nel/tools/misc/extract_filename/extract_filename.cpp +++ b/code/nel/tools/misc/extract_filename/extract_filename.cpp @@ -70,7 +70,7 @@ inline bool isASCII (uint8 c) bool isASCII(vector &fileArray) { // Array size - uint size = fileArray.size(); + uint size = (uint)fileArray.size(); if (size) { @@ -110,7 +110,7 @@ void removeBeginEndSpaces (string &str) str = str.substr (index, str.length ()-index); // Remove end space - index=str.length ()-1; + index=(sint)str.length ()-1; while ( (index>0) && (str[index]==' ') ) index--; str.resize (index+1); @@ -128,17 +128,17 @@ void removeChar (string &str, char ch) void removeDirectory (string &str) { // Remove begin space - int pos = str.rfind ('\\'); - int pos2 = str.rfind ('/'); + string::size_type pos = str.rfind ('\\'); + string::size_type pos2 = str.rfind ('/'); pos = std::max (pos, pos2); - if (pos>=0) + if (pos != string::npos) str = str.substr (pos+1, str.size()); } bool filterExtension (const char *str, const vector &extensions) { // String size - uint size = strlen (str); + uint size = (uint)strlen (str); // For each filter for (uint i=0; i &fileArray, set &filenameStrings, const vector &extensions) { // Array size - uint size = fileArray.size(); + uint size = (uint)fileArray.size(); // Array pointer const char *arrayPointer = &fileArray[0]; @@ -238,7 +238,7 @@ void extractStringsFromBinary (const vector &fileArray, set &filen void extractStringsFromASCII (const vector &fileArray, set &filenameStrings, const vector &extensions) { // Array size - uint size = fileArray.size(); + uint size = (uint)fileArray.size(); if (size) { // Array pointer @@ -470,7 +470,7 @@ void progress (const char *message, float progress) pgId= min(pgId, (uint)(BAR_LENGTH-1)); sprintf (msg, "\r%s %s", progressbar[pgId], message ); uint i; - for (i=strlen(msg); i<79; i++) + for (i=(uint)strlen(msg); i<79; i++) msg[i]=' '; msg[i]=0; printf (msg); @@ -506,7 +506,7 @@ int main(int argc, char* argv[]) printf ("\rScaning files... \n"); uint size = 0; - uint maxSize = inputFiles.size(); + uint maxSize = (uint)inputFiles.size(); set::iterator ite = inputFiles.begin(); while (ite != inputFiles.end()) { From 3c6c83bf03e9a8a25893d98ce7a6988597e6eaf6 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:37:09 +0200 Subject: [PATCH 5/5] Changed: #853 Compilation on 64-bits platforms --- code/nel/tools/3d/lightmap_optimizer/main.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index 80b10668d..6bda04b78 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -155,23 +155,24 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y) string getBaseName (const string &fullname) { string sTmp2 = ""; - int pos = fullname.rfind('_'); - for (int j = 0; j <= pos; ++j) - sTmp2 += fullname[j]; + string::size_type pos = fullname.rfind('_'); + if (pos != string::npos) + sTmp2 = fullname.substr(0, pos+1); return sTmp2; } // --------------------------------------------------------------------------- uint8 getLayerNb (const string &fullname) { - string sTmp2; uint8 nRet = 0; - int beg = fullname.rfind('_'); - int end = fullname.rfind('.'); - for (int j = beg+1; j < end; ++j) - sTmp2 += fullname[j]; + string::size_type beg = fullname.rfind('_'); + string::size_type end = fullname.rfind('.'); + if (beg != string::npos) + { + string sTmp2 = fullname.substr(beg+1, end-beg-1); + NLMISC::fromString(sTmp2, nRet); + } - NLMISC::fromString(sTmp2, nRet); return nRet; } @@ -478,7 +479,7 @@ int main(int nNbArg, char **ppArgs) std::string start = AllLightmapNames[k].substr(0, tags[l].size()); if (NLMISC::nlstricmp(start, tags[l]) == 0) { - bestLength = tags[l].size(); + bestLength = (uint)tags[l].size(); // the tag matchs AllLightmapTags[k] = l; }