diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-09-25 17:46:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-09-25 17:46:32 (GMT) |
commit | ed663577a5394d34a0cfbe5cd5443af1f7957dc5 (patch) | |
tree | f334d37a08de1f77ce046907bce49c9ff56c6597 /test | |
parent | a6036953db9be2210acbed0882cf62c594b3a168 (diff) | |
download | hdf5-ed663577a5394d34a0cfbe5cd5443af1f7957dc5.zip hdf5-ed663577a5394d34a0cfbe5cd5443af1f7957dc5.tar.gz hdf5-ed663577a5394d34a0cfbe5cd5443af1f7957dc5.tar.bz2 |
[svn-r4473] Purpose:
Code cleanup for better compatibility with C++ compilers
Description:
C++ compilers are choking on our C code, for various reasons:
we used our UNUSED macro incorrectly when referring to pointer types
we used various C++ keywords as variables, etc.
we incremented enum's with the ++ operator.
Solution:
Changed variables, etc.to avoid C++ keywords (new, class, typename, typeid,
template)
Fixed usage of UNUSED macro from this:
char UNUSED *c
to this:
char * UNUSED c
Switched the enums from x++ to x=x+1
Platforms tested:
FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 4 | ||||
-rw-r--r-- | test/h5test.c | 6 | ||||
-rw-r--r-- | test/tattr.c | 32 | ||||
-rw-r--r-- | test/titerate.c | 8 |
4 files changed, 28 insertions, 22 deletions
diff --git a/test/dsets.c b/test/dsets.c index c55e25f..40d5f90 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -332,8 +332,8 @@ test_tconv(hid_t file) */ static size_t bogus(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, - const unsigned int UNUSED cd_values[], size_t nbytes, - size_t UNUSED *buf_size, void UNUSED **buf) + const unsigned int * UNUSED cd_values, size_t nbytes, + size_t * UNUSED buf_size, void ** UNUSED buf) { return nbytes; } diff --git a/test/h5test.c b/test/h5test.c index c647a21..4fae090 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -92,7 +92,7 @@ static const char *multi_letters = "msbrglo"; *------------------------------------------------------------------------- */ herr_t -h5_errors(void UNUSED *client_data) +h5_errors(void * UNUSED client_data) { H5_FAILED(); H5Eprint (stdout); @@ -150,7 +150,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) H5FD_mem_t mt; assert(strlen(multi_letters)==H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt=mt+1) { HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); HDremove(temp); /*don't care if it fails*/ @@ -438,7 +438,7 @@ h5_fileaccess(void) HDmemset(memb_addr, 0, sizeof memb_addr); assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++) { + for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=mt+1) { memb_fapl[mt] = H5P_DEFAULT; sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; diff --git a/test/tattr.c b/test/tattr.c index ecdf38c..c9f2de2 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -388,7 +388,7 @@ test_attr_compound_read(void) char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ int rank; /* Attribute rank */ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ - H5T_class_t class; /* Attribute datatype class */ + H5T_class_t t_class; /* Attribute datatype class */ H5T_order_t order; /* Attribute datatype order */ size_t size; /* Attribute datatype size as stored in file */ int fields; /* # of Attribute datatype fields */ @@ -438,8 +438,8 @@ test_attr_compound_read(void) /* Verify Datatype */ type=H5Aget_type(attr); CHECK(type, FAIL, "H5Aget_type"); - class=H5Tget_class(type); - VERIFY(class, H5T_COMPOUND, "H5Tget_class"); + t_class=H5Tget_class(type); + VERIFY(t_class, H5T_COMPOUND, "H5Tget_class"); fields=H5Tget_nmembers(type); VERIFY(fields, 3, "H5Tget_nmembers"); for(i=0; i<fields; i++) { @@ -462,8 +462,8 @@ test_attr_compound_read(void) /* Verify each field's type, class & size */ field=H5Tget_member_type(type,0); CHECK(field, FAIL, "H5Tget_member_type"); - class=H5Tget_class(field); - VERIFY(class, H5T_INTEGER, "H5Tget_class"); + t_class=H5Tget_class(field); + VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order=H5Tget_order(field); VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order"); size=H5Tget_size(field); @@ -471,8 +471,8 @@ test_attr_compound_read(void) H5Tclose(field); field=H5Tget_member_type(type,1); CHECK(field, FAIL, "H5Tget_member_type"); - class=H5Tget_class(field); - VERIFY(class, H5T_FLOAT, "H5Tget_class"); + t_class=H5Tget_class(field); + VERIFY(t_class, H5T_FLOAT, "H5Tget_class"); order=H5Tget_order(field); VERIFY(order, H5Tget_order(H5T_NATIVE_DOUBLE), "H5Tget_order"); size=H5Tget_size(field); @@ -480,8 +480,8 @@ test_attr_compound_read(void) H5Tclose(field); field=H5Tget_member_type(type,2); CHECK(field, FAIL, "H5Tget_member_type"); - class=H5Tget_class(field); - VERIFY(class, H5T_INTEGER, "H5Tget_class"); + t_class=H5Tget_class(field); + VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order=H5Tget_order(field); VERIFY(order, H5Tget_order(H5T_NATIVE_SCHAR), "H5Tget_order"); size=H5Tget_size(field); @@ -775,7 +775,7 @@ test_attr_mult_read(void) char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */ int rank; /* Attribute rank */ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ - H5T_class_t class; /* Attribute datatype class */ + H5T_class_t t_class; /* Attribute datatype class */ H5T_order_t order; /* Attribute datatype order */ size_t size; /* Attribute datatype size as stored in file */ int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ @@ -819,8 +819,8 @@ test_attr_mult_read(void) /* Verify Datatype */ type=H5Aget_type(attr); CHECK(type, FAIL, "H5Aget_type"); - class=H5Tget_class(type); - VERIFY(class, H5T_INTEGER, "H5Tget_class"); + t_class=H5Tget_class(type); + VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order=H5Tget_order(type); VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order"); size=H5Tget_size(type); @@ -884,8 +884,8 @@ test_attr_mult_read(void) /* Verify Datatype */ type=H5Aget_type(attr); CHECK(type, FAIL, "H5Aget_type"); - class=H5Tget_class(type); - VERIFY(class, H5T_INTEGER, "H5Tget_class"); + t_class=H5Tget_class(type); + VERIFY(t_class, H5T_INTEGER, "H5Tget_class"); order=H5Tget_order(type); VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order"); size=H5Tget_size(type); @@ -954,8 +954,8 @@ test_attr_mult_read(void) /* Verify Datatype */ type=H5Aget_type(attr); CHECK(type, FAIL, "H5Aget_type"); - class=H5Tget_class(type); - VERIFY(class, H5T_FLOAT, "H5Tget_class"); + t_class=H5Tget_class(type); + VERIFY(t_class, H5T_FLOAT, "H5Tget_class"); order=H5Tget_order(type); VERIFY(order, H5Tget_order(H5T_NATIVE_DOUBLE), "H5Tget_order"); size=H5Tget_size(type); diff --git a/test/titerate.c b/test/titerate.c index c4370f8..b50913d 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -43,11 +43,17 @@ #define SPACE1_RANK 1 #define SPACE1_DIM1 4 +typedef enum { + RET_ZERO, + RET_ONE, + RET_CHANGE +} iter_enum; + /* Custom group iteration callback data */ typedef struct { char name[NAMELEN]; /* The name of the object */ int type; /* The type of the object */ - enum {RET_ZERO, RET_ONE, RET_CHANGE} command; /* The type of return value */ + iter_enum command; /* The type of return value */ } iter_info; /* Local functions */ |