Commit 7ebccce9 authored by Sean McBride's avatar Sean McBride

Fixed last of -Wcast-qual warnings

For vtkKCoreLayout, just alloc & copy the string.

For vtkInteractorStyleUser, init to nullptr instead of empty string.
It’s taking the char* owned by the vtkRenderWindowInteractor, which looks like it can be null anyway.
Adjusted usage to be prepared for null.

Also fixed some related indentation and comments.
parent 9df11dad
......@@ -118,10 +118,10 @@ virtual void Set##name (const char* _arg) \
this->name = cp1; \
do { *cp1++ = *cp2++; } while ( --n ); \
} \
else \
{ \
else \
{ \
this->name = nullptr; \
} \
} \
this->Modified(); \
}
......
......@@ -176,12 +176,10 @@ int vtkKCoreLayout::RequestData(vtkInformation* vtkNotUsed(request),
// graph size
vtkIdType num_verts = output->GetNumberOfVertices();
if(this->KCoreLabelArrayName)
{
}
else
if(!this->KCoreLabelArrayName)
{
this->KCoreLabelArrayName = (char*)"kcore";
const char * kcore = "kcore";
this->KCoreLabelArrayName = strcpy(new char [strlen(kcore)+1], kcore);
}
// Get the kcore attribute array
......
......@@ -33,7 +33,7 @@ vtkInteractorStyleUser::vtkInteractorStyleUser()
this->ShiftKey = 0;
this->CtrlKey = 0;
this->Char = '\0';
this->KeySym = (char *)("");
this->KeySym = nullptr;
this->Button = 0;
}
......@@ -54,7 +54,7 @@ void vtkInteractorStyleUser::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "ShiftKey: " << this->ShiftKey << "\n";
os << indent << "CtrlKey: " << this->CtrlKey << "\n";
os << indent << "Char: " << this->Char << "\n";
os << indent << "KeySym: " << this->KeySym << "\n";
os << indent << "KeySym: " << (this->KeySym ? this->KeySym : "(null)") << "\n";
os << indent << "Button: " << this->Button << "\n";
}
......
......@@ -68,7 +68,7 @@ public:
//@{
/**
* Test whether modifiers were held down when mouse button or key
* was pressed
* was pressed.
*/
vtkGetMacro(ShiftKey,int);
vtkGetMacro(CtrlKey,int);
......@@ -83,8 +83,8 @@ public:
//@{
/**
* Get the KeySym (in the same format as Tk KeySyms) for a
* KeyPress or KeyRelease method.
* Get the KeySym (in the same format as vtkRenderWindowInteractor KeySyms)
* for a KeyPress or KeyRelease method.
*/
vtkGetStringMacro(KeySym);
//@}
......
......@@ -525,7 +525,7 @@ public:
/**
* Set/get the key symbol for the key that was pressed. This is the key
* symbol as defined by the relevant X headers. On X based platforms this
* corresponds to the installed X sevrer, whereas on other platforms the
* corresponds to the installed X server, whereas on other platforms the
* native key codes are translated into a string representation.
*/
vtkSetStringMacro(KeySym);
......
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