summaryrefslogtreecommitdiffstats
path: root/src/H5Odtype.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-20 14:41:13 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-20 14:41:13 (GMT)
commit29bf0662db641fde339ff9237bd1277509a047f1 (patch)
tree159c0ea547f974050e64a51da81d6fff4097896b /src/H5Odtype.c
parent365dac33e385affcb57a6b8a5cf53f8d03ac2510 (diff)
downloadhdf5-29bf0662db641fde339ff9237bd1277509a047f1.zip
hdf5-29bf0662db641fde339ff9237bd1277509a047f1.tar.gz
hdf5-29bf0662db641fde339ff9237bd1277509a047f1.tar.bz2
[svn-r516] Changes since 19980720
---------------------- ./doc/html/H5.format.html ./src/H5F.c ./src/H5Gprivate.h ./src/H5Oshared.c Added file alignment fields: the boot block has an extra reserved address field. The symbol table entry scratch pad space was reduced from 24 bytes to 16 bytes. The index permutation was moved earlier in the data type message for compound data types and extra padding was added. Four bytes of padding was added to the shared message format.
Diffstat (limited to 'src/H5Odtype.c')
-rw-r--r--src/H5Odtype.c45
1 files changed, 38 insertions, 7 deletions
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;