drbrain avatar drbrain committed 507aec1

Fixed some cross platform issues on gamestats.c.

Comments (0)

Files changed (1)

gamestats/gamestats.c

 	char buffer[300];
 	const char *tmp = 0;
 	const char *str;
-	size_t namelen;
+	unsigned long namelen;
 
 	gamestat_type *newtype = amalloc(sizeof(gamestat_type));
 	newtype->id = ad->nextId++;
 	Link *link;
 	gamestat_type *type;
 	dbwrite_preplite *prep;
-	size_t bufferLen;
-	size_t usedBufferLen;
+	unsigned long bufferLen;
+	unsigned long usedBufferLen;
 
 	DEF_AD(a);
 
 	usedBufferLen = strlen(queryBuffer) + 1;
 
 	if (usedBufferLen <= bufferLen)
-		lm->LogA(L_INFO, "gamestats", a, "used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_INFO, "gamestats", a, "used %lu/%lu bytes in stats", usedBufferLen, bufferLen);
 	else
-		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writePublicStatsToDB: used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writePublicStatsToDB: used %lu/%lu bytes in stats", usedBufferLen, bufferLen);
 
 	db->Query(0, 0, 0, "$", queryBuffer);
 
 	Link *link;
 	gamestat_type *type;
 	dbwrite_prep *prep;
-	size_t bufferLen;
-	size_t usedBufferLen;
+	unsigned long bufferLen;
+	unsigned long usedBufferLen;
 
 	DEF_AD(a);
 
 		return;
 	}
 
-	bufferLen = (size_t)gs_period->estimatedSummaryQuerySize;
+	bufferLen = (unsigned long)gs_period->estimatedSummaryQuerySize;
 
 	queryBuffer = amalloc(sizeof(char) * bufferLen);
 	MYAUNLOCK;
 			usedBufferLen = strlen(queryBuffer) + 1;
 
 			if (usedBufferLen <= bufferLen)
-				lm->LogA(L_INFO, "gamestats", a, "used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
+				lm->LogA(L_INFO, "gamestats", a, "used %lu/%lu bytes in stats", usedBufferLen, bufferLen);
 			else
-				lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
+				lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %lu/%lu bytes in stats", usedBufferLen, bufferLen);
 
 			if (gameId)
 			{
 	usedBufferLen = strlen(queryBuffer) + 1;
 
 	if (usedBufferLen <= bufferLen)
-		lm->LogA(L_INFO, "gamestats", a, "used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_INFO, "gamestats", a, "used %lu/%lu bytes in stats", usedBufferLen, bufferLen);
 	else
-		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %lu/%lu bytes in stats", usedBufferLen, bufferLen);
 
 	if (gameId)
 	{
 #define CHECK_BUFFER(s) \
 	if ((unsigned)(z + sizeof(*item) + s) >= (unsigned)len) \
 	{ \
-		lm->LogA(L_ERROR, "gamestats", a, "persistant data buffer is not large enough to hold all of the data (requested %ld, need %ld)", sizeof(*item) + s, (z + sizeof(*item) + s) - len); \
+		lm->LogA(L_ERROR, "gamestats", a, "persistant data buffer is not large enough to hold all of the data (requested %lu, need %lu)", (unsigned long)(sizeof(*item) + s), (unsigned long)((z + sizeof(*item) + s) - len)); \
 		MYAUNLOCK; \
 		return z; \
 	}
 #define CHECK_BUFFER_RAW(s) \
 	if ((unsigned)(z + s) >= (unsigned)len) \
 	{ \
-		lm->LogA(L_ERROR, "gamestats", a, "persistant data buffer is not large enough to hold all of the data (requested %ld, need %ld)", s, (z + s) - len); \
+		lm->LogA(L_ERROR, "gamestats", a, "persistant data buffer is not large enough to hold all of the data (requested %lu, need %lu)", (unsigned long)s, (unsigned long)((z + s) - len)); \
 		MYAUNLOCK; \
 		return z; \
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.