local line="$COMP_LINE" OLD_IFS="$IFS"
local opts n
- if [[ "$COMP_WORDBREAKS" != ' ' ]]; then
- COMP_WORDBREAKS=' '
- return 124 # try again with proper value
- fi
# This extracts short and long options from the help output
local script='{
if ($1 ~ "-[a-zA-Z]," && $2 ~ "--[a-zA-Z]") {
}
/*
- * This is called at the beginning of every program that uses libgcrypt. We
- * don't have to initialize any random seed here, but we must initialize the
- * gcrypt library. This task is performed by gcry_check_version() which can
- * also check that the gcrypt library version is at least the minimal required
- * version.
+ * This is called at the beginning of every program that uses libgcrypt. The
+ * call to gcry_check_version() initializes the gcrypt library and checks that
+ * we have at least the minimal required version.
*/
void init_random_seed_or_die(void)
{
const char *req_ver = "1.5.0";
+ int seed;
- if (gcry_check_version(req_ver))
- return;
- PARA_EMERG_LOG("fatal: need at least libgcrypt-%s, have: %s\n",
- req_ver, gcry_check_version(NULL));
- exit(EXIT_FAILURE);
+ if (!gcry_check_version(req_ver)) {
+ PARA_EMERG_LOG("fatal: need at least libgcrypt-%s, have: %s\n",
+ req_ver, gcry_check_version(NULL));
+ exit(EXIT_FAILURE);
+ }
+ get_random_bytes_or_die((unsigned char *)&seed, sizeof(seed));
+ srandom(seed);
}
/** S-expression for the public part of an RSA key. */
size_t *result_frames)
{
int ret, num_samples, out_samples;
+ float *in_float;
int16_t *out;
SRC_DATA data;
data.output_frames = num_frames * ctx->ratio + 1;
out_samples = data.output_frames * ctx->channels;
- data.data_in = para_malloc(num_samples * sizeof(float));
- src_short_to_float_array(in, data.data_in, num_samples);
+ in_float = para_malloc(num_samples * sizeof(float));
+ src_short_to_float_array(in, in_float, num_samples);
+ data.data_in = in_float;
data.data_out = para_malloc(out_samples * sizeof(float));
ret = src_process(ctx->src_state, &data);
- free(data.data_in);
+ free(in_float);
if (ret != 0) {
PARA_ERROR_LOG("%s\n", src_strerror(ret));
free(data.data_out);