diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-10-21 13:08:44 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-10-21 13:08:44 (GMT) |
commit | ba665404620b16f0e5140c5f1d19b18ffb68590e (patch) | |
tree | 8759a98880bc6b7fc7cc1b1612f6548207837cef /fortran | |
parent | 9e2fff4540bbbc1718e1395f101973800f706eb9 (diff) | |
download | hdf5-ba665404620b16f0e5140c5f1d19b18ffb68590e.zip hdf5-ba665404620b16f0e5140c5f1d19b18ffb68590e.tar.gz hdf5-ba665404620b16f0e5140c5f1d19b18ffb68590e.tar.bz2 |
[svn-r19654] Description:
Bring Coverity revisions from branch back to trunk, and clean up some other
misc. compiler warnings also.
r19500:
Fix coverity items 1446 and 1447. Moved up calls to memset in test_cont in
ohdr.c so the test never tries to close uninitialized locations.
r19501:
Fix coverity items 1398-1445. Various uninitialized variable errors in fheap.c.
r19502:
Fixed coverity issue 579 and some additional warnings in the file as well.
r19503:
Bug fix: This fix addressed the "RESOURCE_LEAK" problems #789 and 790, run 26
r19504:
minor mods to try to keep coverity from flagging false positives.
r19505:
Fixed coverity issues 566 - 571. Declared variables that are passed to functions that use them as arrays to be arrays of size 1.
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug, production & parallel
(h5committested on trunk)
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5Af.c | 4 | ||||
-rw-r--r-- | fortran/src/H5Ff.c | 2 | ||||
-rw-r--r-- | fortran/src/H5Lf.c | 2 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 125 | ||||
-rw-r--r-- | fortran/src/H5Rf.c | 215 | ||||
-rw-r--r-- | fortran/src/H5Sf.c | 4 | ||||
-rw-r--r-- | fortran/src/H5Tf.c | 27 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 41 | ||||
-rw-r--r-- | fortran/src/H5f90kit.c | 6 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 22 |
10 files changed, 208 insertions, 240 deletions
diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 939fd81..8e6158e 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -974,16 +974,16 @@ nh5aget_name_c(hid_t_f *attr_id, size_t_f *bufsize, _fcd buf) int_f ret_value=0; /* Return value */ c_bufsize = (size_t)*bufsize+1; + /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc(c_bufsize)) == NULL) + if(NULL == (c_buf = (char *)HDmalloc(c_bufsize))) HGOTO_DONE(FAIL); /* * Call H5Aget_name function */ - if ((ret_value = (int_f)H5Aget_name((hid_t)*attr_id, c_bufsize, c_buf)) < 0) HGOTO_DONE(FAIL); diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 9640444..1570bb3 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -520,7 +520,7 @@ nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen) /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc((size_t)*buflen +1)) == NULL) + if(NULL == (c_buf = (char *)HDmalloc((size_t)*buflen + 1))) HGOTO_DONE(FAIL); /* diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c index 4d3e31c..59f4535 100644 --- a/fortran/src/H5Lf.c +++ b/fortran/src/H5Lf.c @@ -606,7 +606,7 @@ nh5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, /* * Allocate buffer to hold name of an attribute */ - if ((c_name = HDmalloc(c_size)) == NULL) + if(NULL == (c_name = (char *)HDmalloc(c_size))) HGOTO_DONE(FAIL) if((*size = (size_t)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, 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 diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index ba5d273..51a775f 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -16,6 +16,7 @@ /* This files contains C stubs for H5R Fortran APIs */ #include "H5f90.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5rcreate_object_c @@ -27,39 +28,34 @@ * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rcreate_object_c (haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) +nh5rcreate_object_c(haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) { - int ret_value = -1; - hid_t c_loc_id; - int ret_value_c; - char *c_name; - size_t c_namelen; + char *c_name = NULL; hobj_ref_t ref_c; + int_f ret_value = 0; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* * Call H5Rcreate function. */ - c_loc_id = *loc_id; - ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_OBJECT, -1); + if(H5Rcreate(&ref_c, *loc_id, c_name, H5R_OBJECT, -1) < 0) + HGOTO_DONE(FAIL) - HDfree(c_name); - if (ret_value_c >= 0) { - *ref=(haddr_t_f)ref_c; - ret_value = 0; - } + /* Copy the reference created */ + *ref = (haddr_t_f)ref_c; +done: + if(c_name) + HDfree(c_name); return ret_value; -} +} /* nh5rcreate_object_c() */ /*---------------------------------------------------------------------------- * Name: h5rcreate_region_c @@ -73,40 +69,34 @@ nh5rcreate_object_c (haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) +nh5rcreate_region_c(int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) { - int ret_value = -1; - hid_t c_loc_id; - hid_t c_space_id; - int ret_value_c; - char *c_name; - size_t c_namelen; + char *c_name = NULL; hdset_reg_ref_t ref_c; + int_f ret_value = 0; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) /* * Call H5Rcreate function. */ - c_loc_id = *loc_id; - c_space_id = *space_id; - ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_DATASET_REGION, c_space_id); - - HDfree(c_name); - if (ret_value_c >= 0) { - HDmemcpy (ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE); - ret_value = 0; - } + if(H5Rcreate(&ref_c, (hid_t)*loc_id, c_name, H5R_DATASET_REGION, (hid_t)*space_id) < 0) + HGOTO_DONE(FAIL) + + /* Copy the reference created */ + HDmemcpy(ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE); + +done: + if(c_name) + HDfree(c_name); return ret_value; -} +} /* end nh5rcreate_region_c() */ /*---------------------------------------------------------------------------- * Name: h5rdereference_region_c @@ -117,29 +107,29 @@ nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) +nh5rdereference_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) { - int ret_value = -1; - hid_t c_dset_id; hdset_reg_ref_t ref_c; hid_t c_obj_id; + int_f ret_value = 0; - HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); + /* Copy the reference to dereference */ + HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); /* * Call H5Rdereference function. */ - c_dset_id = *dset_id; - c_obj_id = H5Rdereference(c_dset_id, H5R_DATASET_REGION, &ref_c); - if(c_obj_id < 0) return ret_value; + if((c_obj_id = H5Rdereference((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the object's ID */ *obj_id = (hid_t_f)c_obj_id; - ret_value = 0; - return ret_value; -} +done: + return ret_value; +} /* end nh5rdereference_region_c() */ /*---------------------------------------------------------------------------- * Name: h5rdereference_object_c @@ -150,28 +140,26 @@ nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id) +nh5rdereference_object_c(hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id) { - int ret_value = -1; - hid_t c_dset_id; hid_t c_obj_id; - hobj_ref_t ref_c; - - ref_c=*ref; + hobj_ref_t ref_c = (hobj_ref_t)*ref; + int_f ret_value = 0; /* * Call H5Rdereference function. */ - c_dset_id = *dset_id; - c_obj_id = H5Rdereference(c_dset_id, H5R_OBJECT, &ref_c); - if(c_obj_id < 0) return ret_value; + if((c_obj_id = H5Rdereference((hid_t)*dset_id, H5R_OBJECT, &ref_c)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the object's ID */ *obj_id = (hid_t_f)c_obj_id; - ret_value = 0; + +done: return ret_value; -} +} /* end nh5rdereference_object_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_region_region_object_c @@ -182,28 +170,29 @@ nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) +nh5rget_region_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) { - int ret_value = -1; - hid_t c_dset_id; hid_t c_space_id; hdset_reg_ref_t ref_c; + int_f ret_value = 0; - HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); + /* Copy the reference to dereference */ + HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); /* * Call H5Rget_region function. */ - c_dset_id = *dset_id; - c_space_id = H5Rget_region(c_dset_id, H5R_DATASET_REGION, &ref_c); - if(c_space_id < 0) return ret_value; + if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the dataspace ID */ *space_id = (hid_t_f)c_space_id; - ret_value = 0; + +done: return ret_value; -} +} /* end nh5rget_region_region_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_object_type_obj_c @@ -215,29 +204,26 @@ nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Wednesday, December 1, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type) +nh5rget_object_type_obj_c(hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type) { H5O_type_t c_obj_type; - hobj_ref_t ref_c; - int_f ret_value = -1; - - ref_c = *ref; + hobj_ref_t ref_c = (hobj_ref_t)*ref; + int_f ret_value = 0; /* * Call H5Rget_object_type function. */ if(H5Rget_obj_type2((hid_t)*dset_id, H5R_OBJECT, &ref_c, &c_obj_type) < 0) - return ret_value; + HGOTO_DONE(FAIL) + /* Copy the object type */ *obj_type = (int_f)c_obj_type; - ret_value = 0; - +done: return ret_value; -} +} /* end nh5rget_object_type_obj_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_name_object_c @@ -252,42 +238,40 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type) * Returns: 0 on success, -1 on failure * Programmer: M.S. Breitenfeld * March 31, 2008 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) +nh5rget_name_object_c(hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) { - hobj_ref_t ref_c; - int_f ret_value = -1; + hobj_ref_t ref_c = (hobj_ref_t)*ref; ssize_t c_size; - size_t c_bufsize; - char *c_buf= NULL; /* Buffer to hold C string */ + size_t c_bufsize = (size_t)*name_len + 1; + char *c_buf = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; - ref_c = *ref; - c_bufsize = (size_t)*name_len+1; /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc(c_bufsize)) == NULL) - return ret_value; - + if(NULL == (c_buf = (char *)HDmalloc(c_bufsize))) + HGOTO_DONE(FAIL) + /* * Call H5Rget_name function. */ - if((c_size=H5Rget_name((hid_t)*loc_id, H5R_OBJECT, &ref_c, c_buf, c_bufsize)) < 0) - return ret_value; + if((c_size = H5Rget_name((hid_t)*loc_id, H5R_OBJECT, &ref_c, c_buf, c_bufsize)) < 0) + HGOTO_DONE(FAIL) + /* * Convert C name to FORTRAN and place it in the given buffer */ HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1); - *size_default = (size_t_f)c_size; - ret_value = 0; - if(c_buf) HDfree(c_buf); +done: + if(c_buf) + HDfree(c_buf); return ret_value; -} +} /* end nh5rget_name_object_c() */ /*---------------------------------------------------------------------------- * Name: h5rget_name_region_c @@ -302,39 +286,40 @@ nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *nam * Returns: 0 on success, -1 on failure * Programmer: M.S. Breitenfeld * March 31, 2008 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) +nh5rget_name_region_c(hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default) { hdset_reg_ref_t ref_c; - int_f ret_value = -1; ssize_t c_size; - size_t c_bufsize; - char *c_buf= NULL; /* Buffer to hold C string */ + size_t c_bufsize = (size_t)*name_len + 1; + char *c_buf = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; - HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); + /* Copy the reference to query */ + HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE); - c_bufsize = (size_t)*name_len+1; /* * Allocate buffer to hold name of an attribute */ - if ((c_buf = HDmalloc(c_bufsize)) == NULL) - return ret_value; + if(NULL == (c_buf = (char *)HDmalloc(c_bufsize))) + HGOTO_DONE(FAIL) /* * Call H5Rget_name function. */ - if((c_size=H5Rget_name((hid_t)*loc_id, H5R_DATASET_REGION, &ref_c, c_buf, c_bufsize)) < 0) - return ret_value; + if((c_size = H5Rget_name((hid_t)*loc_id, H5R_DATASET_REGION, &ref_c, c_buf, c_bufsize)) < 0) + HGOTO_DONE(FAIL) + /* * Convert C name to FORTRAN and place it in the given buffer */ - HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1); - + HD5packFstring(c_buf, _fcdtocp(name), c_bufsize - 1); *size_default = (size_t_f)c_size; - ret_value = 0; - if(c_buf) HDfree(c_buf); +done: + if(c_buf) + HDfree(c_buf); return ret_value; -} +} /* end nh5rget_name_region_c() */ + diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index dea3ff0..e161618 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -989,7 +989,7 @@ nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsi c_space_id = *space_id; rank = H5Sget_simple_extent_ndims(c_space_id); - c_coord = malloc(sizeof(hsize_t)*rank*(*nelements)); + c_coord = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank*(*nelements)); if(!c_coord) return ret_value; for (i=0; i< *nelements; i++) { for (j = 0; j < rank; j++) { @@ -1080,7 +1080,7 @@ nh5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) /* * Allocate buffer */ - if ((c_buf = HDmalloc(c_size)) == NULL) + if(NULL == (c_buf = (unsigned char *)HDmalloc(c_size))) return ret_value; /* * Call H5Sencode function. diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 13fea93..37cfca0 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -990,7 +990,7 @@ nh5tget_member_name_c ( hid_t_f *type_id ,int_f* idx, _fcd member_name, int_f *n char *c_name; c_type_id = *type_id; - c_index = *idx; + c_index = (unsigned)*idx; c_name = H5Tget_member_name(c_type_id, c_index); if (c_name == NULL ) return ret_value; @@ -1199,7 +1199,7 @@ nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype) /*---------------------------------------------------------------------------- * Name: h5tcreate_c * Purpose: Call H5Tcreate to create a datatype - * Inputs: class - class type + * Inputs: cls - class type * size - size of the class memeber * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal @@ -1208,14 +1208,14 @@ nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype) *---------------------------------------------------------------------------*/ int_f -nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id) +nh5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id) { int ret_value = -1; H5T_class_t c_class; size_t c_size; c_size =(size_t) *size; - c_class = (H5T_class_t) *class; + c_class = (H5T_class_t) *cls; *type_id = (hid_t_f)H5Tcreate(c_class, c_size); if(*type_id < 0) return ret_value; @@ -1419,7 +1419,7 @@ nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen) int_f c_value; c_value = *value; c_namelen = ((size_t)*namelen) +1; - c_name = (char *)malloc(sizeof(char)*c_namelen); + c_name = (char *)HDmalloc(sizeof(char)*c_namelen); c_type_id = (hid_t)*type_id; error = H5Tenum_nameof(c_type_id, &c_value, c_name, c_namelen); HD5packFstring(c_name, _fcdtocp(name), strlen(c_name)); @@ -1617,7 +1617,7 @@ nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ) * datatype member * Inputs: type_id - identifier of the dataspace * member_no - member's index - * Outputs: class - member's class + * Outputs: cls - member's class * and negative on failure. * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal @@ -1626,7 +1626,7 @@ nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ) *---------------------------------------------------------------------------*/ int_f -nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class ) +nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *cls ) { int ret_value = 0; hid_t c_type_id; @@ -1638,7 +1638,7 @@ nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class ) c_class = H5Tget_member_class(c_type_id, c_member_no); if ( c_class == H5T_NO_CLASS ) ret_value = -1; - *class = (int_f)c_class; + *cls = (int_f)c_class; return ret_value; } @@ -1766,18 +1766,18 @@ nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) return ret_value; } - c_size = (size_t)*nalloc; /* * Allocate buffer */ - if ((c_buf = HDmalloc(c_size)) == NULL) + c_size = (size_t)*nalloc; + if(NULL == (c_buf = (unsigned char *)HDmalloc(c_size))) return ret_value; + /* * Call H5Tencode function. */ - if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0){ + if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0) return ret_value; - } /* copy the C buffer to the FORTRAN buffer. * Can not use HD5packFstring because we don't want to @@ -1788,7 +1788,8 @@ nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) HDmemcpy(_fcdtocp(buf),(char *)c_buf,c_size); ret_value = 0; - if(c_buf) HDfree(c_buf); + if(c_buf) + HDfree(c_buf); return ret_value; } diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index e0748b5b..12c55af 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -36,7 +36,6 @@ * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, August 3, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes ) @@ -254,7 +253,6 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, August 3, 1999 - * Modifications: *---------------------------------------------------------------------------*/ int_f nh5close_types_c( hid_t_f * types, int_f *lentypes, @@ -300,13 +298,6 @@ nh5close_types_c( hid_t_f * types, int_f *lentypes, * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, August 3, 1999 - * Modifications: Added Z flags. EIP, March 12, 2003 - * Added more FD flags and new H5LIB flags - * Added more FD flags for HDF5 file driver - * EIP, April 9, 2005 - * Added Generic flags introduced in version 1.8 - * MSB, January, 2008 - * Added types in lines h5*_flags = ( )variable to match input *---------------------------------------------------------------------------*/ int_f nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, @@ -644,36 +635,34 @@ nh5init1_flags_c(int_f *h5lib_flags) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Friday, November 17, 2000 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5open_c() +nh5open_c(void) { - int ret_value = -1; + if (H5open() < 0) return ret_value; ret_value = 0; return ret_value; } + /*--------------------------------------------------------------------------- * Name: h5close_c * Purpose: Calls H5close call to close C HDF5 library * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Friday, November 17, 2000 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5close_c() +nh5close_c(void) { - int ret_value = -1; + if (H5close() < 0) return ret_value; ret_value = 0; return ret_value; } - /*--------------------------------------------------------------------------- * Name: h5get_libversion_c * Purpose: Calls H5get_libversion function @@ -687,10 +676,9 @@ nh5close_c() * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) +nh5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum) { int ret_value = -1; @@ -705,7 +693,6 @@ nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) return ret_value; } - /*--------------------------------------------------------------------------- * Name: h5check_version_c * Purpose: Calls H5check_version function @@ -719,14 +706,13 @@ nh5get_libversion_c( int_f *majnum, int_f *minnum, int_f *relnum) * Returns: 0 on success, aborts on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5check_version_c( int_f *majnum, int_f *minnum, int_f *relnum) +nh5check_version_c(int_f *majnum, int_f *minnum, int_f *relnum) { - int ret_value = -1; unsigned c_majnum, c_minnum, c_relnum; + c_majnum = (unsigned) *majnum; c_minnum = (unsigned) *minnum; c_relnum = (unsigned) *relnum; @@ -743,13 +729,12 @@ nh5check_version_c( int_f *majnum, int_f *minnum, int_f *relnum) * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5garbage_collect_c() +nh5garbage_collect_c(void) { - int ret_value = -1; + if (H5garbage_collect() < 0) return ret_value; ret_value = 0; return ret_value; @@ -761,14 +746,14 @@ nh5garbage_collect_c() * Returns: 0 on success, -1 on failure * Programmer: Elena Pourmal * Tuesday, September 24, 2002 - * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5dont_atexit_c() +nh5dont_atexit_c(void) { - int ret_value = -1; + if (H5dont_atexit() < 0) return ret_value; ret_value = 0; return ret_value; } + diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c index 68bb169..a809229 100644 --- a/fortran/src/H5f90kit.c +++ b/fortran/src/H5f90kit.c @@ -51,15 +51,15 @@ HD5f2cstring(_fcd fdesc, size_t len) /* Search for the end of the string */ str = _fcdtocp(fdesc); - for(i=(int)len-1; i>=0 && !isgraph((int)str[i]); i--) + for(i = (int)len - 1; i >= 0 && !HDisgraph((int)str[i]); i--) /*EMPTY*/; /* Allocate C string */ - if ((cstr = HDmalloc( (size_t)(i + 2))) == NULL) + if(NULL == (cstr = (char *)HDmalloc((size_t)(i + 2)))) return NULL; /* Copy text from FORTRAN to C string */ - HDmemcpy(cstr,str,(size_t)(i+1)); + HDmemcpy(cstr, str, (size_t)(i + 1)); /* Terminate C string */ cstr[i + 1] = '\0'; diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 7f16359..3958e61 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -671,7 +671,7 @@ H5_FCDLL int_f nh5arename_c( hid_t_f *loc_id, # define nh5tcompiler_conv_c H5_FC_FUNC_(h5tcompiler_conv_c, H5TCOMPILER_CONV_C) # define nh5tget_native_type_c H5_FC_FUNC_(h5tget_native_type_c, H5TGET_NATIVE_TYPE_C) -H5_FCDLL int_f nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id); +H5_FCDLL int_f nh5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id); H5_FCDLL int_f nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id ); H5_FCDLL int_f nh5tcommit_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *lcpl_id, hid_t_f *tcpl_id, hid_t_f *tapl_id); H5_FCDLL int_f nh5tclose_c ( hid_t_f *type_id ); @@ -726,7 +726,7 @@ H5_FCDLL int_f nh5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims); H5_FCDLL int_f nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id); H5_FCDLL int_f nh5tvlen_create_c ( hid_t_f *type_id , hid_t_f *vltype_id); H5_FCDLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ); -H5_FCDLL int_f nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class ); +H5_FCDLL int_f nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *cls ); H5_FCDLL int_f nh5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id, hid_t_f *tcpl_id, hid_t_f *tapl_id); H5_FCDLL int_f nh5tdecode_c ( _fcd buf, hid_t_f *obj_id ); H5_FCDLL int_f nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ); @@ -908,7 +908,7 @@ H5_FCDLL int_f nh5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, s # define nh5pset_chunk_cache_c H5_FC_FUNC_(h5pset_chunk_cache_c, H5PSET_CHUNK_CACHE_C) # define nh5pget_chunk_cache_c H5_FC_FUNC_(h5pget_chunk_cache_c, H5PGET_CHUNK_CACHE_C) -H5_FCDLL int_f nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ); +H5_FCDLL int_f nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id ); H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id ); H5_FCDLL int_f nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id); H5_FCDLL int_f nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f *c_flag); @@ -990,12 +990,12 @@ H5_FCDLL int_f nh5pset_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pget_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pset_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); H5_FCDLL int_f nh5pget_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); -H5_FCDLL int_f nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class); -H5_FCDLL int_f nh5pregister_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregister_integer_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregister_real_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregister_double_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); -H5_FCDLL int_f nh5pregisterc_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, _fcd value, int_f *value_len); +H5_FCDLL int_f nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls); +H5_FCDLL int_f nh5pregister_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregister_integer_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregister_real_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregister_double_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregisterc_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, _fcd value, int_f *value_len); H5_FCDLL int_f nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); H5_FCDLL int_f nh5pinsert_integer_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); H5_FCDLL int_f nh5pinsert_real_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); @@ -1018,8 +1018,8 @@ H5_FCDLL int_f nh5pget_class_parent_c(hid_t_f *prp_id, hid_t_f *parent_id); H5_FCDLL int_f nh5pisa_class_c(hid_t_f *plist, hid_t_f *pclass); H5_FCDLL int_f nh5pcopy_prop_c(hid_t_f *dst_id, hid_t_f *src_id, _fcd name, int_f *name_len); H5_FCDLL int_f nh5premove_c(hid_t_f *plid, _fcd name, int_f *name_len); -H5_FCDLL int_f nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len); -H5_FCDLL int_f nh5pclose_class_c(hid_t_f * class); +H5_FCDLL int_f nh5punregister_c(hid_t_f *cls, _fcd name, int_f *name_len); +H5_FCDLL int_f nh5pclose_class_c(hid_t_f * cls); H5_FCDLL int_f nh5pget_class_name_c(hid_t_f *prp_id, _fcd name, int_f *name_len); H5_FCDLL int_f nh5pset_shuffle_c ( hid_t_f *prp_id); H5_FCDLL int_f nh5pset_fletcher32_c ( hid_t_f *prp_id ); |