diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-01 10:27:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-01 10:27:45 (GMT) |
commit | 642f392ba3e2d30ae2a82e32f249461121d17cbc (patch) | |
tree | bbce1ae1606153f323156f207b50d88d7fba2ddf /src/H5O.c | |
parent | c034336452ee48574f0dd65bf053079f9801e269 (diff) | |
download | hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.zip hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.tar.gz hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.tar.bz2 |
[svn-r19330] Description:
Bring r19109:19328 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5O.c')
-rw-r--r-- | src/H5O.c | 71 |
1 files changed, 47 insertions, 24 deletions
@@ -1053,17 +1053,29 @@ H5Oclose(hid_t object_id) H5TRACE1("e", "i", object_id); /* Get the type of the object and close it in the correct way */ - switch(H5I_get_type(object_id)) - { - case(H5I_GROUP): - case(H5I_DATATYPE): - case(H5I_DATASET): + switch(H5I_get_type(object_id)) { + case H5I_GROUP: + case H5I_DATATYPE: + case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_ref(object_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") break; @@ -1229,14 +1241,14 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, oh->mesg[0].dirty = TRUE; oh->mesg[0].native = NULL; oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh); - oh->mesg[0].raw_size = size_hint - H5O_SIZEOF_MSGHDR_OH(oh); + oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh); oh->mesg[0].chunkno = 0; /* Set metadata tag in dxpl_id */ H5_BEGIN_TAG(dxpl_id, oh_addr, FAIL); /* Cache object header */ - if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") oh = NULL; @@ -1486,7 +1498,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative") /* Adjust the link count for the object header */ - oh->nlink += adjust; + oh->nlink = (unsigned)((int)oh->nlink + adjust); /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) @@ -1518,7 +1530,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted) } /* end if */ /* Adjust the link count for the object header */ - oh->nlink += adjust; + oh->nlink = (unsigned)((int)oh->nlink + adjust); /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) @@ -1675,6 +1687,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) * when the object header is actually loaded from the file. */ HDassert(udata.made_attempt == TRUE); + HDassert(cont_msg_info.msgs); /* Construct the user data for protecting chunks */ chk_udata.decoding = TRUE; @@ -1716,8 +1729,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) } /* end while */ /* Release any continuation messages built up */ - if(cont_msg_info.msgs) - cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs); + cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs); /* Pass back out some of the chunk's user data */ udata.common.merged_null_msgs = chk_udata.common.merged_null_msgs; @@ -1991,7 +2003,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) break; /* Create a new message, if necessary */ - if(idx == oh->nmesgs) { + if(idx == (int)oh->nmesgs) { unsigned mesg_flags = 0; /* Flags for message in object header */ /* If we would have to create a new message, but we aren't 'forcing' it, get out now */ @@ -2427,23 +2439,35 @@ H5O_get_loc(hid_t object_id) FUNC_ENTER_NOAPI_NOINIT(H5O_get_loc) - switch(H5I_get_type(object_id)) - { - case(H5I_GROUP): + switch(H5I_get_type(object_id)) { + case H5I_GROUP: if(NULL == (ret_value = H5O_OBJ_GROUP->get_oloc(object_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID") break; - case(H5I_DATASET): + case H5I_DATASET: if(NULL == (ret_value = H5O_OBJ_DATASET->get_oloc(object_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID") break; - case(H5I_DATATYPE): + case H5I_DATATYPE: if(NULL == (ret_value = H5O_OBJ_DATATYPE->get_oloc(object_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID") break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type") } /* end switch */ @@ -2505,7 +2529,7 @@ H5O_loc_reset(H5O_loc_t *loc) *------------------------------------------------------------------------- */ herr_t -H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth) +H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_loc_copy) @@ -2525,8 +2549,7 @@ H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth) if(src->holding_file) dst->file->nopen_objs++; } else if(depth == H5_COPY_SHALLOW) { - /* Discarding 'const' qualifier OK - QAK */ - H5O_loc_reset((H5O_loc_t *)src); + H5O_loc_reset(src); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -2687,7 +2710,7 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) hdr->flags = oh->flags; /* Iterate over all the messages, accumulating message size & type information */ - hdr->space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1)); + hdr->space.meta = (hsize_t)H5O_SIZEOF_HDR(oh) + (hsize_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1)); hdr->space.mesg = 0; hdr->space.free = 0; hdr->mesg.present = 0; @@ -2697,11 +2720,11 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) /* Accumulate space usage information, based on the type of message */ if(H5O_NULL_ID == curr_msg->type->id) - hdr->space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size; + hdr->space.free += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size); else if(H5O_CONT_ID == curr_msg->type->id) - hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size; + hdr->space.meta += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size); else { - hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh); + hdr->space.meta += (hsize_t)H5O_SIZEOF_MSGHDR_OH(oh); hdr->space.mesg += curr_msg->raw_size; } /* end else */ |