From: Markus Armbruster Date: Mon, 23 Aug 2004 18:29:44 +0000 (+0000) Subject: caddr_t is obsolete. Replace by void *, except for struct empfile X-Git-Tag: v4.2.18~43 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=dcfd251f959b89a207c85741d9d0a1dcb33f0731 caddr_t is obsolete. Replace by void *, except for struct empfile member cache, which becomes char * to keep pointer arithmetic simple. --- diff --git a/include/commodity.h b/include/commodity.h index 5826d88ca..730ab083c 100644 --- a/include/commodity.h +++ b/include/commodity.h @@ -52,8 +52,8 @@ struct comstr { }; #define getcomm(n, p) \ - ef_read(EF_COMM, n, (caddr_t)p) + ef_read(EF_COMM, n, p) #define putcomm(n, p) \ - ef_write(EF_COMM, n, (caddr_t)p) + ef_write(EF_COMM, n, p) #endif /* _COMMODITY_H_ */ diff --git a/include/common.h b/include/common.h index ef5550531..f4815a371 100644 --- a/include/common.h +++ b/include/common.h @@ -35,7 +35,6 @@ #define _COMMON_H_ #include /* FILE */ -#include /* caddr_t */ #include "misc.h" /* s_char coord natid */ #include "sect.h" /* struct sctstr */ #include "ship.h" /* struct shpstr */ diff --git a/include/econfig-spec.h b/include/econfig-spec.h index 90b7bc189..4f88fd7a8 100644 --- a/include/econfig-spec.h +++ b/include/econfig-spec.h @@ -31,9 +31,9 @@ #if defined(EMP_CONFIG_C_OUTPUT) #define EMPCFONLYC(fvname, vname, vtype, ctype, num, descr) \ - { (fvname), (ctype), ((caddr_t)&(vname)), (num), (descr) }, + { (fvname), (ctype), &(vname), (num), (descr) }, #define EMPCFBOTH(fvname, vname, vtype, ctype, num, descr) \ - { (fvname), (ctype), ((caddr_t)&(vname)), (num), (descr) }, + { (fvname), (ctype), &(vname), (num), (descr) }, #elif defined(EMP_CONFIG_H_OUTPUT) diff --git a/include/file.h b/include/file.h index 4cbd498f2..0a70b2d99 100644 --- a/include/file.h +++ b/include/file.h @@ -50,7 +50,7 @@ struct empfile { int baseid; /* starting item in cache */ int cids; /* # ids in cache */ int csize; /* size of cache in bytes */ - caddr_t cache; /* pointer to cache */ + char *cache; /* pointer to cache */ int fids; /* # of ids in file */ struct castr *cadef; /* ca defs selection list */ }; @@ -90,7 +90,7 @@ struct fileinit { }; extern struct castr *ef_cadef(int); -extern int ef_read(int, int, caddr_t); +extern int ef_read(int, int, void *); extern s_char *ef_ptr(int, int); extern s_char *ef_nameof(int); extern time_t ef_mtime(int); @@ -98,7 +98,7 @@ extern int ef_open(int, int, int); extern int ef_check(int); extern int ef_close(int); extern int ef_flush(int); -extern int ef_write(int, int, caddr_t); +extern int ef_write(int, int, void *); extern int ef_extend(int, int); extern int ef_ensure_space(int, int, int); extern void ef_zapcache(int); @@ -107,7 +107,7 @@ extern int ef_flags(int); extern u_short *ef_items(int, void *); extern int ef_byname(s_char *); -extern int ef_nbread(int type, int id, caddr_t ptr); +extern int ef_nbread(int type, int id, void *ptr); extern struct empfile empfile[]; #endif /* _FILE_H_ */ diff --git a/include/land.h b/include/land.h index 35f288bbe..67ff72e2f 100644 --- a/include/land.h +++ b/include/land.h @@ -175,9 +175,9 @@ struct lchrstr { #define LND_SPY_DETECT_CHANCE(eff) ((110-(eff))/100.0) #define getland(n, p) \ - ef_read(EF_LAND, n, (caddr_t)p) + ef_read(EF_LAND, n, p) #define putland(n, p) \ - ef_write(EF_LAND, n, (caddr_t)p) + ef_write(EF_LAND, n, p) #define getlandp(n) \ (struct lndstr *) ef_ptr(EF_LAND, n) diff --git a/include/loan.h b/include/loan.h index ead009f6f..ffdaef01e 100644 --- a/include/loan.h +++ b/include/loan.h @@ -57,9 +57,9 @@ struct lonstr { #define LS_SIGNED 2 #define getloan(n, lp) \ - ef_read(EF_LOAN, n, (caddr_t)lp) + ef_read(EF_LOAN, n, lp) #define putloan(n, lp) \ - ef_write(EF_LOAN, n, (caddr_t)lp) + ef_write(EF_LOAN, n, lp) #define getloanp(n) \ (struct lonstr *) ef_ptr(EF_LOAN, n) diff --git a/include/lost.h b/include/lost.h index 27e135d36..985bfe6a6 100644 --- a/include/lost.h +++ b/include/lost.h @@ -44,8 +44,8 @@ struct loststr { time_t lost_timestamp; /* When it was lost */ }; -#define getlost(n, p) ef_read(EF_LOST, n, (caddr_t)p) -#define putlost(n, p) ef_write(EF_LOST, n, (caddr_t)p) +#define getlost(n, p) ef_read(EF_LOST, n, p) +#define putlost(n, p) ef_write(EF_LOST, n, p) /* src/lib/subs/lostsub.c */ extern int findlost(char, natid, short, coord, coord, int); diff --git a/include/misc.h b/include/misc.h index de95f85f6..0b7042d9d 100644 --- a/include/misc.h +++ b/include/misc.h @@ -42,7 +42,6 @@ #if defined(_WIN32) typedef unsigned char u_char; typedef unsigned short u_short; -typedef char *caddr_t; typedef unsigned int u_int; /* integral mismatch, due to misuse of sector short */ diff --git a/include/nat.h b/include/nat.h index 1ff816632..ab604b3ff 100644 --- a/include/nat.h +++ b/include/nat.h @@ -142,7 +142,7 @@ extern s_char *relates[]; /* procedures relating to nation stuff */ #define putnat(n) \ - ef_write(EF_NATION, n->nat_cnum, (caddr_t)n) + ef_write(EF_NATION, n->nat_cnum, n) #define getnatp(n) \ (struct natstr *) ef_ptr(EF_NATION, (int)n) diff --git a/include/news.h b/include/news.h index 0fabd0683..c48a8013e 100644 --- a/include/news.h +++ b/include/news.h @@ -160,9 +160,9 @@ struct rptstr { #define NEWS_PERIOD days(10) #define getnews(n, p) \ - ef_read(EF_NEWS, n, (caddr_t)p) + ef_read(EF_NEWS, n, p) #define putnews(n, p) \ - ef_write(EF_NEWS, n, (caddr_t)p) + ef_write(EF_NEWS, n, p) #define getnewsp(n) \ (struct nwsstr *) ef_ptr(EF_NEWS, n) diff --git a/include/nsc.h b/include/nsc.h index 13511d904..9bf39704e 100644 --- a/include/nsc.h +++ b/include/nsc.h @@ -134,7 +134,7 @@ struct nstr_sect { struct range range; /* area of coverage */ int dist; /* dist query: range */ coord cx, cy; /* dist query: center x-y */ - int (*read)(int type, int id, caddr_t ptr); /* read function */ + int (*read)(int type, int id, void *ptr); /* read function */ int ncond; /* # of selection conditions */ struct nscstr cond[NS_NCOND]; /* selection conditions */ }; @@ -152,7 +152,7 @@ struct nstr_item { int size; /* NS_LIST: size of list */ int index; /* NS_LIST: index */ int list[NS_LSIZE]; /* NS_LIST: item list */ - int (*read)(int type, int id, caddr_t ptr); /* read function */ + int (*read)(int type, int id, void *ptr); /* read function */ int flags; /* ef_flags(TYPE) */ int ncond; /* # of selection conditions */ struct nscstr cond[NS_NCOND]; /* selection conditions */ diff --git a/include/nuke.h b/include/nuke.h index a5a4f6883..456164907 100644 --- a/include/nuke.h +++ b/include/nuke.h @@ -66,9 +66,9 @@ struct nchrstr { #define N_NEUT bit(0) /* Neutron bomb (low damage, high fallout) */ #define getnuke(n, p) \ - ef_read(EF_NUKE, n, (caddr_t)p) + ef_read(EF_NUKE, n, p) #define putnuke(n, p) \ - ef_write(EF_NUKE, n, (caddr_t)p) + ef_write(EF_NUKE, n, p) #define getnukep(n) \ (struct nukstr *) ef_ptr(EF_NUKE, n) diff --git a/include/optlist.h b/include/optlist.h index 753fa0dd2..05fe84de3 100644 --- a/include/optlist.h +++ b/include/optlist.h @@ -113,7 +113,7 @@ struct keymatch { s_char *km_key; /* the key */ void (*km_func)(struct keymatch * kp, s_char **av); /* the function to call if matches */ - caddr_t km_data; /* associated data */ + void *km_data; /* associated data */ int km_flags; /* useful flags */ #define KM_ALLOC 0x01 /* memory allocated */ s_char *km_comment; /* Comment (hopefully useful) */ diff --git a/include/plane.h b/include/plane.h index 852ae828d..04d7369b0 100644 --- a/include/plane.h +++ b/include/plane.h @@ -141,9 +141,9 @@ struct plist { #define P_DEL 2 #define getplane(n, p) \ - ef_read(EF_PLANE, n, (caddr_t)p) + ef_read(EF_PLANE, n, p) #define putplane(n, p) \ - ef_write(EF_PLANE, n, (caddr_t)p) + ef_write(EF_PLANE, n, p) #define getplanep(n) \ (struct plnstr *) ef_ptr(EF_PLANE, n) diff --git a/include/power.h b/include/power.h index 27339c21e..aeda7bc2a 100644 --- a/include/power.h +++ b/include/power.h @@ -56,9 +56,9 @@ struct powstr { }; #define getpower(n, p) \ - ef_read(EF_POWER, n, (caddr_t)p) + ef_read(EF_POWER, n, p) #define putpower(n, p) \ - ef_write(EF_POWER, n, (caddr_t)p) + ef_write(EF_POWER, n, p) #define getpowerp(n) \ (struct powstr *) ef_ptr(EF_POWER, n) diff --git a/include/prototypes.h b/include/prototypes.h index 3d3190645..d89a92f1d 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -76,7 +76,7 @@ extern void resnoise(struct sctstr *sptr, int public_amt, s_char *name, int old, int new); extern int line_of_sight(char **rad, int ax, int ay, int bx, int by); extern void plane_sona(struct emp_qelem *, int, int, struct shiplook *); -extern int tend_nxtitem(struct nstr_item *, caddr_t); +extern int tend_nxtitem(struct nstr_item *, void *); extern s_char *prsub(struct shpstr *); extern int check_trade(void); extern int ontradingblock(int, int *); @@ -373,7 +373,7 @@ extern void nuk_init(int, s_char *); extern void nuk_add(coord, coord, int, int); extern void nuk_delete(struct nukstr *, int, int); /* nxtitem.c */ -extern int nxtitem(struct nstr_item *, caddr_t); +extern int nxtitem(struct nstr_item *, void *); /* nxtsct.c */ extern int nxtsct(register struct nstr_sect *, struct sctstr *); /* plane.c */ diff --git a/include/sect.h b/include/sect.h index 63fef0a43..bd6a42588 100644 --- a/include/sect.h +++ b/include/sect.h @@ -150,10 +150,10 @@ struct dchrstr { #define SCT_MAXDEF 34 /* highest sector type in header files */ #define getsect(x, y, p) \ - ef_read(EF_SECTOR, sctoff((int) x, (int) y), (caddr_t)p) + ef_read(EF_SECTOR, sctoff((int) x, (int) y), p) #define putsect(p) \ ef_write(EF_SECTOR, sctoff((int) (p)->sct_x, \ - (int) (p)->sct_y), (caddr_t)p) + (int) (p)->sct_y), p) #define getsectp(x, y) \ (struct sctstr *) ef_ptr(EF_SECTOR, sctoff((int)x, (int)y)) #define getsectid(id) \ diff --git a/include/ship.h b/include/ship.h index 46759d5f0..7374dbafb 100644 --- a/include/ship.h +++ b/include/ship.h @@ -177,9 +177,9 @@ struct mchrstr { #define M_ANTIMISSILE bit(20) /* Shoot down missile */ #define getship(n, p) \ - ef_read(EF_SHIP, n, (caddr_t)p) + ef_read(EF_SHIP, n, p) #define putship(n, p) \ - ef_write(EF_SHIP, n, (caddr_t)p) + ef_write(EF_SHIP, n, p) #define getshipp(n) \ (struct shpstr *) ef_ptr(EF_SHIP, n) diff --git a/include/trade.h b/include/trade.h index 2cb1d0ec3..1e56d605a 100644 --- a/include/trade.h +++ b/include/trade.h @@ -82,9 +82,9 @@ extern long get_outstand(int); extern double loan_owed(struct lonstr *loan, time_t paytime); #define gettrade(n, p) \ - ef_read(EF_TRADE, n, (caddr_t)p) + ef_read(EF_TRADE, n, p) #define puttrade(n, p) \ - ef_write(EF_TRADE, n, (caddr_t)p) + ef_write(EF_TRADE, n, p) #define gettradep(n) \ (struct trdstr *) ef_ptr(EF_TRADE, n) diff --git a/include/treaty.h b/include/treaty.h index 18645788c..f5ecbb07e 100644 --- a/include/treaty.h +++ b/include/treaty.h @@ -71,9 +71,9 @@ struct tchrstr { /* global treaty variables */ #define gettre(n, p) \ - ef_read(EF_TREATY, n, (caddr_t)p) + ef_read(EF_TREATY, n, p) #define puttre(n, p) \ - ef_write(EF_TREATY, n, (caddr_t)p) + ef_write(EF_TREATY, n, p) #define gettrep(n) \ (struct trtstr *) ef_ptr(EF_TREATY, n) diff --git a/src/lib/commands/cede.c b/src/lib/commands/cede.c index a7be84a41..cb1ac50c3 100644 --- a/src/lib/commands/cede.c +++ b/src/lib/commands/cede.c @@ -213,7 +213,7 @@ grab_sect(register struct sctstr *sp, natid to) pp = &p; snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y); - while (nxtitem(&ni, (caddr_t)pp)) { + while (nxtitem(&ni, pp)) { if (pp->pln_own == 0) continue; if (pp->pln_ship >= 0) @@ -236,7 +236,7 @@ grab_sect(register struct sctstr *sp, natid to) np = &nuk; snxtitem_xy(&ni, EF_NUKE, sp->sct_x, sp->sct_y); - while (nxtitem(&ni, (caddr_t)np)) { + while (nxtitem(&ni, np)) { if (np->nuk_own == 0) continue; @@ -251,7 +251,7 @@ grab_sect(register struct sctstr *sp, natid to) lp = &l; snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); - while (nxtitem(&ni, (caddr_t)lp)) { + while (nxtitem(&ni, lp)) { if (lp->lnd_own == 0) continue; if (lp->lnd_ship == 0) @@ -342,7 +342,7 @@ grab_ship(register struct shpstr *sp, natid to) pp = &p; snxtitem_xy(&ni, EF_PLANE, sp->shp_x, sp->shp_y); - while (nxtitem(&ni, (caddr_t)pp)) { + while (nxtitem(&ni, pp)) { if (pp->pln_own == 0) continue; if (pp->pln_flags & PLN_LAUNCHED) @@ -365,7 +365,7 @@ grab_ship(register struct shpstr *sp, natid to) lp = &l; snxtitem_xy(&ni, EF_LAND, sp->shp_x, sp->shp_y); - while (nxtitem(&ni, (caddr_t)lp)) { + while (nxtitem(&ni, lp)) { if (lp->lnd_own == 0) continue; if (lp->lnd_ship != sp->shp_uid) diff --git a/src/lib/commands/cons.c b/src/lib/commands/cons.c index 92509c97e..457373423 100644 --- a/src/lib/commands/cons.c +++ b/src/lib/commands/cons.c @@ -144,7 +144,7 @@ cons_choose(struct ltcomstr *ltcp) sprintf(prompt, "%s number? ", ltcp->Name); if ((ltcp->num = onearg(player->argp[2], prompt)) < 0) return RET_SYN; - if (!ef_read(ltcp->type, ltcp->num, (caddr_t)<cp->u) || + if (!ef_read(ltcp->type, ltcp->num, <cp->u) || !(ltcp->type == EF_TREATY ? distrea(ltcp->num, <cp->u.t) : disloan(ltcp->num, <cp->u.l))) { @@ -204,7 +204,7 @@ loan_accept(struct ltcomstr *ltcp) pr("%s %d is still pending.\n", ltcp->Name, ltcp->num); return RET_OK; } - if (!getloan(ltcp->num, (caddr_t)lp)) { + if (!getloan(ltcp->num, lp)) { pr("loan_accept: can't read loan; get help!\n"); return RET_SYS; } diff --git a/src/lib/commands/fina.c b/src/lib/commands/fina.c index c8056af24..746732604 100644 --- a/src/lib/commands/fina.c +++ b/src/lib/commands/fina.c @@ -64,7 +64,7 @@ fina(void) prdate(); pr("Loan From To Rate Dur Paid Total\n"); snxtitem(&ni, EF_LOAN, "*"); - while (nxtitem(&ni, (caddr_t)&loan)) { + while (nxtitem(&ni, &loan)) { if (loan.l_status != LS_SIGNED) continue; pr(" %-2d (%3d) %-8.8s (%3d) %-8.8s ", ni.cur, diff --git a/src/lib/commands/laun.c b/src/lib/commands/laun.c index f1f4d4fb0..f46531172 100644 --- a/src/lib/commands/laun.c +++ b/src/lib/commands/laun.c @@ -205,7 +205,7 @@ launch_as(struct plnstr *pp) } goodtarget = 0; snxtitem_dist(&ni, EF_PLANE, sx, sy, 0); - while (!goodtarget && nxtitem(&ni, (caddr_t)&plane)) { + while (!goodtarget && nxtitem(&ni, &plane)) { if (!plane.pln_own) continue; if (!(plane.pln_flags & PLN_LAUNCHED)) diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index c98e7571c..434e8385e 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -786,7 +786,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown, return 0; dam = 0; snxtitem_dist(&ni, EF_SHIP, ax, ay, 8); - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { if (ship.shp_own == 0) continue; @@ -874,7 +874,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown, } } snxtitem_dist(&ni, EF_LAND, ax, ay, 8); - while (nxtitem(&ni, (caddr_t)&land)) { + while (nxtitem(&ni, &land)) { if (land.lnd_own == 0) continue; if (land.lnd_effic < LAND_MINFIREEFF) diff --git a/src/lib/commands/sona.c b/src/lib/commands/sona.c index e6ccdbe3c..9fad0c7dd 100644 --- a/src/lib/commands/sona.c +++ b/src/lib/commands/sona.c @@ -159,7 +159,7 @@ sona(void) } memset(visbuf, 0, (WORLD_Y * (WORLD_X + 1))); snxtitem_dist(&nit, EF_SHIP, ship.shp_x, ship.shp_y, range); - while (nxtitem(&nit, (caddr_t)&targ)) { + while (nxtitem(&nit, &targ)) { if (targ.shp_own == player->cnum || targ.shp_own == 0) continue; diff --git a/src/lib/commands/tend.c b/src/lib/commands/tend.c index 227766b1b..fddac53f7 100644 --- a/src/lib/commands/tend.c +++ b/src/lib/commands/tend.c @@ -207,7 +207,7 @@ expose_ship(struct shpstr *s1, struct shpstr *s2) */ int -tend_nxtitem(struct nstr_item *np, caddr_t ptr) +tend_nxtitem(struct nstr_item *np, void *ptr) { struct genitem *gp; int selected; diff --git a/src/lib/commands/tran.c b/src/lib/commands/tran.c index f8b1ede26..4dcaae819 100644 --- a/src/lib/commands/tran.c +++ b/src/lib/commands/tran.c @@ -111,7 +111,7 @@ tran_nuke(void) snxtitem_xy(&nstr, EF_NUKE, sect.sct_x, sect.sct_y); #endif found = 0; - while (nxtitem(&nstr, (caddr_t)&nuke)) { + while (nxtitem(&nstr, &nuke)) { if (player->owner) { found = 1; break; diff --git a/src/lib/common/file.c b/src/lib/common/file.c index 3b065962d..29cc8ed3a 100644 --- a/src/lib/common/file.c +++ b/src/lib/common/file.c @@ -171,10 +171,10 @@ ef_ptr(int type, int id) * This system won't work if item size is > sizeof buffer area. */ int -ef_read(int type, int id, caddr_t ptr) +ef_read(int type, int id, void *ptr) { register struct empfile *ep; - caddr_t from; + void *from; if (ef_check(type) < 0) return 0; @@ -219,7 +219,7 @@ fillcache(struct empfile *ep, int start) * zaps read cache */ int -ef_nbread(int type, int id, caddr_t ptr) +ef_nbread(int type, int id, void *ptr) { register struct empfile *ep; int r; @@ -256,7 +256,7 @@ ef_nbread(int type, int id, caddr_t ptr) * and writes through to disk. */ int -ef_write(int type, int id, caddr_t ptr) +ef_write(int type, int id, void *ptr) { register int r; register struct empfile *ep; @@ -310,7 +310,7 @@ ef_write(int type, int id, caddr_t ptr) * zaps read cache */ int -ef_nbwrite(int type, int id, caddr_t ptr) +ef_nbwrite(int type, int id, void *ptr) { register struct empfile *ep; register int r; diff --git a/src/lib/common/maps.c b/src/lib/common/maps.c index 898fbb720..e35310be8 100644 --- a/src/lib/common/maps.c +++ b/src/lib/common/maps.c @@ -178,7 +178,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp, return RET_OK; if (map_flags & MAP_PLANE) { snxtitem_all(&ni, EF_PLANE); - while (nxtitem(&ni, (caddr_t)&plane)) { + while (nxtitem(&ni, &plane)) { if (plane.pln_own == 0) continue; if (plane.pln_own != player->cnum && !player->god) @@ -193,7 +193,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp, } if (map_flags & MAP_SHIP) { snxtitem_all(&ni, EF_SHIP); - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { if (ship.shp_own == 0) continue; if (ship.shp_own != player->cnum && !player->god) @@ -208,7 +208,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp, } if (map_flags & MAP_LAND) { snxtitem_all(&ni, EF_LAND); - while (nxtitem(&ni, (caddr_t)&land)) { + while (nxtitem(&ni, &land)) { if (land.lnd_own == 0) continue; if (land.lnd_own != player->cnum && !player->god) diff --git a/src/lib/subs/detonate.c b/src/lib/subs/detonate.c index b1b3dbac7..4debe20b7 100644 --- a/src/lib/subs/detonate.c +++ b/src/lib/subs/detonate.c @@ -146,7 +146,7 @@ detonate(struct plnstr *pp, int x, int y) } } snxtitem_dist(&ni, EF_PLANE, x, y, rad); - while (nxtitem(&ni, (caddr_t)&plane)) { + while (nxtitem(&ni, &plane)) { /* Nukes falling on water affect only 1 sector */ if ((plane.pln_x != x) && issea) continue; @@ -197,7 +197,7 @@ detonate(struct plnstr *pp, int x, int y) putplane(ni.cur, &plane); } snxtitem_dist(&ni, EF_LAND, x, y, rad); - while (nxtitem(&ni, (caddr_t)&land)) { + while (nxtitem(&ni, &land)) { /* Nukes falling on water affect only 1 sector */ if ((land.lnd_x != x) && issea) continue; @@ -244,7 +244,7 @@ detonate(struct plnstr *pp, int x, int y) putland(land.lnd_uid, &land); } snxtitem_dist(&ni, EF_SHIP, x, y, rad); - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { /* Nukes falling on water affect only 1 sector */ if ((ship.shp_x != x) && issea) continue; @@ -285,7 +285,7 @@ detonate(struct plnstr *pp, int x, int y) putship(ship.shp_uid, &ship); } snxtitem_dist(&ni, EF_NUKE, x, y, rad); - while (nxtitem(&ni, (caddr_t)&nuke)) { + while (nxtitem(&ni, &nuke)) { /* Nukes falling on water affect only 1 sector */ if ((nuke.nuk_x != x) && issea) continue; diff --git a/src/lib/subs/fortdef.c b/src/lib/subs/fortdef.c index e029f1794..c537623bf 100644 --- a/src/lib/subs/fortdef.c +++ b/src/lib/subs/fortdef.c @@ -82,7 +82,7 @@ sd(natid att, natid own, coord x, coord y, int noisy, int defending, return 0; eff = 1.0; snxtitem_dist(&ni, EF_SHIP, x, y, 8); - while (nxtitem(&ni, (caddr_t)&ship) && eff > 0.30) { + while (nxtitem(&ni, &ship) && eff > 0.30) { if (ship.shp_own == att) continue; if (ship.shp_own == 0) diff --git a/src/lib/subs/nxtitem.c b/src/lib/subs/nxtitem.c index dd503f64f..8167b8b9a 100644 --- a/src/lib/subs/nxtitem.c +++ b/src/lib/subs/nxtitem.c @@ -46,7 +46,7 @@ #include "prototypes.h" int -nxtitem(struct nstr_item *np, caddr_t ptr) +nxtitem(struct nstr_item *np, void *ptr) { struct genitem *gp; int selected; diff --git a/src/lib/subs/nxtsct.c b/src/lib/subs/nxtsct.c index 00f2f70cd..edd2b8ac2 100644 --- a/src/lib/subs/nxtsct.c +++ b/src/lib/subs/nxtsct.c @@ -70,7 +70,7 @@ nxtsct(register struct nstr_sect *np, struct sctstr *sp) continue; } np->id = sctoff(np->x, np->y); - if (!np->read(EF_SECTOR, np->id, (caddr_t)sp)) + if (!np->read(EF_SECTOR, np->id, sp)) continue; if (np->ncond == 0) return 1; diff --git a/src/lib/subs/radmap.c b/src/lib/subs/radmap.c index ed8d4330a..312480670 100644 --- a/src/lib/subs/radmap.c +++ b/src/lib/subs/radmap.c @@ -136,7 +136,7 @@ radmap2(int owner, if (!pr_flag) return; snxtitem_dist(&ni, EF_PLANE, cx, cy, range); - while (nxtitem(&ni, (caddr_t)&plane)) { + while (nxtitem(&ni, &plane)) { if (plane.pln_own == 0) continue; /* Used to have 'ghosts' when scanning whole world --ts */ @@ -149,7 +149,7 @@ radmap2(int owner, } } snxtitem_dist(&ni, EF_SHIP, cx, cy, range); - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { if (ship.shp_own == 0) continue; /* Used to have 'ghosts' when scanning whole world --ts */ diff --git a/src/lib/subs/satmap.c b/src/lib/subs/satmap.c index 107e97eeb..c5301358f 100644 --- a/src/lib/subs/satmap.c +++ b/src/lib/subs/satmap.c @@ -159,7 +159,7 @@ satmap(int x, int y, int eff, int range, int flags, int type) pr(" own shp# ship type sector eff\n"); } } - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { if (ship.shp_own == 0) continue; if ((mchr[(int)ship.shp_type].m_flags & M_SUB) && @@ -214,7 +214,7 @@ satmap(int x, int y, int eff, int range, int flags, int type) prdate(); pr(" own lnd# unit type sector eff\n"); } - while (nxtitem(&ni, (caddr_t)&land)) { + while (nxtitem(&ni, &land)) { if (land.lnd_own == 0) continue; if (!chance((double)land.lnd_effic / 20.0)) @@ -308,7 +308,7 @@ satdisp(struct sctstr *sp, int acc, int showstuff) return; snxtitem_xy(&ni, EF_SHIP, sp->sct_x, sp->sct_y); first = 1; - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { if (ship.shp_own == 0) continue; if (mchr[(int)ship.shp_type].m_flags & M_SUB) @@ -335,7 +335,7 @@ satdisp(struct sctstr *sp, int acc, int showstuff) snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y); first = 1; - while (nxtitem(&ni, (caddr_t)&land)) { + while (nxtitem(&ni, &land)) { if (land.lnd_own == 0) continue; if (!chance((double)land.lnd_effic / 20.0)) diff --git a/src/lib/subs/shpsub.c b/src/lib/subs/shpsub.c index 91cf1c906..f72d33396 100644 --- a/src/lib/subs/shpsub.c +++ b/src/lib/subs/shpsub.c @@ -932,7 +932,7 @@ shp_missile_defense(coord dx, coord dy, natid bombown, int hardtarget) snxtitem_dist(&ni, EF_SHIP, dx, dy, 1); - while (nxtitem(&ni, (caddr_t)&ship)) { + while (nxtitem(&ni, &ship)) { if (!ship.shp_own) continue; diff --git a/src/lib/subs/takeover.c b/src/lib/subs/takeover.c index 7e2d7d28a..40c4c7788 100644 --- a/src/lib/subs/takeover.c +++ b/src/lib/subs/takeover.c @@ -71,7 +71,7 @@ takeover(register struct sctstr *sp, natid newown) pp = &p; /* Take over planes */ snxtitem_dist(&ni, EF_PLANE, sp->sct_x, sp->sct_y, 0); - while (nxtitem(&ni, (caddr_t)pp)) { + while (nxtitem(&ni, pp)) { if (pp->pln_own != sp->sct_own) continue; takeover_plane(pp, newown); @@ -80,7 +80,7 @@ takeover(register struct sctstr *sp, natid newown) /* Take over land units */ lp = &land; snxtitem_dist(&ni, EF_LAND, sp->sct_x, sp->sct_y, 0); - while (nxtitem(&ni, (caddr_t)lp)) { + while (nxtitem(&ni, lp)) { if ((lp->lnd_own == newown) || (lp->lnd_own == 0)) continue; if (lp->lnd_own != sp->sct_own) @@ -232,7 +232,7 @@ takeover_ship(register struct shpstr *sp, natid newown, int hostile) lp = &llp; /* Take over planes */ snxtitem_all(&ni, EF_PLANE); - while (nxtitem(&ni, (caddr_t)pp)) { + while (nxtitem(&ni, pp)) { if (pp->pln_ship != sp->shp_uid) continue; if (pp->pln_own == 0) @@ -255,7 +255,7 @@ takeover_ship(register struct shpstr *sp, natid newown, int hostile) } /* Take over land units */ snxtitem_all(&ni, EF_LAND); - while (nxtitem(&ni, (caddr_t)lp)) { + while (nxtitem(&ni, lp)) { if (lp->lnd_ship != sp->shp_uid) continue; if (lp->lnd_own == 0) @@ -295,7 +295,7 @@ takeover_land(register struct lndstr *landp, natid newown, int hostile) lp = &llp; /* Take over planes */ snxtitem_all(&ni, EF_PLANE); - while (nxtitem(&ni, (caddr_t)pp)) { + while (nxtitem(&ni, pp)) { if (pp->pln_land != landp->lnd_uid) continue; if (pp->pln_own == 0) @@ -318,7 +318,7 @@ takeover_land(register struct lndstr *landp, natid newown, int hostile) } /* Take over land units */ snxtitem_all(&ni, EF_LAND); - while (nxtitem(&ni, (caddr_t)lp)) { + while (nxtitem(&ni, lp)) { if (lp->lnd_land != landp->lnd_uid) continue; if (lp->lnd_own == 0) diff --git a/src/lib/subs/wu.c b/src/lib/subs/wu.c index 091562d74..911756615 100644 --- a/src/lib/subs/wu.c +++ b/src/lib/subs/wu.c @@ -144,7 +144,7 @@ typed_wu(natid from, natid to, s_char *message, int type) tel.tel_length = len; tel.tel_type = type; #if !defined(_WIN32) - iov[0].iov_base = (caddr_t)&tel; + iov[0].iov_base = &tel; iov[0].iov_len = sizeof(tel); iov[1].iov_base = message; iov[1].iov_len = len; diff --git a/src/scripts/indent-emp b/src/scripts/indent-emp index 8131e49fd..d699773f0 100755 --- a/src/scripts/indent-emp +++ b/src/scripts/indent-emp @@ -2,7 +2,7 @@ # indent needs to know type names do to a proper job. # Type names located with grep typedef, then extracted by hand: -types="caddr_t coord empth_sem_t empth_t loc_Sem_t loc_Thread_t natid ns_seltype nsc_cat nsc_flags nsc_type packed_nsc_cat packed_nsc_type qsort_func_t s_char stkalign_t u_char u_int u_short" +types="coord empth_sem_t empth_t loc_Sem_t loc_Thread_t natid ns_seltype nsc_cat nsc_flags nsc_type packed_nsc_cat packed_nsc_type qsort_func_t s_char stkalign_t u_char u_int u_short" opts="-kr -cdw -cp8 -ncs -psl -ss" for t in $types