From 2c3ab210575979b29c6f7cfb83c3252f3dcd415a Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sat, 4 Apr 2015 02:47:49 -0500 Subject: [svn-r26727] Purpose: Fix warnings HDFFV-8658 cont. Description: Fixed many type conversion warnings and unused variables. Merged from trunk r26458, but also combined the fix in r26695 (dsets.cpp) to avoid test failure, that was undetected before committing to trunk until r26695. Platforms tested: Linux/64 (platypus) Linux/32 2.6 (jam) SunOS 5.11 (emu) --- c++/test/dsets.cpp | 8 +++--- c++/test/tattr.cpp | 52 ++++++++++++++++++------------------ c++/test/tfilter.cpp | 12 +++++++-- c++/test/tobject.cpp | 4 ++- c++/test/trefer.cpp | 74 ++++++++++++++++++++++++++-------------------------- c++/test/ttypes.cpp | 2 +- c++/test/tvlstr.cpp | 40 +++++++++++++++------------- 7 files changed, 102 insertions(+), 90 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index fc0ea3a..9f1916d 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -56,11 +56,12 @@ const H5std_string DSET_TCONV_NAME ("tconv"); const H5std_string DSET_COMPRESS_NAME("compressed"); const H5std_string DSET_BOGUS_NAME ("bogus"); +/* Temporary filter IDs used for testing */ const int H5Z_FILTER_BOGUS = 305; -// Local prototypes static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +// UNUSED variables caused warning, but taking them out caused failure. /*------------------------------------------------------------------------- * Function: test_create @@ -458,13 +459,10 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ *------------------------------------------------------------------------- */ 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) -BMR: removed UNUSED for now until asking Q. or R. to pass compilation*/ filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, void **buf) +// UNUSED variables caused warning, but taking them out caused failure. { return nbytes; } diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index e56110c..c604637 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -53,9 +53,9 @@ const size_t ATTR_MAX_DIMS = 7; /* 3-D dataset with fixed dimensions */ const int SPACE1_RANK = 3; -const int SPACE1_DIM1 = 3; -const int SPACE1_DIM2 = 15; -const int SPACE1_DIM3 = 13; +const hsize_t SPACE1_DIM1 = 3; +const hsize_t SPACE1_DIM2 = 15; +const hsize_t SPACE1_DIM3 = 13; /* Object names */ const H5std_string DSET1_NAME("Dataset1"); @@ -65,7 +65,7 @@ const H5std_string TYPE1_NAME("/Type"); /* Attribute Rank & Dimensions */ const H5std_string ATTR1_NAME("Attr1"); const int ATTR1_RANK = 1; -const int ATTR1_DIM1 = 3; +const hsize_t ATTR1_DIM1 = 3; int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */ // File attribute, using the same rank and dimensions as ATTR1_NAME's @@ -74,8 +74,8 @@ const H5std_string FATTR2_NAME("File Attr2"); const H5std_string ATTR2_NAME("Attr2"); const int ATTR2_RANK = 2; -const int ATTR2_DIM1 = 2; -const int ATTR2_DIM2 = 2; +const hsize_t ATTR2_DIM1 = 2; +const hsize_t ATTR2_DIM2 = 2; int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */ const H5std_string ATTR3_NAME("Attr3"); @@ -123,7 +123,7 @@ static void test_attr_basic_write() hsize_t dims2[] = {ATTR1_DIM1}; hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute - int i; + hsize_t i; // Output message about test being performed SUBTEST("Basic Attribute Writing Functions"); @@ -384,7 +384,7 @@ static void test_attr_getname() static void test_attr_rename() { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute - int i; + hsize_t i; // Output message about test being performed SUBTEST("Checking for Existence and Renaming Attribute"); @@ -493,7 +493,7 @@ static void test_attr_rename() ********************************************************************/ static void test_attr_basic_read() { - int i, j; + hsize_t i, j; // Output message about test being performed SUBTEST("Basic Attribute Reading Functions"); @@ -624,7 +624,6 @@ static void test_attr_compound_read() size_t size; // Attribute datatype size as stored in file size_t offset; // Attribute datatype field offset struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; // Buffer for reading 4th attribute - hsize_t i,j; // Output message about test being performed SUBTEST("Basic Attribute Functions"); @@ -654,7 +653,7 @@ static void test_attr_compound_read() // Get the dims of the dataspace and verify them int ndims = space.getSimpleExtentDims(dims); - if(dims[0]!=ATTR4_DIM1) + verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__); verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__); @@ -673,13 +672,14 @@ static void test_attr_compound_read() // Verify that the fields have the same names as when the type // was created - for(i=0; i