Fix broken Windows build

This commit is contained in:
Shahram Najm 2023-04-19 11:20:27 +01:00
parent 168537f503
commit c64d82d433
1 changed files with 8 additions and 1 deletions

View File

@ -22,7 +22,10 @@ int main()
int i = 0; int i = 0;
codes_handle* h = NULL; codes_handle* h = NULL;
const char* filename = "bigfile.grib"; const char* filename = "bigfile.grib";
#ifndef ECCODES_ON_WINDOWS
unsigned int seed = time(NULL); unsigned int seed = time(NULL);
#endif
numbytes = ni * nj * sizeof(double); numbytes = ni * nj * sizeof(double);
values = (double*)malloc(numbytes); values = (double*)malloc(numbytes);
@ -32,7 +35,11 @@ int main()
} }
for (i = 0; i < ni * nj; i++) { for (i = 0; i < ni * nj; i++) {
double r = rand_r(&seed) * 1.0 / RAND_MAX; #ifndef ECCODES_ON_WINDOWS
double r = rand_r(&seed) * 1.0 / RAND_MAX;
#else
double r = rand() * 1.0 / RAND_MAX;
#endif
values[i] = r; values[i] = r;
} }