Commit 5b2b51fe authored by Sean McBride's avatar Sean McBride

Fixed most ‘passedByValue’ cppcheck warnings

Changed some parameters to be by reference,
instead of by value, including some public API.
parent fb7a3909
......@@ -75,7 +75,7 @@ private:
double data[3];
};
static ostream &operator<<(ostream &os, const Triple t)
static ostream &operator<<(ostream &os, const Triple &t)
{
os << t[0] << ", " << t[1] << ", " << t[2];
return os;
......
......@@ -42,8 +42,8 @@
namespace
{
//----------------------------------------------------------------------------
inline static bool vtkReebGraphVertexSoS(const std::pair<int, double> v0,
const std::pair<int, double> v1)
inline static bool vtkReebGraphVertexSoS(const std::pair<int, double> &v0,
const std::pair<int, double> &v1)
{
return ((v0.second < v1.second)
|| ((v0.second == v1.second)&&(v0.first < v1.first)));
......
......@@ -131,7 +131,7 @@ int strcmp_null(const char* s1, const char* s2)
//////////////////////////////////////////////////////////////////////////////
// Prints and checks point/cell data
//////////////////////////////////////////////////////////////////////////////
int PrintAndCheck(const std::vector<vtkPolyData*> inputs, vtkDataSet* output,
int PrintAndCheck(const std::vector<vtkPolyData*>& inputs, vtkDataSet* output,
vtkDataSetAttributes*(*selector)(vtkDataSet*))
{
vtkDataSetAttributes* dataArrays = selector(output);
......@@ -356,7 +356,7 @@ vtkDataSetAttributes* CellDataSelector(vtkDataSet* ds)
//////////////////////////////////////////////////////////////////////////////
// Returns 1 on success, 0 otherwise
//////////////////////////////////////////////////////////////////////////////
int AppendDatasetsAndPrint(const std::vector<vtkPolyData*> inputs)
int AppendDatasetsAndPrint(const std::vector<vtkPolyData*>& inputs)
{
vtkNew<vtkAppendFilter> append;
for (size_t inputIndex = 0; inputIndex < inputs.size(); ++inputIndex)
......
......@@ -79,7 +79,7 @@ namespace
// Returns 1 on success, 0 otherwise
//////////////////////////////////////////////////////////////////////////////
int AppendDatasetsAndCheck(
const std::vector<vtkSmartPointer<vtkStructuredGrid> > inputs,
const std::vector<vtkSmartPointer<vtkStructuredGrid> >& inputs,
int outputExtent[6])
{
vtkNew<vtkStructuredGridAppend> append;
......
......@@ -31,8 +31,8 @@
namespace
{
//----------------------------------------------------------------------------
inline static bool vtkReebGraphVertexSoS(const std::pair<int, double> v0,
const std::pair<int, double> v1)
inline static bool vtkReebGraphVertexSoS(const std::pair<int, double>& v0,
const std::pair<int, double>& v1)
{
return ((v0.second < v1.second)
|| ((v0.second == v1.second)&&(v0.first < v1.first)));
......
......@@ -35,7 +35,7 @@ namespace ADIOS
{
//----------------------------------------------------------------------------
std::ostream& operator<<(std::ostream& os, const ArrayDim d)
std::ostream& operator<<(std::ostream& os, const ArrayDim& d)
{
if(d.ValueS.empty())
{
......
......@@ -482,7 +482,7 @@ void vtkADIOSWriter::Define(const std::string& path,
}
//----------------------------------------------------------------------------
bool vtkADIOSWriter::UpdateMTimeTable(const std::string path,
bool vtkADIOSWriter::UpdateMTimeTable(const std::string& path,
const vtkObject* value)
{
unsigned long &mtimeCurrent = this->LastUpdated[path];
......
......@@ -185,7 +185,7 @@ protected:
int RequestExtent[6];
// Used to determine whether or not the data getting written is stale
bool UpdateMTimeTable(const std::string path, const vtkObject* value);
bool UpdateMTimeTable(const std::string& path, const vtkObject* value);
std::map<std::string, unsigned long> LastUpdated;
private:
bool WriteInternal();
......
......@@ -113,7 +113,7 @@ int vtkAMREnzoReader::GetIndexFromArrayName( std::string arrayName )
}
//-----------------------------------------------------------------------------
double vtkAMREnzoReader::GetConversionFactor( const std::string name )
double vtkAMREnzoReader::GetConversionFactor( const std::string &name )
{
if( this->label2idx.find( name ) != this->label2idx.end() )
{
......@@ -132,7 +132,7 @@ double vtkAMREnzoReader::GetConversionFactor( const std::string name )
//-----------------------------------------------------------------------------
void vtkAMREnzoReader::ParseLabel(
const std::string labelString, int &idx, std::string &label)
const std::string &labelString, int &idx, std::string &label)
{
std::vector< std::string > strings;
......@@ -153,7 +153,7 @@ void vtkAMREnzoReader::ParseLabel(
//-----------------------------------------------------------------------------
void vtkAMREnzoReader::ParseCFactor(
const std::string labelString, int &idx, double &factor )
const std::string &labelString, int &idx, double &factor )
{
std::vector< std::string > strings;
......
......@@ -73,18 +73,18 @@ protected:
// Description:
// Given the label string, this method parses the attribute label and
// the string index.
void ParseLabel(const std::string labelString,int &idx,std::string &label);
void ParseLabel(const std::string &labelString, int &idx, std::string &label);
// Description:
// Given the label string, this method parses the corresponding attribute
// index and conversion factor
void ParseCFactor(const std::string labelString, int &idx, double &factor );
void ParseCFactor(const std::string &labelString, int &idx, double &factor );
// Description:
// Given the variable name, return the conversion factor used to convert
// the data to CGS. These conversion factors are read directly from the
// parameters file when the filename is set.
double GetConversionFactor( const std::string name );
double GetConversionFactor( const std::string& name );
// Description:
// See vtkAMRBaseReader::ReadMetaData
......
......@@ -199,7 +199,7 @@ public:
vtkFloodFillSeed(const vtkFloodFillSeed &seed) {
store[0]=seed.store[0]; store[1]=seed.store[1]; store[2]=seed.store[2]; };
const int &operator[](int i) const { return store[i]; };
const vtkFloodFillSeed &operator=(const vtkFloodFillSeed seed) {
const vtkFloodFillSeed &operator=(const vtkFloodFillSeed &seed) {
store[0]=seed.store[0]; store[1]=seed.store[1]; store[2]=seed.store[2];
return *this; };
......
......@@ -1068,7 +1068,7 @@ namespace boost {
inline typename property_traits<PMap>::reference
get(
vtkGraphPropertyMapMultiplier<PMap> multi,
const typename property_traits<PMap>::key_type key)
const typename property_traits<PMap>::key_type & key)
{
return multi.multiplier * get(multi.pmap, key);
}
......@@ -1077,7 +1077,7 @@ namespace boost {
inline void
put(
vtkGraphPropertyMapMultiplier<PMap> multi,
const typename property_traits<PMap>::key_type key,
const typename property_traits<PMap>::key_type & key,
const typename property_traits<PMap>::value_type & value)
{
put(multi.pmap, key, value);
......
......@@ -113,7 +113,7 @@ vtkShaderProgram::~vtkShaderProgram()
// Process the string, and return a version with replacements.
bool vtkShaderProgram::Substitute(std::string &source, const std::string &search,
const std::string replace, bool all)
const std::string &replace, bool all)
{
std::string::size_type pos = 0;
bool replaced = false;
......
......@@ -194,7 +194,7 @@ public:
static bool Substitute(
std::string &source,
const std::string &search,
const std::string replace,
const std::string &replace,
bool all = true);
// Description:
......
......@@ -32,7 +32,7 @@ namespace vtkvolume
{
//--------------------------------------------------------------------------
std::string replace(std::string source, const std::string &search,
const std::string replace, bool all)
const std::string &replace, bool all)
{
if (replace.empty())
{
......
......@@ -40,7 +40,7 @@ class DICOMCallback;
//
struct group_element_compare
{
bool operator() (const dicom_stl::pair<doublebyte, doublebyte> p1, const dicom_stl::pair<doublebyte, doublebyte> p2) const
bool operator() (const dicom_stl::pair<doublebyte, doublebyte>& p1, const dicom_stl::pair<doublebyte, doublebyte>& p2) const
{
if (p1.first < p2.first)
{
......
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