Commit 496d1c8e authored by Sean McBride's avatar Sean McBride Committed by Kitware Robot

Merge topic 'dead-code'

1d6dc5ee Clarified comment about time system (unix vs UTC)
479a0e20 Fixed buffer overrun by using vsnprintf instead of vsprintf
4cb5e34c Fixed all -Wswitch-enum warnings
545ff6d8 Fixed all -Wunused-member-function warnings, mostly by removing dead code
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David Gobbi's avatarDavid Gobbi <david.gobbi@gmail.com>
Acked-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !4976
parents 5d0206ec 1d6dc5ee
...@@ -176,6 +176,7 @@ vtkRecti vtkContextArea::ComputeExpandedDrawAreaGeometry(vtkContext2D *painter) ...@@ -176,6 +176,7 @@ vtkRecti vtkContextArea::ComputeExpandedDrawAreaGeometry(vtkContext2D *painter)
topRight.SetY(geo.GetTop() - topRight.SetY(geo.GetTop() -
static_cast<int>(bounds.GetHeight())); static_cast<int>(bounds.GetHeight()));
break; break;
case vtkAxis::PARALLEL:
default: default:
abort(); // Shouldn't happen unless vtkAxis::Location is changed. abort(); // Shouldn't happen unless vtkAxis::Location is changed.
} }
......
...@@ -32,7 +32,6 @@ class MyArray : public vtkTypedDataArray<float> ...@@ -32,7 +32,6 @@ class MyArray : public vtkTypedDataArray<float>
{ {
vtkFloatArray *Data; vtkFloatArray *Data;
public: public:
vtkTypeMacro(MyArray, vtkTypedDataArray<float>)
static MyArray *New() { VTK_STANDARD_NEW_BODY(MyArray) } static MyArray *New() { VTK_STANDARD_NEW_BODY(MyArray) }
void Init(vtkFloatArray *array) void Init(vtkFloatArray *array)
{ {
......
...@@ -153,7 +153,6 @@ class MappedGridImpl : public vtkObject ...@@ -153,7 +153,6 @@ class MappedGridImpl : public vtkObject
{ {
public: public:
static MappedGridImpl* New(); static MappedGridImpl* New();
vtkTypeMacro(MappedGridImpl, vtkObject);
void Initialize(vtkUnstructuredGrid* ug) { ug->Register(this); _grid = ug; } void Initialize(vtkUnstructuredGrid* ug) { ug->Register(this); _grid = ug; }
...@@ -287,7 +286,6 @@ class MappedGrid : public vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIt ...@@ -287,7 +286,6 @@ class MappedGrid : public vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIt
{ {
public: public:
typedef vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIterator<MappedGridImpl> > _myBase; typedef vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIterator<MappedGridImpl> > _myBase;
vtkTypeMacro(MappedGrid, _myBase);
int GetDataObjectType() override { return VTK_UNSTRUCTURED_GRID_BASE; } int GetDataObjectType() override { return VTK_UNSTRUCTURED_GRID_BASE; }
......
...@@ -981,7 +981,6 @@ struct IdTuple ...@@ -981,7 +981,6 @@ struct IdTuple
vtkIdType PtId; vtkIdType PtId;
double Dist2; double Dist2;
IdTuple() : PtId(-1), Dist2(0.0) {}
IdTuple(vtkIdType ptId, double dist2) : PtId(ptId), Dist2(dist2) {} IdTuple(vtkIdType ptId, double dist2) : PtId(ptId), Dist2(dist2) {}
bool operator< (const IdTuple& tuple) const bool operator< (const IdTuple& tuple) const
......
...@@ -209,6 +209,11 @@ int TestComposite(std::string& inputDataFile, bool isAMR) ...@@ -209,6 +209,11 @@ int TestComposite(std::string& inputDataFile, bool isAMR)
std::cout << "Per block field data for the second output port changed" << std::endl; std::cout << "Per block field data for the second output port changed" << std::endl;
retVal = VTK_FAILURE; retVal = VTK_FAILURE;
} }
// Exercise NewInstance for coverage.
auto dummy = testAlg->NewInstance();
dummy->Delete();
return retVal; return retVal;
} }
} }
......
...@@ -124,7 +124,7 @@ void vtkTimerLog::FormatAndMarkEvent(const char *format, ...) ...@@ -124,7 +124,7 @@ void vtkTimerLog::FormatAndMarkEvent(const char *format, ...)
static char event[4096]; static char event[4096];
va_list var_args; va_list var_args;
va_start(var_args, format); va_start(var_args, format);
vsprintf(event, format, var_args); vsnprintf(event, sizeof(event), format, var_args);
va_end(var_args); va_end(var_args);
vtkTimerLog::MarkEventInternal(event, vtkTimerLogEntry::STANDALONE); vtkTimerLog::MarkEventInternal(event, vtkTimerLogEntry::STANDALONE);
...@@ -675,8 +675,8 @@ void vtkTimerLog::PrintSelf(ostream& os, vtkIndent indent) ...@@ -675,8 +675,8 @@ void vtkTimerLog::PrintSelf(ostream& os, vtkIndent indent)
// timer table logging. // timer table logging.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Returns the elapsed number of seconds since January 1, 1970. This // Returns the elapsed number of seconds since 00:00:00 Coordinated Universal
// is also called Universal Coordinated Time. // Time (UTC), Thursday, 1 January 1970. This is also called Unix Time.
double vtkTimerLog::GetUniversalTime() double vtkTimerLog::GetUniversalTime()
{ {
double currentTimeInSeconds; double currentTimeInSeconds;
......
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
/** /**
* Record a timing event. The event is represented by a formatted * Record a timing event. The event is represented by a formatted
* string. * string. The internal buffer is 4096 bytes and will truncate anything longer.
*/ */
#ifndef __VTK_WRAP__ #ifndef __VTK_WRAP__
static void FormatAndMarkEvent(const char *EventString, ...) VTK_FORMAT_PRINTF(1, 2); static void FormatAndMarkEvent(const char *EventString, ...) VTK_FORMAT_PRINTF(1, 2);
...@@ -183,8 +183,8 @@ public: ...@@ -183,8 +183,8 @@ public:
static void CleanupLog(); static void CleanupLog();
/** /**
* Returns the elapsed number of seconds since January 1, 1970. This * Returns the elapsed number of seconds since 00:00:00 Coordinated Universal
* is also called Universal Coordinated Time. * Time (UTC), Thursday, 1 January 1970. This is also called Unix Time.
*/ */
static double GetUniversalTime(); static double GetUniversalTime();
......
...@@ -392,6 +392,7 @@ public: ...@@ -392,6 +392,7 @@ public:
return !(this->InputCellGhostArray[id] & this->MASKED_CELL_VALUE); return !(this->InputCellGhostArray[id] & this->MASKED_CELL_VALUE);
case POINTS: case POINTS:
return this->InputStructuredGrid->IsCellVisible(id) ? true : false; return this->InputStructuredGrid->IsCellVisible(id) ? true : false;
case NONE:
default: default:
return 1; return 1;
} }
......
...@@ -373,11 +373,6 @@ struct PointSetFunctor : public CuttingFunctor ...@@ -373,11 +373,6 @@ struct PointSetFunctor : public CuttingFunctor
} }
} }
} }
bool IsCellSlicedByPlane(vtkIdType cellId)
{
return CuttingFunctor::IsCellSlicedByPlane(cellId);
}
}; };
// Process unstructured grids // Process unstructured grids
......
...@@ -469,6 +469,9 @@ struct VTile ...@@ -469,6 +469,9 @@ struct VTile
return false; return false;
} }
// Dead code. Kept because this method seems to be here for instructional purposes,
// and is mentioned in comments elsewhere.
#if 0
// Indicate whether the specified point x is inside the Voronoi flower. See // Indicate whether the specified point x is inside the Voronoi flower. See
// also IntersectTile(x) which is an equivalent computation. // also IntersectTile(x) which is an equivalent computation.
bool InFlower(const double x[2]) bool InFlower(const double x[2])
...@@ -490,6 +493,7 @@ struct VTile ...@@ -490,6 +493,7 @@ struct VTile
} }
return false; return false;
} }
#endif
// Generate a Voronoi tile by iterative clipping of the tile with nearby points. // Generate a Voronoi tile by iterative clipping of the tile with nearby points.
// Termination of the clipping process occurs when the neighboring points become // Termination of the clipping process occurs when the neighboring points become
......
...@@ -388,8 +388,8 @@ vtkSmartPointer<vtkSelector> vtkExtractSelection::NewSelectionOperator( ...@@ -388,8 +388,8 @@ vtkSmartPointer<vtkSelector> vtkExtractSelection::NewSelectionOperator(
return vtkSmartPointer<vtkBlockSelector>::New(); return vtkSmartPointer<vtkBlockSelector>::New();
case vtkSelectionNode::USER: case vtkSelectionNode::USER:
return nullptr; case vtkSelectionNode::SELECTIONS:
case vtkSelectionNode::QUERY:
default: default:
return nullptr; return nullptr;
} }
......
...@@ -297,10 +297,6 @@ struct ComputeGradients ...@@ -297,10 +297,6 @@ struct ComputeGradients
}//over slices }//over slices
} }
void Reduce()
{
}
static void Execute(int dims[3], double origin[3], double spacing[3], static void Execute(int dims[3], double origin[3], double spacing[3],
float *density, float *grad, float *mag, float *density, float *grad, float *mag,
unsigned char *fclass) unsigned char *fclass)
......
...@@ -263,6 +263,8 @@ public: ...@@ -263,6 +263,8 @@ public:
{ {
case PolygonType::MATERIAL: case PolygonType::MATERIAL:
return materialIndexToPolyData.find(materialIndex) == materialIndexToPolyData.end(); return materialIndexToPolyData.find(materialIndex) == materialIndexToPolyData.end();
case PolygonType::NONE:
case PolygonType::TEXTURE:
default: default:
// for NONE imageURI is empty string // for NONE imageURI is empty string
return imageURIToPolyData.find(imageURI) == imageURIToPolyData.end(); return imageURIToPolyData.find(imageURI) == imageURIToPolyData.end();
...@@ -281,6 +283,8 @@ public: ...@@ -281,6 +283,8 @@ public:
case PolygonType::MATERIAL: case PolygonType::MATERIAL:
materialIndexToPolyData[materialIndex] = polyData; materialIndexToPolyData[materialIndex] = polyData;
break; break;
case PolygonType::NONE:
case PolygonType::TEXTURE:
default: default:
// for NONE imageURI is empty string // for NONE imageURI is empty string
imageURIToPolyData[imageURI] = polyData; imageURIToPolyData[imageURI] = polyData;
...@@ -298,6 +302,8 @@ public: ...@@ -298,6 +302,8 @@ public:
{ {
case PolygonType::MATERIAL: case PolygonType::MATERIAL:
return materialIndexToPolyData[materialIndex]; return materialIndexToPolyData[materialIndex];
case PolygonType::NONE:
case PolygonType::TEXTURE:
default: default:
// for NONE imageURI is empty string // for NONE imageURI is empty string
return imageURIToPolyData[imageURI]; return imageURIToPolyData[imageURI];
...@@ -550,6 +556,7 @@ public: ...@@ -550,6 +556,7 @@ public:
this->SetField(polyData, "transparency", &material.Transparency, 1); this->SetField(polyData, "transparency", &material.Transparency, 1);
break; break;
} }
case PolygonType::NONE:
default: default:
// no fields to set // no fields to set
break; break;
......
...@@ -61,6 +61,14 @@ vtkLZMADataCompressor::CompressBuffer(unsigned char const* uncompressedData, ...@@ -61,6 +61,14 @@ vtkLZMADataCompressor::CompressBuffer(unsigned char const* uncompressedData,
case LZMA_UNSUPPORTED_CHECK: case LZMA_UNSUPPORTED_CHECK:
vtkErrorMacro("Specified integrity check is not supported."); vtkErrorMacro("Specified integrity check is not supported.");
break; break;
case LZMA_STREAM_END:
case LZMA_NO_CHECK:
case LZMA_MEMLIMIT_ERROR:
case LZMA_FORMAT_ERROR:
case LZMA_DATA_ERROR:
case LZMA_BUF_ERROR:
case LZMA_PROG_ERROR:
case LZMA_GET_CHECK:
default: default:
vtkErrorMacro("Unknown error."); vtkErrorMacro("Unknown error.");
} }
...@@ -111,6 +119,9 @@ vtkLZMADataCompressor::UncompressBuffer(unsigned char const* compressedData, ...@@ -111,6 +119,9 @@ vtkLZMADataCompressor::UncompressBuffer(unsigned char const* compressedData,
case LZMA_PROG_ERROR: case LZMA_PROG_ERROR:
vtkErrorMacro("LZMA program error."); vtkErrorMacro("LZMA program error.");
break; break;
case LZMA_STREAM_END:
case LZMA_GET_CHECK:
case LZMA_FORMAT_ERROR:
default: default:
vtkErrorMacro("Unknown error."); vtkErrorMacro("Unknown error.");
} }
......
...@@ -140,27 +140,6 @@ namespace ...@@ -140,27 +140,6 @@ namespace
{ {
typedef vtkStdString Type; typedef vtkStdString Type;
typedef vtkStringArray vtkArrayType; typedef vtkStringArray vtkArrayType;
std::string Name() const { return std::string("string"); }
vtkStdString Default() const { return vtkStdString("None"); }
static void Get(vtkIdType index, vtkStdString* in, vtkStringArray* array)
{
assert(array->GetNumberOfComponents() == 1);
*in = array->GetValue(index);
}
static void Stream(std::ostream& out, const vtkStdString& t)
{
std::size_t i = 0;
out << "\'";
for (; i < (t.size() < 32 ? t.size() : 32); i++)
{
out << t[i];
}
for (; i < 32; i++)
{
out << " ";
}
out << "\'";
}
}; };
template <int AttributeId> template <int AttributeId>
......
...@@ -82,6 +82,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname, ...@@ -82,6 +82,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
builder = undir_builder; builder = undir_builder;
break; break;
case vtkGraphReader::UnknownGraph:
default: default:
vtkErrorMacro("ReadGraphType gave invalid result."); vtkErrorMacro("ReadGraphType gave invalid result.");
this->CloseVTKFile(); this->CloseVTKFile();
...@@ -116,6 +117,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname, ...@@ -116,6 +117,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
undir_builder->SetFieldData(field_data); undir_builder->SetFieldData(field_data);
break; break;
case vtkGraphReader::UnknownGraph:
default: // Can't happen, would return earlier. default: // Can't happen, would return earlier.
break; break;
} }
...@@ -160,6 +162,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname, ...@@ -160,6 +162,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
undir_builder->AddVertex(); undir_builder->AddVertex();
break; break;
case vtkGraphReader::UnknownGraph:
default: // Can't happen, would return earlier. default: // Can't happen, would return earlier.
break; break;
} }
...@@ -198,6 +201,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname, ...@@ -198,6 +201,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
undir_builder->AddEdge(source, target); undir_builder->AddEdge(source, target);
break; break;
case vtkGraphReader::UnknownGraph:
default: // Can't happen, would return earlier. default: // Can't happen, would return earlier.
break; break;
} }
...@@ -421,6 +425,7 @@ vtkDataObject* vtkGraphReader::CreateOutput(vtkDataObject* currentOutput) ...@@ -421,6 +425,7 @@ vtkDataObject* vtkGraphReader::CreateOutput(vtkDataObject* currentOutput)
} }
return vtkMolecule::New(); return vtkMolecule::New();
case vtkGraphReader::UnknownGraph:
default: default:
vtkErrorMacro("ReadGraphType returned invalid result."); vtkErrorMacro("ReadGraphType returned invalid result.");
return nullptr; return nullptr;
......
...@@ -152,7 +152,6 @@ class MappedGridImpl : public vtkObject ...@@ -152,7 +152,6 @@ class MappedGridImpl : public vtkObject
{ {
public: public:
static MappedGridImpl* New(); static MappedGridImpl* New();
vtkTypeMacro(MappedGridImpl, vtkObject);
void Initialize(vtkUnstructuredGrid* ug) { ug->Register(this); _grid = ug; } void Initialize(vtkUnstructuredGrid* ug) { ug->Register(this); _grid = ug; }
...@@ -286,7 +285,6 @@ class MappedGrid : public vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIt ...@@ -286,7 +285,6 @@ class MappedGrid : public vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIt
{ {
public: public:
typedef vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIterator<MappedGridImpl> > _myBase; typedef vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIterator<MappedGridImpl> > _myBase;
vtkTypeMacro(MappedGrid, _myBase);
int GetDataObjectType() override { return VTK_UNSTRUCTURED_GRID_BASE; } int GetDataObjectType() override { return VTK_UNSTRUCTURED_GRID_BASE; }
......
...@@ -372,12 +372,6 @@ public: ...@@ -372,12 +372,6 @@ public:
class vtkICF::Seed class vtkICF::Seed
{ {
public: public:
Seed() {
pos[0] = 0; pos[1] = 0; pos[2] = 0; value = 0; }
Seed(int i, int j, int k) {
pos[0] = i; pos[1] = j; pos[2] = k; value = 0; }
Seed(int i, int j, int k, int v) { Seed(int i, int j, int k, int v) {
pos[0] = i; pos[1] = j; pos[2] = k; value = v; } pos[0] = i; pos[1] = j; pos[2] = k; value = v; }
...@@ -387,10 +381,8 @@ public: ...@@ -387,10 +381,8 @@ public:
pos[2] = seed.pos[2]; pos[2] = seed.pos[2];
value = seed.value; }; value = seed.value; };
const int &operator[](int i) const { return pos[i]; }
int &operator[](int i) { return pos[i]; } int &operator[](int i) { return pos[i]; }
const int &operator*() const { return value; }
int &operator*() { return value; } int &operator*() { return value; }
vtkICF::Seed &operator=(const vtkICF::Seed& seed) { vtkICF::Seed &operator=(const vtkICF::Seed& seed) {
......
...@@ -141,5 +141,9 @@ int TestContext2D(int, char*[]) ...@@ -141,5 +141,9 @@ int TestContext2D(int, char*[])
view->GetInteractor()->Initialize(); view->GetInteractor()->Initialize();
view->Render(); view->Render();
// Exercise NewInstance for coverage.
auto dummy = test->NewInstance();
dummy->Delete();
return test->Succeeded ? EXIT_SUCCESS : EXIT_FAILURE; return test->Succeeded ? EXIT_SUCCESS : EXIT_FAILURE;
} }
...@@ -62,7 +62,6 @@ protected: ...@@ -62,7 +62,6 @@ protected:
public: public:
static PointPickCommand * New() {return new PointPickCommand;} static PointPickCommand * New() {return new PointPickCommand;}
vtkTypeMacro(PointPickCommand, vtkCommand);
PointPickCommand() = default; PointPickCommand() = default;
......
...@@ -245,6 +245,8 @@ void vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback( ...@@ -245,6 +245,8 @@ void vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(
break; break;
} }
case vtkTransformFeedback::Normal_F:
case vtkTransformFeedback::Next_Buffer:
default: default:
vtkWarningMacro("Unhandled data role: " << it->Role); vtkWarningMacro("Unhandled data role: " << it->Role);
} }
......
...@@ -397,6 +397,8 @@ bool vtkDualDepthPeelingPass::PostReplaceTranslucentShaderValues( ...@@ -397,6 +397,8 @@ bool vtkDualDepthPeelingPass::PostReplaceTranslucentShaderValues(
); );
break; break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default: default:
break; break;
} }
...@@ -749,6 +751,8 @@ bool vtkDualDepthPeelingPass::PreReplaceVolumetricShaderValues( ...@@ -749,6 +751,8 @@ bool vtkDualDepthPeelingPass::PreReplaceVolumetricShaderValues(
break; break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default: default:
break; break;
} }
...@@ -784,6 +788,8 @@ bool vtkDualDepthPeelingPass::SetTranslucentShaderParameters( ...@@ -784,6 +788,8 @@ bool vtkDualDepthPeelingPass::SetTranslucentShaderParameters(
this->Textures[this->DepthSource]->GetTextureUnit()); this->Textures[this->DepthSource]->GetTextureUnit());
break; break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default: default:
break; break;
} }
...@@ -827,6 +833,8 @@ bool vtkDualDepthPeelingPass::SetVolumetricShaderParameters( ...@@ -827,6 +833,8 @@ bool vtkDualDepthPeelingPass::SetVolumetricShaderParameters(
this->Textures[this->DepthSource]->GetTextureUnit()); this->Textures[this->DepthSource]->GetTextureUnit());
break; break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default: default:
break; break;
} }
......
...@@ -66,6 +66,7 @@ bool vtkShader::Compile() ...@@ -66,6 +66,7 @@ bool vtkShader::Compile()
type = GL_FRAGMENT_SHADER; type = GL_FRAGMENT_SHADER;
break; break;
case vtkShader::Vertex: case vtkShader::Vertex:
case vtkShader::Unknown:
default: default:
type = GL_VERTEX_SHADER; type = GL_VERTEX_SHADER;
break; break;
......
...@@ -307,6 +307,7 @@ bool vtkShaderProgram::DetachShader(const vtkShader *shader) ...@@ -307,6 +307,7 @@ bool vtkShaderProgram::DetachShader(const vtkShader *shader)
return true; return true;
} }
#endif #endif
case vtkShader::Unknown:
default: default:
return false; return false;
} }
......
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