ash: more of -Wall fixes

This commit is contained in:
Denis Vlasenko 2008-05-18 14:06:08 +00:00
parent d04e1fc309
commit 29eb3599e4

View File

@ -1360,7 +1360,7 @@ growstackblock(void)
INT_ON; INT_ON;
} else { } else {
char *oldspace = g_stacknxt; char *oldspace = g_stacknxt;
int oldlen = g_stacknleft; size_t oldlen = g_stacknleft;
char *p = stalloc(newlen); char *p = stalloc(newlen);
/* free the space we just allocated */ /* free the space we just allocated */
@ -1403,7 +1403,7 @@ growstackstr(void)
return stackblock(); return stackblock();
} }
growstackblock(); growstackblock();
return stackblock() + len; return (char *)stackblock() + len;
} }
/* /*
@ -1424,14 +1424,14 @@ makestrspace(size_t newlen, char *p)
break; break;
growstackblock(); growstackblock();
} }
return stackblock() + len; return (char *)stackblock() + len;
} }
static char * static char *
stack_nputstr(const char *s, size_t n, char *p) stack_nputstr(const char *s, size_t n, char *p)
{ {
p = makestrspace(n, p); p = makestrspace(n, p);
p = memcpy(p, s, n) + n; p = (char *)memcpy(p, s, n) + n;
return p; return p;
} }
@ -1536,7 +1536,7 @@ single_quote(const char *s)
q = p = makestrspace(len + 3, p); q = p = makestrspace(len + 3, p);
*q++ = '\''; *q++ = '\'';
q = memcpy(q, s, len) + len; q = (char *)memcpy(q, s, len) + len;
*q++ = '\''; *q++ = '\'';
s += len; s += len;
@ -1549,7 +1549,7 @@ single_quote(const char *s)
q = p = makestrspace(len + 3, p); q = p = makestrspace(len + 3, p);
*q++ = '"'; *q++ = '"';
q = memcpy(q, s, len) + len; q = (char *)memcpy(q, s, len) + len;
*q++ = '"'; *q++ = '"';
s += len; s += len;
@ -2079,10 +2079,10 @@ setvar(const char *name, const char *val, int flags)
} }
INT_OFF; INT_OFF;
nameeq = ckmalloc(namelen + vallen + 2); nameeq = ckmalloc(namelen + vallen + 2);
p = memcpy(nameeq, name, namelen) + namelen; p = (char *)memcpy(nameeq, name, namelen) + namelen;
if (val) { if (val) {
*p++ = '='; *p++ = '=';
p = memcpy(p, val, vallen) + vallen; p = (char *)memcpy(p, val, vallen) + vallen;
} }
*p = '\0'; *p = '\0';
setvareq(nameeq, flags | VNOSAVE); setvareq(nameeq, flags | VNOSAVE);
@ -2364,7 +2364,7 @@ updatepwd(const char *dir)
new = stack_putstr(curdir, new); new = stack_putstr(curdir, new);
} }
new = makestrspace(strlen(dir) + 2, new); new = makestrspace(strlen(dir) + 2, new);
lim = stackblock() + 1; lim = (char *)stackblock() + 1;
if (*dir != '/') { if (*dir != '/') {
if (new[-1] != '/') if (new[-1] != '/')
USTPUTC('/', new); USTPUTC('/', new);
@ -5157,7 +5157,7 @@ _rmescapes(char *str, int flag)
} }
q = r; q = r;
if (len > 0) { if (len > 0) {
q = memcpy(q, str, len) + len; q = (char *)memcpy(q, str, len) + len;
} }
} }
inquotes = (flag & RMESCAPE_QUOTED) ^ RMESCAPE_QUOTED; inquotes = (flag & RMESCAPE_QUOTED) ^ RMESCAPE_QUOTED;
@ -5426,7 +5426,7 @@ expbackq(union node *cmd, int quoted, int quotes)
char *p; char *p;
char *dest; char *dest;
int startloc; int startloc;
int syntax = quoted? DQSYNTAX : BASESYNTAX; int syntax = quoted ? DQSYNTAX : BASESYNTAX;
struct stackmark smark; struct stackmark smark;
INT_OFF; INT_OFF;
@ -5910,7 +5910,7 @@ subevalvar(char *p, char *str, int strloc, int subtype,
STPUTC('\0', expdest); STPUTC('\0', expdest);
herefd = saveherefd; herefd = saveherefd;
argbackq = saveargbackq; argbackq = saveargbackq;
startp = stackblock() + startloc; startp = (char *)stackblock() + startloc;
switch (subtype) { switch (subtype) {
case VSASSIGN: case VSASSIGN:
@ -5988,19 +5988,19 @@ subevalvar(char *p, char *str, int strloc, int subtype,
amount = expdest - ((char *)stackblock() + resetloc); amount = expdest - ((char *)stackblock() + resetloc);
STADJUST(-amount, expdest); STADJUST(-amount, expdest);
startp = stackblock() + startloc; startp = (char *)stackblock() + startloc;
rmesc = startp; rmesc = startp;
rmescend = stackblock() + strloc; rmescend = (char *)stackblock() + strloc;
if (quotes) { if (quotes) {
rmesc = _rmescapes(startp, RMESCAPE_ALLOC | RMESCAPE_GROW); rmesc = _rmescapes(startp, RMESCAPE_ALLOC | RMESCAPE_GROW);
if (rmesc != startp) { if (rmesc != startp) {
rmescend = expdest; rmescend = expdest;
startp = stackblock() + startloc; startp = (char *)stackblock() + startloc;
} }
} }
rmescend--; rmescend--;
str = stackblock() + strloc; str = (char *)stackblock() + strloc;
preglob(str, varflags & VSQUOTE, 0); preglob(str, varflags & VSQUOTE, 0);
workloc = expdest - (char *)stackblock(); workloc = expdest - (char *)stackblock();