Commits

drbrain committed dfba39c

Removed some compiler warnings.

  • Participants
  • Parent commits 2f07f4f

Comments (0)

Files changed (9)

gamestats/gamestats.c

 		playerStatList = addPlayerStatList(a, gs_period, p->name);
 	}
 
-	if (!LLMember(&gs_period->teams, (void *)team))
-		LLAdd(&gs_period->teams, (void *)team);
+	if (!LLMember(&gs_period->teams, (void *)(long)team))
+		LLAdd(&gs_period->teams, (void *)(long)team);
 
 	rawAdd(a, playerStatList, type, team, amt);
 
 
 //odd problems with Ichat::SendSetMessage make me choose this alternative for safe practice
 //even though it's a bit ugly
-#define SENDMSG(x) if (target->type == T_LIST) chat->SendSetMessage((LinkedList *)&target->u.list, x); else if (target->type == T_ARENA) chat->SendArenaMessage(target->u.arena, x); else if (target->type == T_PLAYER) chat->SendMessage(target->u.p, x);
+#define SENDMSG(x) if (target->type == T_LIST) chat->SendSetMessage((LinkedList *)&target->u.list, "%s", x); else if (target->type == T_ARENA) chat->SendArenaMessage(target->u.arena, "%s", x); else if (target->type == T_PLAYER) chat->SendMessage(target->u.p, "%s", x);
 #define SENDMSG1(x,m) if (target->type == T_LIST) chat->SendSetMessage((LinkedList *)&target->u.list, x, m); else if (target->type == T_ARENA) chat->SendArenaMessage(target->u.arena, x, m); else if (target->type == T_PLAYER) chat->SendMessage(target->u.p, x, m);
 #define SENDMSG2(x,m,n) if (target->type == T_LIST) chat->SendSetMessage((LinkedList *)&target->u.list, x, m, n); else if (target->type == T_ARENA) chat->SendArenaMessage(target->u.arena, x, m, n); else if (target->type == T_PLAYER) chat->SendMessage(target->u.p, x, m, n);
 
 		ordering_data *data;
 
 		//set the team in prep
-		team = (int)_team;
+		team = (int)(long)_team;
 		prep.team = team;
 		//then get our statOrder
 		HashEnum(&gs_period->playerStats, hashenum_statorder, &prep);
 	usedBufferLen = strlen(queryBuffer) + 1;
 
 	if (usedBufferLen <= bufferLen)
-		lm->LogA(L_INFO, "gamestats", a, "used %i/%i bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_INFO, "gamestats", a, "used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
 	else
-		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writePublicStatsToDB: used %i/%i bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writePublicStatsToDB: used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
 
 	db->Query(0, 0, 0, "$", queryBuffer);
 
 			usedBufferLen = strlen(queryBuffer) + 1;
 
 			if (usedBufferLen <= bufferLen)
-				lm->LogA(L_INFO, "gamestats", a, "used %i/%i bytes in stats", usedBufferLen, bufferLen);
+				lm->LogA(L_INFO, "gamestats", a, "used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
 			else
-				lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %i/%i bytes in stats", usedBufferLen, bufferLen);
+				lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
 
 			if (gameId)
 			{
 	usedBufferLen = strlen(queryBuffer) + 1;
 
 	if (usedBufferLen <= bufferLen)
-		lm->LogA(L_INFO, "gamestats", a, "used %i/%i bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_INFO, "gamestats", a, "used %ld/%ld bytes in stats", usedBufferLen, bufferLen);
 	else
-		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %i/%i bytes in stats", usedBufferLen, bufferLen);
+		lm->LogA(L_ERROR, "gamestats", a, "BUFFER OVERRUN in writeLeagueStatsToDB: used %ld/%ld 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 %i, need %i)", 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 %ld, need %ld)", sizeof(*item) + s, (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 %i, need %i)", s, (z + s) - 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); \
 		MYAUNLOCK; \
 		return z; \
 	}
 					//slice through the list finding a stat with a freq that hasn't been done yet
 					FOR_EACH(list, stat, link2)
 					{
-						if (!LLMember(&finishedTeams, (void *)stat->team))
+						if (!LLMember(&finishedTeams, (void *)(long)stat->team))
 						{
-							LLAdd(&finishedTeams, (void *)stat->team);
+							LLAdd(&finishedTeams, (void *)(long)stat->team);
 							CHECK_BUFFER(0);
 							item->type = ITEM_NEW_TEAM;
 							currentTeam = item->param = stat->team;
 				gamestat_type *type;
 				int team = item->param;
 				SHIFT_BUFFER(0);
-				if (!LLMember(&activePeriod->teams, (void *)team))
-					LLAdd(&activePeriod->teams, (void *)team);
+				if (!LLMember(&activePeriod->teams, (void *)(long)team))
+					LLAdd(&activePeriod->teams, (void *)(long)team);
 				FOR_EACH(&ad->stattypeList, type, link)
 				{
 					CONTINUE_ON_NONSQL(type);
 	}
 
 	return MM_FAIL;
+
+	(void)persist;
 }
 
 
 
 				graph[y] = 0;
 
-				chat->SendMessage(p, graph);
+				chat->SendMessage(p, "%s", graph);
 
 				current = next;
 				if (current < 0)

hs_akd/hs_powerball.c

 //body:Cgoals
 local void Cgoals(const char *cmd, const char *params, Player *p, const Target *target)
 {
-	int switchF = (int)strstr(params, "-f");
+	int switchF = strstr(params, "-f") != NULL;
 	int i;
 	DEF_AD(p->arena);
 	if (!ad)

hs_akd/log_file_dated.c

 #include <stdio.h>
 #include <string.h>
 #include <time.h>
+#include <sys/stat.h>
 
 #include "asss.h"
 #include "log_file.h"

hs_attach/hs_attach.c

 {
 	if (target->type == T_PLAYER)
 	{
-		ticks_t ticks = current_ticks();
 		Player *t = target->u.p;
 		AData *adata = P_ARENA_DATA(p->arena, adata_key);
 		PData *pdata = PPDATA(p, pdata_key);
 
 	if (target->type == T_PLAYER)
 	{
-		ticks_t ticks = current_ticks();
 		Player *t = target->u.p;
 		AData *adata = P_ARENA_DATA(arena, adata_key);
 		PData *pdata = PPDATA(p, pdata_key);
 {
 	if (action == PA_PREENTERARENA)
 	{
-		PData *pdata = PPDATA(p, pdata_key);
 		set_player_values(p);
 	}
 }
 	}
 
 	sprintf(str, "|%2d.  |$%-5d|%-20s|%-20s|%8s |%8s |%8s |", rpd->place, reward, p->name, p->squad, rpd->cptime, rpd->time, rpd->best);
-	chat->SendArenaMessage(p->arena, str);
+	chat->SendArenaMessage(p->arena, "%s", str);
 
 	if((rpd->finishTime < rpd->bestTime || rpd->bestTime == 0) && ad->saveResults)
 	{

hs_prototypes/hs_flagutil.c

+#include <alloca.h>
 #include "asss.h"
 #include "hs_flagutil.h"
 

hs_prototypes/hs_kojima.c

+#include <stdio.h>
+#include <stdlib.h>
 #include <math.h>
 
 #include "asss.h"
 
 local void cb_arenaaction(Arena *arena, int action);
 local void cb_playeraction(Player *player, int action, Arena *arena);
-local void cb_shipchange(Player *player, int ship, int freq);
 local void cb_itemschanged(Player* player, int ship);
 
 local void update_status(Player *player, int ship);

hs_test/hs_crash.c

 
 local void Ccrash(const char *command, const char *params, Player *p, const Target *target)
 {
-	int i = *((int*)NULL);
+	volatile int i = *((int*)NULL);
+	(void)i;
 }
 
 EXPORT const char info_hs_crash[] = "v1.0 Dr Brain <drbrain@gmail.com>";