Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/ai/ai_profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ void ai_profiles_init()
Ai_profiles_initted = 1;
}

int ai_profile_lookup(char *name)
int ai_profile_lookup(const char *name)
{
for (int i = 0; i < Num_ai_profiles; i++)
if (!stricmp(name, Ai_profiles[i].profile_name))
Expand Down
2 changes: 1 addition & 1 deletion code/ai/ai_profiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ extern ai_profile_t Ai_profiles[MAX_AI_PROFILES];

void ai_profiles_init();

int ai_profile_lookup(char *name);
int ai_profile_lookup(const char *name);

#endif
4 changes: 2 additions & 2 deletions code/graphics/software/NVGFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace font
return 1;
}

const char *nullPtr = strchr(const_cast<char*>(string), '\0');
const char *nextToken = strpbrk(const_cast<char*>(string), TOKEN_SEPARATORS);
const char *nullPtr = strchr(string, '\0');
const char *nextToken = strpbrk(string, TOKEN_SEPARATORS);

// WOHOO! Pointer arithmetic!!!
if (nullPtr != NULL && (nextToken == NULL || nullPtr < nextToken))
Expand Down
8 changes: 4 additions & 4 deletions code/lab/dialogs/lab_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ static void build_ship_table_info_txtbox(ship_info* sip)
}

InputTextMultiline("##table_text",
const_cast<char*>(table_text.c_str()),
table_text.data(),
table_text.length(),
ImVec2(-FLT_MIN, GetTextLineHeight() * 16),
ImGuiInputTextFlags_ReadOnly);
Expand All @@ -681,7 +681,7 @@ static void build_weapon_table_info_txtbox(weapon_info* wip)
}

InputTextMultiline("##weapon_table_text",
const_cast<char*>(table_text.c_str()),
table_text.data(),
table_text.length(),
ImVec2(-FLT_MIN, GetTextLineHeight() * 16),
ImGuiInputTextFlags_ReadOnly);
Expand Down Expand Up @@ -1506,7 +1506,7 @@ void LabUi::show_object_options() const
}

InputTextMultiline("##asteroid_table_text",
const_cast<char*>(table_text.c_str()),
table_text.data(),
table_text.length(),
ImVec2(-FLT_MIN, GetTextLineHeight() * 16),
ImGuiInputTextFlags_ReadOnly);
Expand Down Expand Up @@ -1544,7 +1544,7 @@ void LabUi::show_object_options() const
}

InputTextMultiline("##prop_table_text",
const_cast<char*>(table_text.c_str()),
table_text.data(),
table_text.length(),
ImVec2(-FLT_MIN, GetTextLineHeight() * 16),
ImGuiInputTextFlags_ReadOnly);
Expand Down
6 changes: 3 additions & 3 deletions code/missioneditor/campaignsave.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ typedef struct campaign_link {
int node; // node tracker when link is in sexp tree window
bool is_mission_loop; // whether link leads to mission loop
bool is_mission_fork; // whether link leads to mission fork
char* mission_branch_txt; // text describing mission loop
char* mission_branch_brief_anim; // filename of anim to play in the brief
char* mission_branch_brief_sound; // filename of anim to play in the brief
const char* mission_branch_txt; // text describing mission loop
const char* mission_branch_brief_anim; // filename of anim to play in the brief
const char* mission_branch_brief_sound; // filename of anim to play in the brief
} campaign_link;

class Fred_campaign_save : public Fred_mission_save {
Expand Down
2 changes: 1 addition & 1 deletion code/network/multi_xfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ int multi_xfer_get_flags(int handle)
}

// if the passed filename is being xferred, return the xfer handle, otherwise return -1
int multi_xfer_lookup(char *filename)
int multi_xfer_lookup(const char *filename)
{
int idx;

Expand Down
2 changes: 1 addition & 1 deletion code/network/multi_xfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void multi_xfer_xor_flags(int handle,int flags);
int multi_xfer_get_flags(int handle);

// if the passed filename is being xferred, return the xfer handle, otherwise return -1
int multi_xfer_lookup(char *filename);
int multi_xfer_lookup(const char *filename);

// get the % of completion of the passed file handle, return < 0 if invalid
float multi_xfer_pct_complete(int handle);
Expand Down
2 changes: 1 addition & 1 deletion code/scripting/api/libs/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ ADE_INDEXER(l_Graphics_Posteffects, "number index", "Gets the name of the specif
if (index >= (int) names.size())
return ade_set_error(L, "s", "");

return ade_set_args(L, "s", const_cast<char*>(names[index].c_str()));
return ade_set_args(L, "s", names[index].c_str());
}

ADE_FUNC(__len, l_Graphics_Posteffects, nullptr, "Gets the number of available post-processing effects", "number", "number of post-processing effects or 0 on error")
Expand Down
2 changes: 1 addition & 1 deletion fred2/sexp_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3421,7 +3421,7 @@ int sexp_tree::get_default_value(sexp_list_item *item, char *text_buf, int op, i
break;

case OPF_FONT:
str = const_cast<char*>(font::FontManager::getFont(0)->getName().c_str());
str = font::FontManager::getFont(0)->getName().c_str();
break;

case OPF_AUDIO_VOLUME_OPTION:
Expand Down
2 changes: 1 addition & 1 deletion freespace2/freespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7553,7 +7553,7 @@ int detect_lang()

// try and open the file to verify
font::stuff_first(first_font);
CFILE *detect = cfopen(const_cast<char*>(first_font.c_str()), "rb");
CFILE *detect = cfopen(first_font.c_str(), "rb");

// will use default setting if something went wrong
if (!detect)
Expand Down
10 changes: 3 additions & 7 deletions qtfred/src/mission/dialogs/CampaignEditorDialogModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,9 @@ void CampaignEditorDialogModel::saveCampaign(const SCP_string& filename)

// The descriptive text fields only apply to special (loop/fork) branches.
if (branch.is_loop || branch.is_fork) {
link.mission_branch_txt =
branch.loop_description.empty() ? nullptr : const_cast<char*>(branch.loop_description.c_str());
link.mission_branch_brief_anim =
branch.loop_briefing_anim.empty() ? nullptr : const_cast<char*>(branch.loop_briefing_anim.c_str());
link.mission_branch_brief_sound = branch.loop_briefing_sound.empty()
? nullptr
: const_cast<char*>(branch.loop_briefing_sound.c_str());
link.mission_branch_txt = branch.loop_description.empty() ? nullptr : branch.loop_description.c_str();
link.mission_branch_brief_anim = branch.loop_briefing_anim.empty() ? nullptr : branch.loop_briefing_anim.c_str();
link.mission_branch_brief_sound = branch.loop_briefing_sound.empty() ? nullptr : branch.loop_briefing_sound.c_str();
} else {
link.mission_branch_txt = nullptr;
link.mission_branch_brief_anim = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion qtfred/src/ui/widgets/sexp_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ int sexp_tree::get_default_value(sexp_list_item* item, char* text_buf, int op, i
break;

case OPF_FONT:
str = const_cast<char*>(font::FontManager::getFont(0)->getName().c_str());
str = font::FontManager::getFont(0)->getName().c_str();
break;

case OPF_AUDIO_VOLUME_OPTION:
Expand Down
6 changes: 3 additions & 3 deletions test/src/util/FSTestFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ void test::FSTestFixture::addCommandlineArg(const SCP_string& arg) {
_cmdlineArgs.push_back(arg);
}
void test::FSTestFixture::init_cmdline() {
std::unique_ptr<char* []> parts(new char* [_cmdlineArgs.size()]);
std::vector<char*> parts(_cmdlineArgs.size());

for (size_t i = 0; i < _cmdlineArgs.size(); ++i) {
parts[i] = const_cast<char*>(_cmdlineArgs[i].c_str());
parts[i] = _cmdlineArgs[i].data();
}

parse_cmdline((int) _cmdlineArgs.size(), parts.get());
parse_cmdline(sz2i(_cmdlineArgs.size()), parts.data());
}
void test::FSTestFixture::pushModDir(const SCP_string& mod) {
if (!_currentModDir.empty()) {
Expand Down
Loading