diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5F.c | 10 | ||||
-rw-r--r-- | src/H5Gprivate.h | 2 | ||||
-rw-r--r-- | src/H5Odtype.c | 45 |
3 files changed, 47 insertions, 10 deletions
@@ -742,6 +742,7 @@ H5F_open(const char *name, uintn flags, haddr_t addr1, addr2; /*temporary address */ H5G_entry_t root_ent; /*root symbol table entry */ const H5F_low_class_t *type = NULL; /*low-level file driver */ + haddr_t reserved_addr; /*reserved address */ FUNC_ENTER(H5F_open, NULL); @@ -996,6 +997,7 @@ H5F_open(const char *name, uintn flags, variable_size = H5F_SIZEOF_ADDR(f) + /*base address */ H5F_SIZEOF_ADDR(f) + /*global free list addr */ H5F_SIZEOF_ADDR(f) + /*logical file size */ + H5F_SIZEOF_ADDR(f) + /*reserved address*/ H5G_SIZEOF_ENTRY(f); assert(variable_size <= sizeof buf); addr1 = f->shared->boot_addr; @@ -1009,6 +1011,7 @@ H5F_open(const char *name, uintn flags, H5F_addr_decode(f, &p, &(f->shared->base_addr)); H5F_addr_decode(f, &p, &(f->shared->freespace_addr)); H5F_addr_decode(f, &p, &(f->shared->hdf5_eof)); + H5F_addr_decode(f, &p, &reserved_addr); if (H5G_ent_decode(f, &p, &root_ent) < 0) { HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root symbol entry"); @@ -1311,8 +1314,9 @@ H5Fopen (const char *filename, unsigned flags, hid_t access_id) static herr_t H5F_flush(H5F_t *f, hbool_t invalidate) { - uint8 buf[2048], *p = buf; - + uint8 buf[2048], *p = buf; + haddr_t reserved_addr; + FUNC_ENTER(H5F_flush, FAIL); /* @@ -1357,6 +1361,8 @@ H5F_flush(H5F_t *f, hbool_t invalidate) H5F_addr_encode(f, &p, &(f->shared->base_addr)); H5F_addr_encode(f, &p, &(f->shared->freespace_addr)); H5F_addr_encode(f, &p, &(f->shared->hdf5_eof)); + H5F_addr_undef(&reserved_addr); + H5F_addr_encode(f, &p, &reserved_addr); H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp)); /* update file length if necessary */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 03f0348..0f8f773 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -38,7 +38,7 @@ /* * The disk size for a symbol table entry... */ -#define H5G_SIZEOF_SCRATCH 24 +#define H5G_SIZEOF_SCRATCH 16 #define H5G_SIZEOF_ENTRY(F) \ (H5F_SIZEOF_SIZE(F) + /*offset of name into heap */ \ H5F_SIZEOF_ADDR(F) + /*address of object header */ \ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index aefa335..c890a03 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -174,15 +174,22 @@ H5O_dtype_decode_helper(const uint8 **pp, H5T_t *dt) dt->u.compnd.memb[i].ndims = *(*pp)++; assert(dt->u.compnd.memb[i].ndims <= 4); *pp += 3; /*reserved bytes */ - for (j = 0; j < dt->u.compnd.memb[i].ndims; j++) { - UINT32DECODE(*pp, dt->u.compnd.memb[i].dim[j]); - } + + /* Dimension permutation */ UINT32DECODE(*pp, perm_word); dt->u.compnd.memb[i].perm[0] = (perm_word >> 0) & 0xff; dt->u.compnd.memb[i].perm[1] = (perm_word >> 8) & 0xff; dt->u.compnd.memb[i].perm[2] = (perm_word >> 16) & 0xff; dt->u.compnd.memb[i].perm[3] = (perm_word >> 24) & 0xff; dt->u.compnd.memb[i].type = H5MM_calloc (sizeof(H5T_t)); + + /* Reserved */ + *pp += 4; + + /* Dimension sizes */ + for (j=0; j<4; j++) { + UINT32DECODE(*pp, dt->u.compnd.memb[i].dim[j]); + } if (NULL==dt->u.compnd.memb[i].type) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -400,23 +407,42 @@ H5O_dtype_encode_helper(uint8 **pp, const H5T_t *dt) */ flags = dt->u.compnd.nmembs & 0xffff; for (i = 0; i < dt->u.compnd.nmembs; i++) { + /* Name, multiple of eight bytes */ HDstrcpy ((char*)(*pp), dt->u.compnd.memb[i].name); n = strlen(dt->u.compnd.memb[i].name); for (z=n+1; z%8; z++) (*pp)[z] = '\0'; *pp += z; + + /* Member offset */ UINT32ENCODE(*pp, dt->u.compnd.memb[i].offset); + + /* Dimensionality */ *(*pp)++ = dt->u.compnd.memb[i].ndims; assert(dt->u.compnd.memb[i].ndims <= 4); + + /* Reserved */ *(*pp)++ = '\0'; *(*pp)++ = '\0'; *(*pp)++ = '\0'; - for (j = 0; j < dt->u.compnd.memb[i].ndims; j++) { - UINT32ENCODE(*pp, dt->u.compnd.memb[i].dim[j]); - } + + /* Dimension permutation */ for (j = 0, perm_word = 0; j < dt->u.compnd.memb[i].ndims; j++) { perm_word |= dt->u.compnd.memb[i].perm[j] << (8 * j); } UINT32ENCODE(*pp, perm_word); + + /* Reserved */ + UINT32ENCODE(*pp, 0); + + /* Dimensions */ + for (j=0; j<dt->u.compnd.memb[i].ndims; j++) { + UINT32ENCODE(*pp, dt->u.compnd.memb[i].dim[j]); + } + for (/*void*/; j<4; j++) { + UINT32ENCODE(*pp, 0); + } + + /* Subtype */ if (H5O_dtype_encode_helper(pp, dt->u.compnd.memb[i].type)<0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode member type"); @@ -597,7 +623,12 @@ H5O_dtype_size(H5F_t *f, const void *mesg) case H5T_COMPOUND: for (i = 0; i < dt->u.compnd.nmembs; i++) { ret_value += ((HDstrlen(dt->u.compnd.memb[i].name) + 8) / 8) * 8; - ret_value += 12 + dt->u.compnd.memb[i].ndims * 4; + ret_value += 4 + /*member offset*/ + 1 + /*dimensionality*/ + 3 + /*reserved*/ + 4 + /*permutation*/ + 4 + /*reserved*/ + 16; /*dimensions*/ ret_value += H5O_dtype_size(f, dt->u.compnd.memb[i].type); } break; |