Commit 116aa4d2 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[STYLE] I introduced -Wold-style-cast to the CXX_FLAGS. This gives warning

if we use old-style casts which is forbidden by our coding standard.

I also adapted the code that still had old-style casts. Thus there should be
no such warnings at the moment.
parent 3ca12faf
......@@ -96,7 +96,7 @@ IF( CMAKE_HOST_SYSTEM MATCHES Windows )
SET( CMAKE_SHARED_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE )
SET( CMAKE_EXE_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE )
ELSE()
SET( CMAKE_CXX_FLAGS "-frtti -pedantic -ansi -Wall -Wno-long-long -Wextra" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS "-frtti -pedantic -ansi -Wall -Wno-long-long -Wextra -Wold-style-cast" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -O0" CACHE STRING "" FORCE )
ENDIF()
......
......@@ -194,7 +194,7 @@ osg::ref_ptr< osg::Image > WDataTexture3D::createTexture3D( int16_t* source, int
unsigned char* data = ima->data();
unsigned char* charSource = ( unsigned char* )&tempSource[0];
unsigned char* charSource = reinterpret_cast< unsigned char* >( &tempSource[0] );
for ( unsigned int i = 0; i < m_grid->getNbCoordsX() * m_grid->getNbCoordsY() * m_grid->getNbCoordsZ() * 2 ; ++i )
{
......@@ -214,7 +214,7 @@ osg::ref_ptr< osg::Image > WDataTexture3D::createTexture3D( float* source, int c
unsigned char* data = ima->data();
unsigned char* charSource = ( unsigned char* )source;
unsigned char* charSource = reinterpret_cast< unsigned char* >( source );
for ( unsigned int i = 0; i < m_grid->getNbCoordsX() * m_grid->getNbCoordsY() * m_grid->getNbCoordsZ() * 4 ; ++i )
{
......
......@@ -219,7 +219,7 @@ void WQtDatasetBrowser::addModule2( boost::shared_ptr< WModule > module, int sub
{
if ( boost::shared_dynamic_cast< WMData >( module ) )
{
WQtSubjectTreeItem* subject = ( WQtSubjectTreeItem* )m_treeWidget->topLevelItem( subjectId + 1 );
WQtSubjectTreeItem* subject = static_cast< WQtSubjectTreeItem* >( m_treeWidget->topLevelItem( subjectId + 1 ) );
subject->setExpanded( true );
WQtDatasetTreeItem* item = subject->addDatasetItem( module );
item->setDisabled( true );
......@@ -235,7 +235,7 @@ void WQtDatasetBrowser::addModule2( boost::shared_ptr< WModule > module, int sub
WQtDatasetTreeItem* WQtDatasetBrowser::addDataset( boost::shared_ptr< WModule > module, int subjectId )
{
int c = getFirstSubject();
WQtSubjectTreeItem* subject = ( WQtSubjectTreeItem* )m_treeWidget->topLevelItem( subjectId + c );
WQtSubjectTreeItem* subject = static_cast< WQtSubjectTreeItem* >( m_treeWidget->topLevelItem( subjectId + c ) );
subject->setExpanded( true );
WQtDatasetTreeItem* item = subject->addDatasetItem( module );
item->setDisabled( true );
......@@ -258,7 +258,7 @@ void WQtDatasetBrowser::addRoi( boost::shared_ptr< WRMROIRepresentation > roi )
{
case ROI :
{
WQtRoiTreeItem* roiItem =( ( WQtRoiTreeItem* ) m_treeWidget->selectedItems().at( 0 ) );
WQtRoiTreeItem* roiItem =( static_cast< WQtRoiTreeItem* >( m_treeWidget->selectedItems().at( 0 ) ) );
m_tiRois->setExpanded( true );
roiItem->setExpanded( true );
WQtRoiTreeItem* item = roiItem->addRoiItem( roi );
......@@ -267,7 +267,7 @@ void WQtDatasetBrowser::addRoi( boost::shared_ptr< WRMROIRepresentation > roi )
}
case SUBROI :
{
WQtRoiTreeItem* roiItem =( ( WQtRoiTreeItem* ) m_treeWidget->selectedItems().at( 0 )->parent() );
WQtRoiTreeItem* roiItem =( static_cast< WQtRoiTreeItem* >( m_treeWidget->selectedItems().at( 0 )->parent() ) );
m_tiRois->setExpanded( true );
roiItem->setExpanded( true );
WQtRoiTreeItem* item = roiItem->addRoiItem( roi );
......@@ -295,11 +295,11 @@ boost::shared_ptr< WModule > WQtDatasetBrowser::getSelectedModule()
{
if ( m_treeWidget->selectedItems().at( 0 )->type() == 1 )
{
return ( ( WQtDatasetTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
return ( static_cast< WQtDatasetTreeItem* >( m_treeWidget->selectedItems().at( 0 ) )->getModule() );
}
else if ( m_treeWidget->selectedItems().at( 0 )->type() == 3 )
{
return ( ( WQtModuleTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
return ( static_cast< WQtModuleTreeItem* >( m_treeWidget->selectedItems().at( 0 ) )->getModule() );
}
return boost::shared_ptr< WModule >();
......
......@@ -489,6 +489,6 @@ double WMDistanceMap::xxgauss( double x, double sigma )
{
double y, z, a = 2.506628273;
z = x / sigma;
y = exp( ( double ) -z * z * 0.5 ) / ( sigma * a );
y = exp( -z * z * 0.5 ) / ( sigma * a );
return y;
}
......@@ -314,9 +314,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
{
float maxDim = 255.0;
float xSlice = ( float )( m_sagittalPos->get() );
float ySlice = ( float )( m_coronalPos->get() );
float zSlice = ( float )( m_axialPos->get() );
float xSlice = static_cast< float >( m_sagittalPos->get() );
float ySlice = static_cast< float >( m_coronalPos->get() );
float zSlice = static_cast< float >( m_axialPos->get() );
float xPos = xSlice + 0.5f;
float yPos = ySlice + 0.5f;
......@@ -346,9 +346,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
{
boost::shared_ptr< WGridRegular3D > grid = ( *iter )->getGrid();
float maxX = ( float )( grid->getNbCoordsX() );
float maxY = ( float )( grid->getNbCoordsY() );
float maxZ = ( float )( grid->getNbCoordsZ() );
float maxX = static_cast< float >( grid->getNbCoordsX() );
float maxY = static_cast< float >( grid->getNbCoordsY() );
float maxZ = static_cast< float >( grid->getNbCoordsZ() );
float texX = xSlice / maxX;
//float texY = ySlice / maxY;
......@@ -381,9 +381,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
{
boost::shared_ptr< WGridRegular3D > grid = ( *iter )->getGrid();
float maxX = ( float )( grid->getNbCoordsX() );
float maxY = ( float )( grid->getNbCoordsY() );
float maxZ = ( float )( grid->getNbCoordsZ() );
float maxX = static_cast< float >( grid->getNbCoordsX() );
float maxY = static_cast< float >( grid->getNbCoordsY() );
float maxZ = static_cast< float >( grid->getNbCoordsZ() );
//float texX = xSlice / maxX;
float texY = ySlice / maxY;
......@@ -417,9 +417,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
boost::shared_ptr< WGridRegular3D > grid = ( *iter )->getGrid();
float maxX = ( float )( grid->getNbCoordsX() );
float maxY = ( float )( grid->getNbCoordsY() );
float maxZ = ( float )( grid->getNbCoordsZ() );
float maxX = static_cast< float >( grid->getNbCoordsX() );
float maxY = static_cast< float >( grid->getNbCoordsY() );
float maxZ = static_cast< float >( grid->getNbCoordsZ() );
//float texX = xSlice / maxX;
//float texY = ySlice / maxY;
......@@ -444,9 +444,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
}
else
{
float maxX = ( float )( m_maxSagittal->get() );
float maxY = ( float )( m_maxCoronal->get() );
float maxZ = ( float )( m_maxAxial->get() );
float maxX = static_cast< float >( m_maxSagittal->get() );
float maxY = static_cast< float >( m_maxCoronal->get() );
float maxZ = static_cast< float >( m_maxAxial->get() );
m_sagittalPos->setMax( maxX );
m_coronalPos->setMax( maxY );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment