bitsy: replace atoi() calls with strtol() when hex can be expcted
parent
2ef29e10f4
commit
953387d7ba
|
@ -1326,7 +1326,8 @@ audiowrite(Chan *c, void *vp, long n, vlong)
|
|||
if(strcmp(cb->f[i], "reg") == 0) {
|
||||
if(cb->nf < 3)
|
||||
error(Evolume);
|
||||
setreg(cb->f[1], atoi(cb->f[2]), cb->nf == 4 ? atoi(cb->f[3]):1);
|
||||
setreg(cb->f[1], strtol(cb->f[2], 0, 0),
|
||||
cb->nf == 4 ? strtol(cb->f[3], 0, 0):1);
|
||||
return n0;
|
||||
}
|
||||
error(Evolume);
|
||||
|
|
|
@ -349,7 +349,7 @@ static long
|
|||
if(cmd->nf > 15)
|
||||
error(Ebadarg);
|
||||
for(i = 0; i < cmd->nf; i++)
|
||||
data[i] = atoi(cmd->f[i]);
|
||||
data[i] = strtol(cmd->f[i], 0, 0);
|
||||
|
||||
switch((ulong)c->qid.path){
|
||||
case Qled:
|
||||
|
|
|
@ -194,14 +194,14 @@ lcdtweak(Cmdbuf *cmd)
|
|||
return;
|
||||
if(*cmd->f[0] == 'h')
|
||||
lcd->lccr1 = ((Ht-16)<<PPL)
|
||||
| (atoi(cmd->f[1])<<HSW)
|
||||
| (atoi(cmd->f[2])<<ELW)
|
||||
| (atoi(cmd->f[3])<<BLW);
|
||||
| (strtol(cmd->f[1], 0, 0)<<HSW)
|
||||
| (strtol(cmd->f[2], 0, 0)<<ELW)
|
||||
| (strtol(cmd->f[3], 0, 0)<<BLW);
|
||||
if(*cmd->f[0] == 'v')
|
||||
lcd->lccr2 = ((Wid-1)<<LPP)
|
||||
| (atoi(cmd->f[1])<<VSW)
|
||||
| (atoi(cmd->f[2])<<EFW)
|
||||
| (atoi(cmd->f[3])<<BFW);
|
||||
| (strtol(cmd->f[1], 0, 0)<<VSW)
|
||||
| (strtol(cmd->f[2], 0, 0)<<EFW)
|
||||
| (strtol(cmd->f[3], 0, 0)<<BFW);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue