summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-06-18 20:22:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-06-18 20:22:10 (GMT)
commitd41b9fffdfca2e97c36bc0ad0899fbb7b055f926 (patch)
tree51ed39b08a41a4f6947af07630eb40dfdb013d87 /test
parentfcaf572430a8eda3f6519bd21311ef7a8e3c3c1f (diff)
downloadhdf5-d41b9fffdfca2e97c36bc0ad0899fbb7b055f926.zip
hdf5-d41b9fffdfca2e97c36bc0ad0899fbb7b055f926.tar.gz
hdf5-d41b9fffdfca2e97c36bc0ad0899fbb7b055f926.tar.bz2
[svn-r4012] Purpose:
Clean up compiler warnings. Description: Just code neatening mostly, some casts, etc. Platforms tested: FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c20
-rw-r--r--test/h5test.c118
-rw-r--r--test/tselect.c6
-rw-r--r--test/tvltypes.c20
4 files changed, 81 insertions, 83 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index e461cf5..aa7d5cc 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -215,7 +215,7 @@ generates_sigfpe(void)
for (i=0; i<2000; i++) {
for (j=0; j<sizeof(double); j++) dp[j] = rand();
f = (float)d;
- some_dummy_func(f);
+ some_dummy_func((float)f);
}
exit(0);
}
@@ -2896,12 +2896,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
case INT_LLONG:
memcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- printf(" %29"PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
+ HDfprintf(stdout," %29"PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
break;
case INT_ULLONG:
memcpy(aligned, saved+j*sizeof(long_long),
sizeof(unsigned long_long));
- printf(" %29"PRINTF_LL_WIDTH"u\n",
+ HDfprintf(stdout," %29"PRINTF_LL_WIDTH"u\n",
*((unsigned long_long*)aligned));
break;
case INT_OTHER:
@@ -2949,12 +2949,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
case INT_LLONG:
memcpy(aligned, buf+j*sizeof(long_long), sizeof(long_long));
- printf(" %29"PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
+ HDfprintf(stdout," %29"PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
break;
case INT_ULLONG:
memcpy(aligned, buf+j*sizeof(long_long),
sizeof(unsigned long_long));
- printf(" %29"PRINTF_LL_WIDTH"u\n",
+ HDfprintf(stdout," %29"PRINTF_LL_WIDTH"u\n",
*((unsigned long_long*)aligned));
break;
case INT_OTHER:
@@ -2993,10 +2993,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)hw));
break;
case INT_LLONG:
- printf(" %29"PRINTF_LL_WIDTH"d\n", *((long_long*)hw));
+ HDfprintf(stdout," %29"PRINTF_LL_WIDTH"d\n", *((long_long*)hw));
break;
case INT_ULLONG:
- printf(" %29"PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw));
+ HDfprintf(stdout," %29"PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw));
break;
case INT_OTHER:
break;
@@ -3499,7 +3499,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else {
long double x;
memcpy(&x, (long double*)saved+j, sizeof(long double));
- printf(" %29.20Le\n", x);
+ HDfprintf(stdout," %29.20Le\n", x);
#endif
}
@@ -3521,7 +3521,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else {
long double x;
memcpy(&x, (long double*)buf+j, sizeof(long double));
- printf(" %29.20Le\n", x);
+ HDfprintf(stdout," %29.20Le\n", x);
#endif
}
@@ -3537,7 +3537,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" %29.20e\n", hw_d);
#if SIZEOF_LONG_DOUBLE!=SIZEOF_DOUBLE
} else {
- printf(" %29.20Le\n", hw_ld);
+ HDfprintf(stdout," %29.20Le\n", hw_ld);
#endif
}
diff --git a/test/h5test.c b/test/h5test.c
index deca1fc..23a9ce2 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -11,6 +11,8 @@
#undef NDEBUG /*override -DNDEBUG */
#include "h5test.h"
+#include <sys/types.h>
+#include <sys/stat.h>
#ifdef WIN32
#include <process.h>
@@ -127,7 +129,7 @@ h5_cleanup(const char *base_name[], hid_t fapl)
hid_t driver;
#endif /* H5_WANT_H5_V1_2_COMPAT */
- if (!getenv("HDF5_NOCLEANUP")) {
+ if (!HDgetenv("HDF5_NOCLEANUP")) {
for (i = 0; base_name[i]; i++) {
if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL)
continue;
@@ -139,25 +141,25 @@ h5_cleanup(const char *base_name[], hid_t fapl)
case H5F_LOW_SPLIT:
HDsnprintf(temp, sizeof(temp), "%s.raw", filename);
- remove(temp);
+ HDremove(temp);
HDsnprintf(temp, sizeof(temp), "%s.meta", filename);
- remove(temp);
+ HDremove(temp);
break;
case H5F_LOW_FAMILY:
for (j = 0; /*void*/; j++) {
HDsnprintf(temp, sizeof(temp), filename, j);
- if (access(temp, F_OK) < 0)
+ if (HDaccess(temp, F_OK) < 0)
break;
- remove(temp);
+ HDremove(temp);
}
break;
default:
- remove(filename);
+ HDremove(filename);
break;
}
#else /* H5_WANT_H5_V1_2_COMPAT */
@@ -168,10 +170,10 @@ h5_cleanup(const char *base_name[], hid_t fapl)
for (j = 0; /*void*/; j++) {
HDsnprintf(temp, sizeof temp, filename, j);
- if (access(temp, F_OK) < 0)
+ if (HDaccess(temp, F_OK) < 0)
break;
- remove(temp);
+ HDremove(temp);
}
} else if (driver == H5FD_CORE) {
/*void*/
@@ -182,10 +184,10 @@ h5_cleanup(const char *base_name[], hid_t fapl)
for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
HDsnprintf(temp, sizeof temp, "%s-%c.h5",
filename, multi_letters[mt]);
- remove(temp); /*don't care if it fails*/
+ HDremove(temp); /*don't care if it fails*/
}
} else {
- remove(filename);
+ HDremove(filename);
}
#endif /* H5_WANT_H5_V1_2_COMPAT */
}
@@ -217,8 +219,8 @@ h5_reset(void)
{
char filename[1024];
- fflush(stdout);
- fflush(stderr);
+ HDfflush(stdout);
+ HDfflush(stderr);
H5close();
H5Eset_auto (h5_errors, NULL);
@@ -233,7 +235,7 @@ h5_reset(void)
hid_t grp = H5Gcreate(file, "emit", 0);
H5Gclose(grp);
H5Fclose(file);
- unlink(filename);
+ HDunlink(filename);
} H5E_END_TRY;
}
@@ -313,7 +315,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/* For serial:
* First use the environment variable, then try the constant
*/
- prefix = getenv("HDF5_PREFIX");
+ prefix = HDgetenv("HDF5_PREFIX");
#ifdef HDF5_PREFIX
if (!prefix)
@@ -348,7 +350,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/* For serial:
* First use the environment variable, then try the constant
*/
- prefix = getenv("HDF5_PREFIX");
+ prefix = HDgetenv("HDF5_PREFIX");
#ifdef HDF5_PREFIX
if (!prefix)
@@ -367,14 +369,14 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/* This is a parallel system */
char *subdir;
- if (!strcmp(prefix, HDF5_PARAPREFIX)) {
+ if (!HDstrcmp(prefix, HDF5_PARAPREFIX)) {
/* If the prefix specifies the HDF5_PARAPREFIX directory, then
* default to using the "/tmp/$USER" or "/tmp/$LOGIN"
* directory instead. */
char *user, *login;
- user = getenv("USER");
- login = getenv("LOGIN");
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
subdir = (user ? user : login);
if (subdir) {
@@ -390,22 +392,22 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!fullname[0])
/* We didn't append the prefix yet */
- strncpy(fullname, prefix, MIN(strlen(prefix), size));
+ HDstrncpy(fullname, prefix, MIN(strlen(prefix), size));
- if (strlen(fullname) + strlen(base_name) + 1 < size) {
+ if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
/* Append the base_name with a slash first. Multiple slashes are
* handled below. */
struct stat buf;
- if (stat(fullname, &buf) < 0)
+ if (HDstat(fullname, &buf) < 0)
/* The directory doesn't exist just yet */
- if (mkdir(fullname, 0755) < 0 && errno != EEXIST)
+ if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST)
/* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
* Default to PREFIX's original prefix value. */
- strcpy(fullname, prefix);
+ HDstrcpy(fullname, prefix);
- strcat(fullname, "/");
- strcat(fullname, base_name);
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
} else {
/* Buffer is too small */
return NULL;
@@ -415,11 +417,11 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/* Buffer is too small */
return NULL;
}
- } else if (strlen(base_name) >= size) {
+ } else if (HDstrlen(base_name) >= size) {
/* Buffer is too small */
return NULL;
} else {
- strcpy(fullname, base_name);
+ HDstrcpy(fullname, base_name);
}
#ifdef H5_WANT_H5_V1_2_COMPAT
@@ -428,25 +430,25 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
return NULL;
switch (driver) {
- case H5F_LOW_SPLIT:
- case H5F_LOW_CORE:
- suffix = NULL;
- break;
- case H5F_LOW_FAMILY:
- suffix = "%05d.h5";
- break;
- default:
- suffix = ".h5";
- break;
+ case H5F_LOW_SPLIT:
+ case H5F_LOW_CORE:
+ suffix = NULL;
+ break;
+ case H5F_LOW_FAMILY:
+ suffix = "%05d.h5";
+ break;
+ default:
+ suffix = ".h5";
+ break;
}
#endif /* H5_WANT_H5_V1_2_COMPAT */
/* Append a suffix */
if (suffix) {
- if (strlen(fullname) + strlen(suffix) >= size)
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
return NULL;
- strcat(fullname, suffix);
+ HDstrcat(fullname, suffix);
}
/* Remove any double slashes in the filename */
@@ -491,7 +493,7 @@ h5_fileaccess(void)
H5FD_mem_t mt;
/* First use the environment variable, then the constant */
- val = getenv("HDF5_DRIVER");
+ val = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
if (!val) val = HDF5_DRIVER;
#endif
@@ -499,26 +501,26 @@ h5_fileaccess(void)
if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1;
if (!val || !*val) return fapl; /*use default*/
- strncpy(s, val, sizeof s);
+ HDstrncpy(s, val, sizeof s);
s[sizeof(s)-1] = '\0';
- if (NULL==(name=strtok(s, " \t\n\r"))) return fapl;
+ if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
- if (!strcmp(name, "sec2")) {
+ if (!HDstrcmp(name, "sec2")) {
/* Unix read() and write() system calls */
if (H5Pset_fapl_sec2(fapl)<0) return -1;
- } else if (!strcmp(name, "stdio")) {
+ } else if (!HDstrcmp(name, "stdio")) {
/* Standard C fread() and fwrite() system calls */
if (H5Pset_fapl_stdio(fapl)<0) return -1;
- } else if (!strcmp(name, "core")) {
+ } else if (!HDstrcmp(name, "core")) {
/* In-core temporary file with 1MB increment */
if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
- } else if (!strcmp(name, "split")) {
+ } else if (!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
if (H5Pset_fapl_split(fapl,
"-m.h5", H5P_DEFAULT,
"-r.h5", H5P_DEFAULT)<0)
return -1;
- } else if (!strcmp(name, "multi")) {
+ } else if (!HDstrcmp(name, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
@@ -526,12 +528,12 @@ h5_fileaccess(void)
char sv[H5FD_MEM_NTYPES][1024];
haddr_t memb_addr[H5FD_MEM_NTYPES];
- memset(memb_map, 0, sizeof memb_map);
- memset(memb_fapl, 0, sizeof memb_fapl);
- memset(memb_name, 0, sizeof memb_name);
- memset(memb_addr, 0, sizeof memb_addr);
+ HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_fapl, 0, sizeof memb_fapl);
+ HDmemset(memb_name, 0, sizeof memb_name);
+ HDmemset(memb_addr, 0, sizeof memb_addr);
- assert(strlen(multi_letters)==H5FD_MEM_NTYPES);
+ assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
@@ -543,16 +545,16 @@ h5_fileaccess(void)
memb_addr, FALSE)<0) {
return -1;
}
- } else if (!strcmp(name, "family")) {
+ } else if (!HDstrcmp(name, "family")) {
/* Family of files, each 1MB and using the default driver */
- if ((val=strtok(NULL, " \t\n\r"))) {
- fam_size = strtod(val, NULL) * 1024*1024;
+ if ((val=HDstrtok(NULL, " \t\n\r"))) {
+ fam_size = HDstrtod(val, NULL) * 1024*1024;
}
if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1;
- } else if (!strcmp(name, "log")) {
+ } else if (!HDstrcmp(name, "log")) {
/* Log file access */
- if ((val = strtok(NULL, " \t\n\r")))
- verbosity = strtol(val, NULL, 0);
+ if ((val = HDstrtok(NULL, " \t\n\r")))
+ verbosity = HDstrtol(val, NULL, 0);
if (H5Pset_fapl_log(fapl, NULL, (int)verbosity) < 0)
return -1;
diff --git a/test/tselect.c b/test/tselect.c
index 4aea1cb..b140d16 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -567,12 +567,8 @@ test_select_all(hid_t xfer_plist)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
+ hid_t sid1; /* Dataspace ID */
hsize_t dims1[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
- hssize_t start[SPACE4_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE4_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE4_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE4_RANK]; /* Block size of hyperslab */
uint8_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temporary buffer pointer */
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 3dc4b3f..8fb6b9a 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -51,7 +51,7 @@ void test_vltypes_free_custom(void *mem, void *info);
void *test_vltypes_alloc_custom(size_t size, void *info)
{
void *ret_value=NULL; /* Pointer to return */
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
+ size_t *mem_used=(size_t *)info; /* Get the pointer to the memory used */
size_t extra; /* Extra space needed */
/*
@@ -79,7 +79,7 @@ void *test_vltypes_alloc_custom(size_t size, void *info)
void test_vltypes_free_custom(void *_mem, void *info)
{
unsigned char *mem;
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
+ size_t *mem_used=(size_t *)info; /* Get the pointer to the memory used */
size_t extra; /* Extra space needed */
/*
@@ -114,7 +114,7 @@ test_vltypes_vlen_atomic(void)
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
uintn i,j; /* counting variables */
- int mem_used=0; /* Memory used during allocation */
+ size_t mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -242,7 +242,7 @@ test_vltypes_vlen_compound(void)
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
uintn i,j; /* counting variables */
- int mem_used=0; /* Memory used during allocation */
+ size_t mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -392,7 +392,7 @@ test_vltypes_compound_vlen_atomic(void)
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
uintn i,j; /* counting variables */
- int mem_used=0; /* Memory used during allocation */
+ size_t mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -531,11 +531,11 @@ test_vltypes_compound_vlen_atomic(void)
** Tests VL datatype with VL datatypes of atomic datatypes.
**
****************************************************************/
-static unsigned long vlen_size_func(unsigned long n)
+static size_t vlen_size_func(unsigned long n)
{
- unsigned long u=1;
- unsigned long tmp=1;
- unsigned long result=1;
+ size_t u=1;
+ size_t tmp=1;
+ size_t result=1;
while(u<n) {
u++;
@@ -565,7 +565,7 @@ test_vltypes_vlen_vlen_atomic(void)
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
uintn i,j,k; /* counting variables */
- int mem_used=0; /* Memory used during allocation */
+ size_t mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
/* Output message about test being performed */