From: Paul Brossier Date: Sat, 7 Dec 2013 18:11:09 +0000 (-0500) Subject: examples/parse_args.h: check buffer_size and hop_size X-Git-Tag: 0.4.0-beta1~32 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=04281508709213d63fb61446b22fa418bb056975;p=aubio.git examples/parse_args.h: check buffer_size and hop_size --- diff --git a/examples/parse_args.h b/examples/parse_args.h index 66c47b14..1ab652eb 100644 --- a/examples/parse_args.h +++ b/examples/parse_args.h @@ -229,5 +229,17 @@ parse_args (int argc, char **argv) #endif /* PROG_HAS_JACK */ } + if (hop_size < 1) { + errmsg("Error: got hop_size %d, but can not be < 1\n", hop_size); + usage ( stderr, 1 ); + } else if (buffer_size < 2) { + errmsg("Error: got buffer_size %d, but can not be < 2\n", buffer_size); + usage ( stderr, 1 ); + } else if (buffer_size < hop_size + 1) { + errmsg("Error: hop size (%d) is larger than or equal to win size (%d)\n", + buffer_size, hop_size); + usage ( stderr, 1 ); + } + return 0; }