mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 06:45:42 +01:00
Use strtol() instead of atoi()
Use strtol() instead of atoi() for parsing parameters.
This commit is contained in:
parent
d96b4592c5
commit
9fbb2b59f5
1 changed files with 11 additions and 11 deletions
|
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
rhwparams.channels = atoi(optarg);
|
rhwparams.channels = strtol(optarg, NULL, 0);
|
||||||
if (rhwparams.channels < 1 || rhwparams.channels > 32) {
|
if (rhwparams.channels < 1 || rhwparams.channels > 32) {
|
||||||
error(_("value %i for channels is invalid"), rhwparams.channels);
|
error(_("value %i for channels is invalid"), rhwparams.channels);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -456,7 +456,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
tmp = atoi(optarg);
|
tmp = strtol(optarg, NULL, 0);
|
||||||
if (tmp < 300)
|
if (tmp < 300)
|
||||||
tmp *= 1000;
|
tmp *= 1000;
|
||||||
rhwparams.rate = tmp;
|
rhwparams.rate = tmp;
|
||||||
|
@ -466,35 +466,35 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
timelimit = atoi(optarg);
|
timelimit = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
sleep_min = atoi(optarg);
|
sleep_min = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
nonblock = 1;
|
nonblock = 1;
|
||||||
open_mode |= SND_PCM_NONBLOCK;
|
open_mode |= SND_PCM_NONBLOCK;
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
period_time = atoi(optarg);
|
period_time = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
buffer_time = atoi(optarg);
|
buffer_time = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case OPT_PERIOD_SIZE:
|
case OPT_PERIOD_SIZE:
|
||||||
period_frames = atoi(optarg);
|
period_frames = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case OPT_BUFFER_SIZE:
|
case OPT_BUFFER_SIZE:
|
||||||
buffer_frames = atoi(optarg);
|
buffer_frames = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
avail_min = atoi(optarg);
|
avail_min = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
start_delay = atoi(optarg);
|
start_delay = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
stop_delay = atoi(optarg);
|
stop_delay = strtol(optarg, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose++;
|
verbose++;
|
||||||
|
|
Loading…
Reference in a new issue