pc, pc64: replace atoi() calls with strtol() when hex can be expcte

This commit is contained in:
cinap_lenrek 2015-08-03 17:07:40 +02:00
parent 1b7e120c09
commit 2ef29e10f4
3 changed files with 5 additions and 5 deletions

View file

@ -261,8 +261,8 @@ mpoverride(uchar** newp, uchar** e)
uchar* p;
char* s;
size = atoi(getconf("*mp"));
if(size == 0) panic("mpoverride: invalid size in *mp");
size = strtol(getconf("*mp"), 0, 0);
if(size <= 0) panic("mpoverride: invalid size in *mp");
*newp = p = xalloc(size);
if(p == nil) panic("mpoverride: can't allocate memory");
*e = p + size;

View file

@ -864,7 +864,7 @@ i82365write(Chan *c, void *a, long n, vlong off)
/* set vpp on card */
if(strncmp(buf, "vpp", 3) == 0)
wrreg(pp, Rpc, vcode(atoi(buf+3))|Fautopower|Foutena|Fcardena);
wrreg(pp, Rpc, vcode(strtol(buf+3, 0, 0))|Fautopower|Foutena|Fcardena);
return n;
case Qmem:
case Qattr:

View file

@ -356,7 +356,7 @@ whichfw(Pcidev *p)
print("m10g: %d lanes; ecrc=%d; ", lanes, ecrc);
if(s = getconf("myriforce")){
i = atoi(s);
i = strtol(s, 0, 0);
if(i != 4*KiB || i != 2*KiB)
i = 2*KiB;
print("fw = %d [forced]\n", i);
@ -390,7 +390,7 @@ parseeprom(Ctlr *c)
c->ra[k] = strtoul(s+j+3*k, 0, 16);
}else if(strncmp(s+i, "SN=", 3) == 0){
bits ^= 2;
c->serial = atoi(s+i+3);
c->serial = strtoul(s+i+3, 0, 10);
}
i += l;
}