From d4d99a26171fa552c96c17dd9687b0ce0d83565d Mon Sep 17 00:00:00 2001 From: Francesc Alted Date: Mon, 3 Jul 2023 12:11:15 +0200 Subject: [PATCH] Use srand and rand for Win compat --- tests/test_filters.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/test_filters.c b/tests/test_filters.c index f40277cc1..728fe9a4e 100644 --- a/tests/test_filters.c +++ b/tests/test_filters.c @@ -9,17 +9,23 @@ int main(void) { blosc2_init(); - srandom(0); - char *name = NULL; + srand(0); + char *libname = NULL; char *version = NULL; - if (blosc2_get_complib_info("zstd", &name, &version) < 0) { + int ret = blosc2_get_complib_info("zstd", &libname, &version); + if (libname != NULL) { + free(libname); + free(version); + } + if (ret < 0) { // We need ZSTD for the test here... return 0; } + uint16_t *ref_data = (uint16_t *)malloc(CHUNKSIZE); uint16_t *data_dest = (uint16_t *)malloc(CHUNKSIZE); for (int i = 0; i < LEN; i++) { - ref_data[i] = random() % 118; + ref_data[i] = rand() % 118; } blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS; cparams.compcode = BLOSC_ZSTD;