Commit 5385b815 authored by Sean McBride's avatar Sean McBride

Fixed new cppcheck 1.75 warnings about pass by reference

Made several params const reference.
Mostly in tests, but a couple are slight API change.
parent 5556f6f9
......@@ -337,7 +337,7 @@ int TestAMRBoxSerialization()
}
//------------------------------------------------------------------------------
void CheckTestStatus( int rc, std::string TestName )
void CheckTestStatus( int rc, const std::string &TestName )
{
std::cout << "Test " << TestName << "...";
std::cout.flush();
......
......@@ -423,7 +423,7 @@ void vtkExtentRCBPartitioner::AcquireDataDescription()
}
//------------------------------------------------------------------------------
void vtkExtentRCBPartitioner::PrintExtent( std::string name, int ext[6] )
void vtkExtentRCBPartitioner::PrintExtent( const std::string &name, int ext[6] )
{
cout << name << ": [";
for( int i=0; i < 6; ++i )
......
......@@ -164,7 +164,7 @@ class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExtentRCBPartitioner : public vtkObject
// Description:
// A convenience method for debugging purposes.
void PrintExtent( std::string name, int ext[6] );
void PrintExtent( const std::string& name, int ext[6] );
int NumberOfGhostLayers;
int DataDescription;
......
......@@ -45,7 +45,7 @@ namespace AMRCommon {
//------------------------------------------------------------------------------
// Description:
// Writes a uniform grid as a structure grid
void WriteUniformGrid( vtkUniformGrid *g, std::string prefix )
void WriteUniformGrid( vtkUniformGrid *g, const std::string &prefix )
{
assert( "pre: Uniform grid (g) is NULL!" && (g != NULL) );
......@@ -63,7 +63,7 @@ void WriteUniformGrid( vtkUniformGrid *g, std::string prefix )
//------------------------------------------------------------------------------
// Description:
// Writes the given AMR dataset to a *.vth file with the given prefix.
void WriteAMRData( vtkOverlappingAMR *amrData, std::string prefix )
void WriteAMRData( vtkOverlappingAMR *amrData, const std::string &prefix )
{
// Sanity check
assert( "pre: AMR dataset is NULL!" && (amrData != NULL) );
......@@ -81,7 +81,7 @@ void WriteAMRData( vtkOverlappingAMR *amrData, std::string prefix )
//------------------------------------------------------------------------------
// Description:
// Reads AMR data to the given data-structure from the prescribed file.
vtkHierarchicalBoxDataSet* ReadAMRData( std::string file )
vtkHierarchicalBoxDataSet* ReadAMRData( const std::string &file )
{
// Sanity check
// assert( "pre: AMR dataset is NULL!" && (amrData != NULL) );
......@@ -110,7 +110,7 @@ vtkHierarchicalBoxDataSet* ReadAMRData( std::string file )
//------------------------------------------------------------------------------
// Description:
// Writes the given multi-block data to an XML file with the prescribed prefix
void WriteMultiBlockData( vtkMultiBlockDataSet *mbds, std::string prefix )
void WriteMultiBlockData( vtkMultiBlockDataSet *mbds, const std::string &prefix )
{
// Sanity check
assert( "pre: Multi-block dataset is NULL" && (mbds != NULL) );
......
......@@ -189,7 +189,7 @@ int TestAMRVisibility( const int dataDescription )
}
//------------------------------------------------------------------------------
void CheckTestStatus( int rc, std::string TestName )
void CheckTestStatus( int rc, const std::string &TestName )
{
std::cout << "Test " << TestName << "...";
std::cout.flush();
......
......@@ -44,7 +44,7 @@
// Debugging utilites. Must link vtkIOXML to work
#ifdef DEBUG_ON
#include "vtkXMLImageDataWriter.h"
void WriteUniformGrid( vtkUniformGrid *g, std::string prefix )
void WriteUniformGrid( vtkUniformGrid *g, const std::string &prefix )
{
assert( "pre: Uniform grid (g) is NULL!" && (g != NULL) );
......
......@@ -39,7 +39,7 @@ double exponential_distribution(const int i, const double beta)
}
//------------------------------------------------------------------------------
void WriteGrid(vtkRectilinearGrid* grid, std::string file)
void WriteGrid(vtkRectilinearGrid* grid, const std::string& file)
{
assert( "pre: input grid instance is NULL!" && (grid != NULL) );
......
......@@ -32,7 +32,7 @@
//------------------------------------------------------------------------------
// Description:
// Writes multi-block dataset to grid
void WriteMultiBlock(std::string file, vtkMultiBlockDataSet *mbds)
void WriteMultiBlock(const std::string &file, vtkMultiBlockDataSet *mbds)
{
assert("pre: NULL multi-block dataset!" && (mbds != NULL) );
......
......@@ -84,7 +84,7 @@ const double origin[3] = {0.0,0.0,0.0};
#ifdef ENABLE_IO
//------------------------------------------------------------------------------
void WriteGrid(vtkUniformGrid *grid, std::string prefix)
void WriteGrid(vtkUniformGrid *grid, const std::string &prefix)
{
assert("pre: grid is NULL" && (grid != NULL) );
......@@ -145,7 +145,7 @@ void GetGridExtent(
}
//------------------------------------------------------------------------------
void WriteAMR(vtkOverlappingAMR *amr, std::string prefix)
void WriteAMR(vtkOverlappingAMR *amr, const std::string &prefix)
{
#ifdef ENABLE_IO
std::ostringstream oss;
......@@ -172,7 +172,7 @@ void WriteAMR(vtkOverlappingAMR *amr, std::string prefix)
}
//------------------------------------------------------------------------------
void ApplyXYZFieldToGrid( vtkUniformGrid *grd, std::string prefix )
void ApplyXYZFieldToGrid( vtkUniformGrid *grd, const std::string &prefix )
{
assert( "pre: grd should not be NULL" && (grd != NULL) );
......
......@@ -149,7 +149,7 @@ void AttachNodeAndCellGhostFlags( vtkMultiBlockDataSet *mbds )
// Description:
// Applies an XYZ field to the nodes and cells of the grid whose value is
// corresponding to the XYZ coordinates at that location
void ApplyXYZFieldToGrid( vtkUniformGrid *grd, std::string prefix )
void ApplyXYZFieldToGrid( vtkUniformGrid *grd, const std::string &prefix )
{
assert( "pre: grd should not be NULL" && (grd != NULL) );
......@@ -228,7 +228,7 @@ void ApplyXYZFieldToGrid( vtkUniformGrid *grd, std::string prefix )
}
//------------------------------------------------------------------------------
void ApplyFieldsToDataSet( vtkMultiBlockDataSet *mbds, std::string prefix )
void ApplyFieldsToDataSet( vtkMultiBlockDataSet *mbds, const std::string &prefix )
{
unsigned int block = 0;
for( ; block < mbds->GetNumberOfBlocks(); ++block )
......@@ -416,7 +416,7 @@ void RegisterGrids(
}
//------------------------------------------------------------------------------
void WriteMultiBlock( vtkMultiBlockDataSet *mbds, std::string prefix )
void WriteMultiBlock( vtkMultiBlockDataSet *mbds, const std::string &prefix )
{
......@@ -517,7 +517,7 @@ vtkMultiBlockDataSet* GetGhostedDataSet(
//------------------------------------------------------------------------------
bool Check(
std::string name, const int val, const int expected, bool verbose=true )
const std::string &name, const int val, const int expected, bool verbose=true )
{
bool status = false;
......
......@@ -52,7 +52,7 @@ namespace
//------------------------------------------------------------------------------
// Description:
// Write the uniform grid multi-block dataset into an XML file.
void WriteMultiBlock( vtkMultiBlockDataSet *mbds, std::string prefix )
void WriteMultiBlock( vtkMultiBlockDataSet *mbds, const std::string &prefix )
{
#ifdef DEBUG_ON
assert( "pre: Multi-block is NULL!" && (mbds != NULL) );
......
......@@ -31,7 +31,7 @@
//------------------------------------------------------------------------------
// Description:
// Writes multi-block dataset to grid
void WriteMultiBlock(std::string file, vtkMultiBlockDataSet *mbds)
void WriteMultiBlock(const std::string &file, vtkMultiBlockDataSet *mbds)
{
assert("pre: NULL multi-block dataset!" && (mbds != NULL) );
......
......@@ -167,7 +167,7 @@ int CheckFields( vtkMultiBlockDataSet *mbds,bool hasNodeData,bool hasCellData )
//------------------------------------------------------------------------------
// Description:
// Write the uniform grid multi-block dataset into an XML file.
void WriteMultiBlock( vtkMultiBlockDataSet *mbds, std::string prefix )
void WriteMultiBlock( vtkMultiBlockDataSet *mbds, const std::string &prefix )
{
assert( "pre: Multi-block is NULL!" && (mbds != NULL) );
......
......@@ -57,7 +57,7 @@ int NumberOfProcessors;
//------------------------------------------------------------------------------
void WriteDistributedDataSet(
std::string prefix, vtkMultiBlockDataSet *dataset)
const std::string &prefix, vtkMultiBlockDataSet *dataset)
{
#ifdef DEBUG_ON
vtkXMLPMultiBlockDataWriter *writer = vtkXMLPMultiBlockDataWriter::New();
......
......@@ -74,7 +74,7 @@ namespace Logger {
//------------------------------------------------------------------------------
void WriteDistributedDataSet(
std::string prefix, vtkMultiBlockDataSet *dataset)
const std::string &prefix, vtkMultiBlockDataSet *dataset)
{
#ifdef DEBUG_ON
vtkXMLPMultiBlockDataWriter *writer = vtkXMLPMultiBlockDataWriter::New();
......
......@@ -355,7 +355,7 @@ vtkMultiBlockDataSet* GetDataSet(
//------------------------------------------------------------------------------
void WriteDistributedDataSet(
std::string prefix, vtkMultiBlockDataSet *dataset)
const std::string &prefix, vtkMultiBlockDataSet *dataset)
{
#ifdef DEBUG_ON
vtkXMLPMultiBlockDataWriter *writer = vtkXMLPMultiBlockDataWriter::New();
......
......@@ -62,7 +62,7 @@ int NumberOfProcessors;
//------------------------------------------------------------------------------
void WriteDistributedDataSet(
std::string prefix, vtkMultiBlockDataSet *dataset)
const std::string &prefix, vtkMultiBlockDataSet *dataset)
{
#ifdef DEBUG_ON
vtkXMLPMultiBlockDataWriter *writer = vtkXMLPMultiBlockDataWriter::New();
......
......@@ -33,8 +33,8 @@
#include <cmath>
#include <sstream>
template<typename T> int TestProbabilisticKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, std::string description = "", bool useProbs = true);
template<typename T> int TestKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, std::string description = "");
template<typename T> int TestProbabilisticKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, const std::string &description = "", bool useProbs = true);
template<typename T> int TestKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, const std::string &description = "");
//-----------------------------------------------------------------------------
int UnitTestKernels(int, char*[])
......@@ -231,7 +231,7 @@ int UnitTestKernels(int, char*[])
return status;
}
template<typename T> int TestProbabilisticKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, std::string description, bool useProbs)
template<typename T> int TestProbabilisticKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, const std::string &description, bool useProbs)
{
int status = EXIT_SUCCESS;
......@@ -395,7 +395,7 @@ template<typename T> int TestProbabilisticKernel (vtkSmartPointer<T> kernel, vtk
return status;
}
template<typename T> int TestKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, std::string description)
template<typename T> int TestKernel (vtkSmartPointer<T> kernel, vtkIdType numberOfPoints, const std::string &description)
{
int status = 0;
std::cout << "Testing " << description;
......
......@@ -26,7 +26,7 @@ namespace EnzoReaderTest {
//------------------------------------------------------------------------------
template<class T>
int CheckValue( std::string name, T actualValue, T expectedValue )
int CheckValue( const std::string &name, T actualValue, T expectedValue )
{
if( actualValue != expectedValue )
{
......
......@@ -25,7 +25,7 @@ namespace FlashReaderTest {
//------------------------------------------------------------------------------
template<class T>
int CheckValue( std::string name, T actualValue, T expectedValue )
int CheckValue( const std::string &name, T actualValue, T expectedValue )
{
if( actualValue != expectedValue )
{
......
......@@ -646,7 +646,7 @@ void testPipeline(vtkUnstructuredGridBase *input, vtkDataSet *&output,
}
// Check that refOutput == testOutput, then delete and clear the outputs.
bool validateFilterOutput(std::string name,
bool validateFilterOutput(const std::string &name,
vtkDataSet *&refOutput, vtkDataSet *&testOutput)
{
if (refOutput->GetNumberOfPoints() == 0)
......
......@@ -95,7 +95,7 @@ public:
EncodeNonEmptyByteString5(writer, bytes);
}
static inline void EncodeCharacterString3(vtkX3DExporterFIByteWriter* writer, std::string value)
static inline void EncodeCharacterString3(vtkX3DExporterFIByteWriter* writer, const std::string& value)
{
// We want to start at position 3
assert(writer->CurrentBytePos == 2);
......@@ -109,7 +109,7 @@ public:
// ITU C.23: Encoding of the NonEmptyByteString starting
// on the fifth bit of an byte
static inline void EncodeNonEmptyByteString5(vtkX3DExporterFIByteWriter* writer, std::string value)
static inline void EncodeNonEmptyByteString5(vtkX3DExporterFIByteWriter* writer, const std::string& value)
{
int length = static_cast<int>(value.length());
if (length <= 8)
......
......@@ -36,7 +36,7 @@ namespace
return true;
}
bool TestAMRXMLIO_OverlappingAMR2D(std::string output_dir)
bool TestAMRXMLIO_OverlappingAMR2D(const std::string &output_dir)
{
vtkNew<vtkAMRGaussianPulseSource> pulse;
pulse->SetDimension(2);
......@@ -58,7 +58,7 @@ namespace
vtkOverlappingAMR::SafeDownCast(reader->GetOutputDataObject(0)));
}
bool TestAMRXMLIO_OverlappingAMR3D(std::string output_dir)
bool TestAMRXMLIO_OverlappingAMR3D(const std::string &output_dir)
{
vtkNew<vtkAMRGaussianPulseSource> pulse;
pulse->SetDimension(3);
......
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