From ff58a868b3a3f554f1a386b9dd9be150c6a0d3b8 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 10 Nov 2012 06:37:23 +0000 Subject: [PATCH] - attempt to bugfix windows using proper printf syntax for data types --- source/g3d_viewer/main.cpp | 14 +++--- source/glest_game/ai/ai_rule.cpp | 20 ++++---- source/glest_game/ai/path_finder.cpp | 10 ++-- source/glest_game/game/commander.cpp | 4 +- source/glest_game/game/game.cpp | 14 +++--- source/glest_game/global/config.cpp | 10 ++-- source/glest_game/graphics/renderer.cpp | 22 ++++---- source/glest_game/main/main.cpp | 50 +++++++++---------- .../menu/menu_state_connected_game.cpp | 8 +-- .../menu/menu_state_custom_game.cpp | 4 +- .../glest_game/menu/menu_state_keysetup.cpp | 4 +- .../menu/menu_state_masterserver.cpp | 2 +- source/glest_game/menu/menu_state_options.cpp | 2 +- source/glest_game/type_instances/faction.cpp | 8 +-- source/glest_game/type_instances/unit.cpp | 2 +- source/glest_game/types/faction_type.cpp | 8 +-- source/glest_game/types/unit_type.cpp | 2 +- source/glest_game/world/map.cpp | 10 ++-- .../include/platform/sdl/data_types.h | 21 ++++++++ source/shared_lib/include/util/leak_dumper.h | 4 +- source/shared_lib/sources/graphics/model.cpp | 48 +++++++++--------- source/shared_lib/sources/graphics/pixmap.cpp | 22 ++++---- source/shared_lib/sources/map/map_preview.cpp | 14 +++--- .../sources/platform/posix/miniftpclient.cpp | 6 +-- .../sources/platform/posix/socket.cpp | 8 +-- .../sound/openal/sound_player_openal.cpp | 2 +- .../sources/sound/sound_file_loader.cpp | 2 +- .../shared_lib/sources/util/leak_dumper.cpp | 14 +++--- 28 files changed, 178 insertions(+), 157 deletions(-) diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index 23556598..54ae3fca 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -314,7 +314,7 @@ MainWindow::MainWindow( std::pair > unitToLoad, if(modelPath != "") { this->modelPathList.push_back(modelPath); - printf("Startup Adding model [%s] list size %zu\n",modelPath.c_str(),this->modelPathList.size()); + printf("Startup Adding model [%s] list size " MG_SIZE_T_SPECIFIER "\n",modelPath.c_str(),this->modelPathList.size()); } if(particlePath != "") { this->particlePathList.push_back(particlePath); @@ -1232,14 +1232,14 @@ void MainWindow::loadModel(string path) { try { if(path != "" && fileExists(path) == true) { this->modelPathList.push_back(path); - printf("Adding model [%s] list size %zu\n",path.c_str(),this->modelPathList.size()); + printf("Adding model [%s] list size " MG_SIZE_T_SPECIFIER "\n",path.c_str(),this->modelPathList.size()); } string titlestring=winHeader; for(unsigned int idx =0; idx < this->modelPathList.size(); idx++) { string modelPath = this->modelPathList[idx]; - //printf("Loading model [%s] %u of %zu\n",modelPath.c_str(),idx, this->modelPathList.size()); + //printf("Loading model [%s] %u of " MG_SIZE_T_SPECIFIER "\n",modelPath.c_str(),idx, this->modelPathList.size()); if(timer) timer->Stop(); delete model; @@ -1369,7 +1369,7 @@ void MainWindow::loadParticle(string path) { } void MainWindow::loadProjectileParticle(string path) { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleProjectilePathList.size() = %zu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleProjectilePathList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleProjectilePathList.size() = " MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleProjectilePathList.size()); if(timer) timer->Stop(); if(path != "" && fileExists(path) == true) { @@ -1390,7 +1390,7 @@ void MainWindow::loadProjectileParticle(string path) { try { if(this->particleProjectilePathList.empty() == false) { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("this->particleProjectilePathList.size() = %zu\n",this->particleProjectilePathList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("this->particleProjectilePathList.size() = " MG_SIZE_T_SPECIFIER "\n",this->particleProjectilePathList.size()); string titlestring=winHeader; for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) { @@ -1487,7 +1487,7 @@ void MainWindow::loadProjectileParticle(string path) { } void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSplash::load (and own list...) - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleSplashPathList.size() = %zu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleSplashPathList.size() = " MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size()); if(timer) timer->Stop(); if(path != "" && fileExists(path) == true) { @@ -1590,7 +1590,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal(); } if(timer) timer->Start(100); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s] particleSplashPathList.size() = %zu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s] particleSplashPathList.size() = " MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size()); } void MainWindow::onMenuModeNormals(wxCommandEvent &event){ diff --git a/source/glest_game/ai/ai_rule.cpp b/source/glest_game/ai/ai_rule.cpp index be709468..76059517 100644 --- a/source/glest_game/ai/ai_rule.cpp +++ b/source/glest_game/ai/ai_rule.cpp @@ -921,8 +921,8 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){ int currentProducerIndex = producers[i]; if(currentProducerIndex >= aiInterface->getMyUnitCount()) { char szBuf[8096]=""; - printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = %zu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); - snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %zu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); + printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); + snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); throw megaglest_runtime_error(szBuf); } @@ -953,14 +953,14 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){ if(currentProducerIndex >= aiInterface->getMyUnitCount()) { char szBuf[8096]=""; - printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = %zu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); - snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %zu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); + printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); + snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size()); throw megaglest_runtime_error(szBuf); } if(prIndex >= producers.size()) { char szBuf[8096]=""; - printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %zu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,producers.size()); - snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %zu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,producers.size()); + printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,producers.size()); + snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,producers.size()); throw megaglest_runtime_error(szBuf); } @@ -1019,14 +1019,14 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){ if(currentProducerIndex >= aiInterface->getMyUnitCount()) { char szBuf[8096]=""; - printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %zu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size()); - snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %zu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size()); + printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size()); + snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size()); throw megaglest_runtime_error(szBuf); } if(prIndex >= backupProducers.size()) { char szBuf[8096]=""; - printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %zu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,backupProducers.size()); - snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %zu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,backupProducers.size()); + printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,backupProducers.size()); + snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,backupProducers.size()); throw megaglest_runtime_error(szBuf); } diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index 9bb8ac9b..4159df6a 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -132,7 +132,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu // if(frameIndex != factions[unit->getFactionIndex()].lastFromToNodeListFrame) { // if(factions[unit->getFactionIndex()].mapFromToNodeList.size() > 0) { -// printf("clear duplicate list = %zu for faction = %d frameIndex = %d\n",factions[unit->getFactionIndex()].mapFromToNodeList.size(),unit->getFactionIndex(),frameIndex); +// printf("clear duplicate list = " MG_SIZE_T_SPECIFIER " for faction = %d frameIndex = %d\n",factions[unit->getFactionIndex()].mapFromToNodeList.size(),unit->getFactionIndex(),frameIndex); // factions[unit->getFactionIndex()].mapFromToNodeList.clear(); // } // factions[unit->getFactionIndex()].lastFromToNodeListFrame = frameIndex; @@ -918,7 +918,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [%zu] openPosList.size() [%zu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", + snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [" MG_SIZE_T_SPECIFIER "] openPosList.size() [" MG_SIZE_T_SPECIFIER "] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts); unit->logSynchData(__FILE__,__LINE__,szBuf); } @@ -975,7 +975,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [%zu] openPosList.size() [%zu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", + snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [" MG_SIZE_T_SPECIFIER "] openPosList.size() [" MG_SIZE_T_SPECIFIER "] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts); unit->logSynchData(__FILE__,__LINE__,szBuf); } @@ -1192,7 +1192,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[path for unit BLOCKED] openNodesList.size() [%zu] openPosList.size() [%zu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", + snprintf(szBuf,8096,"[path for unit BLOCKED] openNodesList.size() [" MG_SIZE_T_SPECIFIER "] openPosList.size() [" MG_SIZE_T_SPECIFIER "] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts); unit->logSynchData(__FILE__,__LINE__,szBuf); } @@ -1268,7 +1268,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [%zu] openPosList.size() [%zu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", + snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [" MG_SIZE_T_SPECIFIER "] openPosList.size() [" MG_SIZE_T_SPECIFIER "] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]", factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts); unit->logSynchData(__FILE__,__LINE__,szBuf); diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 3a289c47..d26afb0c 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -556,7 +556,7 @@ bool Commander::getReplayCommandListForFrame(int worldFrameCount) { bool haveReplyCommands = false; if(replayCommandList.empty() == false) { //int worldFrameCount = world->getFrameCount(); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("worldFrameCount = %d replayCommandList.size() = %zu\n",worldFrameCount,replayCommandList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("worldFrameCount = %d replayCommandList.size() = " MG_SIZE_T_SPECIFIER "\n",worldFrameCount,replayCommandList.size()); std::vector replayList; for(unsigned int i = 0; i < replayCommandList.size(); ++i) { @@ -569,7 +569,7 @@ bool Commander::getReplayCommandListForFrame(int worldFrameCount) { if(haveReplyCommands == true) { replayCommandList.erase(replayCommandList.begin(),replayCommandList.begin() + replayList.size()); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("worldFrameCount = %d GIVING COMMANDS replayList.size() = %zu\n",worldFrameCount,replayList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("worldFrameCount = %d GIVING COMMANDS replayList.size() = " MG_SIZE_T_SPECIFIER "\n",worldFrameCount,replayList.size()); for(int i= 0; i < replayList.size(); ++i){ giveNetworkCommand(&replayList[i]); //pushNetworkCommand(&replayList[i]); diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 762efc47..bd42ff78 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -1650,7 +1650,7 @@ void Game::update() { try { gameStarted = false; - //printf("\nname [%s] scenarioFile [%s] results.size() = %zu\n",name.c_str(),scenarioFile.c_str(),results.size()); + //printf("\nname [%s] scenarioFile [%s] results.size() = " MG_SIZE_T_SPECIFIER "\n",name.c_str(),scenarioFile.c_str(),results.size()); //printf("[%s:%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); ScenarioInfo scenarioInfo; Scenario::loadScenarioInfo(scenarioFile, &scenarioInfo); @@ -2446,7 +2446,7 @@ void Game::removeCellMarker(Vec2i surfaceCellPos, const Faction *faction) { gameNetworkInterface->sendUnMarkCellMessage(mc.getTargetPos(),factionIndex); } } - //printf("#1 ADDED in marked list pos [%s] markedCells.size() = %zu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); + //printf("#1 ADDED in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); //isUnMarkCellEnabled = false; @@ -2821,7 +2821,7 @@ void Game::mouseDownLeft(int x, int y) { //GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); //gameNetworkInterface->sendMarkCellMessage(mc.getTargetPos(),mc.getFaction()->getIndex(),mc.getNote()); - //printf("#1 ADDED in marked list pos [%s] markedCells.size() = %zu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); + //printf("#1 ADDED in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); isMarkCellEnabled = false; cellMarkedData = mc; @@ -2851,7 +2851,7 @@ void Game::mouseDownLeft(int x, int y) { isUnMarkCellEnabled = false; removeCellMarker(surfaceCellPos, world.getThisFaction()); - //printf("#1 ADDED in marked list pos [%s] markedCells.size() = %zu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); + //printf("#1 ADDED in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); Renderer &renderer= Renderer::getInstance(); //renderer.updateMarkedCellScreenPosQuadCache(surfaceCellPos); @@ -2898,7 +2898,7 @@ void Game::mouseDownLeft(int x, int y) { MarkedCell mc(targetPos,world.getThisFaction(),"placeholder for note",world.getThisFaction()->getStartLocationIndex()); - //printf("#2 ADDED in marked list pos [%s] markedCells.size() = %zu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); + //printf("#2 ADDED in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); isMarkCellEnabled = false; cellMarkedData = mc; @@ -2928,7 +2928,7 @@ void Game::mouseDownLeft(int x, int y) { isUnMarkCellEnabled = false; removeCellMarker(surfaceCellPos, world.getThisFaction()); - //printf("#1 ADDED in marked list pos [%s] markedCells.size() = %zu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); + //printf("#1 ADDED in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size()); //Renderer &renderer= Renderer::getInstance(); //renderer.updateMarkedCellScreenPosQuadCache(surfaceCellPos); @@ -5109,7 +5109,7 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode) { newGame->lastworldFrameCountForReplay = gameNode->getAttribute("LastWorldFrameCount")->getIntValue(); vector networkCommandNodeList = gameNode->getChildList("NetworkCommand"); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("networkCommandNodeList.size() = %zu\n",networkCommandNodeList.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("networkCommandNodeList.size() = " MG_SIZE_T_SPECIFIER "\n",networkCommandNodeList.size()); for(unsigned int i = 0; i < networkCommandNodeList.size(); ++i) { XmlNode *node = networkCommandNodeList[i]; int worldFrameCount = node->getAttribute("worldFrameCount")->getIntValue(); diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index 075ea4cf..3274ddf6 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -781,7 +781,7 @@ string Config::findValidLocalFileFromPath(string fileName) { vector dirList = config.getPathListForType(ptMaps); replaceFileWithLocalFile(dirList, fileNamePart, result); - printf("Found file [%s] @ %zu [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); + printf("Found file [%s] @ " MG_SIZE_T_SPECIFIER " [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); } else if(fileName.find("tilesets/") != fileName.npos ) { size_t pos = fileName.find("tilesets/"); @@ -790,7 +790,7 @@ string Config::findValidLocalFileFromPath(string fileName) { vector dirList = config.getPathListForType(ptTilesets); replaceFileWithLocalFile(dirList, fileNamePart, result); - printf("Found file [%s] @ %zu [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); + printf("Found file [%s] @ " MG_SIZE_T_SPECIFIER " [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); } else if(fileName.find("techs/") != fileName.npos ) { size_t pos = fileName.find("techs/"); @@ -799,7 +799,7 @@ string Config::findValidLocalFileFromPath(string fileName) { vector dirList = config.getPathListForType(ptTechs); replaceFileWithLocalFile(dirList, fileNamePart, result); - printf("Found file [%s] @ %zu [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); + printf("Found file [%s] @ " MG_SIZE_T_SPECIFIER " [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); } else if(fileName.find("scenarios/") != fileName.npos) { size_t pos = fileName.find("scenarios/"); @@ -808,7 +808,7 @@ string Config::findValidLocalFileFromPath(string fileName) { vector dirList = config.getPathListForType(ptScenarios); replaceFileWithLocalFile(dirList, fileNamePart, result); - printf("Found file [%s] @ %zu [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); + printf("Found file [%s] @ " MG_SIZE_T_SPECIFIER " [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); } else if(fileName.find("tutorials/") != fileName.npos) { size_t pos = fileName.find("tutorials/"); @@ -817,7 +817,7 @@ string Config::findValidLocalFileFromPath(string fileName) { vector dirList = config.getPathListForType(ptTutorials); replaceFileWithLocalFile(dirList, fileNamePart, result); - printf("Found file [%s] @ %zu [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); + printf("Found file [%s] @ " MG_SIZE_T_SPECIFIER " [%s]\nNew File [%s]\n",fileName.c_str(),pos,fileNamePart.c_str(),result.c_str()); } return result; diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 61a75b57..1bfd5dd2 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -1521,7 +1521,7 @@ void Renderer::computeVisibleQuad() { visibleQuad.p[3].x,visibleQuad.p[3].y); for(unsigned int i = 0; i < quadCache.frustumData.size(); ++i) { - printf("\nFrustrum #%u [%zu]: ",i,quadCache.frustumData.size()); + printf("\nFrustrum #%u [" MG_SIZE_T_SPECIFIER "]: ",i,quadCache.frustumData.size()); vector &frustumDataInner = quadCache.frustumData[i]; for(unsigned int j = 0; j < frustumDataInner.size(); ++j) { printf("[%f]",quadCache.frustumData[i][j]); @@ -4479,7 +4479,7 @@ void Renderer::renderSurface(const int renderFps) { std::pair > &surfaceCacheEntity = mapSurfaceData[snapshotOfvisibleQuad.getString()]; surface = &surfaceCacheEntity.second; - //printf("Surface Cache Size for Rendering using VA's = %zu\n",mapSurfaceData.size()); + //printf("Surface Cache Size for Rendering using VA's = " MG_SIZE_T_SPECIFIER "\n",mapSurfaceData.size()); } glEnableClientState(GL_VERTEX_ARRAY); @@ -7756,7 +7756,7 @@ void Renderer::init3dList() { } void Renderer::render3dSetup() { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); const Metrics &metrics= Metrics::getInstance(); //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); @@ -7769,7 +7769,7 @@ void Renderer::render3dSetup() { //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //texture state glActiveTexture(shadowTexUnit); @@ -7786,7 +7786,7 @@ void Renderer::render3dSetup() { //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //material state glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, defSpecularColor.ptr()); @@ -7799,7 +7799,7 @@ void Renderer::render3dSetup() { glDisable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //alpha test state glEnable(GL_ALPHA_TEST); @@ -7823,7 +7823,7 @@ void Renderer::render3dSetup() { glDisable(GL_STENCIL_TEST); //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //fog const Tileset *tileset= NULL; @@ -8812,14 +8812,14 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame, if(markedCells.empty() == false) { if(markedCells.find(pos) != markedCells.end()) { - //printf("#1 ******** VISIBLE SCALED CELL FOUND in marked list pos [%s] markedCells.size() = %zu\n",pos.getString().c_str(),markedCells.size()); + //printf("#1 ******** VISIBLE SCALED CELL FOUND in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",pos.getString().c_str(),markedCells.size()); //if(markedCells.empty() == false) { //SurfaceCell *sc = map->getSurfaceCell(pos); //quadCache.visibleScaledCellToScreenPosList[pos]=computeScreenPosition(sc->getVertex()); updateMarkedCellScreenPosQuadCache(pos); } else { - //printf("#1 VISIBLE SCALED CELL NOT FOUND in marked list pos [%s] markedCells.size() = %zu\n",pos.getString().c_str(),markedCells.size()); + //printf("#1 VISIBLE SCALED CELL NOT FOUND in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",pos.getString().c_str(),markedCells.size()); } } } @@ -8834,13 +8834,13 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame, if(markedCells.empty() == false) { if(markedCells.find(pos) != markedCells.end()) { - //printf("#2 ******** VISIBLE SCALED CELL FOUND in marked list pos [%s] markedCells.size() = %zu\n",pos.getString().c_str(),markedCells.size()); + //printf("#2 ******** VISIBLE SCALED CELL FOUND in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",pos.getString().c_str(),markedCells.size()); //if(markedCells.empty() == false) { //quadCache.visibleScaledCellToScreenPosList[pos]=computeScreenPosition(sc->getVertex()); updateMarkedCellScreenPosQuadCache(pos); } else { - //printf("#2 VISIBLE SCALED CELL NOT FOUND in marked list pos [%s] markedCells.size() = %zu\n",pos.getString().c_str(),markedCells.size()); + //printf("#2 VISIBLE SCALED CELL NOT FOUND in marked list pos [%s] markedCells.size() = " MG_SIZE_T_SPECIFIER "\n",pos.getString().c_str(),markedCells.size()); } } } diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index cc242593..75e59a45 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -176,13 +176,13 @@ static void cleanupProcessObjects() { SystemFlags::Close(); SystemFlags::SHUTDOWN_PROGRAM_MODE=true; - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("start running threads = %zu\n",Thread::getThreadList().size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("start running threads = " MG_SIZE_T_SPECIFIER "\n",Thread::getThreadList().size()); time_t elapsed = time(NULL); for(;Thread::getThreadList().size() > 0 && difftime((long int)time(NULL),elapsed) <= 10;) { //sleep(0); } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("end running threads = %zu\n",Thread::getThreadList().size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("end running threads = " MG_SIZE_T_SPECIFIER "\n",Thread::getThreadList().size()); std::map &crcPlayerTextureCache = CacheManager::getCachedItem< std::map >(GameConstants::playerTextureCacheLookupKey); //deleteMapValues(crcPlayerTextureCache.begin(),crcPlayerTextureCache.end()); @@ -193,10 +193,10 @@ static void cleanupProcessObjects() { crcFactionPreviewTextureCache.clear(); std::map const * >* > &list2d = FileReader::getFileReadersMap(); - //printf("list2d = %zu\n",list2d.size()); + //printf("list2d = " MG_SIZE_T_SPECIFIER "\n",list2d.size()); deleteMapValues(list2d.begin(),list2d.end()); std::map const * >* > &list3d = FileReader::getFileReadersMap(); - //printf("list3d = %zu\n",list3d.size()); + //printf("list3d = " MG_SIZE_T_SPECIFIER "\n",list3d.size()); deleteMapValues(list3d.begin(),list3d.end()); XmlIo::getInstance().cleanup(); @@ -1359,7 +1359,7 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName, } } - printf("Found tileset filecount = %zu, used = %zu\n",foundFileList.size(),loadedFileList.size()); + printf("Found tileset filecount = " MG_SIZE_T_SPECIFIER ", used = " MG_SIZE_T_SPECIFIER "\n",foundFileList.size(),loadedFileList.size()); int purgeCount = 0; bool foundUnusedFile = false; @@ -1581,7 +1581,7 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName, } } - //printf("\nPurge Duplicate Files #2 DISABLED [%zu] - START:\n=====================\n",fileList.size()); + //printf("\nPurge Duplicate Files #2 DISABLED [" MG_SIZE_T_SPECIFIER "] - START:\n=====================\n",fileList.size()); for(unsigned int idx = 0; idx < fileList.size(); ++idx) { string duplicateFile = fileList[idx]; @@ -1790,7 +1790,7 @@ void runTechValidationForPath(string techPath, string techName, } } - printf("Found techtree filecount = %zu, used = %zu\n",foundFileList.size(),loadedFileList.size()); + printf("Found techtree filecount = " MG_SIZE_T_SPECIFIER ", used = " MG_SIZE_T_SPECIFIER "\n",foundFileList.size(),loadedFileList.size()); // for( std::map >::iterator iterMap = loadedFileList.begin(); // iterMap != loadedFileList.end(); ++iterMap) { @@ -1884,7 +1884,7 @@ void runTechValidationForPath(string techPath, string techName, printf("\nWarning, duplicate files were detected - START:\n=====================\n"); } - printf("----- START duplicate files for CRC [%u] count [%zu] first file is [%s]\n",iterMap->first,fileList.size(),fileList[0].c_str()); + printf("----- START duplicate files for CRC [%u] count [" MG_SIZE_T_SPECIFIER "] first file is [%s]\n",iterMap->first,fileList.size(),fileList[0].c_str()); map parentList; for(unsigned int idx = 0; idx < fileList.size(); ++idx) { @@ -1924,7 +1924,7 @@ void runTechValidationForPath(string techPath, string techName, //} } - printf("----- Finding parents for duplicate files [%zu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- Finding parents for duplicate files [" MG_SIZE_T_SPECIFIER "] first file is [%s]\n",fileList.size(),fileList[0].c_str()); for(map::iterator iterMap1 = parentList.begin(); iterMap1 != parentList.end(); ++iterMap1) { @@ -1938,7 +1938,7 @@ void runTechValidationForPath(string techPath, string techName, if(purgeDuplicateFiles == true) { //printf("\nPurge Duplicate Files detected - START:\n=====================\n"); - printf("----- move / remove duplicate files [%zu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- move / remove duplicate files [" MG_SIZE_T_SPECIFIER "] first file is [%s]\n",fileList.size(),fileList[0].c_str()); // First move first duplicate to commondata and delete all other copies string newCommonFileName = ""; for(unsigned int idx = 0; idx < fileList.size(); ++idx) { @@ -1947,7 +1947,7 @@ void runTechValidationForPath(string techPath, string techName, if(fileExt == "wav" || fileExt == "ogg") { off_t fileSize = getFileSize(duplicateFile); - printf("#1 [%u / %zu] removing duplicate [%s]\n",idx,fileList.size(),duplicateFile.c_str()); + printf("#1 [%u / " MG_SIZE_T_SPECIFIER "] removing duplicate [%s]\n",idx,fileList.size(),duplicateFile.c_str()); if(idx == 0) { newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile); @@ -2015,7 +2015,7 @@ void runTechValidationForPath(string techPath, string techName, } } - printf("----- update XML files for duplicate files [%zu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- update XML files for duplicate files [" MG_SIZE_T_SPECIFIER "] first file is [%s]\n",fileList.size(),fileList[0].c_str()); std::map mapUniqueParentList; // Update the XML files to point to the new single copy in commondata @@ -2085,7 +2085,7 @@ void runTechValidationForPath(string techPath, string techName, } } - //printf("\nPurge Duplicate Files #2 DISABLED [%zu] - START:\n=====================\n",fileList.size()); + //printf("\nPurge Duplicate Files #2 DISABLED [" MG_SIZE_T_SPECIFIER "] - START:\n=====================\n",fileList.size()); for(unsigned int idx = 0; idx < fileList.size(); ++idx) { string duplicateFile = fileList[idx]; @@ -2137,7 +2137,7 @@ void runTechValidationForPath(string techPath, string techName, } - printf("----- END duplicate files [%zu] first file is [%s]\n",fileList.size(),fileList[0].c_str()); + printf("----- END duplicate files [" MG_SIZE_T_SPECIFIER "] first file is [%s]\n",fileList.size(),fileList[0].c_str()); } } if(foundDuplicates == true) { @@ -3083,7 +3083,7 @@ int glestMain(int argc, char** argv) { printf("%s %s",extractFileFromDirectoryPath(argv[0]).c_str(),getNetworkPlatformFreeVersionString().c_str()); printf("\nCompiled using: %s on: %s platform: %s endianness: %s",getCompilerNameString().c_str(),getCompileDateTime().c_str(),getPlatformNameString().c_str(),(Shared::PlatformByteOrder::isBigEndian() == true ? "big" : "little")); -// printf("\n\nData type sizes int8 = %zu int16 = %zu int32 = %zu int64 = %zu\n\n",sizeof(int8),sizeof(int16),sizeof(int32),sizeof(int64)); +// printf("\n\nData type sizes int8 = " MG_SIZE_T_SPECIFIER " int16 = " MG_SIZE_T_SPECIFIER " int32 = " MG_SIZE_T_SPECIFIER " int64 = " MG_SIZE_T_SPECIFIER "\n\n",sizeof(int8),sizeof(int16),sizeof(int32),sizeof(int64)); // // Config::getInstance().setBool("DebugNetworkPackets",true,true); // NetworkMessageIntro data(424336, "mg_version_x","player_x", 3, nmgstOk,444444, 555555, "english"); @@ -3153,8 +3153,8 @@ int glestMain(int argc, char** argv) { testVar = Shared::PlatformByteOrder::fromCommonEndian(testVar); printf("\nEndian from common value = %d",testVar); - printf("\nint8 sizeof = %zu",sizeof(int8)); - printf("\nSwitchSetupRequest sizeof = %zu",SwitchSetupRequest().getDataSize()); + printf("\nint8 sizeof = " MG_SIZE_T_SPECIFIER "",sizeof(int8)); + printf("\nSwitchSetupRequest sizeof = " MG_SIZE_T_SPECIFIER "",SwitchSetupRequest().getDataSize()); } printf("\nSVN: [%s]",getSVNRevisionString().c_str()); @@ -4056,7 +4056,7 @@ int glestMain(int argc, char** argv) { string mapName = maps[i]; printf("%s\n",mapName.c_str()); } - printf("===========================================\nTotal: %zu\n",maps.size()); + printf("===========================================\nTotal: " MG_SIZE_T_SPECIFIER "\n",maps.size()); return 0; } @@ -4117,13 +4117,13 @@ int glestMain(int argc, char** argv) { string name2 = results2[k]; printf("--> %s\n",name2.c_str()); } - printf("--> Total Factions: %zu\n",results2.size()); + printf("--> Total Factions: " MG_SIZE_T_SPECIFIER "\n",results2.size()); break; } } } } - printf("===========================================\nTotal Techtrees: %zu\n",results.size()); + printf("===========================================\nTotal Techtrees: " MG_SIZE_T_SPECIFIER "\n",results.size()); return 0; } @@ -4166,7 +4166,7 @@ int glestMain(int argc, char** argv) { string name = results[i]; printf("%s\n",name.c_str()); } - printf("===========================================\nTotal: %zu\n",results.size()); + printf("===========================================\nTotal: " MG_SIZE_T_SPECIFIER "\n",results.size()); return 0; } @@ -4230,7 +4230,7 @@ int glestMain(int argc, char** argv) { } } } - printf("===========================================\nTotal: %zu\n",results.size()); + printf("===========================================\nTotal: " MG_SIZE_T_SPECIFIER "\n",results.size()); return 0; } @@ -4294,7 +4294,7 @@ int glestMain(int argc, char** argv) { } } } - printf("===========================================\nTotal: %zu\n",results.size()); + printf("===========================================\nTotal: " MG_SIZE_T_SPECIFIER "\n",results.size()); return 0; } @@ -4649,7 +4649,7 @@ int glestMain(int argc, char** argv) { renderer.clearBuffers(); renderer.clearZBuffer(); renderer.reset2d(); - snprintf(szTextBuf,8096,"Please wait, converting models [%u of %zu] ...",i,models.size()); + snprintf(szTextBuf,8096,"Please wait, converting models [%u of " MG_SIZE_T_SPECIFIER "] ...",i,models.size()); if(CoreData::getInstance().getMenuFontBig3D() != NULL) { renderer.renderText3D( @@ -4673,7 +4673,7 @@ int glestMain(int argc, char** argv) { Model *model = renderer.newModel(rsGlobal); try { - printf("About to load model [%s] [%u of %zu]\n",file.c_str(),i,models.size()); + printf("About to load model [%s] [%u of " MG_SIZE_T_SPECIFIER "]\n",file.c_str(),i,models.size()); model->load(file); modelLoadedOk = true; } diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index d4bb1947..192fb6b1 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1517,7 +1517,7 @@ void MenuStateConnectedGame::broadCastGameSettingsToHeadlessServer(bool forceNow if(forceNow == true || ((needToBroadcastServerSettings == true ) && ( difftime((long int)time(NULL),broadcastServerSettingsDelayTimer) >= HEADLESSSERVER_BROADCAST_SETTINGS_SECONDS))) { - //printf("In [%s:%s] Line: %d forceNow = %d broadcastServerSettingsDelayTimer = %zu, now =%zu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,forceNow,broadcastServerSettingsDelayTimer,time(NULL)); + //printf("In [%s:%s] Line: %d forceNow = %d broadcastServerSettingsDelayTimer = " MG_SIZE_T_SPECIFIER ", now =" MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,forceNow,broadcastServerSettingsDelayTimer,time(NULL)); needToBroadcastServerSettings = false; broadcastServerSettingsDelayTimer = time(NULL); @@ -1845,7 +1845,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) { gameSettings->setScenarioDir(""); } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = %zu, getCurrentMapFile() [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),getCurrentMapFile().c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = " MG_SIZE_T_SPECIFIER ", getCurrentMapFile() [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),getCurrentMapFile().c_str()); if(listBoxMap.getSelectedItemIndex() >= 0 && listBoxMap.getSelectedItemIndex() < mapFiles.size()) { gameSettings->setDescription(formatString(getCurrentMapFile())); @@ -4143,7 +4143,7 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings, mapFile = ITEM_MISSING; } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = %zu, maps.size() = %zu, getCurrentMapFile() [%s] mapFile [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),maps.size(),getCurrentMapFile().c_str(),mapFile.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = " MG_SIZE_T_SPECIFIER ", maps.size() = " MG_SIZE_T_SPECIFIER ", getCurrentMapFile() [%s] mapFile [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),maps.size(),getCurrentMapFile().c_str(),mapFile.c_str()); listBoxMap.setItems(maps); @@ -4509,7 +4509,7 @@ int MenuStateConnectedGame::setupMapList(string scenario) { loadMapInfo(Map::getMapPath(scenarioInfo.mapName, scenarioDir, true), &mapInfo, false); //printf("#6.2\n"); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = %zu, mapInfo.players = %d, formattedPlayerSortedMaps[mapInfo.players].size() = %zu, scenarioInfo.mapName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),mapInfo.players,formattedPlayerSortedMaps[mapInfo.players].size(),scenarioInfo.mapName.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = " MG_SIZE_T_SPECIFIER ", mapInfo.players = %d, formattedPlayerSortedMaps[mapInfo.players].size() = " MG_SIZE_T_SPECIFIER ", scenarioInfo.mapName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),mapInfo.players,formattedPlayerSortedMaps[mapInfo.players].size(),scenarioInfo.mapName.c_str()); listBoxMap.setItems(formattedPlayerSortedMaps[mapInfo.players]); } //printf("#7\n"); diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 93cba544..cf66750d 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -3389,7 +3389,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force gameSettings->setMasterserver_admin(serverInterface->getSlot(i)->getSessionKey()); gameSettings->setMasterserver_admin_faction_index(serverInterface->getSlot(i)->getPlayerIndex()); labelGameName.setText(serverInterface->getSlot(i)->getName()+" controls"); - //printf("slot = %d, admin key [%d] slot connected time[%zu] clientConnectedTime [%zu]\n",i,gameSettings->getMasterserver_admin(),serverInterface->getSlot(i)->getConnectedTime(),clientConnectedTime); + //printf("slot = %d, admin key [%d] slot connected time[" MG_SIZE_T_SPECIFIER "] clientConnectedTime [" MG_SIZE_T_SPECIFIER "]\n",i,gameSettings->getMasterserver_admin(),serverInterface->getSlot(i)->getConnectedTime(),clientConnectedTime); } if(serverInterface->getSlot(i)->getSessionKey() == gameSettings->getMasterserver_admin()){ masterserver_admin_found=true; @@ -3413,7 +3413,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force gameSettings->setMasterserver_admin(serverInterface->getSlot(i)->getSessionKey()); gameSettings->setMasterserver_admin_faction_index(serverInterface->getSlot(i)->getPlayerIndex()); labelGameName.setText(serverInterface->getSlot(i)->getName()+" controls"); - //printf("slot = %d, admin key [%d] slot connected time[%zu] clientConnectedTime [%zu]\n",i,gameSettings->getMasterserver_admin(),serverInterface->getSlot(i)->getConnectedTime(),clientConnectedTime); + //printf("slot = %d, admin key [%d] slot connected time[" MG_SIZE_T_SPECIFIER "] clientConnectedTime [" MG_SIZE_T_SPECIFIER "]\n",i,gameSettings->getMasterserver_admin(),serverInterface->getSlot(i)->getConnectedTime(),clientConnectedTime); } if(serverInterface->getSlot(i)->getSessionKey() == gameSettings->getMasterserver_admin()){ masterserver_admin_found=true; diff --git a/source/glest_game/menu/menu_state_keysetup.cpp b/source/glest_game/menu/menu_state_keysetup.cpp index 6efc3c4d..408aff3c 100644 --- a/source/glest_game/menu/menu_state_keysetup.cpp +++ b/source/glest_game/menu/menu_state_keysetup.cpp @@ -274,8 +274,8 @@ void MenuStateKeysetup::mouseClick(int x, int y, MouseButton mouseButton){ if(userProperties.empty() == false) { Config &configKeys = Config::getInstance(std::pair(cfgMainKeys,cfgUserKeys)); string userKeysFile = configKeys.getFileName(true); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] save file [%s] userProperties.size() = %zu\n",__FILE__,__FUNCTION__,__LINE__,userKeysFile.c_str(),userProperties.size()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] save file [%s] userProperties.size() = %zu\n",__FILE__,__FUNCTION__,__LINE__,userKeysFile.c_str(),userProperties.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] save file [%s] userProperties.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,userKeysFile.c_str(),userProperties.size()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] save file [%s] userProperties.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,userKeysFile.c_str(),userProperties.size()); configKeys.setUserProperties(userProperties); configKeys.save(); diff --git a/source/glest_game/menu/menu_state_masterserver.cpp b/source/glest_game/menu/menu_state_masterserver.cpp index 5a4d1c46..4f72b9de 100644 --- a/source/glest_game/menu/menu_state_masterserver.cpp +++ b/source/glest_game/menu/menu_state_masterserver.cpp @@ -977,7 +977,7 @@ void MenuStateMasterserver::rebuildServerLines(const string &serverInfo) { Tokenize(server,serverEntities,"|"); const int MIN_FIELDS_EXPECTED = 14; - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("--------------> server [%s] serverEntities.size() = %zu MIN_FIELDS_EXPECTED = %d\n",server.c_str(),serverEntities.size(),MIN_FIELDS_EXPECTED); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("--------------> server [%s] serverEntities.size() = " MG_SIZE_T_SPECIFIER " MIN_FIELDS_EXPECTED = %d\n",server.c_str(),serverEntities.size(),MIN_FIELDS_EXPECTED); if(serverEntities.size() >= MIN_FIELDS_EXPECTED) { labelTitle.setText(lang.get("AvailableServers")); diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index a79e03d6..f43922f5 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -1168,7 +1168,7 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){ vector languageFileMappings; Tokenize(txnURLFileListMapping,languageFileMappings,"|"); - printf("URL5 file count = %zu, %zu [%s]\n",languageFiles.size(),languageFileMappings.size(),(languageFiles.empty() == false ? languageFiles[0].c_str() : "")); + printf("URL5 file count = " MG_SIZE_T_SPECIFIER ", " MG_SIZE_T_SPECIFIER " [%s]\n",languageFiles.size(),languageFileMappings.size(),(languageFiles.empty() == false ? languageFiles[0].c_str() : "")); if(languageFiles.empty() == false) { diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 5b9570e9..7906f3f0 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -1180,7 +1180,7 @@ void Faction::addResourceTargetToCache(const Vec2i &pos,bool incrementUseCounter if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[addResourceTargetToCache] pos [%s]cacheResourceTargetList.size() [%zu]", + snprintf(szBuf,8096,"[addResourceTargetToCache] pos [%s]cacheResourceTargetList.size() [" MG_SIZE_T_SPECIFIER "]", pos.getString().c_str(),cacheResourceTargetList.size()); //unit->logSynchData(szBuf); @@ -1203,7 +1203,7 @@ void Faction::removeResourceTargetFromCache(const Vec2i &pos) { if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[removeResourceTargetFromCache] pos [%s]cacheResourceTargetList.size() [%zu]", + snprintf(szBuf,8096,"[removeResourceTargetFromCache] pos [%s]cacheResourceTargetList.size() [" MG_SIZE_T_SPECIFIER "]", pos.getString().c_str(),cacheResourceTargetList.size()); //unit->logSynchData(szBuf); @@ -1347,7 +1347,7 @@ Vec2i Faction::getClosestResourceTypeTargetFromCache(Unit *unit, const ResourceT if(deleteList.empty() == false) { if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[cleaning old resource targets] deleteList.size() [%zu] cacheResourceTargetList.size() [%zu] result [%s]", + snprintf(szBuf,8096,"[cleaning old resource targets] deleteList.size() [" MG_SIZE_T_SPECIFIER "] cacheResourceTargetList.size() [" MG_SIZE_T_SPECIFIER "] result [%s]", deleteList.size(),cacheResourceTargetList.size(),result.getString().c_str()); unit->logSynchData(__FILE__,__LINE__,szBuf); @@ -1494,7 +1494,7 @@ void Faction::cleanupResourceTypeTargetCache(std::vector *deleteListPtr) if(deleteList.empty() == false) { if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[cleaning old resource targets] deleteList.size() [%zu] cacheResourceTargetList.size() [%zu], needToCleanup [%d]", + snprintf(szBuf,8096,"[cleaning old resource targets] deleteList.size() [" MG_SIZE_T_SPECIFIER "] cacheResourceTargetList.size() [" MG_SIZE_T_SPECIFIER "], needToCleanup [%d]", deleteList.size(),cacheResourceTargetList.size(),needToCleanup); //unit->logSynchData(szBuf); SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"----------------------------------- START [%d] ------------------------------------------------\n",getFrameCount()); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 48052bb6..0349dcf8 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -3325,7 +3325,7 @@ void Unit::cleanupOldBadHarvestPos() { if(purgeList.empty() == false) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[cleaning old bad harvest targets] purgeList.size() [%zu]",purgeList.size()); + snprintf(szBuf,8096,"[cleaning old bad harvest targets] purgeList.size() [" MG_SIZE_T_SPECIFIER "]",purgeList.size()); logSynchData(__FILE__,__LINE__,szBuf); for(int i = 0; i < purgeList.size(); ++i) { diff --git a/source/glest_game/types/faction_type.cpp b/source/glest_game/types/faction_type.cpp index 69bab31e..e470cee8 100644 --- a/source/glest_game/types/faction_type.cpp +++ b/source/glest_game/types/faction_type.cpp @@ -592,7 +592,7 @@ std::vector FactionType::validateFactionType() { } if(foundUnit == false) { - //printf("Problem for unit [%s] unitTypes.size() = %zu\n",unitType.getName().c_str(),unitTypes.size()); + //printf("Problem for unit [%s] unitTypes.size() = " MG_SIZE_T_SPECIFIER "\n",unitType.getName().c_str(),unitTypes.size()); char szBuf[8096]=""; snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has no other units that can produce, build or morph into it in this faction!",unitType.getName().c_str(),this->getName().c_str()); @@ -778,7 +778,7 @@ const UnitType *FactionType::getUnitType(const string &name) const{ } } - printf("In [%s::%s Line: %d] scanning [%s] size = %zu\n",__FILE__,__FUNCTION__,__LINE__,name.c_str(),unitTypes.size()); + printf("In [%s::%s Line: %d] scanning [%s] size = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,name.c_str(),unitTypes.size()); for(int i=0; i= commandTypes.size()) { char szBuf[8096]=""; - snprintf(szBuf,8096,"In [%s::%s Line: %d] i >= commandTypes.size(), i = %d, commandTypes.size() = %zu",__FILE__,__FUNCTION__,__LINE__,i,commandTypes.size()); + snprintf(szBuf,8096,"In [%s::%s Line: %d] i >= commandTypes.size(), i = %d, commandTypes.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,i,commandTypes.size()); throw megaglest_runtime_error(szBuf); } return commandTypes[i]; diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 1b37c459..5f28690c 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -406,7 +406,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { readBytes = fread(&x, sizeof(int32), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } x = Shared::PlatformByteOrder::fromCommonEndian(x); @@ -414,7 +414,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { readBytes = fread(&y, sizeof(int32), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } y = Shared::PlatformByteOrder::fromCommonEndian(y); @@ -433,7 +433,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { readBytes = fread(&alt, sizeof(float32), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } alt = Shared::PlatformByteOrder::fromCommonEndian(alt); @@ -450,7 +450,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { readBytes = fread(&surf, sizeof(int8), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } surf = Shared::PlatformByteOrder::fromCommonEndian(surf); @@ -467,7 +467,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { readBytes = fread(&objNumber, sizeof(int8), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } objNumber = Shared::PlatformByteOrder::fromCommonEndian(objNumber); diff --git a/source/shared_lib/include/platform/sdl/data_types.h b/source/shared_lib/include/platform/sdl/data_types.h index ba9e12d8..27a0b95f 100644 --- a/source/shared_lib/include/platform/sdl/data_types.h +++ b/source/shared_lib/include/platform/sdl/data_types.h @@ -25,6 +25,27 @@ #endif +#if defined(_MSC_VER) + #define MG_SIZE_T_SPECIFIER "%Iu" + #define MG_SSIZE_T_SPECIFIER "%Id" + #define MG_PTRDIFF_T_SPECIFIER "%Id" +#elif defined(__GNUC__) + #define MG_SIZE_T_SPECIFIER "%zu" + #define MG_SSIZE_T_SPECIFIER "%zd" + #define MG_PTRDIFF_T_SPECIFIER "%zd" +#else + // TODO figure out which to use. + #if NUMBITS == 32 + #define MG_SIZE_T_SPECIFIER "%lu" + #define MG_SSIZE_T_SPECIFIER "%ld" + #define MG_PTRDIFF_T_SPECIFIER "%ld" + #else + #define MG_SIZE_T_SPECIFIER "%llu" + #define MG_SSIZE_T_SPECIFIER "%lld" + #define MG_PTRDIFF_T_SPECIFIER "%lld" + #endif +#endif + namespace Shared{ namespace Platform{ #ifndef WIN32 diff --git a/source/shared_lib/include/util/leak_dumper.h b/source/shared_lib/include/util/leak_dumper.h index af636ea5..babdb6a2 100644 --- a/source/shared_lib/include/util/leak_dumper.h +++ b/source/shared_lib/include/util/leak_dumper.h @@ -324,7 +324,7 @@ public: //if(info.line == 0) return; MutexSafeWrapper safeMutexMasterList(mutex); - //printf("ALLOCATE.\tfile: %s, line: %d, bytes: %zu, array: %d inuse: %d\n", info.file, info.line, info.bytes, info.array, info.inuse); + //printf("ALLOCATE.\tfile: %s, line: %d, bytes: " MG_SIZE_T_SPECIFIER ", array: %d inuse: %d\n", info.file, info.line, info.bytes, info.array, info.inuse); if(info.line > 0) { ++allocCount; @@ -339,7 +339,7 @@ public: } } - printf("ALLOCATE NOT MONITORED.\tfile: %s, line: %d, ptr [%p], bytes: %zu, array: %d inuse: %d, \n%s\n", info.file, info.line, info.ptr, info.bytes, info.array, info.inuse, info.stack.c_str()); + printf("ALLOCATE NOT MONITORED.\tfile: %s, line: %d, ptr [%p], bytes: " MG_SIZE_T_SPECIFIER ", array: %d inuse: %d, \n%s\n", info.file, info.line, info.ptr, info.bytes, info.array, info.inuse, info.stack.c_str()); ++nonMonitoredCount; nonMonitoredBytes+= info.bytes; diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp index b2ec4d84..c2073f68 100644 --- a/source/shared_lib/sources/graphics/model.cpp +++ b/source/shared_lib/sources/graphics/model.cpp @@ -411,7 +411,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex size_t readBytes = fread(&meshHeader, sizeof(MeshHeaderV2), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianMeshHeaderV2(meshHeader); @@ -489,7 +489,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex readBytes = fread(vertices, sizeof(Vec3f)*frameCount*vertexCount, 1, f); if(readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(vertices, frameCount*vertexCount); @@ -497,7 +497,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex readBytes = fread(normals, sizeof(Vec3f)*frameCount*vertexCount, 1, f); if(readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(normals, frameCount*vertexCount); @@ -506,7 +506,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f); if(readBytes != 1 && vertexCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(texCoords, vertexCount); @@ -514,7 +514,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex readBytes = fread(&diffuseColor, sizeof(Vec3f), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(&diffuseColor, 1); @@ -522,7 +522,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex readBytes = fread(&opacity, sizeof(float32), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } opacity = Shared::PlatformByteOrder::fromCommonEndian(opacity); @@ -531,7 +531,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex readBytes = fread(indices, sizeof(uint32)*indexCount, 1, f); if(readBytes != 1 && indexCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u] on line: %d.",readBytes,indexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,indexCount,__LINE__); throw megaglest_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount); @@ -548,7 +548,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, size_t readBytes = fread(&meshHeader, sizeof(MeshHeaderV3), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianMeshHeaderV3(meshHeader); @@ -623,7 +623,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, readBytes = fread(vertices, sizeof(Vec3f)*frameCount*vertexCount, 1, f); if(readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(vertices, frameCount*vertexCount); @@ -631,7 +631,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, readBytes = fread(normals, sizeof(Vec3f)*frameCount*vertexCount, 1, f); if(readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(normals, frameCount*vertexCount); @@ -641,7 +641,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f); if(readBytes != 1 && vertexCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(texCoords, vertexCount); @@ -650,7 +650,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, readBytes = fread(&diffuseColor, sizeof(Vec3f), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(&diffuseColor, 1); @@ -658,7 +658,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, readBytes = fread(&opacity, sizeof(float32), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } opacity = Shared::PlatformByteOrder::fromCommonEndian(opacity); @@ -667,7 +667,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f, readBytes = fread(indices, sizeof(uint32)*indexCount, 1, f); if(readBytes != 1 && indexCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u] on line: %d.",readBytes,indexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,indexCount,__LINE__); throw megaglest_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount); @@ -735,7 +735,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu size_t readBytes = fread(&meshHeader, sizeof(MeshHeader), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianMeshHeader(meshHeader); @@ -774,7 +774,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu readBytes = fread(cMapPath, mapPathSize, 1, f); if(readBytes != 1 && mapPathSize != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u] on line: %d.",readBytes,mapPathSize,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,mapPathSize,__LINE__); throw megaglest_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(cMapPath, mapPathSize); @@ -800,7 +800,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu readBytes = fread(vertices, sizeof(Vec3f)*frameCount*vertexCount, 1, f); if(readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(vertices, frameCount*vertexCount); @@ -808,7 +808,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu readBytes = fread(normals, sizeof(Vec3f)*frameCount*vertexCount, 1, f); if(readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(normals, frameCount*vertexCount); @@ -817,7 +817,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f); if(readBytes != 1 && vertexCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.",readBytes,frameCount,vertexCount,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianVecArray(texCoords, vertexCount); @@ -825,7 +825,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu readBytes = fread(indices, sizeof(uint32)*indexCount, 1, f); if(readBytes != 1 && indexCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u] on line: %d.",readBytes,indexCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,indexCount,__LINE__); throw megaglest_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount); @@ -1168,7 +1168,7 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad, if(readBytes != 1) { fclose(f); char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianFileHeader(fileHeader); @@ -1190,7 +1190,7 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad, readBytes = fread(&modelHeader, sizeof(ModelHeader), 1, f); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianModelHeader(modelHeader); @@ -1224,7 +1224,7 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad, readBytes = fread(&meshCount, sizeof(meshCount), 1, f); if(readBytes != 1 && meshCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u] on line: %d.",readBytes,meshCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,meshCount,__LINE__); throw megaglest_runtime_error(szBuf); } meshCount = Shared::PlatformByteOrder::fromCommonEndian(meshCount); @@ -1251,7 +1251,7 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad, readBytes = fread(&meshCount, sizeof(meshCount), 1, f); if(readBytes != 1 && meshCount != 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu [%u] on line: %d.",readBytes,meshCount,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.",readBytes,meshCount,__LINE__); throw megaglest_runtime_error(szBuf); } meshCount = Shared::PlatformByteOrder::fromCommonEndian(meshCount); diff --git a/source/shared_lib/sources/graphics/pixmap.cpp b/source/shared_lib/sources/graphics/pixmap.cpp index 7b8dd97a..e878e05a 100644 --- a/source/shared_lib/sources/graphics/pixmap.cpp +++ b/source/shared_lib/sources/graphics/pixmap.cpp @@ -122,7 +122,7 @@ void PixmapIoTga::openRead(const string &path) { size_t readBytes = fread(&fileHeader, sizeof(TargaFileHeader), 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian(); @@ -171,7 +171,7 @@ void PixmapIoTga::read(uint8 *pixels, int components) { size_t readBytes = fread(&l, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -186,7 +186,7 @@ void PixmapIoTga::read(uint8 *pixels, int components) { size_t readBytes = fread(&b, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -196,7 +196,7 @@ void PixmapIoTga::read(uint8 *pixels, int components) { readBytes = fread(&g, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -206,7 +206,7 @@ void PixmapIoTga::read(uint8 *pixels, int components) { readBytes = fread(&r, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -217,7 +217,7 @@ void PixmapIoTga::read(uint8 *pixels, int components) { readBytes = fread(&a, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -346,7 +346,7 @@ void PixmapIoBmp::openRead(const string &path){ size_t readBytes = fread(&fileHeader, sizeof(BitmapFileHeader), 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian(); @@ -368,7 +368,7 @@ void PixmapIoBmp::openRead(const string &path){ readBytes = fread(&infoHeader, sizeof(BitmapInfoHeader), 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -405,7 +405,7 @@ void PixmapIoBmp::read(uint8 *pixels, int components) { size_t readBytes = fread(&b, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -414,7 +414,7 @@ void PixmapIoBmp::read(uint8 *pixels, int components) { readBytes = fread(&g, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { @@ -424,7 +424,7 @@ void PixmapIoBmp::read(uint8 *pixels, int components) { readBytes = fread(&r, 1, 1, file); if(readBytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",readBytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",readBytes,__LINE__); throw megaglest_runtime_error(szBuf); } if(bigEndianSystem == true) { diff --git a/source/shared_lib/sources/map/map_preview.cpp b/source/shared_lib/sources/map/map_preview.cpp index fbc17b18..29f37764 100644 --- a/source/shared_lib/sources/map/map_preview.cpp +++ b/source/shared_lib/sources/map/map_preview.cpp @@ -795,7 +795,7 @@ void MapPreview::loadFromFile(const string &path) { size_t bytes = fread(&header, sizeof(MapFileHeader), 1, f1); if(bytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",bytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",bytes,__LINE__); throw megaglest_runtime_error(szBuf); } fromEndianMapFileHeader(header); @@ -820,7 +820,7 @@ void MapPreview::loadFromFile(const string &path) { bytes = fread(&startLocations[i].x, sizeof(int32), 1, f1); if(bytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",bytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",bytes,__LINE__); throw megaglest_runtime_error(szBuf); } startLocations[i].x = Shared::PlatformByteOrder::fromCommonEndian(startLocations[i].x); @@ -828,7 +828,7 @@ void MapPreview::loadFromFile(const string &path) { bytes = fread(&startLocations[i].y, sizeof(int32), 1, f1); if(bytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",bytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",bytes,__LINE__); throw megaglest_runtime_error(szBuf); } startLocations[i].y = Shared::PlatformByteOrder::fromCommonEndian(startLocations[i].y); @@ -841,7 +841,7 @@ void MapPreview::loadFromFile(const string &path) { bytes = fread(&cells[i][j].height, sizeof(float), 1, f1); if(bytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",bytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",bytes,__LINE__); throw megaglest_runtime_error(szBuf); } cells[i][j].height = Shared::PlatformByteOrder::fromCommonEndian(cells[i][j].height); @@ -854,7 +854,7 @@ void MapPreview::loadFromFile(const string &path) { bytes = fread(&cells[i][j].surface, sizeof(int8), 1, f1); if(bytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",bytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",bytes,__LINE__); throw megaglest_runtime_error(szBuf); } cells[i][j].surface = Shared::PlatformByteOrder::fromCommonEndian(cells[i][j].surface); @@ -868,7 +868,7 @@ void MapPreview::loadFromFile(const string &path) { bytes = fread(&obj, sizeof(int8), 1, f1); if(bytes != 1) { char szBuf[8096]=""; - snprintf(szBuf,8096,"fread returned wrong size = %zu on line: %d.",bytes,__LINE__); + snprintf(szBuf,8096,"fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.",bytes,__LINE__); throw megaglest_runtime_error(szBuf); } obj = Shared::PlatformByteOrder::fromCommonEndian(obj); @@ -1056,7 +1056,7 @@ bool MapPreview::loadMapInfo(string file, MapInfo *mapInfo, string i18nMaxMapPla if(errorOnInvalidMap == true) { char szBuf[8096]=""; - snprintf(szBuf,8096,"In [%s::%s Line: %d]\nfile [%s]\nreadBytes != sizeof(MapFileHeader) [%zu] [%zu]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,file.c_str(),readBytes,sizeof(MapFileHeader)); + snprintf(szBuf,8096,"In [%s::%s Line: %d]\nfile [%s]\nreadBytes != sizeof(MapFileHeader) [" MG_SIZE_T_SPECIFIER "] [" MG_SIZE_T_SPECIFIER "]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,file.c_str(),readBytes,sizeof(MapFileHeader)); SystemFlags::OutputDebug(SystemFlags::debugError,"%s",szBuf); throw megaglest_runtime_error(szBuf); diff --git a/source/shared_lib/sources/platform/posix/miniftpclient.cpp b/source/shared_lib/sources/platform/posix/miniftpclient.cpp index fba0b73b..d8b2402b 100644 --- a/source/shared_lib/sources/platform/posix/miniftpclient.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpclient.cpp @@ -108,9 +108,9 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { size_t result = fwrite(buffer, size, nmemb, out->stream); if(result != nmemb) { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = %zu, result = %zu\n",fullFilePath.c_str(),nmemb,result); - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = %zu, result = %zu\n",fullFilePath.c_str(),nmemb,result); - SystemFlags::OutputDebug(SystemFlags::debugError,"===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = %zu, result = %zu\n",fullFilePath.c_str(),nmemb,result); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = " MG_SIZE_T_SPECIFIER ", result = " MG_SIZE_T_SPECIFIER "\n",fullFilePath.c_str(),nmemb,result); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = " MG_SIZE_T_SPECIFIER ", result = " MG_SIZE_T_SPECIFIER "\n",fullFilePath.c_str(),nmemb,result); + SystemFlags::OutputDebug(SystemFlags::debugError,"===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = " MG_SIZE_T_SPECIFIER ", result = " MG_SIZE_T_SPECIFIER "\n",fullFilePath.c_str(),nmemb,result); //return -1; /* failure, can't open file to write */ } return result; diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index de096827..23bcb26a 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -1170,12 +1170,12 @@ int Socket::getDataToRead(bool wantImmediateReply) { break; } else if(hasDataToRead() == true) { - //if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, (hasDataToRead() == true) err = %d, sock = %d, size = %zu, loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount); - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, (hasDataToRead() == true) err = %d, sock = %d, size = %zu\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size); + //if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, (hasDataToRead() == true) err = %d, sock = %d, size = " MG_SIZE_T_SPECIFIER ", loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, (hasDataToRead() == true) err = %d, sock = %d, size = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size); } else { - //if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, err = %d, sock = %d, size = %zu, loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount); - if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, err = %d, sock = %d, size = %zu\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size); + //if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, err = %d, sock = %d, size = " MG_SIZE_T_SPECIFIER ", loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount); + if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, err = %d, sock = %d, size = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size); break; } diff --git a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp index 1a30befb..87ce14ea 100644 --- a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp +++ b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp @@ -575,7 +575,7 @@ StaticSoundSource* SoundPlayerOpenAL::findStaticSoundSource() { } } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d] playingCount = %d, staticSources.size() = %zu, params.staticBufferCount = %u\n",__FILE__,__FUNCTION__,__LINE__,playingCount,(unsigned long)staticSources.size(),params.staticBufferCount); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d] playingCount = %d, staticSources.size() = " MG_SIZE_T_SPECIFIER ", params.staticBufferCount = %u\n",__FILE__,__FUNCTION__,__LINE__,playingCount,(unsigned long)staticSources.size(),params.staticBufferCount); // create a new source if(staticSources.size() >= params.staticBufferCount) { diff --git a/source/shared_lib/sources/sound/sound_file_loader.cpp b/source/shared_lib/sources/sound/sound_file_loader.cpp index b4758c68..17c4785e 100644 --- a/source/shared_lib/sources/sound/sound_file_loader.cpp +++ b/source/shared_lib/sources/sound/sound_file_loader.cpp @@ -227,7 +227,7 @@ void OggSoundFileLoader::open(const string &path, SoundInfo *soundInfo){ uint32 samples = static_cast(ov_pcm_total(vf, -1)); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s Line: %d] path = [%s] vi->version = %d, vi->channels = %d, vi->rate = %ld, vi->bitrate_upper = %ld, vi->bitrate_nominal = %ld, vi->bitrate_lower = %ld, vi->bitrate_window = %ld, samples = %zu\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),vi->version,vi->channels,vi->rate,vi->bitrate_upper,vi->bitrate_nominal,vi->bitrate_lower,vi->bitrate_window,samples); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s Line: %d] path = [%s] vi->version = %d, vi->channels = %d, vi->rate = %ld, vi->bitrate_upper = %ld, vi->bitrate_nominal = %ld, vi->bitrate_lower = %ld, vi->bitrate_window = %ld, samples = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),vi->version,vi->channels,vi->rate,vi->bitrate_upper,vi->bitrate_nominal,vi->bitrate_lower,vi->bitrate_window,samples); soundInfo->setChannels(vi->channels); soundInfo->setsamplesPerSecond(vi->rate); diff --git a/source/shared_lib/sources/util/leak_dumper.cpp b/source/shared_lib/sources/util/leak_dumper.cpp index 73dc513b..09b9dc55 100644 --- a/source/shared_lib/sources/util/leak_dumper.cpp +++ b/source/shared_lib/sources/util/leak_dumper.cpp @@ -54,21 +54,21 @@ void AllocRegistry::dump(const char *path) { leakBytes += info.bytes; //allocs[i].stack = AllocInfo::getStackTrace(); - fprintf(f, "Leak #%d.\tfile: %s, line: %d, ptr [%p], bytes: %zu, array: %d, inuse: %d\n%s\n", ++leakCount, info.file, info.line, info.ptr, info.bytes, info.array,info.inuse,info.stack.c_str()); + fprintf(f, "Leak #%d.\tfile: %s, line: %d, ptr [%p], bytes: " MG_SIZE_T_SPECIFIER ", array: %d, inuse: %d\n%s\n", ++leakCount, info.file, info.line, info.ptr, info.bytes, info.array,info.inuse,info.stack.c_str()); } } } - fprintf(f, "\nTotal leaks: %d, %zu bytes\n", leakCount, leakBytes); - fprintf(f, "Total allocations: %d, %zu bytes\n", allocCount, allocBytes); - fprintf(f, "Not monitored allocations: %d, %zu bytes\n", nonMonitoredCount, nonMonitoredBytes); + fprintf(f, "\nTotal leaks: %d, " MG_SIZE_T_SPECIFIER " bytes\n", leakCount, leakBytes); + fprintf(f, "Total allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", allocCount, allocBytes); + fprintf(f, "Not monitored allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", nonMonitoredCount, nonMonitoredBytes); fclose(f); printf("Memory leak dump summary at: %s\n",szBuf2); - printf("Total leaks: %d, %zu bytes\n", leakCount, leakBytes); - printf("Total allocations: %d, %zu bytes\n", allocCount, allocBytes); - printf("Not monitored allocations: %d, %zu bytes\n", nonMonitoredCount, nonMonitoredBytes); + printf("Total leaks: %d, " MG_SIZE_T_SPECIFIER " bytes\n", leakCount, leakBytes); + printf("Total allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", allocCount, allocBytes); + printf("Not monitored allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", nonMonitoredCount, nonMonitoredBytes); } #endif