as pointed out in Bug 17, use uint32_t instead of unsigned long since the code expects the size of the info variables to be 32bits and sizeof(long) on 64bit hosts is not 32bits

This commit is contained in:
Mike Frysinger 2005-09-27 04:16:22 +00:00
parent 67451849de
commit f87b3e30a7

View File

@ -108,7 +108,7 @@ typedef struct xhash_s {
/* Tree node */ /* Tree node */
typedef struct node_s { typedef struct node_s {
unsigned long info; uint32_t info;
unsigned short lineno; unsigned short lineno;
union { union {
struct node_s *n; struct node_s *n;
@ -324,7 +324,7 @@ static char * const tokenlist =
"\3END" "\0" "\3END" "\0"
; ;
static unsigned long tokeninfo[] = { static uint32_t tokeninfo[] = {
0, 0,
0, 0,
@ -430,8 +430,8 @@ static int icase = FALSE;
static int exiting = FALSE; static int exiting = FALSE;
static struct { static struct {
unsigned long tclass; uint32_t tclass;
unsigned long info; uint32_t info;
char *string; char *string;
double number; double number;
short lineno; short lineno;
@ -440,7 +440,7 @@ static struct {
/* function prototypes */ /* function prototypes */
static void handle_special(var *); static void handle_special(var *);
static node *parse_expr(unsigned long); static node *parse_expr(uint32_t);
static void chain_group(void); static void chain_group(void);
static var *evaluate(node *, var *); static var *evaluate(node *, var *);
static rstream *next_input_file(void); static rstream *next_input_file(void);
@ -848,15 +848,15 @@ static void nvfree(var *v)
/* Parse next token pointed by global pos, place results into global t. /* Parse next token pointed by global pos, place results into global t.
* If token isn't expected, give away. Return token class * If token isn't expected, give away. Return token class
*/ */
static unsigned long next_token(unsigned long expected) static uint32_t next_token(uint32_t expected)
{ {
char *p, *pp, *s; char *p, *pp, *s;
char *tl; char *tl;
unsigned long tc, *ti; uint32_t tc, *ti;
int l; int l;
static int concat_inserted = FALSE; static int concat_inserted = FALSE;
static unsigned long save_tclass, save_info; static uint32_t save_tclass, save_info;
static unsigned long ltclass = TC_OPTERM; static uint32_t ltclass = TC_OPTERM;
if (t.rollback) { if (t.rollback) {
@ -999,7 +999,7 @@ static unsigned long next_token(unsigned long expected)
static void rollback_token(void) { t.rollback = TRUE; } static void rollback_token(void) { t.rollback = TRUE; }
static node *new_node(unsigned long info) static node *new_node(uint32_t info)
{ {
register node *n; register node *n;
@ -1028,12 +1028,12 @@ static node *condition(void)
/* parse expression terminated by given argument, return ptr /* parse expression terminated by given argument, return ptr
* to built subtree. Terminator is eaten by parse_expr */ * to built subtree. Terminator is eaten by parse_expr */
static node *parse_expr(unsigned long iexp) static node *parse_expr(uint32_t iexp)
{ {
node sn; node sn;
node *cn = &sn; node *cn = &sn;
node *vn, *glptr; node *vn, *glptr;
unsigned long tc, xtc; uint32_t tc, xtc;
var *v; var *v;
sn.info = PRIMASK; sn.info = PRIMASK;
@ -1144,7 +1144,7 @@ static node *parse_expr(unsigned long iexp)
} }
/* add node to chain. Return ptr to alloc'd node */ /* add node to chain. Return ptr to alloc'd node */
static node *chain_node(unsigned long info) static node *chain_node(uint32_t info)
{ {
register node *n; register node *n;
@ -1164,7 +1164,7 @@ static node *chain_node(unsigned long info)
return n; return n;
} }
static void chain_expr(unsigned long info) static void chain_expr(uint32_t info)
{ {
node *n; node *n;
@ -1200,7 +1200,7 @@ static node *chain_loop(node *nn)
/* parse group and attach it to chain */ /* parse group and attach it to chain */
static void chain_group(void) static void chain_group(void)
{ {
unsigned long c; uint32_t c;
node *n, *n2, *n3; node *n, *n2, *n3;
do { do {
@ -1302,7 +1302,7 @@ static void chain_group(void)
static void parse_program(char *p) static void parse_program(char *p)
{ {
unsigned long tclass; uint32_t tclass;
node *cn; node *cn;
func *f; func *f;
var *v; var *v;
@ -1378,7 +1378,7 @@ static node *mk_splitter(char *s, tsplitter *spl)
if (bb_strlen(s) > 1) { if (bb_strlen(s) > 1) {
mk_re_node(s, n, re); mk_re_node(s, n, re);
} else { } else {
n->info = (unsigned long) *s; n->info = (uint32_t) *s;
} }
return n; return n;
@ -1881,7 +1881,7 @@ static var *exec_builtin(node *op, var *res)
regex_t sreg, *re; regex_t sreg, *re;
static tsplitter tspl; static tsplitter tspl;
node *spl; node *spl;
unsigned long isr, info; uint32_t isr, info;
int nargs; int nargs;
time_t tt; time_t tt;
char *s, *s1; char *s, *s1;
@ -2044,7 +2044,7 @@ static var *evaluate(node *op, var *res)
double d; double d;
int i; int i;
} L, R; } L, R;
unsigned long opinfo; uint32_t opinfo;
short opn; short opn;
union { union {
char *s; char *s;
@ -2052,7 +2052,7 @@ static var *evaluate(node *op, var *res)
FILE *F; FILE *F;
var *v; var *v;
regex_t *re; regex_t *re;
unsigned long info; uint32_t info;
} X; } X;
if (! op) if (! op)