summaryrefslogtreecommitdiffstats
path: root/tools/lv2bench.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-11 18:34:20 -0500
committerDavid Robillard <d@drobilla.net>2024-12-11 19:39:22 -0500
commit5dc6a712ef2cc383083220326354fc7aa960c798 (patch)
treede4fdfb1102436bd6f431a35df6e5189424551df /tools/lv2bench.c
parent45368fc65aebc892bff3ab4b3e844512af26b566 (diff)
downloadlilv-5dc6a712ef2cc383083220326354fc7aa960c798.tar.gz
lilv-5dc6a712ef2cc383083220326354fc7aa960c798.tar.bz2
lilv-5dc6a712ef2cc383083220326354fc7aa960c798.zip
Avoid use of atoi()
Diffstat (limited to 'tools/lv2bench.c')
-rw-r--r--tools/lv2bench.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/lv2bench.c b/tools/lv2bench.c
index b19d376..fab7ec2 100644
--- a/tools/lv2bench.c
+++ b/tools/lv2bench.c
@@ -214,9 +214,15 @@ main(int argc, char** argv)
if (!strcmp(argv[a], "-f")) {
full_output = true;
} else if (!strcmp(argv[a], "-n") && (a + 1 < argc)) {
- sample_count = atoi(argv[++a]);
+ const long l = strtol(argv[++a], NULL, 10);
+ if (l > 0 && l < (1L << 28L)) {
+ sample_count = (uint32_t)l;
+ }
} else if (!strcmp(argv[a], "-b") && (a + 1 < argc)) {
- block_size = atoi(argv[++a]);
+ const long l = strtol(argv[++a], NULL, 10);
+ if (l > 0 && l < 16384) {
+ block_size = (uint32_t)l;
+ }
} else if (argv[a][0] != '-') {
break;
} else {