Skip to content

Commit

Permalink
Fix some stuff found by PVS
Browse files Browse the repository at this point in the history
  • Loading branch information
maraakate committed Apr 21, 2024
1 parent 9d1d00a commit b860f29
Show file tree
Hide file tree
Showing 15 changed files with 479 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# ignore all make dependency files
.vs/
Debug/
Release/
*.suo
*.user
*.obj
*.o
*.exe
Expand Down
7 changes: 4 additions & 3 deletions AM_MAP.C
Original file line number Diff line number Diff line change
Expand Up @@ -1339,16 +1339,17 @@ void AM_DrawTime(void)

if (drawTime == 1)
timefmt = "%H:%M:%S %p"; // FS: Military
else if (drawTime > 1)
else
timefmt = "%I:%M:%S %p"; // FS: Regular

strftime (st, sizeof (st), timefmt, local);
MN_DrTextA(st, 20, 20);
}

void AM_Drawer(void)
{
int highestEpisode;
char *secrets; // FS: For SECRETS FOUND count
//int highestEpisode;
char secrets[32]; // FS: For SECRETS FOUND count

if (!automapactive) return;

Expand Down
2 changes: 1 addition & 1 deletion CT_CHAT.C
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void CT_Init(void)
{
chat_dest[i] = 0;
msgptr[i] = 0;
memset(plr_lastmsg[i], 0, MESSAGESIZE);
memset(plr_lastmsg[i], 0, MESSAGESIZE+9);
memset(chat_msg[i], 0, MESSAGESIZE);
}
FontABaseLump = W_GetNumForName("FONTA_S")+1;
Expand Down
7 changes: 5 additions & 2 deletions D_MAIN.C
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ void tprintf(char *msg,int initflag)
{
if(debugmode || M_CheckParm ("-faststart") || faststart) // FS: Fast Start
{
printf(msg);
printf("%s", msg);
return;
}

Expand Down Expand Up @@ -1027,15 +1027,18 @@ void D_DoomMain(void)
char timebuffer[128];
FILE *f;

if(strstr(myargv[p+1], "-"))
if(strchr(myargv[p+1], '-'))
{
strcpy(statfile, "stats.txt");
}

f = fopen(statfile, "a+");

if (!f)
{
I_Error("Unable to open stats file!");
return;
}

time(&nowtime);
ptr_time = localtime(&nowtime);
Expand Down
15 changes: 7 additions & 8 deletions G_GAME.C
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,8 @@ void G_DoLoadLevel (void)
joyxmove = joyymove = 0;
mousex = mousey = 0;
sendpause = sendsave = paused = false;
memset (mousebuttons, 0, sizeof(mousebuttons));
memset (joybuttons, 0, sizeof(joybuttons));
memset (mousebuttons, 0, sizeof(*mousebuttons));
memset (joybuttons, 0, sizeof(*joybuttons));
I_InitVRGoggles();
}

Expand Down Expand Up @@ -1236,21 +1236,21 @@ void G_PlayerReborn(int player)
int killcount, itemcount, secretcount;
boolean secret;

boolean coopkeys[NUMKEYS]; // FS: Keep keys in Coop
boolean coopkeys[3]; // FS: Keep keys in Coop
boolean coop; // FS: Is it coop?
boolean coopbackpack; // FS: Have a backpack?

ultimatemsg = false; // FS: Clear it out
coop = false; // FS: Clear it out
coopbackpack = false; // FS: Clear it out
coopkeys[NUMKEYS] = false; // FS: Clear it out
coopkeys[3-1] = false; // FS: Clear it out
secret = false;
memcpy(frags, players[player].frags, sizeof(frags));

if(netgame && !deathmatch && !M_CheckParm("-oldrules")) // FS: Check for Coop
{
coop = true;
memcpy(coopkeys, players[player].keys, sizeof(coopkeys)); // FS: Keep keys in Coop
memcpy(coopkeys, players[player].keys, sizeof(players[player].keys)); // FS: Keep keys in Coop
if (players[player].backpack)
{
coopbackpack = true;
Expand All @@ -1277,7 +1277,7 @@ void G_PlayerReborn(int player)

if (coop)
{
memcpy(players[player].keys, coopkeys, sizeof(coopkeys)); // FS: Keep keys in Coop
memcpy(players[player].keys, coopkeys, sizeof(players[player].keys)); // FS: Keep keys in Coop
}

players[player].killcount = killcount;
Expand Down Expand Up @@ -1616,7 +1616,7 @@ void G_DoLoadGame(void)

if (convertsave) // FS: Convert old saves
{
sprintf(convertsavename, (char *)save_p-savestringsize);
sprintf(convertsavename, "%s", (char *)save_p - savestringsize);
}

// Skip the description field
Expand Down Expand Up @@ -1767,7 +1767,6 @@ void G_InitNew(skill_t skill, int episode, int map)
gameepisode = episode;
gamemap = map;
gameskill = skill;
viewactive = true;
BorderNeedRefresh = true;

// Set the sky map
Expand Down
31 changes: 31 additions & 0 deletions Heretic.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.34729.46
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Heretic", "Heretic.vcxproj", "{B21962C4-DB5E-4825-953A-759AA39F463B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B21962C4-DB5E-4825-953A-759AA39F463B}.Debug|x64.ActiveCfg = Debug|x64
{B21962C4-DB5E-4825-953A-759AA39F463B}.Debug|x64.Build.0 = Debug|x64
{B21962C4-DB5E-4825-953A-759AA39F463B}.Debug|x86.ActiveCfg = Debug|Win32
{B21962C4-DB5E-4825-953A-759AA39F463B}.Debug|x86.Build.0 = Debug|Win32
{B21962C4-DB5E-4825-953A-759AA39F463B}.Release|x64.ActiveCfg = Release|x64
{B21962C4-DB5E-4825-953A-759AA39F463B}.Release|x64.Build.0 = Release|x64
{B21962C4-DB5E-4825-953A-759AA39F463B}.Release|x86.ActiveCfg = Release|Win32
{B21962C4-DB5E-4825-953A-759AA39F463B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {36C7A48B-94BC-4B6B-8A23-7B311F49C49F}
EndGlobalSection
EndGlobal
209 changes: 209 additions & 0 deletions Heretic.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AM_MAP.C" />
<ClCompile Include="ct_chat.c" />
<ClCompile Include="deh_ammo.c" />
<ClCompile Include="deh_cht.c" />
<ClCompile Include="deh_frme.c" />
<ClCompile Include="deh_io.c" />
<ClCompile Include="deh_main.c" />
<ClCompile Include="deh_map.c" />
<ClCompile Include="deh_misc.c" />
<ClCompile Include="deh_ptr.c" />
<ClCompile Include="deh_snd.c" />
<ClCompile Include="deh_text.c" />
<ClCompile Include="deh_thng.c" />
<ClCompile Include="deh_wpn.c" />
<ClCompile Include="D_MAIN.C" />
<ClCompile Include="d_net.c" />
<ClCompile Include="F_FINALE.C" />
<ClCompile Include="G_GAME.C" />
<ClCompile Include="info.c" />
<ClCompile Include="IN_LUDE.C" />
<ClCompile Include="I_CYBER.C" />
<ClCompile Include="I_SOUND.C" />
<ClCompile Include="md5.c" />
<ClCompile Include="MN_MENU.C" />
<ClCompile Include="M_MISC.C" />
<ClCompile Include="p_ceilng.c" />
<ClCompile Include="p_doors.c" />
<ClCompile Include="P_ENEMY.C" />
<ClCompile Include="p_floor.c" />
<ClCompile Include="p_inter.c" />
<ClCompile Include="p_lights.c" />
<ClCompile Include="P_MAP.C" />
<ClCompile Include="P_MAPUTL.C" />
<ClCompile Include="p_mobj.c" />
<ClCompile Include="p_plats.c" />
<ClCompile Include="p_pspr.c" />
<ClCompile Include="p_setup.c" />
<ClCompile Include="P_SIGHT.C" />
<ClCompile Include="p_spec.c" />
<ClCompile Include="p_switch.c" />
<ClCompile Include="p_telept.c" />
<ClCompile Include="p_tick.c" />
<ClCompile Include="P_USER.C" />
<ClCompile Include="r_bsp.c" />
<ClCompile Include="r_data.c" />
<ClCompile Include="r_draw.c" />
<ClCompile Include="R_MAIN.C" />
<ClCompile Include="R_PLANE.C" />
<ClCompile Include="R_SEGS.C" />
<ClCompile Include="r_things.c" />
<ClCompile Include="SB_BAR.C" />
<ClCompile Include="sounds.c" />
<ClCompile Include="sys_dosw.c" />
<ClCompile Include="s_sound.c" />
<ClCompile Include="tables.c" />
<ClCompile Include="v_video.c" />
<ClCompile Include="w_merge.c" />
<ClCompile Include="W_WAD.C" />
<ClCompile Include="z_zone.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{b21962c4-db5e-4825-953a-759aa39f463b}</ProjectGuid>
<RootNamespace>Heretic</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading

0 comments on commit b860f29

Please sign in to comment.