Commit 1d7e6e61 authored by Ken Martin's avatar Ken Martin

fix some variable reassignment before use warnings

Bunch of vars that were reassgned values before'
the old value was used.
parent d9022678
......@@ -223,12 +223,9 @@ void ContourImage(vtkSynchronizedTemplatesCutter3D *self, int *exExt,
}
// allocate scalar storage for two slices
T *scalars = nullptr;
T *scalars1 = nullptr;
T *scalars2 = nullptr;
scalars = new T [xdim*ydim*2];
scalars1 = scalars;
scalars2 = scalars + xdim*ydim;
T *scalars = new T [xdim*ydim*2];
T *scalars1 = scalars;
T *scalars2 = scalars + xdim*ydim;
// for each contour
for (vidx = 0; vidx < numContours; vidx++)
......
......@@ -434,8 +434,7 @@ int vtkClipClosedSurface::RequestData(
}
// Break the input lines into segments, generate scalars for lines
vtkCellArray *lines = nullptr;
lines = vtkCellArray::New();
vtkCellArray *lines = vtkCellArray::New();
if (input->GetLines() && input->GetLines()->GetNumberOfCells() > 0)
{
this->BreakPolylines(input->GetLines(), lines, inputScalars,
......
......@@ -93,8 +93,7 @@ int vtkOverlappingAMRLevelIdScalars::RequestData(
vtkUniformGrid* vtkOverlappingAMRLevelIdScalars::ColorLevel(
vtkUniformGrid* input, int group)
{
vtkUniformGrid* output = nullptr;
output = input->NewInstance();
vtkUniformGrid* output = input->NewInstance();
output->ShallowCopy(input);
vtkDataSet* dsOutput = vtkDataSet::SafeDownCast(output);
vtkIdType numCells = dsOutput->GetNumberOfCells();
......
......@@ -285,12 +285,9 @@ void ContourImage(vtkThreadedSynchronizedTemplatesCutter3D *self, int *exExt,
}
// allocate scalar storage for two slices
T *scalars = nullptr;
T *scalars1 = nullptr;
T *scalars2 = nullptr;
scalars = new T [xdim*ydim*2];
scalars1 = scalars;
scalars2 = scalars + xdim*ydim;
T *scalars = new T [xdim*ydim*2];
T *scalars1 = scalars;
T *scalars2 = scalars + xdim*ydim;
// for each contour
for (vidx = 0; vidx < numContours; vidx++)
......
......@@ -534,11 +534,10 @@ void vtkVRMLExporter::WriteShapeBegin( vtkActor* actor, FILE *fileP,
double tempf2;
fprintf(fileP," Shape {\n");
vtkProperty* props = nullptr;
vtkProperty* props = actor->GetProperty();
// write out the material properties to the mat file
fprintf(fileP," appearance Appearance {\n");
fprintf(fileP," material Material {\n");
props = actor->GetProperty();
fprintf(fileP," ambientIntensity %g\n", props->GetAmbient());
// if we don't have colors and we have only lines & points
// use emissive to color them
......
......@@ -65,8 +65,7 @@ void vtkDIMACSGraphWriter::WriteData()
*fp << "p graph "<< vertex_count << " " << edge_count << "\n";
// See if the input has a "weight" array
vtkDataArray* weight = nullptr;
weight = input->GetEdgeData()->GetArray("weight");
vtkDataArray* weight = input->GetEdgeData()->GetArray("weight");
// Output either the weight array or just 1 if
// we have no weight array
......
......@@ -391,9 +391,9 @@ std::string vtkMINCImageWriterCreateIdentString()
static const char *itemsep = ":";
// Get username and hostname
#ifdef _WIN32
const char *username = nullptr;
const char *hostname = nullptr;
#ifdef _WIN32
char usernametext[100];
DWORD numchars = sizeof(usernametext);
if (GetUserName(usernametext, &numchars))
......@@ -407,8 +407,8 @@ std::string vtkMINCImageWriterCreateIdentString()
hostname = hostnametext;
}
#else
username = getenv("LOGNAME");
hostname = getenv("HOSTNAME");
const char *username = getenv("LOGNAME");
const char *hostname = getenv("HOSTNAME");
#endif
if (username == nullptr)
{
......
......@@ -142,9 +142,8 @@ int vtkGroupLeafVertices::RequestData(
}
// Get the builder's group array.
vtkAbstractArray *outputGroupArr = nullptr;
char *groupname = arr->GetName();
outputGroupArr = builderVertexData->GetAbstractArray(groupname);
vtkAbstractArray *outputGroupArr = builderVertexData->GetAbstractArray(groupname);
if (outputGroupArr == nullptr)
{
vtkErrorMacro(<< "Could not find the group array in the builder.");
......
......@@ -1735,9 +1735,8 @@ void vtkOpenGLContextDevice2D::DrawString(float *point,
vtkOpenGLClearErrorMacro();
vtkOpenGLHelper *cbo = nullptr;
this->ReadyVTBOProgram();
cbo = this->VTBO;
vtkOpenGLHelper *cbo = this->VTBO;
if (!cbo->Program)
{
return;
......@@ -1816,9 +1815,8 @@ void vtkOpenGLContextDevice2D::DrawImage(float p[2], float scale,
vtkOpenGLClearErrorMacro();
vtkOpenGLHelper *cbo = nullptr;
this->ReadyVTBOProgram();
cbo = this->VTBO;
vtkOpenGLHelper *cbo = this->VTBO;
if (!cbo->Program)
{
return;
......
......@@ -555,8 +555,8 @@ void vtkXOpenGLRenderWindow::CreateAWindow()
{
// NOTE: It is not necessary to create or make current to a context before
// calling glXGetProcAddressARB
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = nullptr;
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)
glXCreateContextAttribsARBProc glXCreateContextAttribsARB =
(glXCreateContextAttribsARBProc)
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
int context_attribs[] =
......
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