diff --git a/examples/C/Makefile.am b/examples/C/Makefile.am index 1b9911cb8..a265c04a4 100644 --- a/examples/C/Makefile.am +++ b/examples/C/Makefile.am @@ -17,9 +17,9 @@ AM_LDFLAGS = ${top_builddir}/liblib/libnetcdf.la # These are the netCDF-3 examples. check_PROGRAMS = simple_xy_wr simple_xy_rd sfc_pres_temp_wr \ sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd format \ -quick_large_files quick_small_files +quick_large_files quick_small_files sfc_pres_temp_more -TESTS = run_examples.sh format quick_large_files +TESTS = run_examples.sh format quick_large_files quick_small_files # To build netcdf-4, or not to build netcdf-4, that is the question... if USE_HDF5 diff --git a/examples/C/quick_small_files.c b/examples/C/quick_small_files.c index 1ffc5edfe..cf2f1379a 100644 --- a/examples/C/quick_small_files.c +++ b/examples/C/quick_small_files.c @@ -37,8 +37,9 @@ return NC_EXAMPLE_ERROR; \ #define NUMVARS 2 /* This dim len is the max size the first of two fixed size variables for an 8-byte type in classic format: int((2*31 - 4) / 8), that is, - 2 GB minus a bit, on an 8 byte boundary. */ -#define DIM_LEN 268435455 + 2 GB minus a bit, on an 8 byte boundary. That number is + 268435455. But this is the longest dim len which works. */ +#define DIM_LEN 268435440 int main() diff --git a/examples/C/sfc_pres_temp_more.c b/examples/C/sfc_pres_temp_more.c index 1cd100ff0..a723257b0 100644 --- a/examples/C/sfc_pres_temp_more.c +++ b/examples/C/sfc_pres_temp_more.c @@ -9,9 +9,11 @@ * pressure and temperatures, and stores additional metadata as * dimension variables, an attribute. * - * @author Ed Hartnett 2006/03/25 + * @author Ed Hartnett started 2006/03/25, finished 2019/7/2 */ #include +#include +#include #define FILE_NAME "sfc_pres_temp_more.nc" #define NDIMS 2 @@ -113,9 +115,9 @@ main() return retval; /* Write the phoney data. */ - if ((retval = nc_put_var_float(ncid, pres_varid, pres_out))) + if ((retval = nc_put_var_float(ncid, pres_varid, (float *)pres_out))) return retval; - if ((retval = nc_put_var_float(ncid, temp_varid, temp_out))) + if ((retval = nc_put_var_float(ncid, temp_varid, (float *)temp_out))) return retval; /* Close the file. */ @@ -132,16 +134,16 @@ main() return retval; if (!(att_in = malloc(len_in))) return NC_ENOMEM; - if (strcmp(att_in, data_poem)) + if (strcmp(att_in, poem)) error++; free(att_in); if (error) return -2; /* Read the data. */ - if ((retval = nc_get_var_float(ncid, pres_varid, pres_in))) + if ((retval = nc_get_var_float(ncid, pres_varid, (float *)pres_in))) return retval; - if ((retval = nc_get_var_float(ncid, temp_varid, temp_in))) + if ((retval = nc_get_var_float(ncid, temp_varid, (float *)temp_in))) return retval; /* Check the data. */