From 724453b11371898caf9faaa0eb228a1bf57e0c57 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 30 Nov 2015 10:28:06 -0500 Subject: [PATCH 1/2] Update comments related to NC_MAX_VARS and NC_MAX_DIMS --- include/netcdf.h | 7 ++++++- nc_test4/bm_many_objs.c | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/netcdf.h b/include/netcdf.h index 4dd1e94a8..79b4dec3d 100644 --- a/include/netcdf.h +++ b/include/netcdf.h @@ -345,7 +345,12 @@ The specified corner indices were out of range for the rank of the specified variable. For example, a negative index or an index that is larger than the corresponding dimension length will cause an error. */ #define NC_EINVALCOORDS (-40) -#define NC_EMAXDIMS (-41) /**< NC_MAX_DIMS exceeded */ + +/** NC_MAX_DIMS exceeded. Max number of dimensions exceeded in a +classic or 64-bit offset file, or an netCDF-4 file with +::NC_CLASSIC_MODEL on. */ +#define NC_EMAXDIMS (-41) + #define NC_ENAMEINUSE (-42) /**< String match to name in use */ #define NC_ENOTATT (-43) /**< Attribute not found */ #define NC_EMAXATTS (-44) /**< NC_MAX_ATTRS exceeded */ diff --git a/nc_test4/bm_many_objs.c b/nc_test4/bm_many_objs.c index 887d3a695..56215ee6d 100644 --- a/nc_test4/bm_many_objs.c +++ b/nc_test4/bm_many_objs.c @@ -61,8 +61,9 @@ int main(int argc, char **argv) /* create new file */ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; - /* create N variables, printing time after every 1000. Because only - * NC_MAX_VARS are permitted per group, create the necessary number + /* create N variables, printing time after every 1000. + * Put NC_MAX_VARS variables per group (even though netcdf4 non-classic + * format does not limit variable count), create the necessary number * of groups to hold nitem variables. */ numvar = nitem; v = 1; From 2d8b20a97c684d6cad830ffdb6acb72be2049d93 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 30 Nov 2015 10:32:53 -0500 Subject: [PATCH 2/2] Incorrect dimension was used; should be NC_MAX_VAR_DIMS --- nctest/atttests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nctest/atttests.c b/nctest/atttests.c index 5e3a4379d..6cd41bcea 100644 --- a/nctest/atttests.c +++ b/nctest/atttests.c @@ -1293,7 +1293,7 @@ test_ncattdel(path) error("%s: ncinquire in data mode failed", pname); ncclose(cdfid); return ++nerrs; } - vtmp.dims = (int *) emalloc(sizeof(int) * MAX_VAR_DIMS); + vtmp.dims = (int *) emalloc(sizeof(int) * NC_MAX_VAR_DIMS); vtmp.name = (char *) emalloc(MAX_NC_NAME); if (ncvarinq(cdfid, yav_id, vtmp.name, &vtmp.type, &vtmp.ndims, vtmp.dims, &natts) == -1) {