summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-12-15 06:40:40 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-12-15 06:40:40 +0000
commit0dd67692b6f70badeb721a764c2aa7e9de9f2379 (patch)
tree289a82be345b72a7c41aa7c0602b1f702988b8d6
parentea79f035d22993eb20b874e04a422397bf0f3be2 (diff)
as of 1989, fread/fwrite take void *, so there's no need to cast to char *.
-rw-r--r--games/phantasia/fight.c4
-rw-r--r--games/phantasia/gamesupport.c14
-rw-r--r--games/phantasia/interplayer.c26
-rw-r--r--games/phantasia/main.c10
-rw-r--r--games/phantasia/misc.c18
-rw-r--r--games/phantasia/setup.c4
6 files changed, 38 insertions, 38 deletions
diff --git a/games/phantasia/fight.c b/games/phantasia/fight.c
index f5a0e9cceac..a35c02e06e5 100644
--- a/games/phantasia/fight.c
+++ b/games/phantasia/fight.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fight.c,v 1.9 2003/04/25 21:37:47 deraadt Exp $ */
+/* $OpenBSD: fight.c,v 1.10 2010/12/15 06:40:39 tedu Exp $ */
/* $NetBSD: fight.c,v 1.2 1995/03/24 03:58:39 cgd Exp $ */
/*
@@ -1041,7 +1041,7 @@ callmonster(which)
/* fill structure */
fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
- fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
+ fread(&Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
/* handle some special monsters */
if (Curmonster.m_type == SM_MODNAR) {
diff --git a/games/phantasia/gamesupport.c b/games/phantasia/gamesupport.c
index bbabfc2068a..09a14c1209a 100644
--- a/games/phantasia/gamesupport.c
+++ b/games/phantasia/gamesupport.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gamesupport.c,v 1.6 2003/04/25 21:37:47 deraadt Exp $ */
+/* $OpenBSD: gamesupport.c,v 1.7 2010/12/15 06:40:39 tedu Exp $ */
/* $NetBSD: gamesupport.c,v 1.3 1995/04/24 12:24:28 cgd Exp $ */
/*
@@ -515,7 +515,7 @@ monstlist()
puts(" #) Name Str Brain Quick Energy Exper Treas Type Flock%\n");
fseek(Monstfp, 0L, SEEK_SET);
- while (fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1)
+ while (fread(&Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1)
printf("%2d) %-20.20s%4.0f %4.0f %2.0f %5.0f %5.0f %2d %2d %3.0f\n", count++,
Curmonster.m_name, Curmonster.m_strength, Curmonster.m_brains,
Curmonster.m_speed, Curmonster.m_energy, Curmonster.m_experience,
@@ -552,7 +552,7 @@ scorelist()
FILE *fp; /* to open the file */
if ((fp = fopen(_PATH_SCORE, "r")) != NULL) {
- while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
+ while (fread(&sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
printf("%-20s (%-9s) Level: %6.0f Type: %s\n",
sbuf.sb_name, sbuf.sb_login, sbuf.sb_level, sbuf.sb_type);
fclose(fp);
@@ -588,7 +588,7 @@ activelist()
fseek(Playersfp, 0L, SEEK_SET);
printf("Current characters on file are:\n\n");
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_status != S_NOTUSED)
printf("%-20s (%-9s) Level: %6.0f %s (%s)\n",
Other.p_name, Other.p_login, Other.p_level,
@@ -634,7 +634,7 @@ purgeoldplayers()
for (;;) {
fseek(Playersfp, loc, SEEK_SET);
- if (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1)
+ if (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1)
break;
daysold = today - Other.p_lastused;
@@ -686,7 +686,7 @@ enterscore()
bool found = FALSE; /* set if we found an entry for this login */
if ((fp = fopen(_PATH_SCORE, "r+")) != NULL) {
- while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
+ while (fread(&sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
if (strcmp(Player.p_login, sbuf.sb_login) == 0) {
found = TRUE;
break;
@@ -716,6 +716,6 @@ enterscore()
}
/* update entry */
fseek(fp, loc, SEEK_SET);
- fwrite((char *) &sbuf, SZ_SCORESTRUCT, 1, fp);
+ fwrite(&sbuf, SZ_SCORESTRUCT, 1, fp);
fclose(fp);
}
diff --git a/games/phantasia/interplayer.c b/games/phantasia/interplayer.c
index 82e2b47ef66..950d69ef7d2 100644
--- a/games/phantasia/interplayer.c
+++ b/games/phantasia/interplayer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interplayer.c,v 1.4 2000/06/29 07:39:44 pjanzen Exp $ */
+/* $OpenBSD: interplayer.c,v 1.5 2010/12/15 06:40:39 tedu Exp $ */
/* $NetBSD: interplayer.c,v 1.2 1995/03/24 03:58:47 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ checkbattle()
Users = 0;
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
if (Other.p_status != S_OFF
&& Other.p_status != S_NOTUSED
&& Other.p_status != S_HUNGUP
@@ -469,7 +469,7 @@ checktampered()
/* first check for energy voids */
fseek(Energyvoidfp, 0L, SEEK_SET);
- while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
+ while (fread(&Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
if (Enrgyvoid.ev_active
&& Enrgyvoid.ev_x == Player.p_x
&& Enrgyvoid.ev_y == Player.p_y)
@@ -650,7 +650,7 @@ tampered(what, arg1, arg2)
Player.p_lives = 5;
fseek(Playersfp, 0L, SEEK_SET);
loc = 0L;
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
/* search for existing valar */
if (Other.p_specialtype == SC_VALAR
&& Other.p_status != S_NOTUSED)
@@ -721,7 +721,7 @@ userlist(ingameflag)
mvaddstr(8, 0,
"Name X Y Lvl Type Login Status\n");
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
if (Other.p_status == S_NOTUSED
/* record is unused */
|| (Other.p_specialtype == SC_VALAR && Other.p_status == S_CLOAKED))
@@ -808,7 +808,7 @@ throneroom()
/* not already king -- assumes crown */
{
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_specialtype == SC_KING && Other.p_status != S_NOTUSED)
/* found old king */
{
@@ -844,9 +844,9 @@ throneroom()
/* clear all energy voids; retain location of holy grail */
fseek(Energyvoidfp, 0L, SEEK_SET);
- fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
+ fread(&Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
fp = fopen(_PATH_VOID, "w");
- fwrite((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
+ fwrite(&Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
fclose(fp);
}
mvaddstr(6, 0, "0:Decree ");
@@ -944,11 +944,11 @@ dotampered()
if ((fp = fopen(_PATH_GOLD, "r+")) != NULL)
/* collect taxes */
{
- fread((char *) &temp1, sizeof(double), 1, fp);
+ fread(&temp1, sizeof(double), 1, fp);
fseek(fp, 0L, SEEK_SET);
/* clear out value */
temp2 = 0.0;
- fwrite((char *) &temp2, sizeof(double), 1, fp);
+ fwrite(&temp2, sizeof(double), 1, fp);
fclose(fp);
}
mvprintw(4, 0, "You have collected %.0f in gold.\n", temp1);
@@ -993,7 +993,7 @@ dotampered()
/* need a palantir to seek */
{
fseek(Energyvoidfp, 0L, SEEK_SET);
- fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
+ fread(&Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp);
temp1 = distance(Player.p_x, Enrgyvoid.ev_x, Player.p_y, Enrgyvoid.ev_y);
temp1 += ROLL(-temp1 / 10.0, temp1 / 5.0); /* add some error */
mvprintw(5, 0, "The palantir says the Grail is about %.0f away.\n", temp1);
@@ -1118,7 +1118,7 @@ writevoid(vp, loc)
{
fseek(Energyvoidfp, loc, SEEK_SET);
- fwrite((char *) vp, SZ_VOIDSTRUCT, 1, Energyvoidfp);
+ fwrite(vp, SZ_VOIDSTRUCT, 1, Energyvoidfp);
fflush(Energyvoidfp);
fseek(Energyvoidfp, 0L, SEEK_SET);
}
@@ -1154,7 +1154,7 @@ allocvoid()
long loc = 0L; /* location of new energy void */
fseek(Energyvoidfp, 0L, SEEK_SET);
- while (fread((char *) &Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
+ while (fread(&Enrgyvoid, SZ_VOIDSTRUCT, 1, Energyvoidfp) == 1)
if (Enrgyvoid.ev_active)
loc += SZ_VOIDSTRUCT;
else
diff --git a/games/phantasia/main.c b/games/phantasia/main.c
index 52f9d23e46c..0b5348474b1 100644
--- a/games/phantasia/main.c
+++ b/games/phantasia/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.13 2003/04/25 21:37:47 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.14 2010/12/15 06:40:39 tedu Exp $ */
/* $NetBSD: main.c,v 1.3 1995/04/24 12:24:37 cgd Exp $ */
/*
@@ -788,7 +788,7 @@ titlelist()
}
/* search for king */
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_specialtype == SC_KING &&
Other.p_status != S_NOTUSED)
/* found the king */
@@ -805,7 +805,7 @@ titlelist()
/* search for valar */
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_specialtype == SC_VALAR && Other.p_status != S_NOTUSED)
/* found the valar */
{
@@ -818,7 +818,7 @@ titlelist()
/* search for council of the wise */
fseek(Playersfp, 0L, SEEK_SET);
Lines = 10;
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_specialtype == SC_COUNCIL && Other.p_status != S_NOTUSED)
/* found a member of the council */
{
@@ -837,7 +837,7 @@ titlelist()
nxtlvl = hilvl = 0;
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
if (Other.p_experience > hiexp && Other.p_specialtype <= SC_KING && Other.p_status != S_NOTUSED)
/* highest found so far */
{
diff --git a/games/phantasia/misc.c b/games/phantasia/misc.c
index 57b4163903a..7aaf2092daf 100644
--- a/games/phantasia/misc.c
+++ b/games/phantasia/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.13 2003/08/06 21:08:05 millert Exp $ */
+/* $OpenBSD: misc.c,v 1.14 2010/12/15 06:40:39 tedu Exp $ */
/* $NetBSD: misc.c,v 1.2 1995/03/24 03:59:03 cgd Exp $ */
/*
@@ -680,7 +680,7 @@ findname(name, playerp)
long loc = 0; /* location in the file */
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
+ while (fread(playerp, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
if (strcmp(playerp->p_name, name) == 0) {
if (playerp->p_status != S_NOTUSED || Wizard)
/* found it */
@@ -722,7 +722,7 @@ allocrecord()
long loc = 0L; /* location in file */
fseek(Playersfp, 0L, SEEK_SET);
- while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
+ while (fread(&Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1) {
if (Other.p_status == S_NOTUSED)
/* found an empty record */
return (loc);
@@ -901,11 +901,11 @@ death(how)
mvaddstr(4, 0,
"Your ring has taken control of you and turned you into a monster!\n");
fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, SEEK_SET);
- fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
+ fread(&Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
strlcpy(Curmonster.m_name, Player.p_name,
sizeof Curmonster.m_name);
fseek(Monstfp, 13L * SZ_MONSTERSTRUCT, SEEK_SET);
- fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
+ fwrite(&Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
fflush(Monstfp);
}
}
@@ -973,7 +973,7 @@ writerecord(playerp, place)
long place;
{
fseek(Playersfp, place, SEEK_SET);
- fwrite((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
+ fwrite(playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
fflush(Playersfp);
}
/* */
@@ -1156,7 +1156,7 @@ readrecord(playerp, loc)
long loc;
{
fseek(Playersfp, loc, SEEK_SET);
- fread((char *) playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
+ fread(playerp, SZ_PLAYERSTRUCT, 1, Playersfp);
}
/* */
/************************************************************************
@@ -1668,10 +1668,10 @@ collecttaxes(gold, gems)
/* update taxes */
{
dtemp = 0.0;
- fread((char *) &dtemp, sizeof(double), 1, fp);
+ fread(&dtemp, sizeof(double), 1, fp);
dtemp += floor(taxes);
fseek(fp, 0L, SEEK_SET);
- fwrite((char *) &dtemp, sizeof(double), 1, fp);
+ fwrite(&dtemp, sizeof(double), 1, fp);
fclose(fp);
}
}
diff --git a/games/phantasia/setup.c b/games/phantasia/setup.c
index e5dbdff8218..9e3d71991ee 100644
--- a/games/phantasia/setup.c
+++ b/games/phantasia/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.9 2003/04/25 21:37:47 deraadt Exp $ */
+/* $OpenBSD: setup.c,v 1.10 2010/12/15 06:40:39 tedu Exp $ */
/* $NetBSD: setup.c,v 1.4 1995/04/24 12:24:41 cgd Exp $ */
/*
@@ -168,7 +168,7 @@ main(argc, argv)
&Curmonster.m_type, &Curmonster.m_flock);
Databuf[24] = '\0';
strlcpy(Curmonster.m_name, Databuf, sizeof Curmonster.m_name);
- fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
+ fwrite(&Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
}
fclose(fp);
fclose(Monstfp);