diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-03-09 03:30:02 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-03-09 03:30:02 (GMT) |
commit | 20bfdeb2c16ded5bfefed3a505a73dbaca6e7e60 (patch) | |
tree | 2154822bcba629630db7bc2373c6c51536a69bf1 /c++ | |
parent | 67432599a3b53496d0fa357634447356d44c81e5 (diff) | |
download | hdf5-20bfdeb2c16ded5bfefed3a505a73dbaca6e7e60.zip hdf5-20bfdeb2c16ded5bfefed3a505a73dbaca6e7e60.tar.gz hdf5-20bfdeb2c16ded5bfefed3a505a73dbaca6e7e60.tar.bz2 |
[svn-r29361] Purpose: Correction
Description:
Replaced static_cast with reinterpret_cast for "void *".
Removed some commented-out old code.
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++')
-rw-r--r-- | c++/src/H5Location.cpp | 4 | ||||
-rw-r--r-- | c++/test/dsets.cpp | 28 | ||||
-rw-r--r-- | c++/test/tarray.cpp | 2 |
3 files changed, 16 insertions, 18 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 337aa6f..e2b68ae 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -50,7 +50,7 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, #ifdef NO_STATIC_CAST UserData4Aiterate* myData = (UserData4Aiterate *) op_data; #else - UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data); + UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data); #endif myData->op( *myData->location, s_attr_name, myData->opData ); return 0; @@ -232,7 +232,7 @@ int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_ // call the C library routine H5Aiterate2 to iterate the attributes hsize_t idx = _idx ? (hsize_t)*_idx : 0; int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, static_cast<void *>(userData)); + userAttrOpWrpr, reinterpret_cast<void *>(userData)); // release memory delete userData; diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 1837d17..60e875c 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -246,10 +246,10 @@ test_simple_io( H5File& file) DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space)); // Write the data to the dataset - dataset.write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.write(reinterpret_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Read the dataset back - dataset.read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < 100; i++) @@ -395,10 +395,10 @@ test_tconv( H5File& file) DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space)); // Write the data to the dataset - dataset.write (static_cast<void*>(out), PredType::STD_I32LE); + dataset.write (reinterpret_cast<void*>(out), PredType::STD_I32LE); // Read data with byte order conversion - dataset.read (static_cast<void*>(in), PredType::STD_I32BE); + dataset.read (reinterpret_cast<void*>(in), PredType::STD_I32BE); // Check for (int i = 0; i < 1000000; i++) { @@ -539,7 +539,7 @@ test_compression(H5File& file) */ SUBTEST("Compression (uninitialized read)"); - dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { @@ -569,7 +569,7 @@ test_compression(H5File& file) } } - dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (reinterpret_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); PASSED(); @@ -580,7 +580,7 @@ test_compression(H5File& file) SUBTEST("Compression (read)"); // Read the dataset back - dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -609,10 +609,10 @@ test_compression(H5File& file) points[i][j] = rand (); } } - dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (reinterpret_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Read the dataset back and check it - dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -637,7 +637,7 @@ test_compression(H5File& file) delete dataset; dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); - dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -667,8 +667,8 @@ test_compression(H5File& file) } } space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); - dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer); - dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, space1, space1, xfer); + dataset->write (reinterpret_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer); + dataset->read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, space1, space1, xfer); // Check that the values read are the same as the values written for (i=0; i<hs_size[0]; i++) { @@ -714,8 +714,8 @@ test_compression(H5File& file) DataSpace space2 (2, size, NULL); dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist)); - dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (reinterpret_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index e73cfd0..a6cbae4 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -94,9 +94,7 @@ static void test_array_compound_array() for(idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; - //wdata[idxi][idxj].f[idxk]=(float)(idxi * 10.0F + idxj * 2.5F + idxk); wdata[idxi][idxj].f[idxk] = temp; - //wdata[idxi][idxj].f[idxk] = static_cast<float>(temp); } } // end for |