summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/test/ttypes.cpp2
-rw-r--r--c++/test/tvlstr.cpp43
-rw-r--r--test/tvlstr.c18
3 files changed, 32 insertions, 31 deletions
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index 557f400..c9f70e7 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -411,7 +411,7 @@ static void test_named ()
itype.commit(file, "native-int");
// Check that it is committed.
- if (itype.committed() <= 0)
+ if (itype.committed() == false)
cerr << "IntType::committed() returned false" << endl;
// We should not be able to modify a type after it has been committed.
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index d4d0fd1..71b16a6 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -68,8 +68,8 @@ void test_vlstr_free_custom(void *mem, void *info);
****************************************************************/
void *test_vlstr_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
+ void *ret_value = NULL; // Pointer to return
+ size_t *mem_used = (size_t *)info; // Get the pointer to the memory used
size_t extra; // Extra space needed
/*
@@ -77,13 +77,14 @@ void *test_vlstr_alloc_custom(size_t size, void *info)
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *),sizeof(size_t));
- if((ret_value=HDmalloc(extra+size))!=NULL) {
- *(size_t *)ret_value=size;
- *mem_used+=size;
+ if((ret_value = HDmalloc(extra + size)) != NULL) {
+ *(size_t *)ret_value = size;
+ *mem_used += size;
} // end if
- ret_value=((unsigned char *)ret_value)+extra;
+ ret_value = ((unsigned char *)ret_value) + extra;
+
return(ret_value);
}
@@ -100,7 +101,7 @@ void *test_vlstr_alloc_custom(size_t size, void *info)
void test_vlstr_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
/*
@@ -174,14 +175,14 @@ static void test_vlstrings_basic()
// Change to the custom memory allocation routines for reading
// VL string.
DSetMemXferPropList xfer;
- int mem_used = 0; // Memory used during allocation
+ size_t mem_used = 0; // Memory used during allocation
xfer.setVlenMemManager(test_vlstr_alloc_custom, &mem_used, test_vlstr_free_custom, &mem_used);
// Make certain the correct amount of memory will be used.
hsize_t vlsize = dataset.getVlenBufSize(tid1, sid1);
// Count the actual number of bytes used by the strings.
- int str_used; // String data in memory
+ size_t str_used; // String data in memory
hsize_t i; // counting variable
for (i=0,str_used=0; i<SPACE1_DIM1; i++)
str_used+=HDstrlen(wdata[i])+1;
@@ -197,14 +198,14 @@ static void test_vlstrings_basic()
verify_val(mem_used, str_used, "DataSet::read", __LINE__, __FILE__);
// Compare data read in.
- for (i=0; i<SPACE1_DIM1; i++) {
- int wlen = HDstrlen(wdata[i]);
- int rlen = HDstrlen(rdata[i]);
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ size_t wlen = HDstrlen(wdata[i]);
+ size_t rlen = HDstrlen(rdata[i]);
if(wlen != rlen) {
- TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, wlen, (int)i, rlen);
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)i, (unsigned)wlen, (int)i, (unsigned)rlen);
continue;
} // end if
- if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
+ if(HDstrcmp(wdata[i], rdata[i]) != 0) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]);
continue;
} // end if
@@ -276,7 +277,7 @@ static void test_vlstrings_special()
// Check data read in.
hsize_t i; // counting variable
- for (i=0; i<SPACE1_DIM1; i++)
+ for(i = 0; i < SPACE1_DIM1; i++)
if(rdata[i] != NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
@@ -285,14 +286,14 @@ static void test_vlstrings_special()
dataset.read(rdata, tid1);
// Compare data read in.
- for (i=0; i<SPACE1_DIM1; i++) {
- int wlen = HDstrlen(wdata[i]);
- int rlen = HDstrlen(rdata[i]);
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ size_t wlen = HDstrlen(wdata[i]);
+ size_t rlen = HDstrlen(rdata[i]);
if(wlen != rlen) {
- TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, wlen, (int)i, rlen);
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)i, (unsigned)wlen, (int)i, (unsigned)rlen);
continue;
} // end if
- if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
+ if(HDstrcmp(wdata[i],rdata[i]) != 0) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]);
continue;
} // end if
diff --git a/test/tvlstr.c b/test/tvlstr.c
index d87268e..a411b86 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -62,7 +62,7 @@ void test_vlstr_free_custom(void *mem, void *info);
void *test_vlstr_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 */
/*
@@ -90,7 +90,7 @@ void *test_vlstr_alloc_custom(size_t size, void *info)
void test_vlstr_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 */
/*
@@ -132,8 +132,8 @@ test_vlstrings_basic(void)
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
unsigned i; /* counting variable */
- int str_used; /* String data in memory */
- int mem_used=0; /* Memory used during allocation */
+ size_t str_used; /* String data in memory */
+ size_t mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -196,26 +196,26 @@ test_vlstrings_basic(void)
VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
VERIFY(mem_used,str_used,"H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i])!=strlen(rdata[i])) {
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) {
TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
continue;
} /* end if */
- if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
+ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
continue;
} /* end if */
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */