File 03-fix-format-mismatches.diff of Package ultimatestunts

From: Jan Engelhardt <jengelh@inai.de>
Date: 2012-11-25 16:27:14.938909202 +0100
Status: sent to upstream

build: resolve format specifier mismatches

(Using %lu instead of %zu, since I assume you want this runnable
with rather old Windows C runtimes.)

[   15s] datamanager.cpp: In member function 'CDataObject* CDataManager::getObject(CDataObject::eDataType, unsigned int)':
[   15s] datamanager.cpp:53:52: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<CDataObject*>::size_type {aka long unsigned int}' [-Wformat]
[   15s] datamanager.cpp: In member function 'const CDataObject* CDataManager::getObject(CDataObject::eDataType, unsigned int) const':
[   15s] datamanager.cpp:77:52: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<CDataObject*>::size_type {aka long unsigned int}' [-Wformat]
[   16s] glbfile.cpp: In member function 'bool CGLBFile::processIndices(CGLBFile::SPrimitive&, CBinBuffer&, unsigned int)':
[   16s] glbfile.cpp:253:45: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<CGLBFile::SVertex>::size_type {aka long unsigned int}' [-Wformat]
[   55s] loadobj.cpp: In function 'bool loadOBJ(const CString&, CEditGraphObj&)':
[   55s] loadobj.cpp:195:81: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<CVector>::size_type {aka long unsigned int}' [-Wformat]
[   55s] loadobj.cpp:202:58: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<CVertex>::size_type {aka long unsigned int}' [-Wformat]
[   55s] loadobj.cpp:202:58: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<unsigned int>::size_type {aka long unsigned int}' [-Wformat]
[   55s] loadobj.cpp:202:58: warning: format '%d' expects argument of type 'int', but argument 4 has type 'std::vector<unsigned int>::size_type {aka long unsigned int}' [-Wformat]
[   59s] edittrack.cpp: In member function 'void CEditTrack::followTRKRoutes(const CTRKFile&, CTrack::CCheckpoint, int)':
[   59s] edittrack.cpp:524:62: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<CTrack::CRoute>::size_type {aka long unsigned int}' [-Wformat]
[   59s] edittrack.cpp:541:73: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<CTrack::CCheckpoint>::size_type {aka long unsigned int}' [-Wformat]
[   59s] edittrack.cpp:553:88: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<CTrack::CRoute>::size_type {aka long unsigned int}' [-Wformat]
[   59s] edittrack.cpp:608:30: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<CTrack::CRoute>::size_type {aka long unsigned int}' [-Wformat]
[   62s] routetracker.cpp: In member function 'void CRouteTracker::trackSingleRoute(unsigned int)':
[   62s] routetracker.cpp:144:75: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<CTETile::SRoute>::size_type {aka long unsigned int}' [-Wformat]
[   67s] trkfile.cpp: In member function 'bool CTRKFile::load(const CString&)':
[   67s] trkfile.cpp:46:70: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<unsigned char>::size_type {aka long unsigned int}' [-Wformat]
[   73s] music.cpp: In member function 'void CMusic::update()':
[   73s] music.cpp:213:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<unsigned int>::size_type {aka long unsigned int}' [-Wformat]

---
 shared/datamanager.cpp     |   10 ++++++----
 shared/glbfile.cpp         |    6 ++++--
 stunts3dedit/loadobj.cpp   |    8 +++++---
 trackedit/edittrack.cpp    |    9 +++++----
 trackedit/routetracker.cpp |    2 +-
 trackedit/trkfile.cpp      |    2 +-
 ultimatestunts/music.cpp   |    4 ++--
 7 files changed, 24 insertions(+), 17 deletions(-)

Index: ultimatestunts-srcdata-0771/shared/datamanager.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/shared/datamanager.cpp
+++ ultimatestunts-srcdata-0771/shared/datamanager.cpp
@@ -48,9 +48,10 @@ CDataObject *CDataManager::getObject(CDa
 		if(type == CDataObject::eTexture)        name = "Texture";
 		if(type == CDataObject::eSample)         name = "Sample";
 		printf("Errror in CDataManager::getObject (shared/datamanager.cpp):\n"
-			"  Object requested with ID %d, but there are only %d"
+			"  Object requested with ID %d, but there are only %lu"
 			"  objects of type %d (%s)\n",
-			ID, (m_Objects[type]).size(), type, name.c_str());
+			ID, static_cast<unsigned long>(m_Objects[type].size()),
+			type, name.c_str());
 		return NULL;
 	}
 
@@ -72,9 +73,10 @@ const CDataObject *CDataManager::getObje
 		if(type == CDataObject::eTexture)        name = "Texture";
 		if(type == CDataObject::eSample)         name = "Sample";
 		printf("Errror in CDataManager::getObject (shared/datamanager.cpp):\n"
-			"  Object requested with ID %d, but there are only %d"
+			"  Object requested with ID %d, but there are only %lu"
 			"  objects of type %d (%s)\n",
-			ID, (m_Objects[type]).size(), type, name.c_str());
+			ID, static_cast<unsigned long>(m_Objects[type].size()),
+			type, name.c_str());
 		return NULL;
 	}
 
Index: ultimatestunts-srcdata-0771/shared/glbfile.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/shared/glbfile.cpp
+++ ultimatestunts-srcdata-0771/shared/glbfile.cpp
@@ -249,8 +249,10 @@ bool CGLBFile::processIndices(SPrimitive
 		unsigned int index = data.getUint32(pos);
 		if(index >= pr.vertex.size())
 		{
-			printf("Index %d exceeds vertex array size %d in %s\n",
-				index, pr.vertex.size(), pr.Name.c_str());
+			printf("Index %d exceeds vertex array size %lu in %s\n",
+				index,
+				static_cast<unsigned long>(pr.vertex.size()),
+				pr.Name.c_str());
 			
 			return false;
 		}
Index: ultimatestunts-srcdata-0771/stunts3dedit/loadobj.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/stunts3dedit/loadobj.cpp
+++ ultimatestunts-srcdata-0771/stunts3dedit/loadobj.cpp
@@ -192,14 +192,16 @@ bool loadOBJ(const CString &filename, CE
 				if(vi >= v_arr.size())
 				{
 					printf("In line \"%s\":\n", line.c_str());
-					printf("Error: vertex index %d exceeds array size %d\n", vi+1, v_arr.size());
+					printf("Error: vertex index %d exceeds array size %lu\n", vi+1, static_cast<unsigned long>(v_arr.size()));
 					return false;
 				}
 
 				if(pr.m_Vertex.size() != v_index.size() || pr.m_Vertex.size() != vn_index.size())
 				{
-					printf("Error: array sizes %d, %d and %d do not match\n",
-						pr.m_Vertex.size(), v_index.size(), vn_index.size());
+					printf("Error: array sizes %lu, %lu and %lu do not match\n",
+						static_cast<unsigned long>(pr.m_Vertex.size()),
+						static_cast<unsigned long>(v_index.size()),
+						static_cast<unsigned long>(vn_index.size()));
 					return false;
 				}
 
Index: ultimatestunts-srcdata-0771/trackedit/edittrack.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/trackedit/edittrack.cpp
+++ ultimatestunts-srcdata-0771/trackedit/edittrack.cpp
@@ -521,7 +521,7 @@ void CEditTrack::followTRKRoutes(const C
 		{
 			if(altdir == -2) //found a join
 			{
-				printf("Stopping route %d on a join\n", m_Routes.size()-1);
+				printf("Stopping route %lu on a join\n", static_cast<unsigned long>(m_Routes.size()) - 1);
 				m_Routes.back().push_back(start);
 				break;
 			}
@@ -538,7 +538,7 @@ void CEditTrack::followTRKRoutes(const C
 						dir = splitDirs.back();
 						splitPoints.resize(splitPoints.size()-1);
 						splitDirs.resize(splitDirs.size()-1);
-						printf("  %d splits remaining on this route\n", splitPoints.size());
+						printf("  %lu splits remaining on this route\n", static_cast<unsigned long>(splitPoints.size()));
 						continue;
 					}
 					else
@@ -550,7 +550,7 @@ void CEditTrack::followTRKRoutes(const C
 		}
 
 		//Add tile to current route
-		printf("Following route %d: %d %d %d\n", m_Routes.size()-1, start.x, start.y, start.z);
+		printf("Following route %lu: %d %d %d\n", static_cast<unsigned long>(m_Routes.size()) - 1, start.x, start.y, start.z);
 		if(altdir != -3 && //-3 means skip
 			( m_Routes.back().size()==0 || !(start == m_Routes.back().back()) ) //is different
 			)
@@ -604,7 +604,8 @@ void CEditTrack::followTRKRoutes(const C
 			)
 		{
 			start.y = (file.m_Track[start.z][start.x].terrain==0x06);
-			printf("Stopping route %d on finish %d %d %d\n", m_Routes.size()-1,
+			printf("Stopping route %lu on finish %d %d %d\n",
+				static_cast<unsigned long>(m_Routes.size()) - 1,
 				start.x, start.y, start.z);
 			m_Routes.back().push_back(start);
 			break;
Index: ultimatestunts-srcdata-0771/trackedit/routetracker.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/trackedit/routetracker.cpp
+++ ultimatestunts-srcdata-0771/trackedit/routetracker.cpp
@@ -141,7 +141,7 @@ void CRouteTracker::trackSingleRoute(uns
 	{
 		printf("Error: currentTileRoute >= number of tile routes\n");
 		printf("    Tile: %s\n", currentModel->getFilename().c_str());
-		printf("    %d >= %d\n", currentTileRoute, currentModel->m_Routes.size());
+		printf("    %d >= %lu\n", currentTileRoute, static_cast<unsigned long>(currentModel->m_Routes.size()));
 		return;
 	}
 
Index: ultimatestunts-srcdata-0771/trackedit/trkfile.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/trackedit/trkfile.cpp
+++ ultimatestunts-srcdata-0771/trackedit/trkfile.cpp
@@ -43,7 +43,7 @@ bool CTRKFile::load(const CString &filen
 
 	if(bytes.size() != TRKLENGTH)
 	{
-		printf("Expected %d bytes, got %d bytes\n", TRKLENGTH, bytes.size());
+		printf("Expected %d bytes, got %lu bytes\n", TRKLENGTH, static_cast<unsigned long>(bytes.size()));
 		return false;
 	}
 
Index: ultimatestunts-srcdata-0771/ultimatestunts/music.cpp
===================================================================
--- ultimatestunts-srcdata-0771.orig/ultimatestunts/music.cpp
+++ ultimatestunts-srcdata-0771/ultimatestunts/music.cpp
@@ -209,8 +209,8 @@ void CMusic::update()
 			if (ret == 0)
 			{
 				m_streamIsFinished = true;
-				printf("Finished loading Ogg music file (used %d buffers)\n",
-					m_StreamBuffers.size());
+				printf("Finished loading Ogg music file (used %lu buffers)\n",
+					static_cast<unsigned long>(m_StreamBuffers.size()));
 			}
 			else
 			{
openSUSE Build Service is sponsored by