mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
[svn-r19818] Purpose:
Change to skip copying when a dataset is not allocated. Tested: jam (linux32-LE), amani (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE)
This commit is contained in:
parent
76c354a610
commit
5f1db21f84
@ -559,6 +559,7 @@ int do_copy_objects(hid_t fidin,
|
||||
named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes copied */
|
||||
size_t msize; /* size of type */
|
||||
hsize_t nelmts; /* number of elements in dataset */
|
||||
H5D_space_status_t *space_status; /* determines whether space has been allocated for the dataset */
|
||||
int rank; /* rank of dataset */
|
||||
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
|
||||
hsize_t dsize_in; /* input dataset size before filter */
|
||||
@ -746,6 +747,10 @@ int do_copy_objects(hid_t fidin,
|
||||
HDmemset(dims, 0, sizeof dims);
|
||||
if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
|
||||
goto error;
|
||||
|
||||
if(H5Dget_space_status(dset_in, &space_status) <0)
|
||||
goto error;
|
||||
|
||||
nelmts = 1;
|
||||
for ( j = 0; j < rank; j++)
|
||||
{
|
||||
@ -834,9 +839,11 @@ int do_copy_objects(hid_t fidin,
|
||||
* read/write
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (nelmts)
|
||||
if (nelmts>0 && space_status!=H5D_SPACE_STATUS_NOT_ALLOCATED)
|
||||
{
|
||||
size_t need = (size_t)(nelmts*msize); /* bytes needed */
|
||||
|
||||
/* have to read the whole dataset if there is only one element in the dataset */
|
||||
if ( need < H5TOOLS_MALLOCSIZE )
|
||||
buf = HDmalloc(need);
|
||||
|
||||
@ -847,7 +854,6 @@ int do_copy_objects(hid_t fidin,
|
||||
if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
else /* possibly not enough memory, read/write by hyperslabs */
|
||||
{
|
||||
size_t p_type_nbytes = msize; /*size of memory type */
|
||||
@ -949,7 +955,7 @@ int do_copy_objects(hid_t fidin,
|
||||
sm_buf=NULL;
|
||||
}
|
||||
} /* hyperslab read */
|
||||
}/*nelmts*/
|
||||
} /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* amount of compression used
|
||||
|
Loading…
Reference in New Issue
Block a user