From 62131647601a215a7eda43968772d8bf167e814d Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Mon, 8 Feb 2010 08:09:26 +0000 Subject: [PATCH] const-char warning fixes specific to FS1 --- src/controlconfig/controlsconfigcommon.cpp | 2 +- src/localization/localize.cpp | 4 ++-- src/localization/strings_tbl_fs1.cpp | 2 +- src/mission/missionbriefcommon.cpp | 2 +- src/weapon/weapons.cpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controlconfig/controlsconfigcommon.cpp b/src/controlconfig/controlsconfigcommon.cpp index 50978c5..4a7c3b8 100644 --- a/src/controlconfig/controlsconfigcommon.cpp +++ b/src/controlconfig/controlsconfigcommon.cpp @@ -831,7 +831,7 @@ int translate_key_to_index(const char *key) #ifdef MAKE_FS1 // fix for German training mission key check if (Lcl_gr && !strcmp(key, "Links Ctrl")) { - strncpy(key, "Left Ctrl", 10); + key = "Left Ctrl"; } #endif diff --git a/src/localization/localize.cpp b/src/localization/localize.cpp index a3d0391..3ddc942 100644 --- a/src/localization/localize.cpp +++ b/src/localization/localize.cpp @@ -417,7 +417,7 @@ int Lcl_pointer_count = 0; #ifdef MAKE_FS1 // strings.tbl for FS1, hard coded -extern char *FS1_trans[LCL_NUM_LANGUAGES_FS1][LCL_NUM_STRINGS_FS1]; +extern const char *FS1_trans[LCL_NUM_LANGUAGES_FS1][LCL_NUM_STRINGS_FS1]; #endif // ------------------------------------------------------------------------------------------------------------ @@ -665,7 +665,7 @@ void lcl_xstr_init() if ( !strlen(FS1_trans[Lcl_current_lang][i]) ) { Xstr_table[i].str = NULL; } else { - Xstr_table[i].str = FS1_trans[Lcl_current_lang][i]; + Xstr_table[i].str = (char *)FS1_trans[Lcl_current_lang][i]; } Xstr_table[i].offset_x = 0; diff --git a/src/localization/strings_tbl_fs1.cpp b/src/localization/strings_tbl_fs1.cpp index ce9eb54..f79ba81 100644 --- a/src/localization/strings_tbl_fs1.cpp +++ b/src/localization/strings_tbl_fs1.cpp @@ -31,7 +31,7 @@ #include "localize.h" -char *FS1_trans[LCL_NUM_LANGUAGES_FS1][LCL_NUM_STRINGS_FS1] = +const char *FS1_trans[LCL_NUM_LANGUAGES_FS1][LCL_NUM_STRINGS_FS1] = { // English { diff --git a/src/mission/missionbriefcommon.cpp b/src/mission/missionbriefcommon.cpp index c088f24..699b2c9 100644 --- a/src/mission/missionbriefcommon.cpp +++ b/src/mission/missionbriefcommon.cpp @@ -478,7 +478,7 @@ cmd_brief *Cur_cmd_brief; cmd_brief Cmd_briefs[MAX_TEAMS]; #ifdef MAKE_FS1 -static char *fs1_icon_tbl[MAX_BRIEF_ICONS][3] = { +static const char *fs1_icon_tbl[MAX_BRIEF_ICONS][3] = { { "iconfighter", "FadeFighter", "iconhighlight04" }, { "iconfighterW", "FadeFighterW", "iconhighlight02" }, { "iconcargo", "FadeCargo", "iconhighlight04" }, diff --git a/src/weapon/weapons.cpp b/src/weapon/weapons.cpp index 0a7294c..82e29c1 100644 --- a/src/weapon/weapons.cpp +++ b/src/weapon/weapons.cpp @@ -690,10 +690,10 @@ int weapon_info_lookup(const char *name) #ifdef MAKE_FS1 // fix the stupid table stuff - it's non-fatal but annoying error messages if (!strcmp(name, "Disruptor Missile")) { - strncpy(name, "D-Missile", MAX_FILENAME_LENGTH); + name = "D-Missile"; // this one fixes the same issue with a SilentThreat mission } else if (!strcmp(name, "Shield Breaker")) { - strncpy(name, "S-Breaker", MAX_FILENAME_LENGTH); + name = "S-Breaker"; } #endif -- 2.39.2