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