diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-06-27 05:51:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-06-27 05:51:04 (GMT) |
commit | 58a95d0d4a593157bb7e77f71347ee50783a11a0 (patch) | |
tree | 7a54c739616d9beabbbb8202ca0df568413ab040 /src | |
parent | df8bd7ccd6cd8d50280a3a7d862064c6340e2169 (diff) | |
download | hdf5-58a95d0d4a593157bb7e77f71347ee50783a11a0.zip hdf5-58a95d0d4a593157bb7e77f71347ee50783a11a0.tar.gz hdf5-58a95d0d4a593157bb7e77f71347ee50783a11a0.tar.bz2 |
[svn-r27292] Description:
Bring 'fail if unknown always' object header message flag from the
avoid_truncate branch, strengthen error checking for unknown messages, and try
to catch object header code configurations at compile time (instead of runtime).
Tested on:
MacOSX/64 10.10.3 (amazon) w/serial & parallel
(h5committest forthcoming)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5O.c | 9 | ||||
-rw-r--r-- | src/H5Ocache.c | 9 | ||||
-rw-r--r-- | src/H5Oprivate.h | 10 |
3 files changed, 16 insertions, 12 deletions
@@ -44,6 +44,9 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MFprivate.h" /* File memory management */ +#ifdef H5O_ENABLE_BOGUS +#include "H5MMprivate.h" /* Memory management */ +#endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared object header messages */ @@ -196,10 +199,10 @@ H5O_init_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* H5O interface sanity checks */ - HDassert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g)); - HDassert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN); + HDcompile_assert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g)); + HDcompile_assert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN); - HDassert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); + HDcompile_assert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_init_interface() */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index db1bd1f..203d0fc 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1130,7 +1130,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image id = *chunk_image++; /* Check for unknown message ID getting encoded in file */ - if(id == H5O_UNKNOWN_ID) + if(id >= H5O_UNKNOWN_ID) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "'unknown' message ID encoded in file?!?") /* Message size */ @@ -1218,9 +1218,10 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Set message to "unknown" class */ oh->mesg[mesgno].type = H5O_msg_class_g[H5O_UNKNOWN_ID]; - /* Check for "fail if unknown" message flag */ - if((udata->file_intent & H5F_ACC_RDWR) && - (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) + /* Check for "fail if unknown" message flags */ + if(((udata->file_intent & H5F_ACC_RDWR) && + (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) + || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") /* Check for "mark if unknown" message flag, etc. */ else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) && diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 92d0107..dbe74f7 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -75,7 +75,8 @@ typedef struct H5O_t H5O_t; #define H5O_MSG_FLAG_MARK_IF_UNKNOWN 0x10u #define H5O_MSG_FLAG_WAS_UNKNOWN 0x20u #define H5O_MSG_FLAG_SHAREABLE 0x40u -#define H5O_MSG_FLAG_BITS (H5O_MSG_FLAG_CONSTANT|H5O_MSG_FLAG_SHARED|H5O_MSG_FLAG_DONTSHARE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE|H5O_MSG_FLAG_MARK_IF_UNKNOWN|H5O_MSG_FLAG_WAS_UNKNOWN|H5O_MSG_FLAG_SHAREABLE) +#define H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS 0x80u +#define H5O_MSG_FLAG_BITS (H5O_MSG_FLAG_CONSTANT|H5O_MSG_FLAG_SHARED|H5O_MSG_FLAG_DONTSHARE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE|H5O_MSG_FLAG_MARK_IF_UNKNOWN|H5O_MSG_FLAG_WAS_UNKNOWN|H5O_MSG_FLAG_SHAREABLE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS) /* Flags for updating messages */ #define H5O_UPDATE_TIME 0x01u @@ -84,6 +85,9 @@ typedef struct H5O_t H5O_t; /* Hash value constants */ #define H5O_HASH_SIZE 32 +/* Enable reading/writing "bogus" messages */ +/* #define H5O_ENABLE_BOGUS */ + /* ========= Object Creation properties ============ */ #define H5O_CRT_ATTR_MAX_COMPACT_NAME "max compact attr" /* Max. # of attributes to store compactly */ #define H5O_CRT_ATTR_MIN_DENSE_NAME "min dense attr" /* Min. # of attributes to store densely */ @@ -196,7 +200,6 @@ typedef struct H5O_copy_t { #define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */ /* (this should never exist in a file) */ - /* Shared object message types. * Shared objects can be committed, in which case the shared message contains * the location of the object header that holds the message, or shared in the @@ -439,9 +442,6 @@ typedef struct H5O_layout_t { H5O_storage_t storage; /* Information for storing dataset elements */ } H5O_layout_t; -/* Enable reading/writing "bogus" messages */ -/* #define H5O_ENABLE_BOGUS */ - #ifdef H5O_ENABLE_BOGUS /* * "Bogus" Message. |