Convert various PHYSFSX_printf to PHYSFSX_puts_literal
clang-12 warns when the format string checking logic indexes off the end of a very short format string to PHYSFSX_printf. In each case, the call had no variadic arguments, so it can be switched to PHYSFSX_puts_literal to make the code simpler and eliminate the warning.
This commit is contained in:
parent
fb63a73bd1
commit
2b29f91edc
|
@ -245,7 +245,7 @@ static void write_exit_text(fvcsegptridx &vcsegptridx, fvcwallptridx &vcwallptri
|
||||||
else if (count != 1)
|
else if (count != 1)
|
||||||
err_printf(my_file, "Error: More than one exit trigger in this mine.");
|
err_printf(my_file, "Error: More than one exit trigger in this mine.");
|
||||||
else
|
else
|
||||||
PHYSFSX_printf(my_file, "\n");
|
PHYSFSX_puts_literal(my_file, "\n");
|
||||||
|
|
||||||
// ---------- Find exit doors ----------
|
// ---------- Find exit doors ----------
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -269,7 +269,7 @@ static void write_exit_text(fvcsegptridx &vcsegptridx, fvcwallptridx &vcwallptri
|
||||||
warning_printf(my_file, "(If %i are secret exits, then no problem.)", count-1);
|
warning_printf(my_file, "(If %i are secret exits, then no problem.)", count-1);
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
PHYSFSX_printf(my_file, "\n");
|
PHYSFSX_puts_literal(my_file, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ static void write_segment_text(fvcsegptridx &vcsegptridx, PHYSFS_File *my_file)
|
||||||
PHYSFSX_printf(my_file, " special = %3i (%s), station_idx=%3i", segp->special, Special_names[segp->special], segp->station_idx);
|
PHYSFSX_printf(my_file, " special = %3i (%s), station_idx=%3i", segp->special, Special_names[segp->special], segp->station_idx);
|
||||||
if (segp->matcen_num != -1)
|
if (segp->matcen_num != -1)
|
||||||
PHYSFSX_printf(my_file, " matcen = %3i", segp->matcen_num);
|
PHYSFSX_printf(my_file, " matcen = %3i", segp->matcen_num);
|
||||||
PHYSFSX_printf(my_file, "\n");
|
PHYSFSX_puts_literal(my_file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
range_for (const auto &&segp, vcsegptridx)
|
range_for (const auto &&segp, vcsegptridx)
|
||||||
|
@ -472,7 +472,7 @@ static void write_segment_text(fvcsegptridx &vcsegptridx, PHYSFS_File *my_file)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PHYSFSX_printf(my_file, "\n");
|
PHYSFSX_puts_literal(my_file, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ static void write_matcen_text(PHYSFS_File *my_file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PHYSFSX_printf(my_file, "\n");
|
PHYSFSX_puts_literal(my_file, "\n");
|
||||||
|
|
||||||
if (trigger_count == 0)
|
if (trigger_count == 0)
|
||||||
err_printf(my_file, "Error: Matcen %i in segment %i has no trigger!", i, segnum);
|
err_printf(my_file, "Error: Matcen %i in segment %i has no trigger!", i, segnum);
|
||||||
|
@ -676,8 +676,7 @@ void write_game_text_file(const char *filename)
|
||||||
auto &Triggers = LevelUniqueWallSubsystemState.Triggers;
|
auto &Triggers = LevelUniqueWallSubsystemState.Triggers;
|
||||||
PHYSFSX_printf(my_file, "Number of triggers: %4i\n", Triggers.get_count());
|
PHYSFSX_printf(my_file, "Number of triggers: %4i\n", Triggers.get_count());
|
||||||
}
|
}
|
||||||
PHYSFSX_printf(my_file, "Number of matcens: %4i\n", LevelSharedRobotcenterState.Num_robot_centers);
|
PHYSFSX_printf(my_file, "Number of matcens: %4i\n\n", LevelSharedRobotcenterState.Num_robot_centers);
|
||||||
PHYSFSX_printf(my_file, "\n");
|
|
||||||
|
|
||||||
write_segment_text(vcsegptridx, my_file);
|
write_segment_text(vcsegptridx, my_file);
|
||||||
|
|
||||||
|
@ -887,11 +886,7 @@ static void say_used_tmaps(PHYSFS_File *const my_file, const perm_tmap_buffer_ty
|
||||||
const auto Num_tmaps = LevelUniqueTmapInfoState.Num_tmaps;
|
const auto Num_tmaps = LevelUniqueTmapInfoState.Num_tmaps;
|
||||||
for (i=0; i<Num_tmaps; i++)
|
for (i=0; i<Num_tmaps; i++)
|
||||||
if (tb[i]) {
|
if (tb[i]) {
|
||||||
PHYSFSX_printf(my_file, "[%3i %8s (%4i)] ", i, static_cast<const char *>(TmapInfo[i].filename), tb[i]);
|
PHYSFSX_printf(my_file, "[%3i %8s (%4i)]%s", i, static_cast<const char *>(TmapInfo[i].filename), tb[i], count++ >= 4 ? (count = 0, "\n") : " ");
|
||||||
if (count++ >= 4) {
|
|
||||||
PHYSFSX_printf(my_file, "\n");
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#elif defined(DXX_BUILD_DESCENT_II)
|
#elif defined(DXX_BUILD_DESCENT_II)
|
||||||
for (i = 0; i < tb.size(); ++i)
|
for (i = 0; i < tb.size(); ++i)
|
||||||
|
|
|
@ -731,30 +731,43 @@ static int write_player_dxx(const char *filename)
|
||||||
|
|
||||||
if(fout)
|
if(fout)
|
||||||
{
|
{
|
||||||
PHYSFSX_printf(fout,PLX_OPTION_HEADER_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
|
PLX_OPTION_HEADER_TEXT "\n"
|
||||||
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
|
WEAPON_REORDER_HEADER_TEXT "\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
#if defined(DXX_BUILD_DESCENT_I)
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
PHYSFSX_printf(fout,WEAPON_REORDER_HEADER_TEXT "\n");
|
|
||||||
PHYSFSX_printf(fout,WEAPON_REORDER_PRIMARY_NAME_TEXT "=" WEAPON_REORDER_PRIMARY_VALUE_TEXT "\n",PlayerCfg.PrimaryOrder[0], PlayerCfg.PrimaryOrder[1], PlayerCfg.PrimaryOrder[2],PlayerCfg.PrimaryOrder[3], PlayerCfg.PrimaryOrder[4], PlayerCfg.PrimaryOrder[5]);
|
PHYSFSX_printf(fout,WEAPON_REORDER_PRIMARY_NAME_TEXT "=" WEAPON_REORDER_PRIMARY_VALUE_TEXT "\n",PlayerCfg.PrimaryOrder[0], PlayerCfg.PrimaryOrder[1], PlayerCfg.PrimaryOrder[2],PlayerCfg.PrimaryOrder[3], PlayerCfg.PrimaryOrder[4], PlayerCfg.PrimaryOrder[5]);
|
||||||
PHYSFSX_printf(fout,WEAPON_REORDER_SECONDARY_NAME_TEXT "=" WEAPON_REORDER_SECONDARY_VALUE_TEXT "\n",PlayerCfg.SecondaryOrder[0], PlayerCfg.SecondaryOrder[1], PlayerCfg.SecondaryOrder[2],PlayerCfg.SecondaryOrder[3], PlayerCfg.SecondaryOrder[4], PlayerCfg.SecondaryOrder[5]);
|
PHYSFSX_printf(fout,WEAPON_REORDER_SECONDARY_NAME_TEXT "=" WEAPON_REORDER_SECONDARY_VALUE_TEXT "\n",PlayerCfg.SecondaryOrder[0], PlayerCfg.SecondaryOrder[1], PlayerCfg.SecondaryOrder[2],PlayerCfg.SecondaryOrder[3], PlayerCfg.SecondaryOrder[4], PlayerCfg.SecondaryOrder[5]);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
|
||||||
#endif
|
#endif
|
||||||
PHYSFSX_printf(fout,KEYBOARD_HEADER_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
|
END_TEXT "\n"
|
||||||
|
#endif
|
||||||
|
KEYBOARD_HEADER_TEXT "\n");
|
||||||
print_pattern_array(fout, SENSITIVITY_NAME_TEXT, PlayerCfg.KeyboardSens);
|
print_pattern_array(fout, SENSITIVITY_NAME_TEXT, PlayerCfg.KeyboardSens);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
PHYSFSX_printf(fout,JOYSTICK_HEADER_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
JOYSTICK_HEADER_TEXT "\n"
|
||||||
|
);
|
||||||
print_pattern_array(fout, SENSITIVITY_NAME_TEXT, PlayerCfg.JoystickSens);
|
print_pattern_array(fout, SENSITIVITY_NAME_TEXT, PlayerCfg.JoystickSens);
|
||||||
print_pattern_array(fout, LINEAR_NAME_TEXT, PlayerCfg.JoystickLinear);
|
print_pattern_array(fout, LINEAR_NAME_TEXT, PlayerCfg.JoystickLinear);
|
||||||
print_pattern_array(fout, SPEED_NAME_TEXT, PlayerCfg.JoystickSpeed);
|
print_pattern_array(fout, SPEED_NAME_TEXT, PlayerCfg.JoystickSpeed);
|
||||||
print_pattern_array(fout, DEADZONE_NAME_TEXT, PlayerCfg.JoystickDead);
|
print_pattern_array(fout, DEADZONE_NAME_TEXT, PlayerCfg.JoystickDead);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
PHYSFSX_printf(fout,MOUSE_HEADER_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
MOUSE_HEADER_TEXT "\n"
|
||||||
|
);
|
||||||
PHYSFSX_printf(fout,MOUSE_FLIGHTSIM_NAME_TEXT "=" MOUSE_FLIGHTSIM_VALUE_TEXT "\n",PlayerCfg.MouseFlightSim);
|
PHYSFSX_printf(fout,MOUSE_FLIGHTSIM_NAME_TEXT "=" MOUSE_FLIGHTSIM_VALUE_TEXT "\n",PlayerCfg.MouseFlightSim);
|
||||||
print_pattern_array(fout, SENSITIVITY_NAME_TEXT, PlayerCfg.MouseSens);
|
print_pattern_array(fout, SENSITIVITY_NAME_TEXT, PlayerCfg.MouseSens);
|
||||||
print_pattern_array(fout, MOUSE_OVERRUN_NAME_TEXT, PlayerCfg.MouseOverrun);
|
print_pattern_array(fout, MOUSE_OVERRUN_NAME_TEXT, PlayerCfg.MouseOverrun);
|
||||||
PHYSFSX_printf(fout,MOUSE_FSDEAD_NAME_TEXT "=" MOUSE_FSDEAD_VALUE_TEXT "\n",PlayerCfg.MouseFSDead);
|
PHYSFSX_printf(fout,MOUSE_FSDEAD_NAME_TEXT "=" MOUSE_FSDEAD_VALUE_TEXT "\n",PlayerCfg.MouseFSDead);
|
||||||
PHYSFSX_printf(fout,MOUSE_FSINDICATOR_NAME_TEXT "=" MOUSE_FSINDICATOR_VALUE_TEXT "\n",PlayerCfg.MouseFSIndicator);
|
PHYSFSX_printf(fout,MOUSE_FSINDICATOR_NAME_TEXT "=" MOUSE_FSINDICATOR_VALUE_TEXT "\n",PlayerCfg.MouseFSIndicator);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
PHYSFSX_printf(fout,WEAPON_KEYv2_HEADER_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
WEAPON_KEYv2_HEADER_TEXT "\n"
|
||||||
|
);
|
||||||
PHYSFSX_printf(fout,"1=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[0],PlayerCfg.KeySettingsRebirth[1],PlayerCfg.KeySettingsRebirth[2]);
|
PHYSFSX_printf(fout,"1=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[0],PlayerCfg.KeySettingsRebirth[1],PlayerCfg.KeySettingsRebirth[2]);
|
||||||
PHYSFSX_printf(fout,"2=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[3],PlayerCfg.KeySettingsRebirth[4],PlayerCfg.KeySettingsRebirth[5]);
|
PHYSFSX_printf(fout,"2=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[3],PlayerCfg.KeySettingsRebirth[4],PlayerCfg.KeySettingsRebirth[5]);
|
||||||
PHYSFSX_printf(fout,"3=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[6],PlayerCfg.KeySettingsRebirth[7],PlayerCfg.KeySettingsRebirth[8]);
|
PHYSFSX_printf(fout,"3=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[6],PlayerCfg.KeySettingsRebirth[7],PlayerCfg.KeySettingsRebirth[8]);
|
||||||
|
@ -765,8 +778,10 @@ static int write_player_dxx(const char *filename)
|
||||||
PHYSFSX_printf(fout,"8=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[21],PlayerCfg.KeySettingsRebirth[22],PlayerCfg.KeySettingsRebirth[23]);
|
PHYSFSX_printf(fout,"8=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[21],PlayerCfg.KeySettingsRebirth[22],PlayerCfg.KeySettingsRebirth[23]);
|
||||||
PHYSFSX_printf(fout,"9=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[24],PlayerCfg.KeySettingsRebirth[25],PlayerCfg.KeySettingsRebirth[26]);
|
PHYSFSX_printf(fout,"9=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[24],PlayerCfg.KeySettingsRebirth[25],PlayerCfg.KeySettingsRebirth[26]);
|
||||||
PHYSFSX_printf(fout,"0=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[27],PlayerCfg.KeySettingsRebirth[28],PlayerCfg.KeySettingsRebirth[29]);
|
PHYSFSX_printf(fout,"0=" WEAPON_KEYv2_VALUE_TEXT "\n",PlayerCfg.KeySettingsRebirth[27],PlayerCfg.KeySettingsRebirth[28],PlayerCfg.KeySettingsRebirth[29]);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
PHYSFSX_printf(fout,COCKPIT_HEADER_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
COCKPIT_HEADER_TEXT "\n"
|
||||||
|
);
|
||||||
#if defined(DXX_BUILD_DESCENT_I)
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
PHYSFSX_printf(fout,COCKPIT_MODE_NAME_TEXT "=%i\n",PlayerCfg.CockpitMode[0]);
|
PHYSFSX_printf(fout,COCKPIT_MODE_NAME_TEXT "=%i\n",PlayerCfg.CockpitMode[0]);
|
||||||
#endif
|
#endif
|
||||||
|
@ -774,8 +789,10 @@ static int write_player_dxx(const char *filename)
|
||||||
PHYSFSX_printf(fout,COCKPIT_RETICLE_TYPE_NAME_TEXT "=%i\n",PlayerCfg.ReticleType);
|
PHYSFSX_printf(fout,COCKPIT_RETICLE_TYPE_NAME_TEXT "=%i\n",PlayerCfg.ReticleType);
|
||||||
PHYSFSX_printf(fout,COCKPIT_RETICLE_COLOR_NAME_TEXT "=%i,%i,%i,%i\n",PlayerCfg.ReticleRGBA[0],PlayerCfg.ReticleRGBA[1],PlayerCfg.ReticleRGBA[2],PlayerCfg.ReticleRGBA[3]);
|
PHYSFSX_printf(fout,COCKPIT_RETICLE_COLOR_NAME_TEXT "=%i,%i,%i,%i\n",PlayerCfg.ReticleRGBA[0],PlayerCfg.ReticleRGBA[1],PlayerCfg.ReticleRGBA[2],PlayerCfg.ReticleRGBA[3]);
|
||||||
PHYSFSX_printf(fout,COCKPIT_RETICLE_SIZE_NAME_TEXT "=%i\n",PlayerCfg.ReticleSize);
|
PHYSFSX_printf(fout,COCKPIT_RETICLE_SIZE_NAME_TEXT "=%i\n",PlayerCfg.ReticleSize);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
PHYSFSX_printf(fout,TOGGLES_HEADER_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
TOGGLES_HEADER_TEXT "\n"
|
||||||
|
);
|
||||||
#if defined(DXX_BUILD_DESCENT_I)
|
#if defined(DXX_BUILD_DESCENT_I)
|
||||||
PHYSFSX_printf(fout,TOGGLES_BOMBGAUGE_NAME_TEXT "=%i\n",PlayerCfg.BombGauge);
|
PHYSFSX_printf(fout,TOGGLES_BOMBGAUGE_NAME_TEXT "=%i\n",PlayerCfg.BombGauge);
|
||||||
#elif defined(DXX_BUILD_DESCENT_II)
|
#elif defined(DXX_BUILD_DESCENT_II)
|
||||||
|
@ -796,15 +813,18 @@ static int write_player_dxx(const char *filename)
|
||||||
PHYSFSX_printf(fout,TOGGLES_CLOAKINVULTIMER_NAME_TEXT "=%i\n",PlayerCfg.CloakInvulTimer);
|
PHYSFSX_printf(fout,TOGGLES_CLOAKINVULTIMER_NAME_TEXT "=%i\n",PlayerCfg.CloakInvulTimer);
|
||||||
PHYSFSX_printf(fout,TOGGLES_RESPAWN_ANY_KEY "=%i\n",static_cast<unsigned>(PlayerCfg.RespawnMode));
|
PHYSFSX_printf(fout,TOGGLES_RESPAWN_ANY_KEY "=%i\n",static_cast<unsigned>(PlayerCfg.RespawnMode));
|
||||||
PHYSFSX_printf(fout, TOGGLES_MOUSELOOK "=%i\n", PlayerCfg.MouselookFlags);
|
PHYSFSX_printf(fout, TOGGLES_MOUSELOOK "=%i\n", PlayerCfg.MouselookFlags);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout,
|
||||||
PHYSFSX_printf(fout,GRAPHICS_HEADER_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
GRAPHICS_HEADER_TEXT "\n"
|
||||||
|
);
|
||||||
PHYSFSX_printf(fout,GRAPHICS_ALPHAEFFECTS_NAME_TEXT "=%i\n",PlayerCfg.AlphaEffects);
|
PHYSFSX_printf(fout,GRAPHICS_ALPHAEFFECTS_NAME_TEXT "=%i\n",PlayerCfg.AlphaEffects);
|
||||||
PHYSFSX_printf(fout,GRAPHICS_DYNLIGHTCOLOR_NAME_TEXT "=%i\n",PlayerCfg.DynLightColor);
|
PHYSFSX_printf(fout,GRAPHICS_DYNLIGHTCOLOR_NAME_TEXT "=%i\n",PlayerCfg.DynLightColor);
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
PHYSFSX_puts_literal(fout, END_TEXT "\n"
|
||||||
PHYSFSX_printf(fout,PLX_VERSION_HEADER_TEXT "\n");
|
PLX_VERSION_HEADER_TEXT "\n"
|
||||||
PHYSFSX_printf(fout,"plx version=" DXX_VERSION_STR "\n");
|
"plx version=" DXX_VERSION_STR "\n"
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
END_TEXT "\n"
|
||||||
PHYSFSX_printf(fout,END_TEXT "\n");
|
END_TEXT "\n"
|
||||||
|
);
|
||||||
fout.reset();
|
fout.reset();
|
||||||
if(rc==0)
|
if(rc==0)
|
||||||
{
|
{
|
||||||
|
@ -1710,7 +1730,7 @@ void write_netgame_profile(netgame_info *ng)
|
||||||
#else
|
#else
|
||||||
PHYSFSX_puts_literal(file, TrackerStr "=0\n" TrackerNATHPStr "=0\n");
|
PHYSFSX_puts_literal(file, TrackerStr "=0\n" TrackerNATHPStr "=0\n");
|
||||||
#endif
|
#endif
|
||||||
PHYSFSX_printf(file, NGPVersionStr "=" DXX_VERSION_STR "\n");
|
PHYSFSX_puts_literal(file, NGPVersionStr "=" DXX_VERSION_STR "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue