diff options
author | Albert Cheng <acheng@hdfgroup.org> | 1998-02-09 19:37:40 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 1998-02-09 19:37:40 (GMT) |
commit | 7e8e3eec42254a6988b2739b621b1412963d590c (patch) | |
tree | cc7d01adda3675d67d35c8cb2edaf7a1dc469f40 /src/H5Odtype.c | |
parent | 35e7a062e26c1a65e571202a6fda0b475e42da00 (diff) | |
download | hdf5-7e8e3eec42254a6988b2739b621b1412963d590c.zip hdf5-7e8e3eec42254a6988b2739b621b1412963d590c.tar.gz hdf5-7e8e3eec42254a6988b2739b621b1412963d590c.tar.bz2 |
[svn-r230] Changes were actually made by Robb. I am commiting them for him
while he is visiting LLNL. I changed the default creation template
offset and length to 4. Will fix the problem later.
Changes since 19980205
----------------------
./src/H5H.c
./src/H5Hprivate.h
./src/H5O.c
./src/H5Ocont.c
./src/H5Odtype.c
./src/H5Oefl.c
./src/H5Olayout.c
./src/H5Oname.c
./src/H5Onull.c
./src/H5Oprivate.h
./src/H5Odspace.c
./src/H5Ostab.c
./src/debug.c
./html/H5.format.html
Added an extra 4-byte field after the heap magic number for
alignment on the DEC alpha. Changed object header message
alignment to 8-bytes.
./src/H5F.c
./src/H5Farray.c
./src/H5Ffamily.c
./src/H5Fistore.c
./src/H5Flow.c
./src/H5Fprivate.h
./src/H5Fsec2.c
./src/H5Fstdio.c
./src/H5Gnode.c
./src/H5O.c
./src/H5Odtype.c
./src/H5P.c
./src/H5Pprivate.h
./src/H5T.c
./src/H5Tconv.c
./src/H5Tpkg.h
./src/H5Tpublic.h
./src/H5V.c
./src/H5detect.c
./test/cmpd_dset.c
./test/dsets.c
./test/dtypes.c
./test/extend.c
./test/hyperslab.c
./test/istore.c
./test/th5p.c
./test/theap.c
Fixed a few irix64 warnings regarding size_t vs. int,
variables set but not used, printf formats
./config/irix64
Added `-woff 1196' to get rid of errors about __vfork() being
implicitly defined in a system header file.
./src/H5B.c
Fixed a stack alignment problem.
Diffstat (limited to 'src/H5Odtype.c')
-rw-r--r-- | src/H5Odtype.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 9b3777b..776dd86 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -202,10 +202,11 @@ H5O_dtype_decode_helper(const uint8 **pp, H5T_t *dt) static herr_t H5O_dtype_encode_helper(uint8 **pp, const H5T_t *dt) { - uintn flags = 0; - uintn perm_word; - char *hdr = (char *)*pp; - intn i, j, n; + uintn flags = 0; + uintn perm_word; + char *hdr = (char *)*pp; + intn i, j; + size_t n, z; FUNC_ENTER(H5O_dtype_encode_helper, FAIL); @@ -336,10 +337,14 @@ H5O_dtype_encode_helper(uint8 **pp, const H5T_t *dt) flags |= (dt->u.atomic.u.f.sign << 8) & 0xff00; UINT16ENCODE(*pp, dt->u.atomic.offset); UINT16ENCODE(*pp, dt->u.atomic.prec); - *(*pp)++ = dt->u.atomic.u.f.epos; - *(*pp)++ = dt->u.atomic.u.f.esize; - *(*pp)++ = dt->u.atomic.u.f.mpos; - *(*pp)++ = dt->u.atomic.u.f.msize; + assert (dt->u.atomic.u.f.epos<=255); + *(*pp)++ = (uint8)(dt->u.atomic.u.f.epos); + assert (dt->u.atomic.u.f.esize<=255); + *(*pp)++ = (uint8)(dt->u.atomic.u.f.esize); + assert (dt->u.atomic.u.f.mpos<=255); + *(*pp)++ = (uint8)(dt->u.atomic.u.f.mpos); + assert (dt->u.atomic.u.f.msize<=255); + *(*pp)++ = (uint8)(dt->u.atomic.u.f.msize); UINT32ENCODE(*pp, dt->u.atomic.u.f.ebias); break; @@ -349,10 +354,10 @@ 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++) { - HDstrcpy (*pp, dt->u.compnd.memb[i].name); + HDstrcpy ((char*)(*pp), dt->u.compnd.memb[i].name); n = strlen(dt->u.compnd.memb[i].name); - for (j=n+1; j%8; j++) (*pp)[j] = '\0'; - *pp += j; + for (z=n+1; z%8; z++) (*pp)[z] = '\0'; + *pp += z; UINT32ENCODE(*pp, dt->u.compnd.memb[i].offset); *(*pp)++ = dt->u.compnd.memb[i].ndims; assert(dt->u.compnd.memb[i].ndims <= 4); @@ -366,7 +371,7 @@ H5O_dtype_encode_helper(uint8 **pp, const H5T_t *dt) perm_word |= dt->u.compnd.memb[i].perm[j] << (8 * j); } UINT32ENCODE(*pp, perm_word); - if (H5O_dtype_encode_helper(pp, &(dt->u.compnd.memb[i].type)) < 0) { + 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"); } @@ -423,7 +428,7 @@ H5O_dtype_decode(H5F_t *f, size_t raw_size, const uint8 *p) HRETURN_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type"); } - assert(raw_size == H5O_dtype_size(f, (void *) dt)); + assert(raw_size == H5O_ALIGN (H5O_dtype_size(f, (void *) dt))); FUNC_LEAVE(dt); } @@ -454,7 +459,7 @@ H5O_dtype_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *mesg) /* check args */ assert(f); - assert(raw_size == H5O_dtype_size(f, mesg)); + assert(raw_size == H5O_ALIGN (H5O_dtype_size(f, mesg))); assert(p); assert(dt); @@ -674,22 +679,22 @@ H5O_dtype_debug(H5F_t *f, const void *mesg, FILE * stream, fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->u.compnd.memb[i].name); - fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), + fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth-3), "Byte offset:", (unsigned long) (dt->u.compnd.memb[i].offset)); - fprintf(stream, "%*s%-*s %d%s\n", indent + 3, "", MAX(0, fwidth - 3), + fprintf(stream, "%*s%-*s %d%s\n", indent + 3, "", MAX(0, fwidth-3), "Dimensionality:", dt->u.compnd.memb[i].ndims, 0 == dt->u.compnd.memb[i].ndims ? " (scalar)" : ""); if (dt->u.compnd.memb[i].ndims > 0) { - fprintf(stream, "%*s%-*s {", indent + 3, "", MAX(0, fwidth - 3), + fprintf(stream, "%*s%-*s {", indent + 3, "", MAX(0, fwidth-3), "Size:"); for (j = 0; j < dt->u.compnd.memb[i].ndims; j++) { fprintf(stream, "%s%lu", j ? ", " : "", (unsigned long) (dt->u.compnd.memb[i].dim[j])); } fprintf(stream, "}\n"); - fprintf(stream, "%*s%-*s {", indent + 3, "", MAX(0, fwidth - 3), + fprintf(stream, "%*s%-*s {", indent + 3, "", MAX(0, fwidth-3), "Permutation:"); for (j = 0; j < dt->u.compnd.memb[i].ndims; j++) { fprintf(stream, "%s%lu", j ? ", " : "", |