Corrected an issue observed on centos7.
-/* This is part of the netCDF package. Copyright 2005-2011,
+/* This is part of the netCDF package. Copyright 2005-2018,
University Corporation for Atmospheric Research/Unidata. See
COPYRIGHT file for conditions of use.
Test that NetCDF-4 can read HDF4 files.
- Ed Hartnett
+ Ed Hartnett, Ward Fisher
*/
#include <config.h>
#include <nc_tests.h>
@@ -68,6 +68,7 @@ main(int argc, char **argv)
int data_int2[LAT_LEN * LON_LEN];
float data_float[LAT_LEN * LON_LEN];
double data_double[LAT_LEN * LON_LEN];
+ int i = 0;
/* Open HDF4 file with netCDF. */
if (nc_open(FILE_NAME, 0, &ncid)) ERR;
@@ -79,27 +80,27 @@ main(int argc, char **argv)
/* Read data as short. */
if (nc_get_vara_short(ncid, 0, start, count, data_short)) ERR;
- for (int i = 0; i < LAT_LEN * LON_LEN; i++)
+ for (i = 0; i < LAT_LEN * LON_LEN; i++)
if (data_short[i] != (short)i) ERR;
/* Read data as int. */
if (nc_get_vara_int(ncid, 0, start, count, data_int)) ERR;
- for (int i = 0; i < LAT_LEN * LON_LEN; i++)
+ for (i = 0; i < LAT_LEN * LON_LEN; i++)
if (data_int[i] != i) ERR;
/* NULL count is treated as meaing entire variable. */
if (nc_get_vara_int(ncid, 0, start, NULL, data_int2)) ERR;
- for (int i = 0; i < LAT_LEN * LON_LEN; i++)
+ for (i = 0; i < LAT_LEN * LON_LEN; i++)
if (data_int2[i] != i) ERR;
/* Read data as float. */
if (nc_get_vara_float(ncid, 0, start, count, data_float)) ERR;
- for (int i = 0; i < LAT_LEN * LON_LEN; i++)
+ for (i = 0; i < LAT_LEN * LON_LEN; i++)
if (data_float[i] != (float)i) ERR;
/* Read data as double. */
if (nc_get_vara_double(ncid, 0, start, count, data_double)) ERR;
- for (int i = 0; i < LAT_LEN * LON_LEN; i++)
+ for (i = 0; i < LAT_LEN * LON_LEN; i++)
if (data_double[i] != (double)i) ERR;
/* Close the file. */
