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)
topRight.SetY(geo.GetTop() -
static_cast<int>(bounds.GetHeight()));
break;
case vtkAxis::PARALLEL:
default:
abort(); // Shouldn't happen unless vtkAxis::Location is changed.
}
......
......@@ -32,7 +32,6 @@ class MyArray : public vtkTypedDataArray<float>
{
vtkFloatArray *Data;
public:
vtkTypeMacro(MyArray, vtkTypedDataArray<float>)
static MyArray *New() { VTK_STANDARD_NEW_BODY(MyArray) }
void Init(vtkFloatArray *array)
{
......
......@@ -153,7 +153,6 @@ class MappedGridImpl : public vtkObject
{
public:
static MappedGridImpl* New();
vtkTypeMacro(MappedGridImpl, vtkObject);
void Initialize(vtkUnstructuredGrid* ug) { ug->Register(this); _grid = ug; }
......@@ -287,7 +286,6 @@ class MappedGrid : public vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIt
{
public:
typedef vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIterator<MappedGridImpl> > _myBase;
vtkTypeMacro(MappedGrid, _myBase);
int GetDataObjectType() override { return VTK_UNSTRUCTURED_GRID_BASE; }
......
......@@ -981,7 +981,6 @@ struct IdTuple
vtkIdType PtId;
double Dist2;
IdTuple() : PtId(-1), Dist2(0.0) {}
IdTuple(vtkIdType ptId, double dist2) : PtId(ptId), Dist2(dist2) {}
bool operator< (const IdTuple& tuple) const
......
......@@ -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;
retVal = VTK_FAILURE;
}
// Exercise NewInstance for coverage.
auto dummy = testAlg->NewInstance();
dummy->Delete();
return retVal;
}
}
......
......@@ -124,7 +124,7 @@ void vtkTimerLog::FormatAndMarkEvent(const char *format, ...)
static char event[4096];
va_list var_args;
va_start(var_args, format);
vsprintf(event, format, var_args);
vsnprintf(event, sizeof(event), format, var_args);
va_end(var_args);
vtkTimerLog::MarkEventInternal(event, vtkTimerLogEntry::STANDALONE);
......@@ -675,8 +675,8 @@ void vtkTimerLog::PrintSelf(ostream& os, vtkIndent indent)
// timer table logging.
//----------------------------------------------------------------------------
// Returns the elapsed number of seconds since January 1, 1970. This
// is also called Universal Coordinated Time.
// Returns the elapsed number of seconds since 00:00:00 Coordinated Universal
// Time (UTC), Thursday, 1 January 1970. This is also called Unix Time.
double vtkTimerLog::GetUniversalTime()
{
double currentTimeInSeconds;
......
......@@ -109,7 +109,7 @@ public:
/**
* 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__
static void FormatAndMarkEvent(const char *EventString, ...) VTK_FORMAT_PRINTF(1, 2);
......@@ -183,8 +183,8 @@ public:
static void CleanupLog();
/**
* Returns the elapsed number of seconds since January 1, 1970. This
* is also called Universal Coordinated Time.
* Returns the elapsed number of seconds since 00:00:00 Coordinated Universal
* Time (UTC), Thursday, 1 January 1970. This is also called Unix Time.
*/
static double GetUniversalTime();
......
......@@ -392,6 +392,7 @@ public:
return !(this->InputCellGhostArray[id] & this->MASKED_CELL_VALUE);
case POINTS:
return this->InputStructuredGrid->IsCellVisible(id) ? true : false;
case NONE:
default:
return 1;
}
......
......@@ -373,11 +373,6 @@ struct PointSetFunctor : public CuttingFunctor
}
}
}
bool IsCellSlicedByPlane(vtkIdType cellId)
{
return CuttingFunctor::IsCellSlicedByPlane(cellId);
}
};
// Process unstructured grids
......
......@@ -469,6 +469,9 @@ struct VTile
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
// also IntersectTile(x) which is an equivalent computation.
bool InFlower(const double x[2])
......@@ -490,6 +493,7 @@ struct VTile
}
return false;
}
#endif
// Generate a Voronoi tile by iterative clipping of the tile with nearby points.
// Termination of the clipping process occurs when the neighboring points become
......
......@@ -388,8 +388,8 @@ vtkSmartPointer<vtkSelector> vtkExtractSelection::NewSelectionOperator(
return vtkSmartPointer<vtkBlockSelector>::New();
case vtkSelectionNode::USER:
return nullptr;
case vtkSelectionNode::SELECTIONS:
case vtkSelectionNode::QUERY:
default:
return nullptr;
}
......
......@@ -297,10 +297,6 @@ struct ComputeGradients
}//over slices
}
void Reduce()
{
}
static void Execute(int dims[3], double origin[3], double spacing[3],
float *density, float *grad, float *mag,
unsigned char *fclass)
......
......@@ -263,6 +263,8 @@ public:
{
case PolygonType::MATERIAL:
return materialIndexToPolyData.find(materialIndex) == materialIndexToPolyData.end();
case PolygonType::NONE:
case PolygonType::TEXTURE:
default:
// for NONE imageURI is empty string
return imageURIToPolyData.find(imageURI) == imageURIToPolyData.end();
......@@ -281,6 +283,8 @@ public:
case PolygonType::MATERIAL:
materialIndexToPolyData[materialIndex] = polyData;
break;
case PolygonType::NONE:
case PolygonType::TEXTURE:
default:
// for NONE imageURI is empty string
imageURIToPolyData[imageURI] = polyData;
......@@ -298,6 +302,8 @@ public:
{
case PolygonType::MATERIAL:
return materialIndexToPolyData[materialIndex];
case PolygonType::NONE:
case PolygonType::TEXTURE:
default:
// for NONE imageURI is empty string
return imageURIToPolyData[imageURI];
......@@ -550,6 +556,7 @@ public:
this->SetField(polyData, "transparency", &material.Transparency, 1);
break;
}
case PolygonType::NONE:
default:
// no fields to set
break;
......
......@@ -61,6 +61,14 @@ vtkLZMADataCompressor::CompressBuffer(unsigned char const* uncompressedData,
case LZMA_UNSUPPORTED_CHECK:
vtkErrorMacro("Specified integrity check is not supported.");
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:
vtkErrorMacro("Unknown error.");
}
......@@ -111,6 +119,9 @@ vtkLZMADataCompressor::UncompressBuffer(unsigned char const* compressedData,
case LZMA_PROG_ERROR:
vtkErrorMacro("LZMA program error.");
break;
case LZMA_STREAM_END:
case LZMA_GET_CHECK:
case LZMA_FORMAT_ERROR:
default:
vtkErrorMacro("Unknown error.");
}
......
......@@ -140,27 +140,6 @@ namespace
{
typedef vtkStdString Type;
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>
......
......@@ -82,6 +82,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
builder = undir_builder;
break;
case vtkGraphReader::UnknownGraph:
default:
vtkErrorMacro("ReadGraphType gave invalid result.");
this->CloseVTKFile();
......@@ -116,6 +117,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
undir_builder->SetFieldData(field_data);
break;
case vtkGraphReader::UnknownGraph:
default: // Can't happen, would return earlier.
break;
}
......@@ -160,6 +162,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
undir_builder->AddVertex();
break;
case vtkGraphReader::UnknownGraph:
default: // Can't happen, would return earlier.
break;
}
......@@ -198,6 +201,7 @@ int vtkGraphReader::ReadMeshSimple(const std::string& fname,
undir_builder->AddEdge(source, target);
break;
case vtkGraphReader::UnknownGraph:
default: // Can't happen, would return earlier.
break;
}
......@@ -421,6 +425,7 @@ vtkDataObject* vtkGraphReader::CreateOutput(vtkDataObject* currentOutput)
}
return vtkMolecule::New();
case vtkGraphReader::UnknownGraph:
default:
vtkErrorMacro("ReadGraphType returned invalid result.");
return nullptr;
......
......@@ -152,7 +152,6 @@ class MappedGridImpl : public vtkObject
{
public:
static MappedGridImpl* New();
vtkTypeMacro(MappedGridImpl, vtkObject);
void Initialize(vtkUnstructuredGrid* ug) { ug->Register(this); _grid = ug; }
......@@ -286,7 +285,6 @@ class MappedGrid : public vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIt
{
public:
typedef vtkMappedUnstructuredGrid<MappedGridImpl, MappedCellIterator<MappedGridImpl> > _myBase;
vtkTypeMacro(MappedGrid, _myBase);
int GetDataObjectType() override { return VTK_UNSTRUCTURED_GRID_BASE; }
......
......@@ -372,12 +372,6 @@ public:
class vtkICF::Seed
{
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) {
pos[0] = i; pos[1] = j; pos[2] = k; value = v; }
......@@ -387,10 +381,8 @@ public:
pos[2] = seed.pos[2];
value = seed.value; };
const int &operator[](int i) const { return pos[i]; }
int &operator[](int i) { return pos[i]; }
const int &operator*() const { return value; }
int &operator*() { return value; }
vtkICF::Seed &operator=(const vtkICF::Seed& seed) {
......
......@@ -141,5 +141,9 @@ int TestContext2D(int, char*[])
view->GetInteractor()->Initialize();
view->Render();
// Exercise NewInstance for coverage.
auto dummy = test->NewInstance();
dummy->Delete();
return test->Succeeded ? EXIT_SUCCESS : EXIT_FAILURE;
}
......@@ -62,7 +62,6 @@ protected:
public:
static PointPickCommand * New() {return new PointPickCommand;}
vtkTypeMacro(PointPickCommand, vtkCommand);
PointPickCommand() = default;
......
......@@ -245,6 +245,8 @@ void vtkOpenGLGL2PSHelperImpl::ProcessTransformFeedback(
break;
}
case vtkTransformFeedback::Normal_F:
case vtkTransformFeedback::Next_Buffer:
default:
vtkWarningMacro("Unhandled data role: " << it->Role);
}
......
......@@ -397,6 +397,8 @@ bool vtkDualDepthPeelingPass::PostReplaceTranslucentShaderValues(
);
break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default:
break;
}
......@@ -749,6 +751,8 @@ bool vtkDualDepthPeelingPass::PreReplaceVolumetricShaderValues(
break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default:
break;
}
......@@ -784,6 +788,8 @@ bool vtkDualDepthPeelingPass::SetTranslucentShaderParameters(
this->Textures[this->DepthSource]->GetTextureUnit());
break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default:
break;
}
......@@ -827,6 +833,8 @@ bool vtkDualDepthPeelingPass::SetVolumetricShaderParameters(
this->Textures[this->DepthSource]->GetTextureUnit());
break;
case vtkDualDepthPeelingPass::Inactive:
case vtkDualDepthPeelingPass::NumberOfPasses:
default:
break;
}
......
......@@ -66,6 +66,7 @@ bool vtkShader::Compile()
type = GL_FRAGMENT_SHADER;
break;
case vtkShader::Vertex:
case vtkShader::Unknown:
default:
type = GL_VERTEX_SHADER;
break;
......
......@@ -307,6 +307,7 @@ bool vtkShaderProgram::DetachShader(const vtkShader *shader)
return true;
}
#endif
case vtkShader::Unknown:
default:
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