Fix Jira bug NCF-141 and finish bug fix for NCF-139

This commit is contained in:
Russ Rew 2012-01-30 22:10:23 +00:00
parent 7b3c25b9db
commit 9d2c29045c
2 changed files with 16 additions and 6 deletions

View File

@ -567,12 +567,19 @@ nc4_put_vara(NC_FILE_INFO_T *nc, int ncid, int varid, const size_t *startp,
count[i] = countp[i];
}
/* Open this databset if necessary. */
/* Open this databset if necessary, also checking for a weird case:
* a non-coordinate variable that has the same name as a
* dimension. */
if (var->hdf5_name && strlen(var->hdf5_name) >= strlen(NON_COORD_PREPEND) &&
strncmp(var->hdf5_name, NON_COORD_PREPEND, strlen(NON_COORD_PREPEND)) == 0)
if ((var->hdf_datasetid = H5Dopen2(grp->hdf_grpid, var->hdf5_name,
H5P_DEFAULT)) < 0)
return NC_ENOTVAR;
if (!var->hdf_datasetid)
if ((var->hdf_datasetid = H5Dopen2(grp->hdf_grpid, var->name,
H5P_DEFAULT)) < 0)
return NC_ENOTVAR;
if ((var->hdf_datasetid = H5Dopen2(grp->hdf_grpid, var->name,
H5P_DEFAULT)) < 0)
return NC_ENOTVAR;
/* Get file space of data. */
if ((file_spaceid = H5Dget_space(var->hdf_datasetid)) < 0)
BAIL(NC_EHDFERR);

View File

@ -380,7 +380,10 @@ nc_next_iter(nciter_t *iter, /* returned opaque iteration state */
/* adjust count to stay in range of dimsizes */
for(i = 0; i < iter->rank; i++) {
int leftover = iter->dimsizes[i] - start[i];
count[i] = iter->chunksizes[i];
if(iter->chunksizes[i] <= iter->dimsizes[i])
count[i] = iter->chunksizes[i];
else /* can happen for variables with only unlimited dimensions */
count[i] = iter->dimsizes[i];
if(leftover < count[i])
count[i] = leftover;
}