|
From: <ufo...@li...> - 2010-05-23 17:22:24
|
Revision: 1139
http://ufo2000.svn.sourceforge.net/ufo2000/?rev=1139&view=rev
Author: ssvb
Date: 2010-05-23 17:22:18 +0000 (Sun, 23 May 2010)
Log Message:
-----------
Fixed a bunch of string format related issues reported as gcc warnings
From: Siarhei Siamashka <sia...@gm...>
Modified Paths:
--------------
trunk/src/editor.cpp
trunk/src/main.cpp
trunk/src/multiplay.cpp
trunk/src/scenario.cpp
trunk/src/soldier.cpp
trunk/src/units.cpp
Modified: trunk/src/editor.cpp
===================================================================
--- trunk/src/editor.cpp 2010-05-23 16:57:26 UTC (rev 1138)
+++ trunk/src/editor.cpp 2010-05-23 17:22:18 UTC (rev 1139)
@@ -382,7 +382,7 @@
int x2 = 236;
sprintf(str1, "%s: %4d", _("Equipment cost"), man->calc_full_ammunition_cost() );
int w1 = text_length(g_small_font, str1); // right-justify string
- textprintf(screen2, g_small_font, x2-w1, 20, COLOR_GRAY02, str1);
+ textprintf(screen2, g_small_font, x2-w1, 20, COLOR_GRAY02, "%s", str1);
draw_alpha_sprite(screen2, mouser, mouse_x, mouse_y);
blit(screen2, screen, 0, 0, 0, 0, screen2->w, screen2->h);
Modified: trunk/src/main.cpp
===================================================================
--- trunk/src/main.cpp 2010-05-23 16:57:26 UTC (rev 1138)
+++ trunk/src/main.cpp 2010-05-23 17:22:18 UTC (rev 1139)
@@ -1909,8 +1909,8 @@
//textprintf(newscr, large, x1, y1, COLOR_GREEN, _("Your Platoon") );
//textprintf(newscr, large, x2, y1, COLOR_GREEN, _("Remote Platoon") );
}
- textprintf(newscr, large, x1, y1, COLOR_GREEN, player1 );
- textprintf(newscr, large, x2, y1, COLOR_GREEN, player2 );
+ textprintf(newscr, large, x1, y1, COLOR_GREEN, "%s", player1 );
+ textprintf(newscr, large, x2, y1, COLOR_GREEN, "%s", player2 );
strcpy(txt, _("Total Kills:") );
textprintf(newscr, g_small_font, x1+ 0, y2+0*h, COLOR_RED03, "%s", txt );
@@ -2124,7 +2124,7 @@
chk = -chk; // Error codes are negative.
if(FLAGS & F_ENDTURNSND)
soundSystem::getInstance()->play(SS_BUTTON_PUSH_2);
- g_console->printf(GameErrorColour[chk], GameErrorMessage[chk]);
+ g_console->printf(GameErrorColour[chk], "%s", GameErrorMessage[chk]);
}
/**
@@ -2629,7 +2629,7 @@
} else {
sprintf(buf, "%s", _("You: Draw offer recalled"));
}
- g_console->printf(COLOR_SYS_PROMPT, buf);
+ g_console->printf(COLOR_SYS_PROMPT, "%s", buf);
battle_report("# %s\n", buf);
}
}
Modified: trunk/src/multiplay.cpp
===================================================================
--- trunk/src/multiplay.cpp 2010-05-23 16:57:26 UTC (rev 1138)
+++ trunk/src/multiplay.cpp 2010-05-23 17:22:18 UTC (rev 1139)
@@ -263,7 +263,7 @@
if (!packet.empty()) {
queue->put(packet);
if (FLAGS & F_RAWMESSAGES) {
- g_console->printf( _("put:[%d]"), packet.size());
+ g_console->printf( _("put:[%d]"), (int)packet.size());
g_console->printf("%s", packet.c_str());
}
}
@@ -274,7 +274,7 @@
if (!queue->get(packet)) return;
if (FLAGS & F_RAWMESSAGES) {
- g_console->printf( _("get:[%d]"), packet.size());
+ g_console->printf( _("get:[%d]"), (int)packet.size());
g_console->printf("%s", packet.c_str());
}
@@ -1328,7 +1328,7 @@
// special end of terrain list marker received (empty terrain name)
g_console->printf("\n");
g_console->printf( _("Remote player has the following %d maps that can be used for network game:\n"),
- g_net_allowed_terrains.size());
+ (int)g_net_allowed_terrains.size());
std::string tlist = "";
@@ -1637,7 +1637,7 @@
} else {
sprintf(buf, "%s", _("Opponent: Draw offer recalled"));
}
- g_console->printf(COLOR_SYS_PROMPT, buf);
+ g_console->printf(COLOR_SYS_PROMPT, "%s", buf);
battle_report("# %s\n", buf);
return 0;
}
Modified: trunk/src/scenario.cpp
===================================================================
--- trunk/src/scenario.cpp 2010-05-23 16:57:26 UTC (rev 1138)
+++ trunk/src/scenario.cpp 2010-05-23 17:22:18 UTC (rev 1139)
@@ -822,7 +822,7 @@
platoon->findnum(i)->place(P_MAP)->get_items_list(items);
if (items.size() > 0) {
- g_console->printf(COLOR_RED04, _("Items on the ground aren't allowed (you have: %d, including unselected soldiers)."), items.size());
+ g_console->printf(COLOR_RED04, _("Items on the ground aren't allowed (you have: %d, including unselected soldiers)."), (int)items.size());
return false;
}
}
Modified: trunk/src/soldier.cpp
===================================================================
--- trunk/src/soldier.cpp 2010-05-23 16:57:26 UTC (rev 1138)
+++ trunk/src/soldier.cpp 2010-05-23 17:22:18 UTC (rev 1139)
@@ -1111,7 +1111,7 @@
if((havetime(walk_time + time, 0) != OK) && (havetime(time, 0) == OK)) {
if(error != "")
- g_console->printf(COLOR_SYS_INFO1, error.c_str());
+ g_console->printf(COLOR_SYS_INFO1, "%s", error.c_str());
return havetime(walk_time + time, 0);
} else {
return havetime(walk_time, use_energy);
Modified: trunk/src/units.cpp
===================================================================
--- trunk/src/units.cpp 2010-05-23 16:57:26 UTC (rev 1138)
+++ trunk/src/units.cpp 2010-05-23 17:22:18 UTC (rev 1139)
@@ -314,13 +314,13 @@
textout_centre(screen2, font, _("Player 1"), x0, SCREEN2H - 285, xcom1_color(CAPTION));
for (i = 0; i < 8; i++)
- textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 270 + i * 9, xcom1_color(COMMENT), scenario->briefing_left[scenario->type][i]);
+ textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 270 + i * 9, xcom1_color(COMMENT), "%s", scenario->briefing_left[scenario->type][i]);
if (pos == POS_LEFT)
rect(screen2, x0 - x1 + 3, SCREEN2H - 272, x0 + x1 - 3, SCREEN2H - 198, xcom1_color(LOCAL_COLOR));
textout_centre(screen2, font, _("Player 2"), x0, SCREEN2H - 185, xcom1_color(CAPTION));
for (i = 0; i < 8; i++)
- textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 170 + i * 9, xcom1_color(COMMENT), scenario->briefing_right[scenario->type][i]);
+ textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 170 + i * 9, xcom1_color(COMMENT), "%s", scenario->briefing_right[scenario->type][i]);
if (pos == POS_RIGHT)
rect(screen2, x0 - x1 + 3, SCREEN2H - 172, x0 + x1 - 3, SCREEN2H - 98, xcom1_color(LOCAL_COLOR));
@@ -333,14 +333,14 @@
break;
case OPT_NUMBER:
- textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 70 + i * 9, xcom1_color(COMMENT), scenario->options[scenario->type][i]->caption);
+ textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 70 + i * 9, xcom1_color(COMMENT), "%s", scenario->options[scenario->type][i]->caption);
textout_centre(screen2, font, "<", x0 + 150, SCREEN2H - 70 + i * 9, xcom1_color(BUTTON));
textprintf_centre(screen2, font, x0 + 170, SCREEN2H - 70 + i * 9, xcom1_color(SELECTED), "%d", scenario->options[scenario->type][i]->value);
textout_centre(screen2, font, ">", x0 + 190, SCREEN2H - 70 + i * 9, xcom1_color(BUTTON));
break;
case OPT_SWITCH:
- textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 70 + i * 9, scenario->options[scenario->type][i]->value ? xcom1_color(SWITCH_ON) : xcom1_color(SWITCH_OFF), scenario->options[scenario->type][i]->value ? scenario->options[scenario->type][i]->caption_on : scenario->options[scenario->type][i]->caption_off);
+ textprintf(screen2, font, x0 - x1 + 5, SCREEN2H - 70 + i * 9, scenario->options[scenario->type][i]->value ? xcom1_color(SWITCH_ON) : xcom1_color(SWITCH_OFF), "%s", scenario->options[scenario->type][i]->value ? scenario->options[scenario->type][i]->caption_on : scenario->options[scenario->type][i]->caption_off);
break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|