[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)
This commit is contained in:
Binh-Minh Ribler 2016-03-08 22:30:02 -05:00
parent 67432599a3
commit 20bfdeb2c1
3 changed files with 16 additions and 18 deletions

View File

@ -50,7 +50,7 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
#ifdef NO_STATIC_CAST #ifdef NO_STATIC_CAST
UserData4Aiterate* myData = (UserData4Aiterate *) op_data; UserData4Aiterate* myData = (UserData4Aiterate *) op_data;
#else #else
UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data); UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
#endif #endif
myData->op( *myData->location, s_attr_name, myData->opData ); myData->op( *myData->location, s_attr_name, myData->opData );
return 0; 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 // call the C library routine H5Aiterate2 to iterate the attributes
hsize_t idx = _idx ? (hsize_t)*_idx : 0; hsize_t idx = _idx ? (hsize_t)*_idx : 0;
int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
userAttrOpWrpr, static_cast<void *>(userData)); userAttrOpWrpr, reinterpret_cast<void *>(userData));
// release memory // release memory
delete userData; delete userData;

View File

@ -246,10 +246,10 @@ test_simple_io( H5File& file)
DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space)); DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
// Write the data to the dataset // 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 // 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 // Check that the values read are the same as the values written
for (i = 0; i < 100; i++) 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)); DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space));
// Write the data to the dataset // 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 // 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 // Check
for (int i = 0; i < 1000000; i++) { for (int i = 0; i < 1000000; i++) {
@ -539,7 +539,7 @@ test_compression(H5File& file)
*/ */
SUBTEST("Compression (uninitialized read)"); 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 (i=0; i<size[0]; i++) {
for (j=0; j<size[1]; j++) { 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(); PASSED();
@ -580,7 +580,7 @@ test_compression(H5File& file)
SUBTEST("Compression (read)"); SUBTEST("Compression (read)");
// Read the dataset back // 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 // Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++) for (i = 0; i < size[0]; i++)
@ -609,10 +609,10 @@ test_compression(H5File& file)
points[i][j] = rand (); 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 // 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 // Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++) for (i = 0; i < size[0]; i++)
@ -637,7 +637,7 @@ test_compression(H5File& file)
delete dataset; delete dataset;
dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); 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 // Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++) for (i = 0; i < size[0]; i++)
@ -667,8 +667,8 @@ test_compression(H5File& file)
} }
} }
space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset );
dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer); dataset->write (reinterpret_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer);
dataset->read (static_cast<void*>(check), 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 // Check that the values read are the same as the values written
for (i=0; i<hs_size[0]; i++) { for (i=0; i<hs_size[0]; i++) {
@ -714,8 +714,8 @@ test_compression(H5File& file)
DataSpace space2 (2, size, NULL); DataSpace space2 (2, size, NULL);
dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist)); 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->write (reinterpret_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->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 // Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++) for (i = 0; i < size[0]; i++)

View File

@ -94,9 +94,7 @@ static void test_array_compound_array()
for(idxk = 0; idxk < ARRAY1_DIM1; idxk++) for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
{ {
float temp = idxi * 10.0 + idxj * 2.5 + 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] = temp;
//wdata[idxi][idxj].f[idxk] = static_cast<float>(temp);
} }
} // end for } // end for