From 787e68230c8a3ab55c815784f7c8014bd64c0c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Mon, 26 Nov 2018 10:39:35 -0300 Subject: [PATCH] Minor clean up. --HG-- branch : dev-functional --- include/eepp/system/virtualfilesystem.hpp | 2 +- projects/linux/ee.creator.user | 183 +++++++++++++--------- src/eepp/system/filesystem.cpp | 6 +- src/eepp/system/pak.cpp | 3 +- src/eepp/system/translator.cpp | 4 +- src/eepp/system/virtualfilesystem.cpp | 9 +- src/eepp/system/zip.cpp | 6 +- 7 files changed, 126 insertions(+), 87 deletions(-) diff --git a/include/eepp/system/virtualfilesystem.hpp b/include/eepp/system/virtualfilesystem.hpp index b84b6bd77..5fdeab204 100644 --- a/include/eepp/system/virtualfilesystem.hpp +++ b/include/eepp/system/virtualfilesystem.hpp @@ -29,7 +29,7 @@ class EE_API VirtualFileSystem : protected Container { vfsFile() {} - vfsFile( std::string path, Pack * pack ) : + vfsFile( const std::string& path, Pack * pack ) : path( path ), pack( pack ) {} diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index cced14bbe..43d03c721 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -61,6 +61,8 @@ ProjectExplorer.Project.PluginSettings + + true @@ -88,8 +90,9 @@ false - -j`nproc` eepp-test + eepp-test make + false true @@ -128,8 +131,9 @@ false - -j`nproc` -e config=release eepp-test + -e config=release eepp-test + false true Make @@ -177,8 +181,9 @@ false - -j8 + make + false true Make @@ -226,8 +231,9 @@ false - -j`nproc` -e config=release + -e config=release make + false true Make @@ -266,8 +272,9 @@ false - -j`nproc` + make.sh + false true Make @@ -306,8 +313,9 @@ false - -j`nproc` -e config=release + -e config=release make.sh + false true Make @@ -346,8 +354,9 @@ false - -j`nproc` eepp-sound + eepp-sound make + false true Make @@ -386,8 +395,9 @@ false - -j`nproc` eepp-sprites + eepp-sprites make + false true Make @@ -426,8 +436,9 @@ false - -j`nproc` eepp-fonts + eepp-fonts make + false true Make @@ -466,8 +477,9 @@ false - -j`nproc` eepp-vbo-fbo-batch + eepp-vbo-fbo-batch make + false true Make @@ -506,8 +518,9 @@ false - -j`nproc` eepp-physics + eepp-physics make + false true Make @@ -546,8 +559,9 @@ false - -j`nproc` eepp-http-request + eepp-http-request make + false true Make @@ -586,8 +600,9 @@ false - -j`nproc` eepp-static + eepp-static + false true @@ -635,8 +650,9 @@ false - -j`nproc` eeiv + eeiv make + false true Make @@ -675,8 +691,9 @@ false - -j`nproc` -e config=release eepp-static + -e config=release eepp-static + false true @@ -715,8 +732,9 @@ false - -j`nproc` eepp-shared + eepp-shared + false true @@ -755,8 +773,9 @@ false - -j`nproc` -e config=release eepp-shared + -e config=release eepp-shared + false true @@ -804,8 +823,9 @@ false - -j`nproc` eepp-ew + eepp-ew + false true Make Clone of @@ -844,8 +864,9 @@ false - -j`nproc` -e config=release eepp-ew + -e config=release eepp-ew + false true Make Clone of Make @@ -884,8 +905,9 @@ false - -j`nproc` eepp-es + eepp-es + false true Make Clone of @@ -924,8 +946,9 @@ false - -j`nproc` -e config=release eepp-es + -e config=release eepp-es + false true Make Clone of Make @@ -1015,19 +1038,20 @@ 2 - %{buildDir}../../../bin/eetest-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eetest-debug eetest-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1071,19 +1095,20 @@ 2 - %{buildDir}../../../bin/eetest - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eetest eetest-release ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1127,19 +1152,20 @@ 2 - %{buildDir}../../../bin/eephysics-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eephysics-debug eephysics-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1183,19 +1209,20 @@ 2 - %{buildDir}../../../bin/eehttp-request-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eehttp-request-debug eehttp-request-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1239,19 +1266,20 @@ 2 - %{buildDir}../../../bin/eeiv-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eeiv-debug eeiv-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1295,19 +1323,20 @@ 2 - %{buildDir}../../../bin/eepp-TextureAtlasEditor-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eepp-TextureAtlasEditor-debug eepp-TextureAtlasEditor-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1351,19 +1380,20 @@ 2 - %{buildDir}../../../bin/eepp-MapEditor-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eepp-MapEditor-debug eepp-MapEditor-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1407,19 +1437,20 @@ 2 - %{buildDir}../../../bin/eepp-UIEditor-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eepp-UIEditor-debug eepp-UIEditor-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1463,19 +1494,20 @@ 2 - %{buildDir}../../../bin/eeew-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eeew-debug eeew-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1519,19 +1551,20 @@ 2 - %{buildDir}../../../bin/eeew - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eeew eeew-release ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false false + false + %{buildDir}../../../bin/ + false @@ -1575,19 +1608,20 @@ 2 - %{buildDir}../../../bin/eees-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eees-debug eees-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1631,19 +1665,20 @@ 2 - %{buildDir}../../../bin/eees - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eees eees-release ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1687,19 +1722,20 @@ 2 - %{buildDir}../../../bin/eesound-debug - true - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eesound-debug eesound-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + true + %{buildDir}../../../bin/ + false @@ -1743,19 +1779,20 @@ 2 - %{buildDir}../../../bin/eesprites-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eesprites-debug eesprites-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1799,19 +1836,20 @@ 2 - %{buildDir}../../../bin/eefonts-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eefonts-debug eefonts-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + false @@ -1855,19 +1893,20 @@ 2 - %{buildDir}../../../bin/eevbo-fbo-batch-debug - false - %{buildDir}../../../bin/ Run %{buildDir}../../../bin/eevbo-fbo-batch-debug eevbo-fbo-batch-debug ProjectExplorer.CustomExecutableRunConfiguration + 3768 true false false false true + false + %{buildDir}../../../bin/ + 16 @@ -1878,10 +1917,10 @@ ProjectExplorer.Project.Updater.FileVersion - 18 + 20 Version - 18 + 20 diff --git a/src/eepp/system/filesystem.cpp b/src/eepp/system/filesystem.cpp index 871dce2f6..a9ace7b3e 100644 --- a/src/eepp/system/filesystem.cpp +++ b/src/eepp/system/filesystem.cpp @@ -212,9 +212,7 @@ std::string FileSystem::removeLastFolderFromPath( std::string path ) { if ( pos2 != pos ) { sstr = path.substr(0,pos) + getOSSlash(); } else { - if ( pos == pos2 ) { - sstr = path.substr(0,pos2+1); - } + sstr = path.substr(0,pos2+1); } if ( sstr.size() ) { @@ -527,7 +525,7 @@ std::string FileSystem::sizeToString( const Int64& Size ) { } bool FileSystem::changeWorkingDirectory( const std::string & path ) { - int res = -1; + int res; #ifdef EE_COMPILER_MSVC #ifdef UNICODE res = _wchdir( String::fromUtf8( path.c_str() ).toWideString().c_str() ); diff --git a/src/eepp/system/pak.cpp b/src/eepp/system/pak.cpp index e7f0936c2..760b11540 100755 --- a/src/eepp/system/pak.cpp +++ b/src/eepp/system/pak.cpp @@ -302,7 +302,6 @@ bool Pak::eraseFiles( const std::vector& paths ) { Uint32 total_offset = 0, i = 0; pakFile nPf; std::vector uEntry; - bool Remove; for ( i = 0; i < paths.size(); i++ ) { Ex = exists( paths[i] ); @@ -317,7 +316,7 @@ bool Pak::eraseFiles( const std::vector& paths ) { nPf.fs = eeNew( IOStreamFile, ( nPf.pakPath.c_str() , "wb" ) ); for ( i = 0; i < mPakFiles.size(); i++ ) { - Remove = false; + bool Remove = false; for ( Uint32 u = 0; u < files.size(); u++ ) { if ( files[u] == static_cast(i) ) diff --git a/src/eepp/system/translator.cpp b/src/eepp/system/translator.cpp index 30782319d..2c535f9bf 100644 --- a/src/eepp/system/translator.cpp +++ b/src/eepp/system/translator.cpp @@ -173,7 +173,7 @@ String Translator::getStringf( const char * key, ... ) { const char * format = str.c_str(); - int n, size = 256; + int size = 256; std::string tstr( size, '\0' ); va_list args; @@ -181,7 +181,7 @@ String Translator::getStringf( const char * key, ... ) { while (1) { va_start( args, key ); - n = vsnprintf( &tstr[0], size, format, args ); + int n = vsnprintf( &tstr[0], size, format, args ); if ( n > -1 && n < size ) { tstr.resize( n ); diff --git a/src/eepp/system/virtualfilesystem.cpp b/src/eepp/system/virtualfilesystem.cpp index 2cfaeff6a..9e51e6006 100644 --- a/src/eepp/system/virtualfilesystem.cpp +++ b/src/eepp/system/virtualfilesystem.cpp @@ -20,9 +20,10 @@ std::vector VirtualFileSystem::filesGetInPath( std::string path ) { std::vector files; std::vector paths = vfsSplitPath( path ); vfsDirectory * curDir = &mRoot; - size_t pos = 0; if ( paths.size() >= 1 ) { + size_t pos = 0; + do { if ( pos < paths.size() ) { if ( curDir->directories.find( paths[pos] ) == curDir->directories.end() ) { @@ -47,9 +48,10 @@ std::vector VirtualFileSystem::filesGetInPath( std::string path ) { Pack * VirtualFileSystem::getPackFromFile( std::string path ) { std::vector paths = vfsSplitPath( path ); vfsDirectory * curDir = &mRoot; - size_t pos = 0; if ( paths.size() >= 1 ) { + size_t pos = 0; + do { if ( pos == paths.size() - 1 ) { if ( curDir->files.find( paths[pos] ) != curDir->files.end() ) { @@ -97,9 +99,10 @@ void VirtualFileSystem::onResourceRemove( Pack * resource ) { void VirtualFileSystem::addFile( std::string path , Pack * pack ) { std::vector paths = vfsSplitPath( path ); vfsDirectory * curDir = &mRoot; - size_t pos = 0; if ( paths.size() >= 1 ) { + size_t pos = 0; + do { if ( pos == paths.size() - 1 ) { curDir->files[ paths[pos] ] = vfsFile( path, pack ); diff --git a/src/eepp/system/zip.cpp b/src/eepp/system/zip.cpp index 80c34d7d3..e7f03e844 100644 --- a/src/eepp/system/zip.cpp +++ b/src/eepp/system/zip.cpp @@ -142,7 +142,7 @@ bool Zip::eraseFiles( const std::vector& paths ) { bool Zip::extractFile( const std::string& path , const std::string& dest ) { lock(); - bool Ret = false; + bool Ret; SafeDataPointer data; @@ -161,9 +161,9 @@ bool Zip::extractFileToMemory( const std::string& path, std::vector& data bool Ret = false; Int32 Pos = exists( path ); - int Result = 0; if ( 0 == checkPack() && -1 != Pos ) { + data.clear(); struct zip_stat zs; @@ -175,7 +175,7 @@ bool Zip::extractFileToMemory( const std::string& path, std::vector& data if ( NULL != zf ) { data.resize( zs.size ); - Result = (Int32)zip_fread( zf, reinterpret_cast (&data[0]), data.size() ); + int Result = (Int32)zip_fread( zf, reinterpret_cast (&data[0]), data.size() ); zip_fclose(zf);