diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-01-02 19:59:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-01-02 19:59:11 (GMT) |
commit | 1bba04f3e50aab260ca1986f410dad7899737c1f (patch) | |
tree | ac1bd95628c70b9901de0d768e9d95bd4d028701 /src | |
parent | 2a8faf8f776ac5e22791b2d2bddceebc2628433d (diff) | |
download | hdf5-1bba04f3e50aab260ca1986f410dad7899737c1f.zip hdf5-1bba04f3e50aab260ca1986f410dad7899737c1f.tar.gz hdf5-1bba04f3e50aab260ca1986f410dad7899737c1f.tar.bz2 |
[svn-r11852] Purpose:
Code cleanup/update
Description:
Update compiler flags for gcc 4.1.x & start cleaning up some of the C++
compatibility
Platforms tested:
FreeBSD 4.11 (sleipnir) w/gcc 4.1 and/or g++
Diffstat (limited to 'src')
-rw-r--r-- | src/H5A.c | 34 | ||||
-rw-r--r-- | src/H5FLprivate.h | 36 |
2 files changed, 35 insertions, 35 deletions
@@ -203,9 +203,9 @@ H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") - if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Go do the real work for attaching the attribute to the dataset */ @@ -576,7 +576,7 @@ H5A_open(H5G_loc_t *loc, unsigned idx, hid_t dxpl_id) /* Read in attribute with H5O_read() */ H5_CHECK_OVERFLOW(idx,unsigned,int); - if(NULL == (attr = H5O_read(loc->oloc, H5O_ATTR_ID, (int)idx, NULL, dxpl_id))) + if(NULL == (attr = (H5A_t *)H5O_read(loc->oloc, H5O_ATTR_ID, (int)idx, NULL, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from dataset header") attr->initialized = TRUE; @@ -644,9 +644,9 @@ H5Awrite(hid_t attr_id, hid_t type_id, const void *buf) H5TRACE3("e","iix",attr_id,type_id,buf); /* check arguments */ - if(NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (mem_type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (mem_type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") @@ -732,7 +732,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) /* Free the previous attribute data buffer, if there is one */ if(attr->data) - H5FL_BLK_FREE(attr_buf, attr->data); + attr->data = H5FL_BLK_FREE(attr_buf, attr->data); /* Set the pointer to the attribute data to the converted information */ attr->data = tconv_buf; @@ -769,7 +769,7 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id); if(bkg_buf) - H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_write() */ @@ -802,9 +802,9 @@ H5Aread(hid_t attr_id, hid_t type_id, void *buf) H5TRACE3("e","iix",attr_id,type_id,buf); /* check arguments */ - if(NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (mem_type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (mem_type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") @@ -912,9 +912,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id); if(tconv_buf) - H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_read() */ @@ -947,7 +947,7 @@ H5Aget_space(hid_t attr_id) H5TRACE1("i","i",attr_id); /* check arguments */ - if(NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Copy the attribute's dataspace */ @@ -990,7 +990,7 @@ H5Aget_type(hid_t attr_id) H5TRACE1("i","i",attr_id); /* check arguments */ - if(NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* @@ -1108,7 +1108,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) H5TRACE3("Zs","izs",attr_id,buf_size,buf); /* check arguments */ - if(NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(!buf && buf_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") @@ -1165,7 +1165,7 @@ H5Aget_storage_size(hid_t attr_id) H5TRACE1("h","i",attr_id); /* Check args */ - if(NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* Set return value */ @@ -1653,7 +1653,7 @@ H5A_free(H5A_t *attr) if(H5S_close(attr->ds) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") if(attr->data) - H5FL_BLK_FREE(attr_buf, attr->data); + attr->data = H5FL_BLK_FREE(attr_buf, attr->data); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1694,7 +1694,7 @@ H5A_close(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") /* Free temporary buffer */ - H5FL_BLK_FREE(attr_buf, tmp_buf); + tmp_buf = H5FL_BLK_FREE(attr_buf, tmp_buf); } /* end if */ /* Free dynamicly allocated items */ diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 325eef8..2ff31c7 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -120,10 +120,10 @@ typedef struct H5FL_reg_head_t { #define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t) /* Allocate an object of type 't' */ -#define H5FL_MALLOC(t) H5FL_reg_malloc(&(H5FL_REG_NAME(t)) H5FL_TRACK_INFO) +#define H5FL_MALLOC(t) (t *)H5FL_reg_malloc(&(H5FL_REG_NAME(t)) H5FL_TRACK_INFO) /* Allocate an object of type 't' and clear it to all zeros */ -#define H5FL_CALLOC(t) H5FL_reg_calloc(&(H5FL_REG_NAME(t)) H5FL_TRACK_INFO) +#define H5FL_CALLOC(t) (t *)H5FL_reg_calloc(&(H5FL_REG_NAME(t)) H5FL_TRACK_INFO) /* Free an object of type 't' */ #define H5FL_FREE(t,obj) H5FL_reg_free(&(H5FL_REG_NAME(t)),obj) @@ -140,8 +140,8 @@ typedef struct H5FL_reg_head_t { #define H5FL_DEFINE(t) H5_DLL H5FL_DEFINE_COMMON(t) #define H5FL_EXTERN(t) extern H5_DLL int H5FL_REG_NAME(t) #define H5FL_DEFINE_STATIC(t) static H5FL_DEFINE_COMMON(t) -#define H5FL_MALLOC(t) H5MM_malloc(sizeof(t)) -#define H5FL_CALLOC(t) H5MM_calloc(sizeof(t)) +#define H5FL_MALLOC(t) (t *)H5MM_malloc(sizeof(t)) +#define H5FL_CALLOC(t) (t *)H5MM_calloc(sizeof(t)) #define H5FL_FREE(t,obj) H5MM_xfree(obj) #endif /* H5_NO_REG_FREE_LISTS */ @@ -189,16 +189,16 @@ typedef struct H5FL_blk_head_t { #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) /* Allocate an block of type 't' */ -#define H5FL_BLK_MALLOC(t,size) H5FL_blk_malloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) +#define H5FL_BLK_MALLOC(t,size) (uint8_t *)H5FL_blk_malloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) /* Allocate an block of type 't' and clear it to zeros */ -#define H5FL_BLK_CALLOC(t,size) H5FL_blk_calloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) +#define H5FL_BLK_CALLOC(t,size) (uint8_t *)H5FL_blk_calloc(&(H5FL_BLK_NAME(t)),size H5FL_TRACK_INFO) /* Free a block of type 't' */ -#define H5FL_BLK_FREE(t,blk) H5FL_blk_free(&(H5FL_BLK_NAME(t)),blk) +#define H5FL_BLK_FREE(t,blk) (uint8_t *)H5FL_blk_free(&(H5FL_BLK_NAME(t)),blk) /* Re-allocate a block of type 't' */ -#define H5FL_BLK_REALLOC(t,blk,new_size) H5FL_blk_realloc(&(H5FL_BLK_NAME(t)),blk,new_size H5FL_TRACK_INFO) +#define H5FL_BLK_REALLOC(t,blk,new_size) (uint8_t *)H5FL_blk_realloc(&(H5FL_BLK_NAME(t)),blk,new_size H5FL_TRACK_INFO) /* Check if there is a free block available to re-use */ #define H5FL_BLK_AVAIL(t,size) H5FL_blk_free_block_avail(&(H5FL_BLK_NAME(t)),size) @@ -210,10 +210,10 @@ typedef struct H5FL_blk_head_t { #define H5FL_BLK_DEFINE(t) H5_DLL H5FL_BLK_DEFINE_COMMON(t) #define H5FL_BLK_EXTERN(t) extern H5_DLL int H5FL_BLK_NAME(t) #define H5FL_BLK_DEFINE_STATIC(t) static H5FL_BLK_DEFINE_COMMON(t) -#define H5FL_BLK_MALLOC(t,size) H5MM_malloc(size) -#define H5FL_BLK_CALLOC(t,size) H5MM_calloc(size) -#define H5FL_BLK_FREE(t,blk) H5MM_xfree(blk) -#define H5FL_BLK_REALLOC(t,blk,new_size) H5MM_realloc(blk,new_size) +#define H5FL_BLK_MALLOC(t,size) (uint8_t *)H5MM_malloc(size) +#define H5FL_BLK_CALLOC(t,size) (uint8_t *)H5MM_calloc(size) +#define H5FL_BLK_FREE(t,blk) (uint8_t *)H5MM_xfree(blk) +#define H5FL_BLK_REALLOC(t,blk,new_size) (uint8_t *)H5MM_realloc(blk,new_size) #define H5FL_BLK_AVAIL(t,size) (FALSE) #endif /* H5_NO_BLK_FREE_LISTS */ @@ -321,16 +321,16 @@ typedef struct H5FL_seq_head_t { #define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t) /* Allocate a sequence of type 't' */ -#define H5FL_SEQ_MALLOC(t,elem) H5FL_seq_malloc(&(H5FL_SEQ_NAME(t)),elem H5FL_TRACK_INFO) +#define H5FL_SEQ_MALLOC(t,elem) (t *)H5FL_seq_malloc(&(H5FL_SEQ_NAME(t)),elem H5FL_TRACK_INFO) /* Allocate a sequence of type 't' and clear it to all zeros */ -#define H5FL_SEQ_CALLOC(t,elem) H5FL_seq_calloc(&(H5FL_SEQ_NAME(t)),elem H5FL_TRACK_INFO) +#define H5FL_SEQ_CALLOC(t,elem) (t *)H5FL_seq_calloc(&(H5FL_SEQ_NAME(t)),elem H5FL_TRACK_INFO) /* Free a sequence of type 't' */ #define H5FL_SEQ_FREE(t,obj) H5FL_seq_free(&(H5FL_SEQ_NAME(t)),obj) /* Re-allocate a sequence of type 't' */ -#define H5FL_SEQ_REALLOC(t,obj,new_elem) H5FL_seq_realloc(&(H5FL_SEQ_NAME(t)),obj,new_elem H5FL_TRACK_INFO) +#define H5FL_SEQ_REALLOC(t,obj,new_elem) (t *)H5FL_seq_realloc(&(H5FL_SEQ_NAME(t)),obj,new_elem H5FL_TRACK_INFO) #else /* H5_NO_SEQ_FREE_LISTS */ /* Common macro for H5FL_BLK_DEFINE & H5FL_BLK_DEFINE_STATIC */ @@ -339,10 +339,10 @@ typedef struct H5FL_seq_head_t { #define H5FL_SEQ_DEFINE(t) H5_DLL H5FL_SEQ_DEFINE_COMMON(t) #define H5FL_SEQ_EXTERN(t) extern H5_DLL int H5FL_SEQ_NAME(t) #define H5FL_SEQ_DEFINE_STATIC(t) static H5FL_SEQ_DEFINE_COMMON(t) -#define H5FL_SEQ_MALLOC(t,elem) H5MM_malloc((elem)*sizeof(t)) -#define H5FL_SEQ_CALLOC(t,elem) H5MM_calloc((elem)*sizeof(t)) +#define H5FL_SEQ_MALLOC(t,elem) (t *)H5MM_malloc((elem)*sizeof(t)) +#define H5FL_SEQ_CALLOC(t,elem) (t *)H5MM_calloc((elem)*sizeof(t)) #define H5FL_SEQ_FREE(t,obj) H5MM_xfree(obj) -#define H5FL_SEQ_REALLOC(t,obj,new_elem) H5MM_realloc(obj,(new_elem)*sizeof(t)) +#define H5FL_SEQ_REALLOC(t,obj,new_elem) (t *)H5MM_realloc(obj,(new_elem)*sizeof(t)) #endif /* H5_NO_SEQ_FREE_LISTS */ /* Data structure for free list block factory */ |