(u_char, u_short, u_int): BSDisms. Figuring out whether sys/types.h

defines them would be possible, but isn't worth the trouble.  Replace
by unabbreviated types.
This commit is contained in:
Markus Armbruster 2006-03-25 07:05:34 +00:00
parent 21bf6b41d4
commit 8054aafb9a
22 changed files with 109 additions and 113 deletions

View file

@ -538,7 +538,7 @@ doland(s_char op, int arg, s_char *p, struct sctstr *sect)
case 'e':
new = errcheck(arg, 0, 100);
noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
sect->sct_effic = (u_char)new;
sect->sct_effic = (unsigned char)new;
break;
case 'm':
new = errcheck(arg, -127, 255);
@ -548,39 +548,39 @@ doland(s_char op, int arg, s_char *p, struct sctstr *sect)
case 'i':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
sect->sct_min = (u_char)new;
sect->sct_min = (unsigned char)new;
break;
case 'g':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
sect->sct_gmin = (u_char)new;
sect->sct_gmin = (unsigned char)new;
break;
case 'f':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
sect->sct_fertil = (u_char)new;
sect->sct_fertil = (unsigned char)new;
break;
case 'c':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
sect->sct_oil = (u_char)new;
sect->sct_oil = (unsigned char)new;
break;
case 'u':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
sect->sct_uran = (u_char)new;
sect->sct_uran = (unsigned char)new;
break;
case 'w':
new = errcheck(arg, 0, 100);
noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
sect->sct_work = (u_char)new;
sect->sct_work = (unsigned char)new;
break;
case 'l':
new = errcheck(arg, 0, 127);
pr("Loyalty of %s changed from %d to %d%%\n",
xyas(sect->sct_x, sect->sct_y, player->cnum),
sect->sct_loyal, new);
sect->sct_loyal = (u_char)new;
sect->sct_loyal = (unsigned char)new;
break;
case 'x':
old = sect->sct_che;
@ -1136,7 +1136,7 @@ doplane(s_char op, int arg, s_char *p, struct plnstr *plane)
plane->pln_def = (s_char)arg;
break;
case 'r':
plane->pln_range = (u_char)arg;
plane->pln_range = (unsigned char)arg;
break;
case 's':
plane->pln_ship = arg;

View file

@ -61,7 +61,7 @@ look(void)
int x, y;
int civ;
int mil;
u_char *bitmap;
unsigned char *bitmap;
int changed = 0;
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
@ -186,7 +186,7 @@ llook(void)
int x, y;
int civ;
int mil;
u_char *bitmap;
unsigned char *bitmap;
int changed = 0;
if (!snxtitem(&ni, EF_LAND, player->argp[1]))

View file

@ -232,7 +232,7 @@ multifire(void)
continue;
if (item.sect.sct_type != SCT_FORTR)
continue;
if (item.sect.sct_effic < ((u_char)FORTEFF)) {
if (item.sect.sct_effic < FORTEFF) {
pr("Fort not efficient enough to fire!\n");
continue;
}

View file

@ -224,7 +224,7 @@ nav_map(int x, int y, int show_designations)
int i;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static u_char *bitmap = NULL;
static unsigned char *bitmap = NULL;
static s_char *wmapbuf = NULL;
static s_char **wmap = NULL;
s_char what[64];

View file

@ -89,7 +89,7 @@ prod(void)
int used; /* production w/infinite workforce */
i_type it;
i_type vtype;
u_char *resource;
unsigned char *resource;
s_char maxc[MAXPRCON][10];
s_char use[MAXPRCON][10];
int lcms, hcms;
@ -100,7 +100,7 @@ prod(void)
int type;
int eff;
int maxpop;
u_char otype;
int otype;
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
@ -199,7 +199,7 @@ prod(void)
goto is_enlist;
if (pp->p_nrndx != 0) {
unit_work++;
resource = (u_char *)&sect + pp->p_nrndx;
resource = (unsigned char *)&sect + pp->p_nrndx;
p_e = (*resource * p_e) / 100.0;
}
/*

View file

@ -79,7 +79,7 @@ setres(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Iron ore content",
(int)sect.sct_min, amt);
sect.sct_min = (u_char)amt;
sect.sct_min = (unsigned char)amt;
putsect(&sect);
}
break;
@ -98,7 +98,7 @@ setres(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Gold content",
(int)sect.sct_gmin, amt);
sect.sct_gmin = (u_char)amt;
sect.sct_gmin = (unsigned char)amt;
putsect(&sect);
}
break;
@ -116,7 +116,7 @@ setres(void)
amt = 0;
if (sect.sct_own != 0)
resnoise(&sect, 1, "Oil content", (int)sect.sct_oil, amt);
sect.sct_oil = (u_char)amt;
sect.sct_oil = (unsigned char)amt;
putsect(&sect);
}
break;
@ -135,7 +135,7 @@ setres(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Fertility content",
(int)sect.sct_fertil, amt);
sect.sct_fertil = (u_char)amt;
sect.sct_fertil = (unsigned char)amt;
putsect(&sect);
}
break;
@ -154,7 +154,7 @@ setres(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Uranium content",
(int)sect.sct_uran, amt);
sect.sct_uran = (u_char)amt;
sect.sct_uran = (unsigned char)amt;
putsect(&sect);
}
break;

View file

@ -87,7 +87,7 @@ setsector(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Iron ore content",
(int)sect.sct_min, current);
sect.sct_min = (u_char)current;
sect.sct_min = (unsigned char)current;
putsect(&sect);
}
break;
@ -108,7 +108,7 @@ setsector(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Gold content",
(int)sect.sct_gmin, current);
sect.sct_gmin = (u_char)current;
sect.sct_gmin = (unsigned char)current;
putsect(&sect);
}
break;
@ -131,7 +131,7 @@ setsector(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Oil content",
(int)sect.sct_oil, current);
sect.sct_oil = (u_char)current;
sect.sct_oil = (unsigned char)current;
putsect(&sect);
}
break;
@ -204,7 +204,7 @@ setsector(void)
current = 100;
pr("Efficiency in %s changed to %d.\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), current);
sect.sct_effic = (u_char)current;
sect.sct_effic = (unsigned char)current;
putsect(&sect);
}
break;
@ -291,7 +291,7 @@ setsector(void)
current = 100;
pr("Work in %s changed to %d.\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), current);
sect.sct_work = (u_char)current;
sect.sct_work = (unsigned char)current;
putsect(&sect);
}
break;
@ -312,7 +312,7 @@ setsector(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Fertility content",
(int)sect.sct_fertil, current);
sect.sct_fertil = (u_char)current;
sect.sct_fertil = (unsigned char)current;
putsect(&sect);
}
break;
@ -333,7 +333,7 @@ setsector(void)
if (sect.sct_own != 0)
resnoise(&sect, 1, "Uranium content",
(int)sect.sct_uran, current);
sect.sct_uran = (u_char)current;
sect.sct_uran = (unsigned char)current;
putsect(&sect);
}
break;

View file

@ -51,7 +51,7 @@
#include "optlist.h"
static int bmnxtsct(struct nstr_sect *);
static s_char map_char(u_char type, natid own, int owner_or_god);
static s_char map_char(unsigned char type, natid own, int owner_or_god);
int
draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp)
@ -66,7 +66,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp)
int i;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static u_char *bitmap = NULL;
static unsigned char *bitmap = NULL;
static s_char *wmapbuf = NULL;
static s_char **wmap = NULL;
@ -288,7 +288,7 @@ bmnxtsct(struct nstr_sect *np)
* If OWNER_OR_GOD, the map is for the sector's owner or a deity.
*/
static s_char
map_char(u_char type, natid own, int owner_or_god)
map_char(unsigned char type, natid own, int owner_or_god)
{
if (type > SCT_MAXDEF) {
logerror("bad sector type %d\n", type);

View file

@ -61,8 +61,8 @@
#define fldoff(str, fld) offsetof(struct str, fld)
#define NSC_IELT(name, pfx, sfx, base, itype) \
{NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(u_short)), \
#define NSC_IELT(name, pfx, sfx, base, itype) \
{NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(unsigned short)), \
sizeof(sfx) == 1 ? name : pfx sfx, EF_BAD}
#define NSC_IVEC(base, sfx) \

View file

@ -125,7 +125,7 @@ static int *bitmaps[5] = {
#define GCFy(y) ((y + WORLD_Y) % WORLD_Y)
int
emp_getbit(int x, int y, u_char *bitmap)
emp_getbit(int x, int y, unsigned char *bitmap)
{
int id;
@ -134,7 +134,7 @@ emp_getbit(int x, int y, u_char *bitmap)
}
void
emp_setbit(int x, int y, u_char *bitmap)
emp_setbit(int x, int y, unsigned char *bitmap)
{
register int id;
@ -143,8 +143,7 @@ emp_setbit(int x, int y, u_char *bitmap)
}
void
emp_setbitmap(register int x, register int y, register u_char *bitmap,
int *bitmaps)
emp_setbitmap(int x, int y, unsigned char *bitmap, int *bitmaps)
{
register int *mp;
register int id;
@ -159,7 +158,7 @@ emp_setbitmap(register int x, register int y, register u_char *bitmap,
}
void
bitinit2(struct nstr_sect *np, u_char *bitmap, int country)
bitinit2(struct nstr_sect *np, unsigned char *bitmap, int country)
{
struct sctstr sect;
int eff;

View file

@ -60,7 +60,7 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
struct pchrstr *product;
double p_e;
double prodeff;
u_char *resource;
unsigned char *resource;
double output;
int actual;
int unit_work;
@ -85,7 +85,7 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
p_e = neweff / 100.0;
if (product->p_nrndx != 0) {
unit_work++;
resource = (u_char *)sp + product->p_nrndx;
resource = (unsigned char *)sp + product->p_nrndx;
p_e = (*resource * p_e) / 100.0;
}
/*

View file

@ -65,7 +65,7 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
int work_cost = 0;
int buildeff_work = *workp / 2;
int n, hcms, lcms, neweff;
u_char old_type = *desig;
unsigned char old_type = *desig;
*cost = 0;
neweff = sp->sct_effic;

View file

@ -119,7 +119,7 @@ upd_ship(struct shpstr *sp, int etus,
int max_oil;
int max_food;
struct pchrstr *product;
u_char *resource;
unsigned char *resource;
int dep;
int n;
int mult;
@ -180,7 +180,7 @@ upd_ship(struct shpstr *sp, int etus,
if (sp->shp_item[I_OIL] + oil_gained > max_oil)
oil_gained = max_oil - sp->shp_item[I_OIL];
if (product->p_nrdep != 0 && oil_gained > 0) {
resource = (u_char *)sectp + product->p_nrndx;
resource = (unsigned char *)sectp + product->p_nrndx;
if (*resource * 100 < product->p_nrdep * oil_gained)
oil_gained = *resource * 100 / product->p_nrdep;
dep = roundavg(oil_gained * product->p_nrdep / 100.0);