summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-08-10 22:30:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-08-10 22:30:01 (GMT)
commitd24ae52673e96864f4e406dd7b277f91d42fbb38 (patch)
treee9bb3c48c58f43899616fe8d6cda8daec8d4cc8a /tools/h5dump
parent48842d60fa84fb69fb0a3dc527132eb93a6be7f2 (diff)
downloadhdf5-d24ae52673e96864f4e406dd7b277f91d42fbb38.zip
hdf5-d24ae52673e96864f4e406dd7b277f91d42fbb38.tar.gz
hdf5-d24ae52673e96864f4e406dd7b277f91d42fbb38.tar.bz2
[svn-r4326] Purpose:
Code cleanups, mostly.. Description: Work on pacifying the SGI compiler to get the generic properties working correctly with --enable-parallel and --enable-fortran. It's not quite fixed yet, but I need to head home and these patches help... :-/ Platforms tested: IRIX64 6.5 (modi4)
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c30
-rw-r--r--tools/h5dump/h5dumptst.c108
2 files changed, 115 insertions, 23 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 51a0608..dfc1a09 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -3237,9 +3237,9 @@ static const char *apos = "&apos;";
static char *
xml_escape_the_name(const char *str)
{
- int extra;
- int len;
- int i;
+ size_t extra;
+ size_t len;
+ size_t i;
const char *cp;
char *ncp;
char *rcp;
@@ -3323,9 +3323,9 @@ xml_escape_the_name(const char *str)
static char *
xml_escape_the_string(const char *str, int slen)
{
- int extra;
- int len;
- int i;
+ size_t extra;
+ size_t len;
+ size_t i;
const char *cp;
char *ncp;
char *rcp;
@@ -3360,7 +3360,7 @@ xml_escape_the_string(const char *str, int slen)
}
cp = str;
- rcp = ncp = calloc((size_t)(len + extra + 1), sizeof(char));
+ rcp = ncp = calloc((len + extra + 1), sizeof(char));
if (ncp == NULL)
return NULL; /* ?? */
@@ -3472,7 +3472,7 @@ xml_print_datatype(hid_t type)
}
printf("\" Size=\"");
sz = H5Tget_size(type);
- printf("%d", sz);
+ printf("%lu", (unsigned long)sz);
printf("\" />\n");
indent -= COL;
indentation(indent);
@@ -3503,12 +3503,12 @@ xml_print_datatype(hid_t type)
}
printf("\" Size=\"");
sz = H5Tget_size(type);
- printf("%d", sz);
+ printf("%lu", (unsigned long)sz);
H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
- printf("\" SignBitLocation=\"%d\" ", spos);
- printf("ExponentBits=\"%d\" ExponentLocation=\"%d\" ", esize, epos);
- printf("MantissaBits=\"%d\" MantissaLocation=\"%d\" />\n",
- msize, mpos);
+ printf("\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
+ printf("ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
+ printf("MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n",
+ (unsigned long)msize, (unsigned long)mpos);
indent -= COL;
indentation(indent);
printf("</AtomicType>\n");
@@ -3577,7 +3577,7 @@ xml_print_datatype(hid_t type)
printf("ERROR_UNKNOWN");
}
size = H5Tget_size(type);
- printf("\" Size=\"%d\"/>\n", size);
+ printf("\" Size=\"%lu\"/>\n", (unsigned long)size);
indent -= COL;
indentation(indent);
printf("</AtomicType>\n");
@@ -3592,7 +3592,7 @@ xml_print_datatype(hid_t type)
indentation(indent);
printf("<OpaqueType Tag=\"%s\" ", H5Tget_tag(type));
size = H5Tget_size(type);
- printf("Size=\"%d\"/>\n", size);
+ printf("Size=\"%lu\"/>\n", (unsigned long)size);
indent -= COL;
indentation(indent);
printf("</AtomicType>\n");
diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c
index b4ab79e..24f5f21 100644
--- a/tools/h5dump/h5dumptst.c
+++ b/tools/h5dump/h5dumptst.c
@@ -1856,7 +1856,6 @@ static void test_vldatatypes(void)
int i;
herr_t ret=0;
- ret = ret; /* so that compiler won't complain "is set but never used" */
file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Allocate and initialize VL dataset to write */
@@ -1875,11 +1874,16 @@ static void test_vldatatypes(void)
type = H5Tvlen_create(H5T_NATIVE_INT);
dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT);
ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ assert(ret>=0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
+ assert(ret>=0);
ret = H5Dclose(dset);
+ assert(ret>=0);
ret = H5Tclose(type);
+ assert(ret>=0);
ret = H5Sclose(space);
+ assert(ret>=0);
/* Allocate and initialize VL dataset to write */
for(i = 0; i < SPACE1_DIM1; i++) {
@@ -1897,11 +1901,16 @@ static void test_vldatatypes(void)
type = H5Tvlen_create(H5T_NATIVE_FLOAT);
dset = H5Dcreate(file, "Dataset2.0", type, space, H5P_DEFAULT);
ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ assert(ret>=0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
+ assert(ret>=0);
ret = H5Dclose(dset);
+ assert(ret>=0);
ret = H5Tclose(type);
+ assert(ret>=0);
ret = H5Sclose(space);
+ assert(ret>=0);
/* Allocate and initialize a scalar VL dataset to write */
adata.p = malloc(37 * sizeof(int));
@@ -1915,12 +1924,18 @@ static void test_vldatatypes(void)
type = H5Tvlen_create(H5T_NATIVE_INT);
dset = H5Dcreate(file, "Dataset3.0", type, space, H5P_DEFAULT);
ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
+ assert(ret>=0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata);
+ assert(ret>=0);
ret = H5Dclose(dset);
+ assert(ret>=0);
ret = H5Tclose(type);
+ assert(ret>=0);
ret = H5Sclose(space);
+ assert(ret>=0);
ret = H5Fclose(file);
+ assert(ret>=0);
}
static void test_vldatatypes2(void)
@@ -1935,8 +1950,6 @@ static void test_vldatatypes2(void)
uintn i,j,k; /* counting variables */
herr_t ret; /* Generic return value */
- ret = ret; /* so that compiler won't complain "is set but never used" */
-
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].p=malloc((i+1)*sizeof(hvl_t));
@@ -1974,16 +1987,23 @@ static void test_vldatatypes2(void)
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Reclaim the write VL data */
ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid2);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
@@ -2003,8 +2023,6 @@ static void test_vldatatypes3(void)
uintn i,j; /* counting variables */
herr_t ret; /* Generic return value */
- ret = ret; /* so that compiler won't complain "is set but never used" */
-
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].i=i*10;
@@ -2029,24 +2047,34 @@ static void test_vldatatypes3(void)
/* Insert fields */
ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ assert(ret>=0);
ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ assert(ret>=0);
ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
+ assert(ret>=0);
/* Create a dataset */
dataset=H5Dcreate(fid1,"Dataset1",tid2,sid1,H5P_DEFAULT);
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Reclaim the write VL data */
ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid2);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_vldatatypes4(void)
@@ -2064,8 +2092,6 @@ static void test_vldatatypes4(void)
uintn i,j; /* counting variables */
herr_t ret; /* Generic return value */
- ret = ret; /* so that compiler won't complain "is set but never used" */
-
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].p=malloc((i+1)*sizeof(s1));
@@ -2087,7 +2113,9 @@ static void test_vldatatypes4(void)
/* Insert fields */
ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ assert(ret>=0);
ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ assert(ret>=0);
/* Create a datatype to refer to */
tid1 = H5Tvlen_create (tid2);
@@ -2097,16 +2125,23 @@ static void test_vldatatypes4(void)
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Reclaim the write VL data */
ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Tclose(tid2);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_array1(void)
@@ -2140,12 +2175,17 @@ static void test_array1(void)
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_array2(void)
@@ -2181,12 +2221,17 @@ static void test_array2(void)
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid);
+ assert(ret>=0);
ret = H5Sclose(sid);
+ assert(ret>=0);
ret = H5Fclose(fid);
+ assert(ret>=0);
}
static void test_array3(void)
@@ -2227,13 +2272,19 @@ static void test_array3(void)
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Tclose(tid2);
+ assert(ret>=0);
ret = H5Sclose(sid);
+ assert(ret>=0);
ret = H5Fclose(fid);
+ assert(ret>=0);
}
static void test_array4(void)
@@ -2271,27 +2322,35 @@ static void test_array4(void)
/* Insert integer field */
ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
+ assert(ret>=0);
/* Insert float field */
ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), H5T_NATIVE_FLOAT);
+ assert(ret>=0);
/* Create an array datatype to refer to */
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
/* Close compound datatype */
ret=H5Tclose(tid2);
+ assert(ret>=0);
/* Create a dataset */
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_array5(void)
@@ -2331,33 +2390,42 @@ static void test_array5(void)
/* Insert integer field */
ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
+ assert(ret>=0);
/* Create an array of floats datatype */
tid3 = H5Tarray_create (H5T_NATIVE_FLOAT,ARRAY1_RANK,tdims1,NULL);
/* Insert float array field */
ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3);
+ assert(ret>=0);
/* Close array of floats field datatype */
ret=H5Tclose(tid3);
+ assert(ret>=0);
/* Create an array datatype to refer to */
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
/* Close compound datatype */
ret=H5Tclose(tid2);
+ assert(ret>=0);
/* Create a dataset */
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_array6(void)
@@ -2396,21 +2464,28 @@ static void test_array6(void)
/* Close VL datatype */
ret=H5Tclose(tid2);
+ assert(ret>=0);
/* Create a dataset */
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Reclaim the write VL data */
ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_array7(void)
@@ -2451,27 +2526,35 @@ static void test_array7(void)
/* Close nested array datatype */
ret=H5Tclose(tid3);
+ assert(ret>=0);
/* Create an array datatype to refer to */
tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL);
/* Close VL datatype */
ret=H5Tclose(tid2);
+ assert(ret>=0);
/* Create a dataset */
dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT);
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Reclaim the write VL data */
ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ assert(ret>=0);
/* Close Dataset */
ret = H5Dclose(dataset);
+ assert(ret>=0);
ret = H5Tclose(tid1);
+ assert(ret>=0);
ret = H5Sclose(sid1);
+ assert(ret>=0);
ret = H5Fclose(fid1);
+ assert(ret>=0);
}
static void test_empty(void)
@@ -2485,7 +2568,6 @@ static void test_empty(void)
hsize_t dims[] = { SPACE1_DIM1 };
herr_t ret=0;
- ret = ret; /* so that compiler won't complain "is set but never used" */
file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
@@ -2495,24 +2577,30 @@ static void test_empty(void)
dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
+ assert(ret>=0);
ret = H5Tclose(type);
+ assert(ret>=0);
/* write out an empty native integer dataset dataset */
dset = H5Dcreate(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
+ assert(ret>=0);
/* write out an empty native floating-point dataset dataset */
dset = H5Dcreate(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
+ assert(ret>=0);
/* write out an empty array dataset */
type = H5Tarray_create(H5T_NATIVE_INT,SPACE1_RANK,dims,NULL);
dset = H5Dcreate(file, "Dataset4.0", type, space, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
+ assert(ret>=0);
ret = H5Tclose(type);
+ assert(ret>=0);
/* write out an empty compound dataset */
type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct));
@@ -2522,11 +2610,15 @@ static void test_empty(void)
dset = H5Dcreate(file, "Dataset5.0", type, space, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
+ assert(ret>=0);
ret = H5Tclose(type);
+ assert(ret>=0);
ret = H5Sclose(space);
+ assert(ret>=0);
ret = H5Fclose(file);
+ assert(ret>=0);
}
int main(void)