Fix warnings from GCC, Clang and cppcheck.

This commit is contained in:
Guus Sliepen 2012-12-09 16:53:21 +01:00
parent a7493773c4
commit 2fed23c6ec
4 changed files with 8 additions and 7 deletions

View File

@ -498,7 +498,7 @@ void circle(int xc, int yc, int R, SDL_Surface *PIX, int col)
void blevelRect(SDL_Surface *dest, int x, int y, int w, int h, Uint8 red, Uint8 green, Uint8 blue) void blevelRect(SDL_Surface *dest, int x, int y, int w, int h, Uint8 red, Uint8 green, Uint8 blue)
{ {
SDL_Rect r = {x, y, w, h}; SDL_Rect r = {(int16_t)x, (int16_t)y, (uint16_t)w, (uint16_t)h};
SDL_FillRect(dest, &r, SDL_MapRGB(screen->format, red, green, blue)); SDL_FillRect(dest, &r, SDL_MapRGB(screen->format, red, green, blue));
drawLine(dest, x, y, x + w, y, SDL_MapRGB(screen->format, 255, 255, 255)); drawLine(dest, x, y, x + w, y, SDL_MapRGB(screen->format, 255, 255, 255));

View File

@ -98,7 +98,7 @@ void getKillMessage(object *ally)
case 3: case 3:
case 4: case 4:
case 5: case 5:
sprintf(in, killMessage[rand() % 6]); strcpy(in, killMessage[rand() % 6]);
break; break;
case 6: case 6:
@ -120,11 +120,11 @@ void getKillMessage(object *ally)
case 9: case 9:
if (firstPlace) if (firstPlace)
{ {
sprintf(in, killMessage[9]); strcpy(in, killMessage[9]);
} }
else else
{ {
sprintf(in, killMessage[rand() % 6]); strcpy(in, killMessage[rand() % 6]);
} }
break; break;
} }

View File

@ -672,7 +672,7 @@ bool missionFailed()
static void drawBriefScreen() static void drawBriefScreen()
{ {
SDL_Rect r = {0, 0, screen->w, 2}; SDL_Rect r = {0, 0, (uint16_t)screen->w, 2};
for (int i = 0 ; i < (int)(screen->h / 4) - 30 ; i++) for (int i = 0 ; i < (int)(screen->h / 4) - 30 ; i++)
{ {
@ -845,7 +845,7 @@ void missionFinishedScreen()
{ {
if (currentMission.secondaryType[i] != NONE) if (currentMission.secondaryType[i] != NONE)
{ {
sprintf(temp, currentMission.secondaryObjective[i]); strcpy(temp, currentMission.secondaryObjective[i]);
if (currentMission.completed2[i] >= 1) if (currentMission.completed2[i] >= 1)
{ {
drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN); drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN);

View File

@ -62,6 +62,7 @@ void loadGameGraphics()
#if USEPACK #if USEPACK
int dataLocation = locateDataInPak(string, 1); int dataLocation = locateDataInPak(string, 1);
fp = fopen(PACKLOCATION, "rb"); fp = fopen(PACKLOCATION, "rb");
if(fp)
fseek(fp, dataLocation, SEEK_SET); fseek(fp, dataLocation, SEEK_SET);
#else #else
fp = fopen(string, "rb"); fp = fopen(string, "rb");