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

COMP:Fixed old-style casts.

parent 32a3fc4c
......@@ -19,7 +19,7 @@
// the function to be minimized
static void vtkFunctionToMinimize(void *arg)
{
vtkAmoebaMinimizer *minimizer = (vtkAmoebaMinimizer *)arg;
vtkAmoebaMinimizer *minimizer = static_cast<vtkAmoebaMinimizer *>(arg);
double x = minimizer->GetParameterValue("x");
double y = minimizer->GetParameterValue("y");
......
......@@ -42,7 +42,7 @@ int TestSortDataArray(int, char *[])
keys->SetNumberOfTuples(ARRAY_SIZE);
for (i = 0; i < ARRAY_SIZE; i++)
{
keys->SetComponent(i, 0, (int)vtkMath::Random(0, ARRAY_SIZE*4));
keys->SetComponent(i,0,static_cast<int>(vtkMath::Random(0, ARRAY_SIZE*4)));
}
cout << "Sorting array" << endl;
......@@ -85,9 +85,10 @@ int TestSortDataArray(int, char *[])
values->SetNumberOfTuples(ARRAY_SIZE);
for (i = 0; i < ARRAY_SIZE; i++)
{
keys->SetComponent(i, 0, (int)vtkMath::Random(0, ARRAY_SIZE*4));
keys->SetComponent(i,0,static_cast<int>(vtkMath::Random(0, ARRAY_SIZE*4)));
values->SetComponent(i, 0, i);
values->SetComponent(i, 1, (int)vtkMath::Random(0, ARRAY_SIZE*4));
values->SetComponent(i,1,
static_cast<int>(vtkMath::Random(0, ARRAY_SIZE*4)));
}
vtkIntArray *saveKeys = vtkIntArray::New();
saveKeys->DeepCopy(keys);
......@@ -103,7 +104,7 @@ int TestSortDataArray(int, char *[])
for (i = 0; i < ARRAY_SIZE-1; i++)
{
int lookup = (int)values->GetComponent(i, 0);
int lookup = static_cast<int>(values->GetComponent(i, 0));
if (keys->GetComponent(i, 0) > keys->GetComponent(i+1, 0))
{
cout << "Array not properly sorted!" << endl;
......@@ -131,7 +132,7 @@ int TestSortDataArray(int, char *[])
for (i = 0; i < ARRAY_SIZE-1; i++)
{
int lookup = (int)values->GetComponent(i, 0);
int lookup = static_cast<int>(values->GetComponent(i, 0));
if (keys->GetComponent(i, 0) > keys->GetComponent(i+1, 0))
{
cout << "Array not properly sorted!" << endl;
......
......@@ -32,122 +32,122 @@ int TestByteSwap(ostream& strm)
char cword[1024];
unsigned short usword[2];
memcpy (reinterpret_cast<char *>(sword), "abcd", 2);
memcpy (sword, "abcd", 2);
vtkByteSwap::Swap2BE(sword);
memcpy ((char *) check, sword, 2);
strm << "Swap2BE(short \"ab\") -> " << (char) check[0] << (char) check[1] << endl;
memcpy (check, sword, 2);
strm << "Swap2BE(short \"ab\") -> " << check[0] << check[1] << endl;
memcpy ((char *) usword, "abcd", 2);
memcpy (usword, "abcd", 2);
vtkByteSwap::Swap2BE(usword);
memcpy ((char *) check, usword, 2);
strm << "Swap2BE(unsigned short \"ab\") -> " << (char) check[0] << (char) check[1] << endl;
memcpy (check, usword, 2);
strm << "Swap2BE(unsigned short \"ab\") -> " << check[0] << check[1] << endl;
memcpy ((char *) cword, "abcd", 4);
memcpy (cword, "abcd", 4);
vtkByteSwap::Swap4BE(cword);
memcpy ((char *) check, cword, 4);
strm << "Swap4BE(char *\"abcd\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << endl;
memcpy (check, cword, 4);
strm << "Swap4BE(char *\"abcd\") -> " << check[0] << check[1] << check[2] << check[3] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap8BE(cword);
memcpy ((char *) check, cword, 8);
strm << "Swap8BE(char *\"abcdefgh\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap8BE(char *\"abcdefgh\") -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap2BERange(cword,8);
memcpy ((char *) check, cword, 8);
strm << "Swap2BERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap2BERange(char *\"abcdefgh\",8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap4BERange(cword,8);
memcpy ((char *) check, cword, 8);
strm << "Swap4BERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap4BERange(char *\"abcdefgh\",8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap8BERange(cword,8);
memcpy ((char *) check, cword, 8);
strm << "Swap8BERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap8BERange(char *\"abcdefgh\",8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefghijklmnop", 16);
memcpy (cword, "abcdefghijklmnop", 16);
strm << "SwapWrite2BERange(char *\"abcdefghijklmnop\",8,stdout) -> ";
vtkByteSwap::SwapWrite2BERange(cword,8,stdout);
strm << endl;
memcpy ((char *) cword, "abcdefghijklmnop", 16);
memcpy (cword, "abcdefghijklmnop", 16);
strm << "SwapWrite4BERange(char *\"abcdefghijklmnop\",4,stdout) -> ";
vtkByteSwap::SwapWrite4BERange(cword,4,stdout);
strm << endl;
memcpy ((char *) cword, "abcdefghijklmnop", 16);
memcpy (cword, "abcdefghijklmnop", 16);
strm << "SwapWrite8BERange(char *\"abcdefghijklmnop\",2,stdout) -> ";
vtkByteSwap::SwapWrite8BERange(cword,2,stdout);
strm << endl;
memcpy ((char *) cword, "abcdefghijklmnop", 16);
memcpy (cword, "abcdefghijklmnop", 16);
strm << "SwapWrite2BERange(char *\"abcdefghijklmnop\",8,&strm) -> ";
vtkByteSwap::SwapWrite2BERange(cword,8,&strm);
strm << endl;
memcpy ((char *) cword, "abcdefghijklmnop", 16);
memcpy (cword, "abcdefghijklmnop", 16);
strm << "SwapWrite4BERange(char *\"abcdefghijklmnop\",4,&strm) -> ";
vtkByteSwap::SwapWrite4BERange(cword,4,&strm);
strm << endl;
memcpy ((char *) cword, "abcdefghijklmnop", 16);
memcpy (cword, "abcdefghijklmnop", 16);
strm << "SwapWrite8BERange(char *\"abcdefghijklmnop\",2,&strm) -> ";
vtkByteSwap::SwapWrite8BERange(cword,2,&strm);
strm << endl;
memcpy ((char *) sword, "abcd", 2);
memcpy (sword, "abcd", 2);
vtkByteSwap::Swap2LE(sword);
memcpy ((char *) check, sword, 2);
strm << "Swap2LE(short \"ab\") -> " << (char) check[0] << (char) check[1] << endl;
memcpy (check, sword, 2);
strm << "Swap2LE(short \"ab\") -> " << check[0] << check[1] << endl;
memcpy ((char *) usword, "abcd", 2);
memcpy (usword, "abcd", 2);
vtkByteSwap::Swap2LE(usword);
memcpy ((char *) check, usword, 2);
strm << "Swap2LE(unsigned short \"ab\") -> " << (char) check[0] << (char) check[1] << endl;
memcpy (check, usword, 2);
strm << "Swap2LE(unsigned short \"ab\") -> " << check[0] << check[1] << endl;
memcpy ((char *) cword, "abcd", 4);
memcpy (cword, "abcd", 4);
vtkByteSwap::Swap4LE(cword);
memcpy ((char *) check, cword, 4);
strm << "Swap4LE(char *\"abcd\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << endl;
memcpy (check, cword, 4);
strm << "Swap4LE(char *\"abcd\") -> " << check[0] << check[1] << check[2] << check[3] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap8LE(cword);
memcpy ((char *) check, cword, 8);
strm << "Swap8LE(char *\"abcdefgh\") -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap8LE(char *\"abcdefgh\") -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap2LERange(cword,8);
memcpy ((char *) check, cword, 8);
strm << "Swap2LERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap2LERange(char *\"abcdefgh\",8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap4LERange(cword,8);
memcpy ((char *) check, cword, 8);
strm << "Swap4LERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap4LERange(char *\"abcdefgh\",8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::Swap8LERange(cword,8);
memcpy ((char *) check, cword, 8);
strm << "Swap8LERange(char *\"abcdefgh\",8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "Swap8LERange(char *\"abcdefgh\",8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::SwapVoidRange(cword,4,2);
memcpy ((char *) check, cword, 8);
strm << "SwapVoidRange(char *\"abcdefgh\",4,2) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "SwapVoidRange(char *\"abcdefgh\",4,2) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::SwapVoidRange(cword,2,4);
memcpy ((char *) check, cword, 8);
strm << "SwapVoidRange(char *\"abcdefgh\",2,4) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "SwapVoidRange(char *\"abcdefgh\",2,4) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
memcpy ((char *) cword, "abcdefgh", 8);
memcpy (cword, "abcdefgh", 8);
vtkByteSwap::SwapVoidRange(cword,1,8);
memcpy ((char *) check, cword, 8);
strm << "SwapVoidRange(char *\"abcdefgh\",1,8) -> " << (char) check[0] << (char) check[1] << (char) check[2] << (char) check[3] << (char) check[4] << (char) check[5] << (char) check[6] << (char) check[7] << endl;
memcpy (check, cword, 8);
strm << "SwapVoidRange(char *\"abcdefgh\",1,8) -> " << check[0] << check[1] << check[2] << check[3] << check[4] << check[5] << check[6] << check[7] << endl;
strm << "Test vtkByteSwap End" << endl;
return 0;
......
......@@ -46,109 +46,109 @@ void TestOLT(vtkLookupTable *lut1)
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2(&bitA, output, VTK_CHAR,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
lut1->MapScalarsThroughTable2(&bitA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) &bitA, output, VTK_CHAR,
lut1->MapScalarsThroughTable2(&bitA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE);
char charA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
lut1->MapScalarsThroughTable2(charA, output, VTK_CHAR,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
lut1->MapScalarsThroughTable2(charA, output, VTK_CHAR,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
lut1->MapScalarsThroughTable2(charA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) charA, output, VTK_CHAR,
lut1->MapScalarsThroughTable2(charA, output, VTK_CHAR,
2, 1, VTK_LUMINANCE);
unsigned char ucharA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
lut1->MapScalarsThroughTable2(ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
lut1->MapScalarsThroughTable2(ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
lut1->MapScalarsThroughTable2(ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ucharA, output, VTK_UNSIGNED_CHAR,
lut1->MapScalarsThroughTable2(ucharA, output, VTK_UNSIGNED_CHAR,
2, 1, VTK_LUMINANCE);
int intA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
lut1->MapScalarsThroughTable2(intA, output, VTK_INT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
lut1->MapScalarsThroughTable2(intA, output, VTK_INT,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
lut1->MapScalarsThroughTable2(intA, output, VTK_INT,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) intA, output, VTK_INT,
lut1->MapScalarsThroughTable2(intA, output, VTK_INT,
2, 1, VTK_LUMINANCE);
unsigned int uintA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
lut1->MapScalarsThroughTable2(uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
lut1->MapScalarsThroughTable2(uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
lut1->MapScalarsThroughTable2(uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) uintA, output, VTK_UNSIGNED_INT,
lut1->MapScalarsThroughTable2(uintA, output, VTK_UNSIGNED_INT,
2, 1, VTK_LUMINANCE);
long longA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
lut1->MapScalarsThroughTable2(longA, output, VTK_LONG,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
lut1->MapScalarsThroughTable2(longA, output, VTK_LONG,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
lut1->MapScalarsThroughTable2(longA, output, VTK_LONG,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) longA, output, VTK_LONG,
lut1->MapScalarsThroughTable2(longA, output, VTK_LONG,
2, 1, VTK_LUMINANCE);
unsigned long ulongA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
lut1->MapScalarsThroughTable2(ulongA, output, VTK_UNSIGNED_LONG,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
lut1->MapScalarsThroughTable2(ulongA, output, VTK_UNSIGNED_LONG,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG,
lut1->MapScalarsThroughTable2(ulongA, output, VTK_UNSIGNED_LONG,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_LUMINANCE);
lut1->MapScalarsThroughTable2(ulongA, output, VTK_UNSIGNED_LONG, 2, 1, VTK_LUMINANCE);
short shortA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
lut1->MapScalarsThroughTable2(shortA, output, VTK_SHORT,
2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
lut1->MapScalarsThroughTable2(shortA, output, VTK_SHORT,
2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
lut1->MapScalarsThroughTable2(shortA, output, VTK_SHORT,
2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) shortA, output, VTK_SHORT,
lut1->MapScalarsThroughTable2(shortA, output, VTK_SHORT,
2, 1, VTK_LUMINANCE);
unsigned short ushortA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) ushortA, output,
lut1->MapScalarsThroughTable2(ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
lut1->MapScalarsThroughTable2(ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
lut1->MapScalarsThroughTable2(ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) ushortA, output,
lut1->MapScalarsThroughTable2(ushortA, output,
VTK_UNSIGNED_SHORT, 2, 1, VTK_LUMINANCE);
float floatA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) floatA, output,
lut1->MapScalarsThroughTable2(floatA, output,
VTK_FLOAT, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) floatA, output,
lut1->MapScalarsThroughTable2(floatA, output,
VTK_FLOAT, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) floatA, output,
lut1->MapScalarsThroughTable2(floatA, output,
VTK_FLOAT, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) floatA, output,
lut1->MapScalarsThroughTable2(floatA, output,
VTK_FLOAT, 2, 1, VTK_LUMINANCE);
double doubleA[2] = {1, 10};
lut1->MapScalarsThroughTable2((void *) doubleA, output,
lut1->MapScalarsThroughTable2(doubleA, output,
VTK_DOUBLE, 2, 1, VTK_RGBA);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
lut1->MapScalarsThroughTable2(doubleA, output,
VTK_DOUBLE, 2, 1, VTK_RGB);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
lut1->MapScalarsThroughTable2(doubleA, output,
VTK_DOUBLE, 2, 1, VTK_LUMINANCE_ALPHA);
lut1->MapScalarsThroughTable2((void *) doubleA, output,
lut1->MapScalarsThroughTable2(doubleA, output,
VTK_DOUBLE, 2, 1, VTK_LUMINANCE);
......
Supports Markdown
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