diff options
Diffstat (limited to 'fortran/src/H5Pf.c')
-rw-r--r-- | fortran/src/H5Pf.c | 125 |
1 files changed, 61 insertions, 64 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 96b771d..29ba593 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -22,7 +21,7 @@ /*---------------------------------------------------------------------------- * Name: h5pcreate_c * Purpose: Call H5Pcreate to create a property list - * Inputs: class - property list class identifier + * Inputs: cls - property list class identifier * Outputs: prp_id - identifier of the created property list * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal @@ -31,12 +30,12 @@ *---------------------------------------------------------------------------*/ int_f -nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ) +nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id ) { hid_t c_prp_id; int_f ret_value = 0; - c_prp_id = H5Pcreate((hid_t)*class); + c_prp_id = H5Pcreate((hid_t)*cls); if(c_prp_id < 0) HGOTO_DONE(FAIL) @@ -264,7 +263,7 @@ nh5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims ) herr_t status; int i; - c_dims = malloc(sizeof(hsize_t) * (*rank )); + c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * (*rank )); if (!c_dims) return ret_value; /* @@ -309,7 +308,7 @@ nh5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims ) int c_max_rank; int i; - c_dims = malloc(sizeof(hsize_t) * (*max_rank )); + c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * (*max_rank )); if (!c_dims) return ret_value; c_prp_id = (hid_t)*prp_id; @@ -1311,8 +1310,8 @@ nh5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, h c_meta_ext_size = (size_t) *meta_ext_size; c_raw_ext_size = (size_t) *raw_ext_size; - c_meta_ext = (char*)malloc(sizeof(char)*c_meta_ext_size); - c_raw_ext = (char*)malloc(sizeof(char)*c_raw_ext_size); + c_meta_ext = (char *)HDmalloc(sizeof(char) * c_meta_ext_size); + c_raw_ext = (char *)HDmalloc(sizeof(char) * c_raw_ext_size); if(c_meta_ext == NULL || c_raw_ext == NULL) return ret_value; /* @@ -1481,7 +1480,7 @@ nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nel c_filter = (H5Z_filter_t)*filter; c_flags = (unsigned)*flags; c_cd_nelmts = (size_t)*cd_nelmts; - c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts)); + c_cd_values = (unsigned int*)HDmalloc(sizeof(unsigned int) * ((int)c_cd_nelmts)); if (!c_cd_values) return ret_value; for (i = 0; i < c_cd_nelmts; i++) c_cd_values[i] = (unsigned int)cd_values[i]; @@ -1566,10 +1565,10 @@ nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* c_cd_nelmts = (size_t)*cd_nelmts; - if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1))) + if(NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1))) goto DONE; - if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts))) + if(NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts))) goto DONE; /* @@ -1702,7 +1701,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, /* * Allocate memory to store the name of the external file. */ - if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1); + if(c_namelen) c_name = (char*)HDmalloc(c_namelen + 1); if (c_name == NULL) return ret_value; /* @@ -2232,14 +2231,14 @@ nh5pget_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size) * Inputs: parent - property list class identifier * name - name of the new class * name_len - lenght of the "name" buffer - * Outputs: class - new class identifier + * Outputs: cls - new class identifier * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * October 11, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class) +nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls) { int ret_value = -1; hid_t c_parent; @@ -2255,7 +2254,7 @@ nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class) */ c_class = H5Pcreate_class(c_parent, c_name, NULL, NULL,NULL,NULL,NULL,NULL); if (c_class < 0) goto DONE; - *class = (hid_t_f)c_class; + *cls = (hid_t_f)c_class; ret_value = 0; DONE: @@ -2266,7 +2265,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5pregisterc_c * Purpose: Call h5pregister_c to registers a permanent property - * Inputs: class - property list class identifier + * Inputs: cls - property list class identifier * name - name of the new property * name_len - length of the "name" buffer * size - property size @@ -2277,21 +2276,21 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pregisterc_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f UNUSED *value_len) +nh5pregisterc_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f UNUSED *value_len) { int ret_value = -1; /* * Call h5pregister_c function */ - ret_value = nh5pregister_c(class, name, name_len, size, _fcdtocp(value)); + ret_value = nh5pregister_c(cls, name, name_len, size, _fcdtocp(value)); return ret_value; } /*---------------------------------------------------------------------------- * Name: h5pregister_c * Purpose: Call H5Pregister2 to registers a permanent property - * Inputs: class - property list class identifier + * Inputs: cls - property list class identifier * name - name of the new property * name_len - length of the "name" buffer * size - property size @@ -2302,7 +2301,7 @@ nh5pregisterc_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, _fcd * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pregister_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void UNUSED *value) +nh5pregister_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void UNUSED *value) { char* c_name = NULL; int_f ret_value = -1; @@ -2313,7 +2312,7 @@ nh5pregister_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void /* * Call H5Pregister2 function. */ - if(H5Pregister2((hid_t)*class, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5Pregister2((hid_t)*cls, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto DONE; ret_value = 0; @@ -2324,30 +2323,30 @@ DONE: } int_f -nh5pregister_integer_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) +nh5pregister_integer_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value) { /* * Call h5pregister_c function */ - return nh5pregister_c(class, name, name_len, size, value); + return nh5pregister_c(cls, name, name_len, size, value); } int_f -nh5pregister_real_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) +nh5pregister_real_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value) { /* * Call h5pregister_c function */ - return nh5pregister_c(class, name, name_len, size, value); + return nh5pregister_c(cls, name, name_len, size, value); } int_f -nh5pregister_double_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) +nh5pregister_double_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value) { /* * Call h5pregister_c function */ - return nh5pregister_c(class, name, name_len, size, value); + return nh5pregister_c(cls, name, name_len, size, value); } /*---------------------------------------------------------------------------- @@ -2450,7 +2449,7 @@ nh5pinsert_double_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pexist_c(hid_t_f *class, _fcd name, int_f *name_len) +nh5pexist_c(hid_t_f *cls, _fcd name, int_f *name_len) { int_f ret_value = -1; hid_t c_class; @@ -2460,7 +2459,7 @@ nh5pexist_c(hid_t_f *class, _fcd name, int_f *name_len) c_name = (char *)HD5f2cstring(name, (size_t)*name_len); if (c_name == NULL) goto DONE; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; /* * Call H5Pexist function. */ @@ -2476,21 +2475,21 @@ DONE: * Purpose: Call H5Pisa_class to querie whether a property is a * member of a class * Inputs: plist - property list identifier - * class - property class identifier + * cls - property class identifier * Returns: nonnegative on success, -1 on failure * Programmer: Elena Pourmal * October 11, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pisa_class_c(hid_t_f *plist, hid_t_f *class) +nh5pisa_class_c(hid_t_f *plist, hid_t_f *cls) { int_f ret_value = -1; hid_t c_class; hid_t c_plist; htri_t status; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; c_plist = (hid_t)*plist; /* @@ -2663,7 +2662,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5punregister_c * Purpose: Call H5Punregister to remove a property from a property class - * Inputs: class - identifier of property class + * Inputs: cls - identifier of property class * name - name of the property to unregister * name_len - length of the "name" buffer * Returns: 0 on success, -1 on failure @@ -2672,7 +2671,7 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len) +nh5punregister_c(hid_t_f *cls, _fcd name, int_f *name_len) { int_f ret_value = -1; hid_t c_class; @@ -2681,7 +2680,7 @@ nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len) c_name = (char *)HD5f2cstring(name, (size_t)*name_len); if (c_name == NULL) goto DONE; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; /* * Call H5Punregister function. */ @@ -2695,19 +2694,19 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5pclose_class_c * Purpose: Call H5Pclose_class to close property class - * Inputs: class - identifier of property class to close + * Inputs: cls - identifier of property class to close * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * October 11, 2002 * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pclose_class_c(hid_t_f *class) +nh5pclose_class_c(hid_t_f *cls) { int_f ret_value = -1; hid_t c_class; - c_class = (hid_t)*class; + c_class = (hid_t)*cls; /* * Call H5Pclose_class function. */ @@ -2718,7 +2717,7 @@ nh5pclose_class_c(hid_t_f *class) /*---------------------------------------------------------------------------- * Name: h5pget_class_name_c * Purpose: Call H5Pget_class_name to get property class name - * Inputs: class - identifier of property class + * Inputs: cls - identifier of property class * name - ibuffer to retrieve name in * name_len - length of the "name" buffer * Returns: 0 on success, -1 on failure @@ -2727,22 +2726,24 @@ nh5pclose_class_c(hid_t_f *class) * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pget_class_name_c(hid_t_f *class, _fcd name, int_f *name_len) +nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) { int_f ret_value = -1; char *c_name = NULL; /* Buffer to hold C string */ size_t c_size; c_size = (size_t)*name_len + 1; + /* * Allocate buffer to hold name */ - if ((c_name = HDmalloc(c_size)) == NULL) + if(NULL == (c_name = (char *)HDmalloc(c_size))) goto DONE; + /* * Call H5Pget_class_name function. */ - c_name = H5Pget_class_name((hid_t)*class); + c_name = H5Pget_class_name((hid_t)*cls); if(c_name == NULL) goto DONE; HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); @@ -2752,6 +2753,7 @@ DONE: HDfree(c_name); return ret_value; } + /*---------------------------------------------------------------------------- * Name: h5pset_c * Purpose: Call h5setc_c to set property with the character string value @@ -3092,14 +3094,11 @@ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f if (tmp ==NULL) return ret_value; tmp_p = tmp; for (i=0; i < H5FD_MEM_NTYPES; i++) { - c_memb_name[i] = malloc((size_t)len[i] + 1); - memcpy(c_memb_name[i], tmp_p, (size_t)len[i]); + c_memb_name[i] = (char *)HDmalloc((size_t)len[i] + 1); + HDmemcpy(c_memb_name[i], tmp_p, (size_t)len[i]); tmp_pp = c_memb_name[i]; tmp_pp[len[i]] = '\0'; tmp_p = tmp_p + c_lenmax; -/* printf(" %d \n", len[i]); - printf("name %s \n", c_memb_name[i]); -*/ } /* * Take care of othe arguments @@ -3108,25 +3107,22 @@ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f c_prp_id = (hid_t)*prp_id; for (i=0; i < H5FD_MEM_NTYPES; i++) { c_memb_map[i] = (H5FD_mem_t)memb_map[i]; - /*printf("map %d \n", c_memb_map[i]); */ c_memb_fapl[i] = (hid_t)memb_fapl[i]; - /*printf("fapl %d \n", c_memb_fapl[i]); */ if(memb_addr[i] < 0) c_memb_addr[i] = HADDR_UNDEF; - /* else c_memb_addr[i] = (haddr_t)(((float)memb_addr[i])*(HADDR_MAX));*/ else c_memb_addr[i] = (haddr_t)(((float)memb_addr[i])*(tmp_max_addr)); - /*printf("address %Ld \n", c_memb_addr[i]); */ } /* * Call H5Pset_fapl_multi function */ - status = H5Pset_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, c_memb_name, c_memb_addr, relax); + status = H5Pset_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, (const char * const *)c_memb_name, c_memb_addr, relax); if ( status < 0 ) goto DONE; ret_value = 0; DONE: - free(tmp); - for (i=0; i < H5FD_MEM_NTYPES; i++) free(c_memb_name[i]); + HDfree(tmp); + for (i=0; i < H5FD_MEM_NTYPES; i++) + HDfree(c_memb_name[i]); return ret_value; } @@ -3203,9 +3199,9 @@ nh5pget_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f /* * Take care of names array */ - tmp = (char *)malloc(c_lenmax*H5FD_MEM_NTYPES + 1); + tmp = (char *)HDmalloc(c_lenmax*H5FD_MEM_NTYPES + 1); tmp_p = tmp; - memset(tmp,' ', c_lenmax*H5FD_MEM_NTYPES); + HDmemset(tmp,' ', c_lenmax*H5FD_MEM_NTYPES); tmp[c_lenmax*H5FD_MEM_NTYPES] = '\0'; for (i=0; i < H5FD_MEM_NTYPES; i++) { memcpy(tmp_p, c_memb_name[i], strlen(c_memb_name[i])); @@ -3228,8 +3224,9 @@ HD5packFstring(tmp, _fcdtocp(memb_name), (size_t)(c_lenmax*H5FD_MEM_NTYPES)); *flag = (int_f)relax; *maxlen_out = (int_f)length; ret_value = 0; - free(tmp); - for (i=0; i < H5FD_MEM_NTYPES; i++) free(c_memb_name[i]); + HDfree(tmp); + for (i=0; i < H5FD_MEM_NTYPES; i++) + HDfree(c_memb_name[i]); return ret_value; } @@ -3326,10 +3323,10 @@ nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f unsigned i; int_f ret_value = -1; - if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1))) + if(NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1))) goto DONE; - if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * ((int)c_cd_nelmts_in)))) + if(NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * ((int)c_cd_nelmts_in)))) goto DONE; /* @@ -3385,7 +3382,7 @@ nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_ c_filter = (H5Z_filter_t)*filter; c_flags = (unsigned)*flags; c_cd_nelmts = (size_t)*cd_nelmts; - c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts)); + c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * ((int)c_cd_nelmts)); if (!c_cd_values) return ret_value; for (i = 0; i < c_cd_nelmts; i++) c_cd_values[i] = (unsigned int)cd_values[i]; @@ -3977,7 +3974,7 @@ nh5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_l * Allocate memory to store the expression. */ if(c_expression_len) { - c_expression = (char*)HDmalloc(c_expression_len); + c_expression = (char *)HDmalloc(c_expression_len); if(NULL == c_expression) HGOTO_DONE(FAIL) } /* end if */ @@ -4223,7 +4220,7 @@ nh5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_den * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pset_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size, size_t_f *cbuf_size ) +nh5pset_fapl_direct_c(hid_t_f UNUSED *fapl_id, size_t_f UNUSED *alignment, size_t_f UNUSED *block_size, size_t_f UNUSED *cbuf_size) { int ret_value = -1; #ifdef H5_HAVE_DIRECT @@ -4257,7 +4254,7 @@ nh5pset_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_siz * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5pget_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size, size_t_f *cbuf_size ) +nh5pget_fapl_direct_c(hid_t_f UNUSED *fapl_id, size_t_f UNUSED *alignment, size_t_f UNUSED *block_size, size_t_f UNUSED *cbuf_size) { int ret_value = -1; #ifdef H5_HAVE_DIRECT |