mode_t new_mode;
char op;
- if (((unsigned int)(*s - '0')) < 8) {
+ if ((unsigned char)(*s - '0') < 8) {
unsigned long tmp;
char *e;
i = 0;
do {
- p = ((char *) ((struct passwd *) data)) + pw_off[i];
+ p = (char *) data + pw_off[i];
if ((i & 6) ^ 2) { /* i!=2 and i!=3 */
*((char **) p) = line;
end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
i = 0;
do {
- p = ((char *) ((struct group *) data)) + gr_off[i];
+ p = (char *) data + gr_off[i];
if (i < 2) {
*((char **) p) = line;
offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */
};
-static int bb__parsespent(void *data, char * line)
+static int bb__parsespent(void *data, char *line)
{
char *endptr;
char *p;
int i;
i = 0;
- do {
- p = ((char *) ((struct spwd *) data)) + sp_off[i];
+ while (1) {
+ p = (char *) data + sp_off[i];
if (i < 2) {
*((char **) p) = line;
line = strchr(line, ':');
break;
}
} else {
- *((long *) p) = (long) strtoul(line, &endptr, 10);
+ *((long *) p) = strtoul(line, &endptr, 10);
if (endptr == line) {
- *((long *) p) = ((i != 8) ? -1L : ((long)(~0UL)));
+ *((long *) p) = (i != 8) ? -1L : (long)(~0UL);
}
line = endptr;
}
- *line++ = 0;
+ *line++ = '\0';
++i;
- } while (1);
+ }
return EINVAL;
}
skip = 1;
++ptr;
} else if (isdigit(*ptr)) {
+ char *endp;
if (n1 < 0) {
- n1 = strtol(ptr, &ptr, 10) + off;
+ n1 = strtol(ptr, &endp, 10) + off;
} else {
- n2 = strtol(ptr, &ptr, 10) + off;
+ n2 = strtol(ptr, &endp, 10) + off;
}
+ ptr = endp; /* gcc likes temp var for &endp */
skip = 1;
} else if (names) {
int i;
n2 = n1;
}
if (*ptr == '/') {
- skip = strtol(ptr + 1, &ptr, 10);
+ char *endp;
+ skip = strtol(ptr + 1, &endp, 10);
+ ptr = endp; /* gcc likes temp var for &endp */
}
/*
loc = contents + sym->value;
if (*pinfo == 'c') {
- if (!isdigit(*(pinfo + 1))) {
+ if (!isdigit(pinfo[1])) {
bb_error_msg_and_die("parameter type 'c' for %s must be followed by"
" the maximum size", param);
}
- charssize = strtoul(pinfo + 1, (char **) NULL, 10);
+ charssize = strtoul(pinfo + 1, NULL, 10);
}
if (val == NULL) {
n = 0;
p = val;
while (*p != 0) {
+ char *endp;
+
if (++n > max)
bb_error_msg_and_die("too many values for %s (max %d)", param, max);
p += len;
break;
case 'b':
- *loc++ = strtoul(p, &p, 0);
+ *loc++ = strtoul(p, &endp, 0);
+ p = endp; /* gcc likes temp var for &endp */
break;
case 'h':
- *(short *) loc = strtoul(p, &p, 0);
+ *(short *) loc = strtoul(p, &endp, 0);
loc += tgt_sizeof_short;
+ p = endp;
break;
case 'i':
- *(int *) loc = strtoul(p, &p, 0);
+ *(int *) loc = strtoul(p, &endp, 0);
loc += tgt_sizeof_int;
+ p = endp;
break;
case 'l':
- *(long *) loc = strtoul(p, &p, 0);
+ *(long *) loc = strtoul(p, &endp, 0);
loc += tgt_sizeof_long;
+ p = endp;
break;
default:
bb_error_msg_and_die("unknown parameter type '%c' for %s",
res = RTN_THROW;
else {
res = strtoul(arg, &end, 0);
- if (!end || end == arg || *end || res > 255)
+ if (end == arg || *end || res > 255)
return -1;
}
*id = res;
if (*arg) {
res = strtoul(arg, &ptr, 0);
+//FIXME: "" will be accepted too, is it correct?!
if (!*ptr && res <= UINT_MAX) {
return res;
}
if (*arg) {
res = strtoul(arg, &ptr, 0);
+//FIXME: "" will be accepted too, is it correct?!
if (!*ptr && res <= 0xFFFFFFFFUL) {
return res;
}
if (*arg) {
res = strtoul(arg, &ptr, 0);
+//FIXME: "" will be accepted too, is it correct?!
if (!*ptr && res <= 0xFFFF) {
return res;
}
if (p == str)
return 1;
maj <<= 16;
- if (*p != ':' && *p!=0)
+ if (*p != ':' && *p != '\0')
return 1;
ok:
*h = maj;
maj <<= 16;
str = p + 1;
min = strtoul(str, &p, 16);
- if (*p != 0 || min >= (1<<16))
+//FIXME: check for "" too?
+ if (*p != '\0' || min >= (1<<16))
return 1;
maj |= min;
} else if (*p != 0)
vrandom.flags &= ~VNOFUNC;
} else {
/* set/reset */
- random_galois_LFSR = random_LCG = strtoul(value, (char **)NULL, 10);
+ random_galois_LFSR = random_LCG = strtoul(value, NULL, 10);
}
}
#endif