Commit e07253d9 authored by Francois Bertel's avatar Francois Bertel
Browse files

COMP:Removed some warnings about old-style casts. Not all of them are removable unfortunately.

parent 1e6ad468
......@@ -32,7 +32,7 @@ extern "C"
vtkTclInterpStruct *vtkGetInterpStruct(Tcl_Interp *interp)
{
vtkTclInterpStruct *is = (vtkTclInterpStruct *)Tcl_GetAssocData(interp,(char *) "vtk",NULL);
vtkTclInterpStruct *is = static_cast<vtkTclInterpStruct *>(Tcl_GetAssocData(interp,static_cast<char *>("vtk"),NULL));
if (!is)
{
vtkGenericWarningMacro("unable to find interp struct");
......@@ -56,7 +56,7 @@ VTKTCL_EXPORT void vtkTclDeleteObjectFromHash(vtkObject *obj,
unsigned long vtkNotUsed(eventId),
void *cd, void *)
{
vtkTclCommandArgStruct *as = (vtkTclCommandArgStruct *)cd;
vtkTclCommandArgStruct *as = static_cast<vtkTclCommandArgStruct *>(cd);
char temps[80];
Tcl_HashEntry *entry;
char *temp;
......@@ -67,7 +67,7 @@ VTKTCL_EXPORT void vtkTclDeleteObjectFromHash(vtkObject *obj,
entry = Tcl_FindHashEntry(&is->PointerLookup,temps);
if (entry)
{
temp = (char *)(Tcl_GetHashValue(entry));
temp = static_cast<char *>(Tcl_GetHashValue(entry));
if (temp)
{
Tcl_DeleteCommand(as->Interp,temp);
......@@ -86,12 +86,12 @@ VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd)
char *temp;
vtkObject *tobject;
int error;
vtkTclCommandArgStruct *as = (vtkTclCommandArgStruct *)cd;
vtkTclCommandArgStruct *as = static_cast<vtkTclCommandArgStruct *>(cd);
Tcl_Interp *interp = as->Interp;
vtkTclInterpStruct *is = vtkGetInterpStruct(interp);
/* set up the args */
args[1] = (char *) "Delete";
args[1] = static_cast<char *>("Delete");
// lookup the objects name
sprintf(temps,"%p",as->Pointer);
......@@ -101,21 +101,22 @@ VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd)
return;
}
temp = (char *)(Tcl_GetHashValue(entry));
temp = static_cast<char *>(Tcl_GetHashValue(entry));
args[0] = temp;
// first we clear the delete callback since we will
// always remove this object from the hash regardless
// of if it has really been freed.
tobject = (vtkObject *)vtkTclGetPointerFromObject(temp,"vtkObject",
interp, error);
tobject = static_cast<vtkObject *>(
vtkTclGetPointerFromObject(temp,"vtkObject",
interp, error));
tobject->RemoveObserver(as->Tag);
as->Tag = 0;
// get the command function and invoke the delete operation
entry = Tcl_FindHashEntry(&is->CommandLookup,temp);
command = (int (*)(ClientData,Tcl_Interp *,int,char *[]))
Tcl_GetHashValue(entry);
command = reinterpret_cast<int (*)(ClientData,Tcl_Interp *,int,char *[])>(
Tcl_GetHashValue(entry));
// do we need to delete the c++ obj
if (strncmp(temp,"vtkTemp",7))
......@@ -162,7 +163,7 @@ int vtkCreateCommand(ClientData vtkNotUsed(cd), Tcl_Interp *interp, int argc, ch
entry != NULL;
entry = Tcl_FirstHashEntry(&is->PointerLookup,&search))
{
tmp = strdup((char *)Tcl_GetHashValue(entry));
tmp = strdup(static_cast<char *>(Tcl_GetHashValue(entry)));
if (tmp)
{
Tcl_DeleteCommand(interp,tmp);
......@@ -180,7 +181,7 @@ int vtkCreateCommand(ClientData vtkNotUsed(cd), Tcl_Interp *interp, int argc, ch
entry != NULL; entry = Tcl_NextHashEntry(&search))
{
Tcl_AppendResult(interp,
(char *)Tcl_GetHashKey(&is->InstanceLookup,entry),NULL);
static_cast<char *>(Tcl_GetHashKey(&is->InstanceLookup,entry)),NULL);
Tcl_AppendResult(interp,"\n",NULL);
}
return TCL_OK;
......@@ -233,8 +234,8 @@ vtkTclUpdateCommand(Tcl_Interp *interp, char *name, vtkObject *temp)
{
if (cinf.clientData)
{
vtkTclCommandStruct *cs = (vtkTclCommandStruct *)cinf.clientData;
command = (Tcl_CmdProc *)cs->CommandFunction;
vtkTclCommandStruct *cs = static_cast<vtkTclCommandStruct *>(cinf.clientData);
command = reinterpret_cast<Tcl_CmdProc *>(cs->CommandFunction);
}
}
if (tstr)
......@@ -256,7 +257,7 @@ vtkTclUpdateCommand(Tcl_Interp *interp, char *name, vtkObject *temp)
vtkTclInterpStruct *is = vtkGetInterpStruct(interp);
Tcl_HashEntry *entry = Tcl_FindHashEntry(&is->CommandLookup,name);
Tcl_SetHashValue(entry,(ClientData)command);
Tcl_SetHashValue(entry,reinterpret_cast<ClientData>(command));
}
......@@ -266,7 +267,7 @@ vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp1,
{
int (*command)(ClientData, Tcl_Interp *,int, char *[]) = 0;
int is_new;
vtkObject *temp = (vtkObject *)temp1;
vtkObject *temp = static_cast<vtkObject *>(temp1);
char temps[80];
char name[80];
Tcl_HashEntry *entry;
......@@ -292,12 +293,12 @@ vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp1,
if (is->DebugOn)
{
vtkGenericWarningMacro("Found name: "
<< (char *)(Tcl_GetHashValue(entry))
<< static_cast<char *>(Tcl_GetHashValue(entry))
<< " for vtk pointer: " << temp);
}
/* while we are at it store the name since it is required anyhow */
Tcl_SetResult(interp, (char *)(Tcl_GetHashValue(entry)), TCL_VOLATILE);
Tcl_SetResult(interp, static_cast<char *>(Tcl_GetHashValue(entry)), TCL_VOLATILE);
return;
}
......@@ -318,7 +319,7 @@ vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp1,
{
if (cinf.clientData)
{
vtkTclCommandStruct *cs = (vtkTclCommandStruct *)cinf.clientData;
vtkTclCommandStruct *cs = static_cast<vtkTclCommandStruct *>(cinf.clientData);
command = cs->CommandFunction;
}
}
......@@ -334,7 +335,7 @@ vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp1,
{
if (cinf.clientData)
{
vtkTclCommandStruct *cs = (vtkTclCommandStruct *)cinf.clientData;
vtkTclCommandStruct *cs = static_cast<vtkTclCommandStruct *>(cinf.clientData);
command = cs->CommandFunction;
}
}
......@@ -351,7 +352,7 @@ vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp1,
{
if (cinf.clientData)
{
vtkTclCommandStruct *cs = (vtkTclCommandStruct *)cinf.clientData;
vtkTclCommandStruct *cs = static_cast<vtkTclCommandStruct *>(cinf.clientData);
command = cs->CommandFunction;
}
}
......@@ -362,27 +363,27 @@ vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp1,
}
entry = Tcl_CreateHashEntry(&is->InstanceLookup,name,&is_new);
Tcl_SetHashValue(entry,(ClientData)(temp));
Tcl_SetHashValue(entry,static_cast<ClientData>(temp));
entry = Tcl_CreateHashEntry(&is->PointerLookup,temps,&is_new);
Tcl_SetHashValue(entry,(ClientData)(strdup(name)));
Tcl_SetHashValue(entry,static_cast<ClientData>(strdup(name)));
vtkTclCommandArgStruct *as = new vtkTclCommandArgStruct;
as->Pointer = (void *)temp;
as->Pointer = static_cast<void *>(temp);
as->Interp = interp;
Tcl_CreateCommand(interp,name,
reinterpret_cast<vtkTclCommandType>(command),
(ClientData)(as),
(Tcl_CmdDeleteProc *)vtkTclGenericDeleteObject);
static_cast<ClientData>(as),
static_cast<Tcl_CmdDeleteProc *>(vtkTclGenericDeleteObject));
entry = Tcl_CreateHashEntry(&is->CommandLookup,name,&is_new);
Tcl_SetHashValue(entry,(ClientData)command);
Tcl_SetHashValue(entry,reinterpret_cast<ClientData>(command));
// setup the delete callback
vtkCallbackCommand *cbc = vtkCallbackCommand::New();
cbc->SetCallback(vtkTclDeleteObjectFromHash);
cbc->SetClientData((void *)as);
cbc->SetClientData(static_cast<void *>(as));
as->Tag = temp->AddObserver(vtkCommand::DeleteEvent, cbc);
cbc->Delete();
Tcl_SetResult(interp, (char *)name, TCL_VOLATILE);
Tcl_SetResult(interp, static_cast<char *>(name), TCL_VOLATILE);
}
VTKTCL_EXPORT void *vtkTclGetPointerFromObject(const char *name,
......@@ -412,7 +413,7 @@ VTKTCL_EXPORT void *vtkTclGetPointerFromObject(const char *name,
if ((entry = Tcl_FindHashEntry(&is->InstanceLookup,name)))
{
temp = (ClientData)Tcl_GetHashValue(entry);
temp = static_cast<ClientData>(Tcl_GetHashValue(entry));
}
else
{
......@@ -425,7 +426,7 @@ VTKTCL_EXPORT void *vtkTclGetPointerFromObject(const char *name,
/* now handle the typecasting, get the command proc */
if ((entry = Tcl_FindHashEntry(&is->CommandLookup,name)))
{
command = (int (*)(ClientData,Tcl_Interp *,int,char *[]))Tcl_GetHashValue(entry);
command = reinterpret_cast<int (*)(ClientData,Tcl_Interp *,int,char *[])>(Tcl_GetHashValue(entry));
}
else
{
......@@ -436,27 +437,27 @@ VTKTCL_EXPORT void *vtkTclGetPointerFromObject(const char *name,
}
/* set up the args */
args[0] = (char *) "DoTypecasting";
args[0] = static_cast<char *>("DoTypecasting");
args[1] = strdup(result_type);
args[2] = NULL;
vtkTclCommandArgStruct foo;
foo.Pointer = temp;
foo.Interp = interp;
if (command((ClientData)&foo,(Tcl_Interp *)NULL,3,args) == TCL_OK)
if (command(static_cast<ClientData>(&foo),static_cast<Tcl_Interp *>(NULL),3,args) == TCL_OK)
{
free (args[1]);
return (void *)(args[2]);
return static_cast<void *>(args[2]);
}
else
{
Tcl_Interp *i;
i = Tcl_CreateInterp();
// provide more diagnostic info
args[0] = (char *) "Dummy";
args[0] = static_cast<char *>("Dummy");
free (args[1]);
args[1] = (char *) "GetClassName";
args[1] = static_cast<char *>("GetClassName");
args[2] = NULL;
command((ClientData)&foo,i,2,args);
command(static_cast<ClientData>(&foo),i,2,args);
sprintf(temps,"vtk bad argument, type conversion failed for object %s.\nCould not type convert %s which is of type %s, to type %s.\n", name, name, i->result, result_type);
Tcl_AppendResult(interp,temps,NULL);
......@@ -473,7 +474,7 @@ VTKTCL_EXPORT void vtkTclVoidFunc(void *arg)
vtkTclVoidFuncArg *arg2;
arg2 = (vtkTclVoidFuncArg *)arg;
arg2 = static_cast<vtkTclVoidFuncArg *>(arg);
#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION <= 2
res = Tcl_GlobalEval(arg2->interp, arg2->command);
......@@ -483,11 +484,11 @@ VTKTCL_EXPORT void vtkTclVoidFunc(void *arg)
if (res == TCL_ERROR)
{
if (Tcl_GetVar(arg2->interp,(char *) "errorInfo",0))
if (Tcl_GetVar(arg2->interp,static_cast<char *>("errorInfo"),0))
{
vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
arg2->command << endl <<
Tcl_GetVar(arg2->interp,(char *) "errorInfo",0) <<
Tcl_GetVar(arg2->interp,static_cast<char *>("errorInfo"),0) <<
" at line number " << arg2->interp->errorLine);
}
else
......@@ -503,7 +504,7 @@ VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void *arg)
{
vtkTclVoidFuncArg *arg2;
arg2 = (vtkTclVoidFuncArg *)arg;
arg2 = static_cast<vtkTclVoidFuncArg *>(arg);
// free the string and then structure
delete [] arg2->command;
......@@ -552,13 +553,13 @@ int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp,
int is_new;
char temps[80];
char name[80];
vtkTclCommandStruct *cs = (vtkTclCommandStruct *)cd;
vtkTclCommandStruct *cs = static_cast<vtkTclCommandStruct *>(cd);
Tcl_CmdInfo cinf;
vtkTclInterpStruct *is = vtkGetInterpStruct(interp);
if (argc != 2)
{
Tcl_SetResult(interp, (char *) "vtk object creation requires one argument, a name, or the special New keyword to instantiate a new name.", TCL_VOLATILE);
Tcl_SetResult(interp, static_cast<char *>("vtk object creation requires one argument, a name, or the special New keyword to instantiate a new name."), TCL_VOLATILE);
return TCL_ERROR;
}
......@@ -598,7 +599,7 @@ int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp,
ClientData temp;
if (!strcmp("ListInstances",argv[1]))
{
vtkTclListInstances(interp,(ClientData) cs->CommandFunction);
vtkTclListInstances(interp,reinterpret_cast<ClientData>(cs->CommandFunction));
return TCL_OK;
}
......@@ -613,17 +614,18 @@ int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp,
entry = Tcl_CreateHashEntry(&is->InstanceLookup,argv[1],&is_new);
Tcl_SetHashValue(entry,temp);
sprintf(temps,"%p",(void *)temp);
sprintf(temps,"%p",static_cast<void *>(temp));
entry = Tcl_CreateHashEntry(&is->PointerLookup,temps,&is_new);
Tcl_SetHashValue(entry,(ClientData)(strdup(argv[1])));
Tcl_SetHashValue(entry,static_cast<ClientData>(strdup(argv[1])));
// check to see if we can find the command function based on class name
char *tstr = strdup(((vtkObject *)temp)->GetClassName());
char *tstr = strdup(static_cast<vtkObject *>(temp)->GetClassName());
if (Tcl_GetCommandInfo(interp,tstr,&cinf))
{
if (cinf.clientData)
{
vtkTclCommandStruct *cs2 = (vtkTclCommandStruct *)cinf.clientData;
vtkTclCommandStruct *cs2 =
static_cast<vtkTclCommandStruct *>(cinf.clientData);
command = cs2->CommandFunction;
}
else
......@@ -641,20 +643,21 @@ int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp,
}
vtkTclCommandArgStruct *as = new vtkTclCommandArgStruct;
as->Pointer = (void *)temp;
as->Pointer = static_cast<void *>(temp);
as->Interp = interp;
Tcl_CreateCommand(interp,argv[1],
reinterpret_cast<vtkTclCommandType>(command),
(ClientData)as,
(Tcl_CmdDeleteProc *)vtkTclGenericDeleteObject);
static_cast<ClientData>(as),
static_cast<Tcl_CmdDeleteProc *>(vtkTclGenericDeleteObject));
entry = Tcl_CreateHashEntry(&is->CommandLookup,argv[1],&is_new);
Tcl_SetHashValue(entry,(ClientData)(cs->CommandFunction));
Tcl_SetHashValue(entry,reinterpret_cast<ClientData>(cs->CommandFunction));
// setup the delete callback
vtkCallbackCommand *cbc = vtkCallbackCommand::New();
cbc->SetCallback(vtkTclDeleteObjectFromHash);
cbc->SetClientData((void *)as);
as->Tag = ((vtkObject *)temp)->AddObserver(vtkCommand::DeleteEvent, cbc);
cbc->SetClientData(static_cast<void *>(as));
as->Tag =
static_cast<vtkObject *>(temp)->AddObserver(vtkCommand::DeleteEvent, cbc);
cbc->Delete();
Tcl_SetResult(interp, argv[1], TCL_VOLATILE);
......@@ -663,7 +666,7 @@ int vtkTclNewInstanceCommand(ClientData cd, Tcl_Interp *interp,
void vtkTclDeleteCommandStruct(ClientData cd)
{
vtkTclCommandStruct *cs = (vtkTclCommandStruct *)cd;
vtkTclCommandStruct *cs = static_cast<vtkTclCommandStruct *>(cd);
delete cs;
}
......@@ -676,11 +679,12 @@ void vtkTclCreateNew(Tcl_Interp *interp, const char *cname,
vtkTclCommandStruct *cs = new vtkTclCommandStruct;
cs->NewCommand = NewCommand;
cs->CommandFunction = CommandFunction;
Tcl_CreateCommand(interp,(char *) cname,
reinterpret_cast<vtkTclCommandType>(
vtkTclNewInstanceCommand),
(ClientData *)cs,
(Tcl_CmdDeleteProc *)vtkTclDeleteCommandStruct);
Tcl_CreateCommand(
interp,const_cast<char *>(cname),
reinterpret_cast<vtkTclCommandType>(
vtkTclNewInstanceCommand),
reinterpret_cast<ClientData *>(cs),
static_cast<Tcl_CmdDeleteProc *>(vtkTclDeleteCommandStruct));
}
......@@ -713,11 +717,11 @@ void vtkTclCommand::Execute(vtkObject *, unsigned long, void *)
if (res == TCL_ERROR)
{
if (Tcl_GetVar(this->Interp,(char *) "errorInfo",0))
if (Tcl_GetVar(this->Interp,static_cast<char *>("errorInfo"),0))
{
vtkGenericWarningMacro("Error returned from vtk/tcl callback:\n" <<
this->StringCommand << endl <<
Tcl_GetVar(this->Interp,(char *) "errorInfo",0) <<
Tcl_GetVar(this->Interp,static_cast<char *>("errorInfo"),0) <<
" at line number " << this->Interp->errorLine);
}
else
......
......@@ -144,7 +144,7 @@ void use_hints(FILE *fp)
fprintf(fp,"\"");
for (i = 0; i < currentFunction->HintSize; i++)
{
fprintf(fp,",(int)temp%i[%i]",MAX_ARGS,i);
fprintf(fp,",static_cast<int>(temp%i[%i])",MAX_ARGS,i);
}
fprintf(fp,");\n");
fprintf(fp," Tcl_SetResult(interp, tempResult, TCL_VOLATILE);\n");
......@@ -421,7 +421,7 @@ void return_result(FILE *fp)
fprintf(fp," Tcl_SetResult(interp, tempResult, TCL_VOLATILE);\n");
break;
case 0x303:
fprintf(fp," if (temp%i)\n {\n Tcl_SetResult(interp, (char*)temp%i, TCL_VOLATILE);\n",MAX_ARGS,MAX_ARGS);
fprintf(fp," if (temp%i)\n {\n Tcl_SetResult(interp, const_cast<char *>(temp%i), TCL_VOLATILE);\n",MAX_ARGS,MAX_ARGS);
fprintf(fp," }\n else\n {\n");
fprintf(fp," Tcl_ResetResult(interp);\n }\n");
break;
......@@ -433,7 +433,7 @@ void return_result(FILE *fp)
break;
case 0x109:
case 0x309:
fprintf(fp," vtkTclGetObjectFromPointer(interp,(void *)temp%i,\"%s\");\n",MAX_ARGS,currentFunction->ReturnClass);
fprintf(fp," vtkTclGetObjectFromPointer(interp,static_cast<void *>(temp%i),\"%s\");\n",MAX_ARGS,currentFunction->ReturnClass);
break;
/* handle functions returning vectors */
......@@ -444,7 +444,7 @@ void return_result(FILE *fp)
use_hints(fp);
break;
default:
fprintf(fp," Tcl_SetResult(interp, (char *) \"unable to return result.\", TCL_VOLATILE);\n");
fprintf(fp," Tcl_SetResult(interp, static_cast<char *>(\"unable to return result.\"), TCL_VOLATILE);\n");
break;
}
}
......@@ -500,29 +500,29 @@ void get_args(FILE *fp, int i)
case 0x13:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i = (unsigned char)tempi;\n",i);
fprintf(fp," temp%i = static_cast<unsigned char>(tempi);\n",i);
break;
case 0x14: case 0x1A: case 0x1B: case 0x1C:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i = (unsigned int)tempi;\n",i);
fprintf(fp," temp%i = static_cast<unsigned int>(tempi);\n",i);
break;
case 0x15:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i = (unsigned short)tempi;\n",i);
fprintf(fp," temp%i = static_cast<unsigned short>(tempi);\n",i);
break;
case 0x16:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i = (unsigned long)tempi;\n",i);
fprintf(fp," temp%i = static_cast<unsigned long>(tempi);\n",i);
break;
case 0x303:
fprintf(fp," temp%i = argv[%i];\n",i,start_arg);
break;
case 0x109:
case 0x309:
fprintf(fp," temp%i = (%s *)(vtkTclGetPointerFromObject(argv[%i],(char *) \"%s\",interp,error));\n",i,currentFunction->ArgClasses[i],start_arg,
fprintf(fp," temp%i = static_cast<%s *>(vtkTclGetPointerFromObject(argv[%i],static_cast<char *>(\"%s\"),interp,error));\n",i,currentFunction->ArgClasses[i],start_arg,
currentFunction->ArgClasses[i]);
break;
case 0x2:
......@@ -557,22 +557,22 @@ void get_args(FILE *fp, int i)
case 0x13:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i[%i] = (unsigned char)tempi;\n",i,j);
fprintf(fp," temp%i[%i] = static_cast<unsigned char>(tempi);\n",i,j);
break;
case 0x14: case 0x1A:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i[%i] = (unsigned int)tempi;\n",i,j);
fprintf(fp," temp%i[%i] = static_cast<unsigned int>(tempi);\n",i,j);
break;
case 0x15:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i[%i] = (unsigned short)tempi;\n",i,j);
fprintf(fp," temp%i[%i] = static_cast<unsigned short>(tempi);\n",i,j);
break;
case 0x16:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i[%i] = (unsigned long)tempi;\n",i,j);
fprintf(fp," temp%i[%i] = static_cast<unsigned long>(tempi);\n",i,j);
break;
}
start_arg++;
......@@ -709,7 +709,7 @@ void outputFunction(FILE *fp, FileInfo *data)
}
else if (currentFunction->ArgTypes[i] == 0x5000)
{
fprintf(fp,"vtkTclVoidFunc,(void *)temp%i",i);
fprintf(fp,"vtkTclVoidFunc,static_cast<void *>(temp%i)",i);
}
else
{
......@@ -777,13 +777,13 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
fprintf(fp,"#else\n");
fprintf(fp," %s *temp = %s::New();\n",data->ClassName,data->ClassName);
fprintf(fp,"#endif\n");
fprintf(fp," return ((ClientData)temp);\n}\n\n");
fprintf(fp," return static_cast<ClientData>(temp);\n}\n\n");
}
else
{
fprintf(fp,"\nClientData %sNewCommand()\n{\n",data->ClassName);
fprintf(fp," %s *temp = %s::New();\n",data->ClassName,data->ClassName);
fprintf(fp," return ((ClientData)temp);\n}\n\n");
fprintf(fp," return static_cast<ClientData>(temp);\n}\n\n");
}
}
......@@ -796,7 +796,7 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
fprintf(fp," if ((argc == 2)&&(!strcmp(\"Delete\",argv[1]))&& !vtkTclInDelete(interp))\n {\n");
fprintf(fp," Tcl_DeleteCommand(interp,argv[0]);\n");
fprintf(fp," return TCL_OK;\n }\n");
fprintf(fp," return %sCppCommand((%s *)(((vtkTclCommandArgStruct *)cd)->Pointer),interp, argc, argv);\n}\n",data->ClassName,data->ClassName);
fprintf(fp," return %sCppCommand(static_cast<%s *>(static_cast<vtkTclCommandArgStruct *>(cd)->Pointer),interp, argc, argv);\n}\n",data->ClassName,data->ClassName);
fprintf(fp,"\nint VTKTCL_EXPORT %sCppCommand(%s *op, Tcl_Interp *interp,\n int argc, char *argv[])\n{\n",data->ClassName,data->ClassName);
fprintf(fp," int tempi;\n");
......@@ -808,20 +808,20 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
fprintf(fp," tempd = 0; tempd = tempd;\n");
fprintf(fp," temps[0] = 0; temps[0] = temps[0];\n\n");
fprintf(fp," if (argc < 2)\n {\n Tcl_SetResult(interp, (char *) \"Could not find requested method.\", TCL_VOLATILE);\n return TCL_ERROR;\n }\n");
fprintf(fp," if (argc < 2)\n {\n Tcl_SetResult(interp, static_cast<char *>(\"Could not find requested method.\"), TCL_VOLATILE);\n return TCL_ERROR;\n }\n");
/* stick in the typecasting and delete functionality here */
fprintf(fp," if (!interp)\n {\n");
fprintf(fp," if (!strcmp(\"DoTypecasting\",argv[0]))\n {\n");
fprintf(fp," if (!strcmp(\"%s\",argv[1]))\n {\n",
data->ClassName);
fprintf(fp," argv[2] = (char *)((void *)op);\n");
fprintf(fp," argv[2] = static_cast<char *>(static_cast<void *>(op));\n");
fprintf(fp," return TCL_OK;\n }\n");
/* check our superclasses */
for (i = 0; i < data->NumberOfSuperClasses; i++)
{
fprintf(fp," if (%sCppCommand((%s *)op,interp,argc,argv) == TCL_OK)\n {\n",
fprintf(fp," if (%sCppCommand(static_cast<%s *>(op),interp,argc,argv) == TCL_OK)\n {\n",
data->SuperClasses[i],data->SuperClasses[i]);
fprintf(fp," return TCL_OK;\n }\n");
}
......@@ -832,7 +832,7 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
{
fprintf(fp," if (!strcmp(\"GetSuperClassName\",argv[1]))\n");
fprintf(fp," {\n");
fprintf(fp," Tcl_SetResult(interp,(char *) \"%s\", TCL_VOLATILE);\n",data->SuperClasses[0]);
fprintf(fp," Tcl_SetResult(interp,static_cast<char *>(\"%s\"), TCL_VOLATILE);\n",data->SuperClasses[0]);
fprintf(fp," return TCL_OK;\n");
fprintf(fp," }\n\n");
}
......@@ -848,7 +848,7 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
/* add the ListInstances method */
fprintf(fp,"\n if (!strcmp(\"ListInstances\",argv[1]))\n {\n");
fprintf(fp," vtkTclListInstances(interp,(ClientData)%sCommand);\n",data->ClassName);
fprintf(fp," vtkTclListInstances(interp,reinterpret_cast<ClientData>(%sCommand));\n",data->ClassName);
fprintf(fp," return TCL_OK;\n }\n");
/* add the ListMethods method */
......@@ -905,7 +905,7 @@ void vtkParseOutput(FILE *fp, FileInfo *data)
/* try superclasses */
for (i = 0; i < data->NumberOfSuperClasses; i++)
{
fprintf(fp,"\n if (%sCppCommand((%s *)op,interp,argc,argv) == TCL_OK)\n",
fprintf(fp,"\n if (%sCppCommand(static_cast<%s *>(op),interp,argc,argv) == TCL_OK)\n",
data->SuperClasses[i], data->SuperClasses[i]);
fprintf(fp," {\n return TCL_OK;\n }\n");
}
......
......@@ -128,14 +128,14 @@ static void CreateInitFile(const char *libName,
fprintf(fout,
" Tcl_InitHashTable(&info->CommandLookup, TCL_STRING_KEYS);\n");
fprintf(fout,
" Tcl_SetAssocData(interp,(char *) \"vtk\",NULL,(ClientData *)info);\n");
" Tcl_SetAssocData(interp,static_cast<char *>(\"vtk\"),NULL,reinterpret_cast<ClientData *>(info));\n");
fprintf(fout,
" Tcl_CreateExitHandler(vtkCommonDeleteAssocData,(ClientData *)info);\n");
" Tcl_CreateExitHandler(vtkCommonDeleteAssocData,reinterpret_cast<ClientData *>(info));\n");
/* create special vtkCommand command */
fprintf(fout," Tcl_CreateCommand(interp,(char *) \"vtkCommand\",\n"
fprintf(fout," Tcl_CreateCommand(interp,static_cast<char *>(\"vtkCommand\"),\n"
" reinterpret_cast<vtkTclCommandType>(vtkCreateCommand),\n"
" (ClientData *)NULL, NULL);\n\n");
" static_cast<ClientData *>(NULL), NULL);\n\n");
}
for (i = 0; i < numCommands; i++)
......@@ -146,7 +146,7 @@ static void CreateInitFile(const char *libName,
for (i = 0; i < numConcrete; i++)
{
fprintf(fout," vtkTclCreateNew(interp,(char *) \"%s\", %sNewCommand,\n",
fprintf(fout," vtkTclCreateNew(interp,static_cast<char *>(\"%s\"), %sNewCommand,\n",
concrete[i], concrete[i]);
fprintf(fout," %sCommand);\n",concrete[i]);
}
......
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