From cbe68608262abf9f8e96c2fad34b93c8b59a6979 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 21 Oct 2010 16:36:26 +0000 Subject: [PATCH] - more compiler warning cleanup --- source/glest_game/main/main.cpp | 4 ++-- source/glest_game/types/tech_tree.cpp | 2 +- source/glest_map_editor/map.cpp | 14 +++++++------- source/shared_lib/sources/lua/lua_script.cpp | 2 +- .../sources/platform/common/simple_threads.cpp | 4 ++-- source/shared_lib/sources/util/conversion.cpp | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 50765a6a..aeee579f 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -853,7 +853,7 @@ int glestMain(int argc, char** argv){ } printf("\n----------------------------------------------------------------"); - printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),factionsList.size()); + printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),(int)factionsList.size()); for(int j = 0; j < factionsList.size(); ++j) { if( filteredFactionList.size() == 0 || std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) { @@ -905,7 +905,7 @@ int glestMain(int argc, char** argv){ } if(techtree_errors == false) { - printf("\nValidation found NO ERRORS for techPath [%s] techName [%s] factions checked (count = %d):\n",techPath.c_str(), techName.c_str(),factions.size()); + printf("\nValidation found NO ERRORS for techPath [%s] techName [%s] factions checked (count = %d):\n",techPath.c_str(), techName.c_str(),(int)factions.size()); for ( set::iterator it = factions.begin(); it != factions.end(); ++it ) { printf("Faction [%s]\n",(*it).c_str()); } diff --git a/source/glest_game/types/tech_tree.cpp b/source/glest_game/types/tech_tree.cpp index a1b421f8..469fa6a6 100644 --- a/source/glest_game/types/tech_tree.cpp +++ b/source/glest_game/types/tech_tree.cpp @@ -137,7 +137,7 @@ void TechTree::load(const string &dir, set &factions, Checksum* checksum string factionName = *it; char szBuf[1024]=""; - sprintf(szBuf,"%s %s [%d / %d] - %s",Lang::getInstance().get("Loading").c_str(),Lang::getInstance().get("Faction").c_str(),i+1,factions.size(),factionName.c_str()); + sprintf(szBuf,"%s %s [%d / %d] - %s",Lang::getInstance().get("Loading").c_str(),Lang::getInstance().get("Faction").c_str(),i+1,(int)factions.size(),factionName.c_str()); Logger &logger= Logger::getInstance(); logger.setState(szBuf); diff --git a/source/glest_map_editor/map.cpp b/source/glest_map_editor/map.cpp index d4efd237..bf32e348 100644 --- a/source/glest_map_editor/map.cpp +++ b/source/glest_map_editor/map.cpp @@ -591,7 +591,7 @@ void Map::loadFromFile(const string &path) { //read header MapFileHeader header; - fread(&header, sizeof(MapFileHeader), 1, f1); + size_t bytes = fread(&header, sizeof(MapFileHeader), 1, f1); altFactor = header.altFactor; waterLevel = header.waterLevel; @@ -602,30 +602,30 @@ void Map::loadFromFile(const string &path) { //read start locations resetFactions(header.maxFactions); for (int i = 0; i < maxFactions; ++i) { - fread(&startLocations[i].x, sizeof(int32), 1, f1); - fread(&startLocations[i].y, sizeof(int32), 1, f1); + bytes = fread(&startLocations[i].x, sizeof(int32), 1, f1); + bytes = fread(&startLocations[i].y, sizeof(int32), 1, f1); } //read Heights reset(header.width, header.height, 10, 1); for (int j = 0; j < h; ++j) { for (int i = 0; i < w; ++i) { - fread(&cells[i][j].height, sizeof(float), 1, f1); + bytes = fread(&cells[i][j].height, sizeof(float), 1, f1); } } //read surfaces for (int j = 0; j < h; ++j) { for (int i = 0; i < w; ++i) { - fread(&cells[i][j].surface, sizeof(int8), 1, f1); + bytes = fread(&cells[i][j].surface, sizeof(int8), 1, f1); } } //read objects for (int j = 0; j < h; ++j) { for (int i = 0; i < w; ++i) { - int8 obj; - fread(&obj, sizeof(int8), 1, f1); + int8 obj=0; + bytes = fread(&obj, sizeof(int8), 1, f1); if (obj <= 10) { cells[i][j].object = obj; } else { diff --git a/source/shared_lib/sources/lua/lua_script.cpp b/source/shared_lib/sources/lua/lua_script.cpp index a936fcfa..e38ea845 100644 --- a/source/shared_lib/sources/lua/lua_script.cpp +++ b/source/shared_lib/sources/lua/lua_script.cpp @@ -204,7 +204,7 @@ void * LuaArguments::getGenericData(int argumentIndex) const{ //} else if(lua_isnumber(luaState, argumentIndex)) { lua_Integer result = luaL_checkinteger(luaState, argumentIndex); - printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,result); + printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,(int)result); return (void *)result; } else { diff --git a/source/shared_lib/sources/platform/common/simple_threads.cpp b/source/shared_lib/sources/platform/common/simple_threads.cpp index e0d34a00..c96d052a 100644 --- a/source/shared_lib/sources/platform/common/simple_threads.cpp +++ b/source/shared_lib/sources/platform/common/simple_threads.cpp @@ -42,12 +42,12 @@ void FileCRCPreCacheThread::execute() { string techName = techPaths[idx]; time_t elapsedTime = time(NULL); - printf("In [%s::%s Line: %d] caching CRC value for Tech [%s] [%d of %d]\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),idx+1,techPaths.size()); + printf("In [%s::%s Line: %d] caching CRC value for Tech [%s] [%d of %d]\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),idx+1,(int)techPaths.size()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] caching CRC value for Tech [%s] [%d of %d]\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),idx+1,techPaths.size()); int32 techCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, string("/") + techName + string("/*"), ".xml", NULL); - printf("In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] [%d of %d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,idx+1,techPaths.size(),difftime(time(NULL),elapsedTime)); + printf("In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] [%d of %d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,idx+1,(int)techPaths.size(),difftime(time(NULL),elapsedTime)); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] [%d of %d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,idx+1,techPaths.size(),difftime(time(NULL),elapsedTime)); if(getQuitStatus() == true) { diff --git a/source/shared_lib/sources/util/conversion.cpp b/source/shared_lib/sources/util/conversion.cpp index de7f2eec..5965fdaf 100644 --- a/source/shared_lib/sources/util/conversion.cpp +++ b/source/shared_lib/sources/util/conversion.cpp @@ -104,9 +104,9 @@ string boolToStr(bool b){ } } -string intToStr(int64 i){ +string intToStr(int64 i) { char str[strSize]=""; - sprintf(str, "%d", i); + sprintf(str, "%lld", i); return str; }