Kaydet (Commit) 6ade6fe1 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Silence compiler warnings

üst f38b7b2f
...@@ -299,7 +299,7 @@ void ...@@ -299,7 +299,7 @@ void
} }
void * void *
domalloc(int size) domalloc(size_t size)
{ {
void *p = malloc(size); void *p = malloc(size);
......
...@@ -234,7 +234,8 @@ long ...@@ -234,7 +234,8 @@ long
{ {
Token *tp; Token *tp;
Nlist *np; Nlist *np;
int ntok, rnd; size_t ntok;
int rnd;
trp->tp++; trp->tp++;
if (kw == KIFDEF || kw == KIFNDEF) if (kw == KIFDEF || kw == KIFNDEF)
......
...@@ -635,7 +635,7 @@ Source * ...@@ -635,7 +635,7 @@ Source *
setsource(char *name, int path, int fd, char *str, int wrap) setsource(char *name, int path, int fd, char *str, int wrap)
{ {
Source *s = new(Source); Source *s = new(Source);
int len; size_t len;
s->line = 1; s->line = 1;
s->lineinc = 0; s->lineinc = 0;
......
...@@ -516,7 +516,7 @@ void ...@@ -516,7 +516,7 @@ void
error(ERROR, "# not followed by macro parameter"); error(ERROR, "# not followed by macro parameter");
continue; continue;
} }
ntok = 1 + (rtr->tp - tp); ntok = 1 + (int)(rtr->tp - tp);
rtr->tp = tp; rtr->tp = tp;
insertrow(rtr, ntok, stringify(atr[argno])); insertrow(rtr, ntok, stringify(atr[argno]));
continue; continue;
...@@ -554,7 +554,7 @@ void ...@@ -554,7 +554,7 @@ void
{ {
Token *ltp, *ntp; Token *ltp, *ntp;
Tokenrow ntr; Tokenrow ntr;
int len; size_t len;
for (trp->tp = trp->bp; trp->tp < trp->lp; trp->tp++) for (trp->tp = trp->bp; trp->tp < trp->lp; trp->tp++)
{ {
...@@ -617,7 +617,7 @@ void ...@@ -617,7 +617,7 @@ void
doconcat(&ntr); doconcat(&ntr);
trp->tp = ltp; trp->tp = ltp;
makespace(&ntr, ltp); makespace(&ntr, ltp);
insertrow(trp, ntp - ltp, &ntr); insertrow(trp, (int)(ntp - ltp), &ntr);
dofree(ntr.bp); dofree(ntr.bp);
trp->tp--; trp->tp--;
} }
...@@ -639,7 +639,7 @@ int ...@@ -639,7 +639,7 @@ int
for (ap = mac->ap->bp; ap < mac->ap->lp; ap++) for (ap = mac->ap->bp; ap < mac->ap->lp; ap++)
{ {
if (ap->len == tp->len && strncmp((char *) ap->t, (char *) tp->t, ap->len) == 0) if (ap->len == tp->len && strncmp((char *) ap->t, (char *) tp->t, ap->len) == 0)
return ap - mac->ap->bp; return (int)(ap - mac->ap->bp);
} }
return -1; return -1;
} }
......
...@@ -194,8 +194,8 @@ void ...@@ -194,8 +194,8 @@ void
Token * Token *
growtokenrow(Tokenrow * trp) growtokenrow(Tokenrow * trp)
{ {
int ncur = trp->tp - trp->bp; size_t ncur = trp->tp - trp->bp;
int nlast = trp->lp - trp->bp; size_t nlast = trp->lp - trp->bp;
trp->max = 3 * trp->max / 2 + 1; trp->max = 3 * trp->max / 2 + 1;
trp->bp = (Token *) realloc(trp->bp, trp->max * sizeof(Token)); trp->bp = (Token *) realloc(trp->bp, trp->max * sizeof(Token));
...@@ -235,7 +235,7 @@ int ...@@ -235,7 +235,7 @@ int
void void
insertrow(Tokenrow * dtr, int ntok, Tokenrow * str) insertrow(Tokenrow * dtr, int ntok, Tokenrow * str)
{ {
int nrtok = rowlen(str); int nrtok = (int)rowlen(str);
dtr->tp += ntok; dtr->tp += ntok;
adjustrow(dtr, nrtok - ntok); adjustrow(dtr, nrtok - ntok);
...@@ -274,7 +274,7 @@ void ...@@ -274,7 +274,7 @@ void
void void
movetokenrow(Tokenrow * dtr, Tokenrow * str) movetokenrow(Tokenrow * dtr, Tokenrow * str)
{ {
int nby; size_t nby;
/* nby = sizeof(Token) * (str->lp - str->bp); */ /* nby = sizeof(Token) * (str->lp - str->bp); */
nby = (char *) str->lp - (char *) str->bp; nby = (char *) str->lp - (char *) str->bp;
...@@ -290,7 +290,7 @@ void ...@@ -290,7 +290,7 @@ void
void void
adjustrow(Tokenrow * trp, int nt) adjustrow(Tokenrow * trp, int nt)
{ {
int nby, size; size_t nby, size;
if (nt == 0) if (nt == 0)
return; return;
...@@ -311,7 +311,7 @@ void ...@@ -311,7 +311,7 @@ void
Tokenrow * Tokenrow *
copytokenrow(Tokenrow * dtr, Tokenrow * str) copytokenrow(Tokenrow * dtr, Tokenrow * str)
{ {
int len = rowlen(str); int len = (int)rowlen(str);
maketokenrow(len, dtr); maketokenrow(len, dtr);
movetokenrow(dtr, str); movetokenrow(dtr, str);
...@@ -331,7 +331,7 @@ Tokenrow * ...@@ -331,7 +331,7 @@ Tokenrow *
Tokenrow *ntrp = new(Tokenrow); Tokenrow *ntrp = new(Tokenrow);
int len; int len;
len = trp->lp - trp->tp; len = (int)(trp->lp - trp->tp);
if (len <= 0) if (len <= 0)
len = 1; len = 1;
maketokenrow(len, ntrp); maketokenrow(len, ntrp);
...@@ -396,7 +396,7 @@ void ...@@ -396,7 +396,7 @@ void
{ {
if (tp->type != NL) if (tp->type != NL)
{ {
len = tp->len + tp->wslen; len = (int)(tp->len + tp->wslen);
p = tp->t - tp->wslen; p = tp->t - tp->wslen;
/* add parameter check to delete operator? */ /* add parameter check to delete operator? */
...@@ -410,7 +410,7 @@ void ...@@ -410,7 +410,7 @@ void
if( ntp->type == NAME ) if( ntp->type == NAME )
{ {
uchar* np = ntp->t - ntp->wslen; uchar* np = ntp->t - ntp->wslen;
int nlen = ntp->len + ntp->wslen; int nlen = (int)(ntp->len + ntp->wslen);
memcpy(wbp, "if(", 3 ); memcpy(wbp, "if(", 3 );
wbp += 4; wbp += 4;
...@@ -492,7 +492,7 @@ void ...@@ -492,7 +492,7 @@ void
{ {
if (wbp > wbuf) if (wbp > wbuf)
{ {
if ( write(1, wbuf, wbp - wbuf) != -1) if ( write(1, wbuf, (int)(wbp - wbuf)) != -1)
wbp = wbuf; wbp = wbuf;
else else
exit(1); exit(1);
...@@ -527,7 +527,7 @@ char * ...@@ -527,7 +527,7 @@ char *
* Null terminated. * Null terminated.
*/ */
uchar * uchar *
newstring(uchar * s, int l, int o) newstring(uchar * s, size_t l, size_t o)
{ {
uchar *ns = (uchar *) domalloc(l + o + 1); uchar *ns = (uchar *) domalloc(l + o + 1);
......
...@@ -135,7 +135,7 @@ void ...@@ -135,7 +135,7 @@ void
case 'w': case 'w':
dp = &optarg[n + 1]; dp = &optarg[n + 1];
n += strlen(dp); n += (int)strlen(dp);
while (isspace(*dp)) dp++; while (isspace(*dp)) dp++;
for (i = NINCLUDE - 1; i >= 0; i--) for (i = NINCLUDE - 1; i >= 0; i--)
...@@ -173,7 +173,7 @@ void ...@@ -173,7 +173,7 @@ void
{ {
if ((fp = strrchr(argv[optind], '/')) != NULL) if ((fp = strrchr(argv[optind], '/')) != NULL)
{ {
int len = fp - argv[optind]; int len = (int)(fp - argv[optind]);
dp = (char *) newstring((uchar *) argv[optind], len + 1, 0); dp = (char *) newstring((uchar *) argv[optind], len + 1, 0);
dp[len] = '\0'; dp[len] = '\0';
......
...@@ -54,8 +54,8 @@ typedef struct token ...@@ -54,8 +54,8 @@ typedef struct token
{ {
unsigned char type; unsigned char type;
unsigned char flag; unsigned char flag;
unsigned int wslen; size_t wslen;
unsigned int len; size_t len;
uchar *t; uchar *t;
unsigned int identifier; /* used from macro processor to identify where a macro becomes valid again. */ unsigned int identifier; /* used from macro processor to identify where a macro becomes valid again. */
} Token; } Token;
...@@ -87,7 +87,7 @@ typedef struct nlist ...@@ -87,7 +87,7 @@ typedef struct nlist
{ {
struct nlist *next; struct nlist *next;
uchar *name; uchar *name;
int len; size_t len;
Tokenrow *vp; /* value as macro */ Tokenrow *vp; /* value as macro */
Tokenrow *ap; /* list of argument names, if any */ Tokenrow *ap; /* list of argument names, if any */
char val; /* value as preprocessor name */ char val; /* value as preprocessor name */
...@@ -174,7 +174,7 @@ Source *setsource(char *, int, int, char *, int); ...@@ -174,7 +174,7 @@ Source *setsource(char *, int, int, char *, int);
void unsetsource(void); void unsetsource(void);
void puttokens(Tokenrow *); void puttokens(Tokenrow *);
void process(Tokenrow *); void process(Tokenrow *);
void *domalloc(int); void *domalloc(size_t);
void dofree(void *); void dofree(void *);
void error(enum errtype, char *,...); void error(enum errtype, char *,...);
void flushout(void); void flushout(void);
...@@ -211,7 +211,7 @@ void setempty(Tokenrow *); ...@@ -211,7 +211,7 @@ void setempty(Tokenrow *);
void makespace(Tokenrow *, Token *); void makespace(Tokenrow *, Token *);
char *outnum(char *, int); char *outnum(char *, int);
int digit(int); int digit(int);
uchar *newstring(uchar *, int, int); uchar *newstring(uchar *, size_t, size_t);
#define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp) #define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment