diff options
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r-- | src/H5Olayout.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c index ce079ed..d3fe92c 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -181,6 +181,16 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, /* Interpret the rest of the message according to the layout class */ switch(mesg->type) { + case H5D_COMPACT: + UINT16DECODE(p, mesg->u.compact.size); + if(mesg->u.compact.size > 0) { + if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") + HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size); + p += mesg->u.compact.size; + } /* end if */ + break; + case H5D_CONTIGUOUS: H5F_addr_decode(f, &p, &(mesg->u.contig.addr)); H5F_DECODE_LENGTH(f, p, mesg->u.contig.size); @@ -204,16 +214,6 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, mesg->u.chunk.size *= mesg->u.chunk.dim[u]; break; - case H5D_COMPACT: - UINT16DECODE(p, mesg->u.compact.size); - if(mesg->u.compact.size > 0) { - if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") - HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size); - p += mesg->u.compact.size; - } /* end if */ - break; - default: HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class") } /* end switch */ @@ -283,6 +283,20 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi /* Write out layout class specific information */ switch(mesg->type) { + case H5D_COMPACT: + /* Size of raw data */ + UINT16ENCODE(p, mesg->u.compact.size); + + /* Raw data */ + if(mesg->u.compact.size > 0) { + if(mesg->u.compact.buf) + HDmemcpy(p, mesg->u.compact.buf, mesg->u.compact.size); + else + HDmemset(p, 0, mesg->u.compact.size); + p += mesg->u.compact.size; + } /* end if */ + break; + case H5D_CONTIGUOUS: H5F_addr_encode(f, &p, mesg->u.contig.addr); H5F_ENCODE_LENGTH(f, p, mesg->u.contig.size); @@ -301,20 +315,6 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi UINT32ENCODE(p, mesg->u.chunk.dim[u]); break; - case H5D_COMPACT: - /* Size of raw data */ - UINT16ENCODE(p, mesg->u.compact.size); - - /* Raw data */ - if(mesg->u.compact.size > 0) { - if(mesg->u.compact.buf) - HDmemcpy(p, mesg->u.compact.buf, mesg->u.compact.size); - else - HDmemset(p, 0, mesg->u.compact.size); - p += mesg->u.compact.size; - } /* end if */ - break; - default: HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class") } /* end switch */ @@ -406,6 +406,11 @@ H5O_layout_meta_size(const H5F_t *f, const void *_mesg) 1; /* layout class type */ switch(mesg->type) { + case H5D_COMPACT: + /* Size of raw data */ + ret_value += 2; + break; + case H5D_CONTIGUOUS: ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */ @@ -423,11 +428,6 @@ H5O_layout_meta_size(const H5F_t *f, const void *_mesg) ret_value += mesg->u.chunk.ndims * 4; break; - case H5D_COMPACT: - /* Size of raw data */ - ret_value += 2; - break; - default: HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class") } /* end switch */ |