Browse Source

🧹 Fix more `-Wformat` warnings

pull/1805/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
47c93c2f9c
  1. 5
      Source/appfat.cpp
  2. 6
      Source/diablo.cpp
  3. 2
      Source/dvlnet/tcp_client.cpp
  4. 2
      Source/init.cpp
  5. 10
      Source/loadsave.cpp
  6. 2
      Source/mainmenu.cpp
  7. 6
      Source/msg.cpp
  8. 14
      Source/pfile.cpp
  9. 2
      Source/qol/monhealthbar.cpp
  10. 2
      Source/qol/xpbar.cpp

5
Source/appfat.cpp

@ -156,9 +156,10 @@ void InsertCDDlg()
snprintf(
text,
1024,
"%s",
_("Unable to open main data archive (diabdat.mpq or spawn.mpq).\n"
"\n"
"Make sure that it is in the game folder and that the file name is in all lowercase."));
"\n"
"Make sure that it is in the game folder and that the file name is in all lowercase."));
UiErrorOkDialog(_("Data File Error"), text);
app_fatal(nullptr);

6
Source/diablo.cpp

@ -157,7 +157,7 @@ extern void plrctrls_after_game_logic();
[[noreturn]] static void print_help_and_exit()
{
printInConsole(_("Options:\n"));
printInConsole("%s", _("Options:\n"));
printInConsole(" %-20s %-30s\n", "-h, --help", _("Print this message and exit"));
printInConsole(" %-20s %-30s\n", "--version", _("Print the version and exit"));
printInConsole(" %-20s %-30s\n", "--data-dir", _("Specify the folder of diabdat.mpq"));
@ -170,7 +170,7 @@ extern void plrctrls_after_game_logic();
printInConsole(" %-20s %-30s\n", "-x", _("Run in windowed mode"));
printInConsole(" %-20s %-30s\n", "--verbose", _("Enable verbose logging"));
printInConsole(" %-20s %-30s\n", "--spawn", _("Force spawn mode even if diabdat.mpq is found"));
printInConsole(_("\nHellfire options:\n"));
printInConsole("%s", _("\nHellfire options:\n"));
printInConsole(" %-20s %-30s\n", "--diablo", _("Force diablo mode even if hellfire.mpq is found"));
printInConsole(" %-20s %-30s\n", "--nestart", _("Use alternate nest palette"));
#ifdef _DEBUG
@ -188,7 +188,7 @@ extern void plrctrls_after_game_logic();
printInConsole(" %-20s %-30s\n", "-r <##########>", "Set map seed");
printInConsole(" %-20s %-30s\n", "-t <##>", "Set current quest level");
#endif
printInConsole(_("\nReport bugs at https://github.com/diasurgical/devilutionX/\n"));
printInConsole("%s", _("\nReport bugs at https://github.com/diasurgical/devilutionX/\n"));
diablo_quit(0);
}

2
Source/dvlnet/tcp_client.cpp

@ -65,7 +65,7 @@ int tcp_client::join(std::string addrstr, std::string passwd)
}
}
if (plr_self == PLR_BROADCAST) {
SDL_SetError(_("Unable to connect"));
SDL_SetError("%s", _("Unable to connect"));
return -1;
}

2
Source/init.cpp

@ -209,7 +209,7 @@ void init_archives()
void init_create_window()
{
if (!SpawnWindow(PROJECT_NAME))
app_fatal(_("Unable to create main window"));
app_fatal("%s", _("Unable to create main window"));
dx_init();
gbActive = true;
#ifndef USE_SDL1

10
Source/loadsave.cpp

@ -994,10 +994,10 @@ void LoadGame(bool firstflag)
LoadHelper file("game");
if (!file.isValid())
app_fatal(_("Unable to open save file archive"));
app_fatal("%s", _("Unable to open save file archive"));
if (!IsHeaderValid(file.nextLE<uint32_t>()))
app_fatal(_("Invalid save file"));
app_fatal("%s", _("Invalid save file"));
if (gbIsHellfireSaveGame) {
giNumberOfLevels = 25;
@ -1026,7 +1026,7 @@ void LoadGame(bool firstflag)
int _nobjects = file.nextBE<int32_t>();
if (!gbIsHellfire && currlevel > 17)
app_fatal(_("Player is on a Hellfire only level"));
app_fatal("%s", _("Player is on a Hellfire only level"));
for (uint8_t i = 0; i < giNumberOfLevels; i++) {
glSeedTbl[i] = file.nextBE<uint32_t>();
@ -1783,7 +1783,7 @@ void SaveGameData()
else if (!gbIsSpawn && !gbIsHellfire)
file.writeLE<uint32_t>(LoadLE32("RETL"));
else
app_fatal(_("Invalid game state"));
app_fatal("%s", _("Invalid game state"));
if (gbIsHellfire) {
giNumberOfLevels = 25;
@ -2021,7 +2021,7 @@ void LoadLevel()
GetPermLevelNames(szName);
LoadHelper file(szName);
if (!file.isValid())
app_fatal(_("Unable to open save file archive"));
app_fatal("%s", _("Unable to open save file archive"));
if (leveltype != DTYPE_TOWN) {
for (int j = 0; j < MAXDUNY; j++) {

2
Source/mainmenu.cpp

@ -120,7 +120,7 @@ void mainmenu_loop()
do {
menu = MAINMENU_NONE;
if (!UiMainMenuDialog(gszProductName, &menu, effects_play_sound, 30))
app_fatal(_("Unable to display mainmenu"));
app_fatal("%s", _("Unable to display mainmenu"));
switch (menu) {
case MAINMENU_NONE:

6
Source/msg.cpp

@ -176,13 +176,13 @@ bool msg_wait_resync()
}
if (gbGameDestroyed) {
DrawDlg(_("The game ended"));
DrawDlg("%s", _("The game ended"));
msg_free_packets();
return false;
}
if (sgbDeltaChunks != MAX_CHUNKS) {
DrawDlg(_("Unable to get level data"));
DrawDlg("%s", _("Unable to get level data"));
msg_free_packets();
return false;
}
@ -607,7 +607,7 @@ static void delta_put_item(TCmdPItem *pI, int x, int y, BYTE bLevel)
&& pD->dwSeed == pI->dwSeed) {
if (pD->bCmd == CMD_ACK_PLRINFO)
return;
app_fatal(_("Trying to drop a floor item?"));
app_fatal("%s", _("Trying to drop a floor item?"));
}
}

14
Source/pfile.cpp

@ -214,7 +214,7 @@ PFileScopedArchiveWriter::PFileScopedArchiveWriter(bool clear_tables)
, clear_tables_(clear_tables)
{
if (!pfile_open_archive(save_num_))
app_fatal(_("Failed to open player archive for writing."));
app_fatal("%s", _("Failed to open player archive for writing."));
}
PFileScopedArchiveWriter::~PFileScopedArchiveWriter()
@ -388,9 +388,9 @@ void pfile_read_player_from_save(char name[16], int playerId)
save_num = pfile_get_save_num_from_name(name);
archive = pfile_open_save_archive(save_num);
if (archive == nullptr)
app_fatal(_("Unable to open archive"));
app_fatal("%s", _("Unable to open archive"));
if (!pfile_read_hero(archive, &pkplr))
app_fatal(_("Unable to load character"));
app_fatal("%s", _("Unable to load character"));
gbValidSaveFile = pfile_archive_contains_game(archive);
if (gbValidSaveFile)
@ -413,7 +413,7 @@ bool LevelFileExists()
DWORD save_num = pfile_get_save_num_from_name(plr[myplr]._pName);
if (!pfile_open_archive(save_num))
app_fatal(_("Unable to read to save file archive"));
app_fatal("%s", _("Unable to read to save file archive"));
bool has_file = mpqapi_has_file(szName);
mpqapi_flush_and_close(true);
@ -436,7 +436,7 @@ void GetPermLevelNames(char *szPerm)
save_num = pfile_get_save_num_from_name(plr[myplr]._pName);
GetTempLevelNames(szPerm);
if (!pfile_open_archive(save_num))
app_fatal(_("Unable to read to save file archive"));
app_fatal("%s", _("Unable to read to save file archive"));
has_file = mpqapi_has_file(szPerm);
mpqapi_flush_and_close(true);
@ -455,7 +455,7 @@ void pfile_remove_temp_files()
DWORD save_num = pfile_get_save_num_from_name(plr[myplr]._pName);
if (!pfile_open_archive(save_num))
app_fatal(_("Unable to write to save file archive"));
app_fatal("%s", _("Unable to write to save file archive"));
mpqapi_remove_hash_entries(GetTempSaveNames);
mpqapi_flush_and_close(true);
}
@ -467,7 +467,7 @@ void pfile_write_save_file(const char *pszName, BYTE *pbData, DWORD dwLen, DWORD
save_num = pfile_get_save_num_from_name(plr[myplr]._pName);
codec_encode(pbData, dwLen, qwLen, pfile_get_password());
if (!pfile_open_archive(save_num))
app_fatal(_("Unable to write to save file archive"));
app_fatal("%s", _("Unable to write to save file archive"));
mpqapi_write_file(pszName, pbData, qwLen);
mpqapi_flush_and_close(true);
}

2
Source/qol/monhealthbar.cpp

@ -32,7 +32,7 @@ void InitMonsterHealthBar()
if ((healthBox.surface == nullptr)
|| (health.surface == nullptr)
|| (resistance.surface == nullptr)) {
app_fatal(_("Failed to load UI resources. Is devilutionx.mpq accessible and up to date?"));
app_fatal("%s", _("Failed to load UI resources. Is devilutionx.mpq accessible and up to date?"));
}
}

2
Source/qol/xpbar.cpp

@ -49,7 +49,7 @@ void InitXPBar()
LoadMaskedArt("data\\xpbar.pcx", &xpbarArt, 1, 1);
if (xpbarArt.surface == nullptr) {
app_fatal(_("Failed to load UI resources. Is devilutionx.mpq accessible and up to date?"));
app_fatal("%s", _("Failed to load UI resources. Is devilutionx.mpq accessible and up to date?"));
}
}
}

Loading…
Cancel
Save