mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Fix possibility of divide by zero in rechunking.
This commit is contained in:
parent
f99e03dc36
commit
93878e8816
@ -7,7 +7,7 @@ This file contains a high-level description of this package's evolution. Release
|
||||
|
||||
## 4.3.1.2 Released TBD
|
||||
|
||||
* Fixed small default chunk size for 1-dimensional record variables.
|
||||
* Fixed small default chunk size for 1-dimensional record variables. [NCF-211](https://bugtracking.unidata.ucar.edu/browse/NCF-211)
|
||||
|
||||
* Cleaned up type handling in netCDF-4 to fix bugs with fill-values.
|
||||
|
||||
|
@ -235,11 +235,10 @@ static int
|
||||
nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
{
|
||||
int d;
|
||||
size_t type_size, max_len = 0;
|
||||
size_t type_size;
|
||||
float num_values = 1, num_set = 0;
|
||||
int retval;
|
||||
#ifdef LOGGING
|
||||
int max_dim;
|
||||
double total_chunk_size;
|
||||
#endif
|
||||
|
||||
@ -260,20 +259,10 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
for (d = 0; d < var->ndims; d++)
|
||||
{
|
||||
assert(var->dim[d]);
|
||||
if (var->dim[d]->len)
|
||||
if (var->dim[d]->len > 0)
|
||||
num_values *= (float)var->dim[d]->len;
|
||||
else
|
||||
num_set++;
|
||||
|
||||
if (var->dim[d]->len > max_len)
|
||||
{
|
||||
max_len = var->dim[d]->len;
|
||||
#ifdef LOGGING
|
||||
max_dim = d;
|
||||
#endif
|
||||
}
|
||||
LOG((4, "d = %d max_dim %d max_len %ld num_values %f", d, max_dim, max_len,
|
||||
num_values));
|
||||
}
|
||||
|
||||
/* Pick a chunk length for each dimension, if one has not already
|
||||
|
Loading…
Reference in New Issue
Block a user