Commit 129e8abc authored by David Gobbi's avatar David Gobbi Committed by Code Review

Merge topic 'wrap-const-cast' into master

af541360 Revert "Remove some unecessary casts."
parents 4b29cd1d af541360
......@@ -316,7 +316,7 @@ void vtkParse_FreeValue(ValueInfo *value_info)
{
if (value_info->NumberOfDimensions)
{
free(value_info->Dimensions);
free((char **)value_info->Dimensions);
}
if (value_info->Function)
{
......@@ -560,7 +560,7 @@ void vtkParse_FreeClass(ClassInfo *class_info)
if (class_info->Template) { vtkParse_FreeTemplate(class_info->Template); }
m = class_info->NumberOfSuperClasses;
if (m > 0) { free(class_info->SuperClasses); }
if (m > 0) { free((char **)class_info->SuperClasses); }
m = class_info->NumberOfClasses;
for (j = 0; j < m; j++) { vtkParse_FreeClass(class_info->Classes[j]); }
......@@ -663,7 +663,7 @@ void vtkParse_AddStringToArray(
const char ***valueArray, int *count, const char *value)
{
*valueArray = (const char **)array_size_check(
*valueArray, sizeof(const char *), *count);
(char **)*valueArray, sizeof(const char *), *count);
(*valueArray)[(*count)++] = value;
}
......
......@@ -1221,7 +1221,7 @@ void vtkParse_FreeTemplateDecomposition(
free((char *)args[i]);
}
free(args);
free((char **)args);
}
}
......@@ -1331,8 +1331,8 @@ void vtkParse_InstantiateClassTemplate(
class_substitution(data, cache, m, arg_names, args, arg_types);
/* free all allocated arrays */
free(new_args);
free(arg_names);
free((char **)new_args);
free((char **)arg_names);
for (i = 0; i < m; i++)
{
......
......@@ -256,9 +256,9 @@ HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename)
else
{
entry->TemplateParameters = (const char **)realloc(
entry->TemplateParameters, (j+1)*sizeof(char *));
(char **)entry->TemplateParameters, (j+1)*sizeof(char *));
entry->TemplateDefaults = (const char **)realloc(
entry->TemplateDefaults, (j+1)*sizeof(char *));
(char **)entry->TemplateDefaults, (j+1)*sizeof(char *));
}
entry->NumberOfTemplateParameters++;
entry->TemplateDefaults[j] = NULL;
......@@ -344,7 +344,7 @@ HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename)
else
{
entry->SuperClasses = (const char **)realloc(
entry->SuperClasses, (j+1)*sizeof(char *));
(char **)entry->SuperClasses, (j+1)*sizeof(char *));
entry->SuperClassIndex = (int *)realloc(
entry->SuperClassIndex, (j+1)*sizeof(int));
}
......@@ -503,7 +503,7 @@ HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename)
else
{
entry->Properties = (const char **)realloc(
entry->Properties,
(char **)entry->Properties,
(entry->NumberOfProperties+1)*sizeof(char **));
}
n = 0;
......@@ -545,17 +545,17 @@ void vtkParseHierarchy_Free(HierarchyInfo *info)
entry = &info->Entries[i];
if (entry->NumberOfTemplateParameters)
{
free(entry->TemplateParameters);
free(entry->TemplateDefaults);
free((char **)entry->TemplateParameters);
free((char **)entry->TemplateDefaults);
}
if (entry->NumberOfSuperClasses)
{
free(entry->SuperClasses);
free((char **)entry->SuperClasses);
free(entry->SuperClassIndex);
}
if (entry->NumberOfProperties)
{
free(entry->Properties);
free((char **)entry->Properties);
}
}
......@@ -773,7 +773,7 @@ void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[])
free((char *)args[i]);
}
free(args);
free((char **)args);
}
/* Given a classname with template parameters, get the superclass name
......
......@@ -1401,7 +1401,7 @@ static int preproc_evaluate_define(
{
if (tokens->tok != TOK_ID && tokens->tok != TOK_ELLIPSIS)
{
free(params);
free((char **)params);
#if PREPROC_DEBUG
fprintf(stderr, "syntax error %d\n", __LINE__);
#endif
......@@ -1420,7 +1420,7 @@ static int preproc_evaluate_define(
/* add to the arg list */
params = (const char **)preproc_array_check(
params, sizeof(char *), n);
(char **)params, sizeof(char *), n);
params[n++] = vtkParse_CacheString(info->Strings, param, l);
vtkParse_NextToken(tokens);
......@@ -1438,7 +1438,7 @@ static int preproc_evaluate_define(
}
else if (tokens->tok != ')')
{
free(params);
free((char **)params);
#if PREPROC_DEBUG
fprintf(stderr, "syntax error %d\n", __LINE__);
#endif
......@@ -1456,7 +1456,7 @@ static int preproc_evaluate_define(
macro = *macro_p;
if (macro)
{
free(params);
free((char **)params);
if (preproc_identical(macro->Definition, definition))
{
return VTK_PARSE_OK;
......@@ -1510,7 +1510,7 @@ static int preproc_add_include_file(PreprocessInfo *info, const char *name)
}
info->IncludeFiles = (const char **)preproc_array_check(
info->IncludeFiles, sizeof(char *), info->NumberOfIncludeFiles);
(char **)info->IncludeFiles, sizeof(char *), info->NumberOfIncludeFiles);
info->IncludeFiles[info->NumberOfIncludeFiles++] =
vtkParse_CacheString(info->Strings, name, strlen(name));
......@@ -1588,7 +1588,8 @@ const char *preproc_find_include_file(
}
info->IncludeFiles = (const char **)preproc_array_check(
info->IncludeFiles, sizeof(char *), info->NumberOfIncludeFiles);
(char **)info->IncludeFiles, sizeof(char *),
info->NumberOfIncludeFiles);
info->IncludeFiles[info->NumberOfIncludeFiles++] = output;
return output;
......@@ -1697,7 +1698,7 @@ const char *preproc_find_include_file(
{
nn = info->NumberOfIncludeFiles;
info->IncludeFiles = (const char **)preproc_array_check(
info->IncludeFiles, sizeof(char *), nn);
(char **)info->IncludeFiles, sizeof(char *), nn);
info->IncludeFiles[info->NumberOfIncludeFiles++] =
vtkParse_CacheString(info->Strings, output, strlen(output));
free(output);
......@@ -2514,12 +2515,12 @@ const char *vtkParsePreprocess_ExpandMacro(
if (values != stack_values)
{
values = (const char **)realloc(
values, 2*n*sizeof(const char **));
(char **)values, 2*n*sizeof(const char **));
}
else
{
values = (const char **)malloc(2*n*sizeof(const char **));
memcpy(values, stack_values, 8*sizeof(const char **));
memcpy((char **)values, stack_values, 8*sizeof(const char **));
}
}
......@@ -2558,7 +2559,7 @@ const char *vtkParsePreprocess_ExpandMacro(
if (n < (macro->NumberOfParameters - empty_variadic) ||
(n > macro->NumberOfParameters && !macro->IsVariadic))
{
if (values != stack_values) { free(values); }
if (values != stack_values) { free((char **)values); }
#if PREPROC_DEBUG
fprintf(stderr, "wrong number of macro args to %s, %lu != %lu\n",
macro->Name, n, macro->NumberOfParameters);
......@@ -2804,7 +2805,7 @@ const char *vtkParsePreprocess_ExpandMacro(
}
}
if (values != stack_values) { free(values); }
if (values != stack_values) { free((char **)values); }
if (!macro->IsFunction && macro->Definition &&
strcmp(rp, macro->Definition) == 0)
......@@ -3056,7 +3057,7 @@ void vtkParsePreprocess_IncludeDirectory(
}
info->IncludeDirectories = (const char **)preproc_array_check(
info->IncludeDirectories, sizeof(char *),
(char **)info->IncludeDirectories, sizeof(char *),
info->NumberOfIncludeDirectories);
info->IncludeDirectories[info->NumberOfIncludeDirectories++] =
vtkParse_CacheString(info->Strings, name, strlen(name));
......@@ -3103,7 +3104,7 @@ void vtkParsePreprocess_InitMacro(MacroInfo *macro)
*/
void vtkParsePreprocess_FreeMacro(MacroInfo *macro)
{
free(macro->Parameters);
free((char **)macro->Parameters);
free(macro);
}
......@@ -3161,8 +3162,8 @@ void vtkParsePreprocess_Free(PreprocessInfo *info)
free(info->MacroHashTable);
}
free(info->IncludeDirectories);
free(info->IncludeFiles);
free((char **)info->IncludeDirectories);
free((char **)info->IncludeFiles);
free(info);
}
......@@ -919,7 +919,7 @@ static int vtkWrapHierarchy_TryWriteHierarchyFile(
static int string_compare(const void *vp1, const void *vp2)
{
return strcmp(*(const char *const *)vp1, *(const char *const *)vp2);
return strcmp(*(const char **)vp1, *(const char **)vp2);
}
int main(int argc, char *argv[])
......
......@@ -229,7 +229,7 @@ static void vtkWrapPython_GenerateSpecialHeaders(
{
if (numTypes > 0 && (numTypes % 1000) == 0)
{
types = realloc((char **)types,
types = (const char **)realloc((char **)types,
(numTypes + 1000)*sizeof(const char *));
}
types[numTypes++] = classname;
......@@ -270,7 +270,7 @@ static void vtkWrapPython_GenerateSpecialHeaders(
}
}
free(types);
free((char **)types);
}
/* -------------------------------------------------------------------- */
......@@ -332,7 +332,7 @@ static void vtkWrapPython_ImportExportEnumTypes(
/* crude code to expand list as necessary */
if (numTypes > 0 && (numTypes % 1000) == 0)
{
types = realloc(types,
types = (const char **)realloc((char **)types,
(numTypes + 1000)*sizeof(const char *));
}
types[numTypes++] = val->Class;
......@@ -396,7 +396,7 @@ static void vtkWrapPython_ImportExportEnumTypes(
enumname, enumname);
}
free(types);
free((char **)types);
}
/* -------------------------------------------------------------------- */
......
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