ref: 7a3249ce14ac528a5cdf9ca2d0a62535cf2bb1cd
parent: c37f757b57cbfd88d66aed1576412e311a503384
author: Simon Howard <[email protected]>
date: Mon May 3 14:23:15 EDT 2010
Fix compiler warnings. Subversion-branch: /branches/raven-branch Subversion-revision: 1934
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -679,6 +679,32 @@
DrawFileSlots(&SaveMenu);
}
+static boolean ReadDescriptionForSlot(int slot, char *description)
+{
+ FILE *fp;
+ boolean found;
+ char name[100];
+ char versionText[HXS_VERSION_TEXT_LENGTH];
+
+ sprintf(name, "%shex%d.hxs", SavePath, slot);
+
+ fp = fopen(name, "rb");
+
+ if (fp == NULL)
+ {
+ return false;
+ }
+
+ found = fread(description, HXS_DESCRIPTION_LENGTH, 1, fp) == 1
+ && fread(versionText, HXS_VERSION_TEXT_LENGTH, 1, fp) == 1;
+
+ found = found && strcmp(versionText, HXS_VERSION_TEXT) == 0;
+
+ fclose(fp);
+
+ return found;
+}
+
//===========================================================================
//
// MN_LoadSlotText
@@ -689,29 +715,12 @@
void MN_LoadSlotText(void)
{
- int slot;
- FILE *fp;
- char name[100];
- char versionText[HXS_VERSION_TEXT_LENGTH];
char description[HXS_DESCRIPTION_LENGTH];
- boolean found;
+ int slot;
for (slot = 0; slot < 6; slot++)
{
- found = false;
- sprintf(name, "%shex%d.hxs", SavePath, slot);
- fp = fopen(name, "rb");
- if (fp)
- {
- fread(description, HXS_DESCRIPTION_LENGTH, 1, fp);
- fread(versionText, HXS_VERSION_TEXT_LENGTH, 1, fp);
- fclose(fp);
- if (!strcmp(versionText, HXS_VERSION_TEXT))
- {
- found = true;
- }
- }
- if (found)
+ if (ReadDescriptionForSlot(slot, description))
{
memcpy(SlotText[slot], description, SLOTTEXTLEN);
SlotStatus[slot] = 1;
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -509,7 +509,7 @@
}
ACSStore[index].map = map;
ACSStore[index].script = number;
- *((int *) ACSStore[index].args) = *((int *) args);
+ memcpy(ACSStore[index].args, args, sizeof(int));
return true;
}
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -245,6 +245,8 @@
fixed_t height = currentheight;
fixed_t heightlist[20]; // 20 adjoining sectors max!
+ heightlist[0] = 0;
+
for (i = 0, h = 0; i < sec->linecount; i++)
{
check = sec->lines[i];
--- a/src/hexen/r_things.c
+++ b/src/hexen/r_things.c
@@ -158,7 +158,7 @@
void R_InitSpriteDefs(char **namelist)
{
char **check;
- int i, l, intname, frame, rotation;
+ int i, l, frame, rotation;
int start, end;
// count the number of sprite names
@@ -184,13 +184,12 @@
memset(sprtemp, -1, sizeof(sprtemp));
maxframe = -1;
- intname = *(int *) namelist[i];
//
// scan the lumps, filling in the frames for whatever is found
//
for (l = start + 1; l < end; l++)
- if (*(int *) lumpinfo[l].name == intname)
+ if (!strncmp(lumpinfo[l].name, namelist[i], 4))
{
frame = lumpinfo[l].name[4] - 'A';
rotation = lumpinfo[l].name[5] - '0';