diff options
Diffstat (limited to 'src/H5Olink.c')
-rw-r--r-- | src/H5Olink.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/H5Olink.c b/src/H5Olink.c index 175c937..ffe80e7 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -38,7 +38,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, const uint8_t *p); +static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_link_copy(const void *_mesg, void *_dest); static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -115,8 +116,8 @@ H5FL_DEFINE_STATIC(H5O_link_t); *------------------------------------------------------------------------- */ static void * -H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - const uint8_t *p) +H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_link_t *lnk = NULL; /* Pointer to link message */ size_t len = 0; /* Length of a string in the message */ @@ -145,7 +146,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, /* Check for non-default link type */ if(link_flags & H5O_LINK_STORE_LINK_TYPE) { /* Get the type of the link */ - lnk->type = *p++; + lnk->type = (H5L_type_t)*p++; if(lnk->type < H5L_TYPE_HARD || lnk->type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad link type") } /* end if */ @@ -197,7 +198,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length") /* Get the link's name */ - if(NULL == (lnk->name = H5MM_malloc(len + 1))) + if(NULL == (lnk->name = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(lnk->name, p, len); lnk->name[len] = '\0'; @@ -215,7 +216,7 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, UINT16DECODE(p, len) if(len == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length") - if(NULL == (lnk->u.soft.name = H5MM_malloc((size_t)len + 1))) + if(NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(lnk->u.soft.name, p, len); lnk->u.soft.name[len] = '\0'; @@ -253,7 +254,7 @@ done: H5MM_xfree(lnk->u.soft.name); if(lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL) H5MM_xfree(lnk->u.ud.udata); - H5FL_FREE(H5O_link_t, lnk); + (void)H5FL_FREE(H5O_link_t, lnk); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -323,7 +324,7 @@ H5O_link_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void /* Store the link name's length */ switch(link_flags & H5O_LINK_NAME_SIZE) { case 0: /* 1 byte size */ - *p++ = len; + *p++ = (uint8_t)len; break; case 1: /* 2 byte size */ @@ -534,12 +535,12 @@ H5O_link_reset(void *_mesg) if(lnk) { /* Free information for link (but don't free link pointer) */ if(lnk->type == H5L_TYPE_SOFT) - lnk->u.soft.name = H5MM_xfree(lnk->u.soft.name); + lnk->u.soft.name = (char *)H5MM_xfree(lnk->u.soft.name); else if (lnk->type >= H5L_TYPE_UD_MIN) { if(lnk->u.ud.size > 0) lnk->u.ud.udata = H5MM_xfree(lnk->u.ud.udata); } /* end if */ - lnk->name = H5MM_xfree(lnk->name); + lnk->name = (char *)H5MM_xfree(lnk->name); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -569,7 +570,7 @@ H5O_link_free(void *_mesg) /* Free information for link */ H5O_link_reset(lnk); - H5FL_FREE(H5O_link_t, lnk); + (void)H5FL_FREE(H5O_link_t, lnk); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_link_free() */ @@ -627,17 +628,17 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *_mesg) hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ /* Get a file ID for the file the link is in */ - if((file_id = H5F_get_id(f)) < 0) + if((file_id = H5F_get_id(f, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") /* Call user-defined link's 'delete' callback */ if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { - H5I_dec_ref(file_id); + H5I_dec_ref(file_id, FALSE); HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") } /* end if */ /* Release the file ID */ - if(H5I_dec_ref(file_id) < 0) + if(H5I_dec_ref(file_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") } /* end if */ } /* end if */ @@ -836,7 +837,7 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * default: if(lnk->type >= H5L_TYPE_UD_MIN) { if(lnk->type == H5L_TYPE_EXTERNAL) { - const char * objname = (const char *)lnk->u.ud.udata + (HDstrlen(lnk->u.ud.udata) + 1); + const char *objname = (const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External File Name:", lnk->u.ud.udata); |