diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-08-29 02:18:41 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-08-29 02:18:41 (GMT) |
commit | 1103585dc13cd4aa3bb2a05b6e2232fb1fbd72bd (patch) | |
tree | 1eb83c6a093a4f326e1330eb4cc760d320d9b6ea /src | |
parent | d001bbde049a81e12d521903ae79de1f97ab2039 (diff) | |
download | hdf5-1103585dc13cd4aa3bb2a05b6e2232fb1fbd72bd.zip hdf5-1103585dc13cd4aa3bb2a05b6e2232fb1fbd72bd.tar.gz hdf5-1103585dc13cd4aa3bb2a05b6e2232fb1fbd72bd.tar.bz2 |
[svn-r27614] Description:
Align w/vds branch: Change code in H5O_layout_copy() to use switch for
different types of dataset layouts.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial & parallel
(h5committest forthcoming)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Olayout.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c index b499e31..b38d2a9 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -389,19 +389,35 @@ H5O_layout_copy(const void *_mesg, void *_dest) /* copy */ *dest = *mesg; - /* Deep copy the buffer for compact datasets also */ - if(mesg->type == H5D_COMPACT && mesg->storage.u.compact.size > 0) { - /* Allocate memory for the raw data */ - if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") - - /* Copy over the raw data */ - HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); - } /* end if */ + /* Special actions for each type of layout */ + switch(mesg->type) { + case H5D_COMPACT: + /* Deep copy the buffer for compact datasets also */ + if(mesg->storage.u.compact.size > 0) { + /* Allocate memory for the raw data */ + if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") + + /* Copy over the raw data */ + HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); + } /* end if */ + break; + + case H5D_CONTIGUOUS: + /* Nothing required */ + break; + + case H5D_CHUNKED: + /* Reset the pointer of the chunked storage index but not the address */ + if(dest->storage.u.chunk.ops) + H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE); + break; - /* Reset the pointer of the chunked storage index but not the address */ - if(dest->type == H5D_CHUNKED && dest->storage.u.chunk.ops) - H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE); + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + default: + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, NULL, "Invalid layout class") + } /* end switch */ /* Set return value */ ret_value = dest; |