Commit 4d9d3cb1 authored by David Cole's avatar David Cole
Browse files

BUG: Fix bug 1953: replace strstream use with stringstream now that kwsys...

BUG: Fix bug 1953: replace strstream use with stringstream now that kwsys provides stringstream on all platforms. Many thanks to Sean McBride and Mathieu Coursolle from Rogue Research for all their effort developing the patch (and patience in waiting for its commit...!). COMP: Eliminate performance warning in generated Java wrappers regarding jboolean cast to bool. ENH: Exclude Java and Python wrappers (in addition to already excluded Tcl wrappers) from coverage analysis.
parent cc661fb6
......@@ -73,7 +73,7 @@ ENDIF(APPLE)
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
"vtk.*TCLInit.cxx"
"vtk[^\\.]+Tcl.cxx"
"vtk[^\\.]+(Java|Python|Tcl).cxx"
"Utilities.kwsys"
"Utilities.vtksys"
)
......@@ -26,6 +26,8 @@
#include "vtkDoubleArray.h"
#include "vtkIdTypeArray.h"
#include <vtksys/ios/sstream>
#define SIZE 1000
template <class T, class A, class V>
......@@ -666,7 +668,7 @@ int otherArraysTest(ostream& strm)
int otherArrays(int, char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
// return otherArraysTest(vtkmsg_with_warning_C4701);
return otherArraysTest(cerr);
......
......@@ -20,6 +20,8 @@
#include "vtkByteSwap.h"
#include "vtkDebugLeaks.h"
#include <vtksys/ios/sstream>
int TestByteSwap(ostream& strm)
{
// actual test
......@@ -154,6 +156,6 @@ int TestByteSwap(ostream& strm)
int otherByteSwap(int,char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestByteSwap(vtkmsg_with_warning_C4701);
}
......@@ -19,6 +19,8 @@
#include "vtkStringArray.h"
#include "vtkIdList.h"
#include <vtksys/ios/sstream>
#define SIZE 1000
int doStringArrayTest(ostream& strm, int size)
......@@ -199,7 +201,7 @@ int otherStringArrayTest(ostream& strm)
int otherStringArray(int, char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
// return otherArraysTest(vtkmsg_with_warning_C4701);
return otherStringArrayTest(cerr);
......
......@@ -20,6 +20,8 @@
#include "vtkTimerLog.h"
#include "vtkDebugLeaks.h"
#include <vtksys/ios/sstream>
// this is needed for the unlink call
#if defined(__CYGWIN__)
#include <sys/unistd.h>
......@@ -68,7 +70,7 @@ void otherTimerLogTest(ostream& strm)
int otherTimerLog(int,char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
otherTimerLogTest(vtkmsg_with_warning_C4701);
return 0;
......
......@@ -18,6 +18,7 @@
#include "vtkObjectFactory.h"
#include "vtkSmartPointerBase.h"
#include <vtksys/ios/sstream>
#include <vtkstd/queue>
#include <vtkstd/stack>
#include <vtkstd/vector>
......@@ -35,7 +36,7 @@
#include <assert.h>
vtkCxxRevisionMacro(vtkGarbageCollector, "1.30");
vtkCxxRevisionMacro(vtkGarbageCollector, "1.31");
vtkStandardNewMacro(vtkGarbageCollector);
#if VTK_GARBAGE_COLLECTOR_HASH
......@@ -610,14 +611,12 @@ void vtkGarbageCollectorImpl::Report(vtkObjectBase* obj, void* ptr,
if(this->Debug && vtkObject::GetGlobalWarningDisplay())
{
vtkObjectBase* current = this->Current->Object;
ostrstream msg;
vtksys_ios::ostringstream msg;
msg << "Report: "
<< current->GetClassName() << "(" << current << ") "
<< (desc?desc:"")
<< " -> " << obj->GetClassName() << "(" << obj << ")";
msg << ends;
vtkDebugMacro(<< msg.str());
msg.rdbuf()->freeze(0);
vtkDebugMacro(<< msg.str().c_str());
}
// Forward call to the internal implementation.
......@@ -708,7 +707,7 @@ void vtkGarbageCollectorImpl::PrintComponent(ComponentType* c)
{
if(this->Debug && vtkObject::GetGlobalWarningDisplay())
{
ostrstream msg;
vtksys_ios::ostringstream msg;
msg << "Identified strongly connected component "
<< c->Identifier << " with net reference count "
<< c->NetCount << ":";
......@@ -720,9 +719,7 @@ void vtkGarbageCollectorImpl::PrintComponent(ComponentType* c)
<< " with " << count << " external "
<< ((count == 1)? "reference" : "references");
}
msg << ends;
vtkDebugMacro(<< msg.str());
msg.rdbuf()->freeze(0);
vtkDebugMacro(<< msg.str().c_str());
}
}
#else
......
......@@ -33,7 +33,6 @@
#endif
# include <iostream> // Include real ansi istream and ostream.
# include <strstream> // Include real ansi strstreams.
# include <fstream> // Include real ansi ifstream and ofstream.
# include <iomanip> // Include real ansi io manipulators.
......@@ -52,9 +51,6 @@ using std::endl;
using std::ends;
using std::ostream;
using std::istream;
using std::ostrstream;
using std::istrstream;
using std::strstream;
using std::ofstream;
using std::ifstream;
using std::fstream;
......@@ -71,11 +67,6 @@ using std::fstream;
# else
# include <iostream.h> // Include old-style istream and ostream.
# include <iomanip.h>
# if defined(_MSC_VER)
# include <strstrea.h> // Include old-style strstream from MSVC.
# else
# include <strstream.h> // Include old-style strstream.
# endif
# include <fstream.h> // Include old-style ifstream and ofstream.
# endif
#endif
......
......@@ -17,6 +17,8 @@
#include "vtkDebugLeaks.h"
#include "vtkGarbageCollector.h"
#include <vtksys/ios/sstream>
#define vtkBaseDebugMacro(x)
class vtkObjectBaseToGarbageCollectorFriendship
......@@ -172,15 +174,15 @@ void vtkObjectBase::UnRegister(vtkObjectBase* o)
void vtkObjectBase::CollectRevisions(ostream& os)
{
os << "vtkObjectBase 1.15\n";
os << "vtkObjectBase 1.16\n";
}
void vtkObjectBase::PrintRevisions(ostream& os)
{
ostrstream revisions;
vtksys_ios::ostringstream revisions;
this->CollectRevisions(revisions);
revisions << ends;
const char* c = revisions.str();
vtksys_stl::string s = revisions.str();
const char* c = s.c_str();
while(*c)
{
const char* beginClass = 0;
......@@ -222,7 +224,6 @@ void vtkObjectBase::PrintRevisions(ostream& os)
++c;
}
}
revisions.rdbuf()->freeze(0);
}
//----------------------------------------------------------------------------
......
......@@ -25,6 +25,8 @@
#include "vtkTimeStamp.h"
#include "vtkWindows.h"
#include <vtksys/ios/sstream>
#include <vtkstd/map>
#include <vtkstd/string>
......@@ -100,11 +102,10 @@ static PyObject *PyVTKObject_PyString(PyVTKObject *self)
}
PyErr_Clear();
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
self->vtk_ptr->Print(vtkmsg_with_warning_C4701);
vtkmsg_with_warning_C4701.put('\0');
PyObject *res = PyString_FromString(vtkmsg_with_warning_C4701.str());
vtkmsg_with_warning_C4701.rdbuf()->freeze(0);
PyObject *res = PyString_FromString(vtkmsg_with_warning_C4701.str().c_str());
return res;
}
......
......@@ -24,6 +24,8 @@
#include "vtkIdTypeArray.h"
#include "vtkQuad.h"
#include <vtksys/ios/sstream>
int TestCellArray(ostream& strm)
{
// actual test
......@@ -81,6 +83,6 @@ int TestCellArray(ostream& strm)
int otherCellArray(int,char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestCellArray(vtkmsg_with_warning_C4701);
}
......@@ -36,6 +36,7 @@
#include "vtkPentagonalPrism.h"
#include "vtkHexagonalPrism.h"
#include <vtksys/ios/sstream>
int TestOCB(ostream& strm)
{
......@@ -494,6 +495,6 @@ int TestOCB(ostream& strm)
int otherCellBoundaries(int, char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestOCB(vtkmsg_with_warning_C4701);
}
......@@ -36,6 +36,8 @@
#include "vtkPentagonalPrism.h"
#include "vtkHexagonalPrism.h"
#include <vtksys/ios/sstream>
int TestOCP(ostream& strm)
{
// actual test
......@@ -578,6 +580,6 @@ int TestOCP(ostream& strm)
int otherCellPosition(int, char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestOCP(vtkmsg_with_warning_C4701);
}
......@@ -20,6 +20,8 @@
#include "vtkColorTransferFunction.h"
#include "vtkDebugLeaks.h"
#include <vtksys/ios/sstream>
int Test(ostream& strm)
{
int i, j, k;
......@@ -147,6 +149,6 @@ int Test(ostream& strm)
int otherColorTransferFunction(int, char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return Test(vtkmsg_with_warning_C4701);
}
......@@ -22,6 +22,8 @@
#include "vtkPointData.h"
#include "vtkCellData.h"
#include <vtksys/ios/sstream>
#include "vtkDebugLeaks.h"
void TestOEC(ostream& strm)
......@@ -93,7 +95,7 @@ void TestOEC(ostream& strm)
int otherEmptyCell(int , char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
TestOEC(vtkmsg_with_warning_C4701);
return 0;
......
......@@ -28,6 +28,8 @@
#include "vtkRectilinearGrid.h"
#include "vtkShortArray.h"
#include <vtksys/ios/sstream>
int TestORG(ostream& strm)
{
int i, j, k;
......@@ -597,6 +599,6 @@ int TestORG(ostream& strm)
int otherRectilinearGrid(int,char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestORG(vtkmsg_with_warning_C4701);
}
......@@ -28,6 +28,8 @@
#include "vtkShortArray.h"
#include "vtkStructuredGrid.h"
#include <vtksys/ios/sstream>
int TestOSG(ostream& strm)
{
int i, j, k;
......@@ -629,6 +631,6 @@ int TestOSG(ostream& strm)
int otherStructuredGrid(int,char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestOSG(vtkmsg_with_warning_C4701);
}
......@@ -29,6 +29,8 @@
#include "vtkQuadraticPyramid.h"
#include "vtkPoints.h"
#include <vtksys/ios/sstream>
void ComputeDataValues(vtkPoints *pts, double *edgeValues)
{
double x[3];
......@@ -396,6 +398,6 @@ int TestQE(ostream& strm)
int quadraticEvaluation(int,char *[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
return TestQE(vtkmsg_with_warning_C4701);
}
......@@ -1680,7 +1680,7 @@ int TestWithPointsAndCellsAndPointData(ostream &strm)
int otherCreation(int vtkNotUsed(argc),
char *vtkNotUsed(argv)[])
{
ostrstream vtkmsg_with_warning_C4701;
vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
if (TestEmpty(cout))
{
......
......@@ -30,11 +30,12 @@
#include "vtkDoubleArray.h"
#include "vtkSmartPointer.h"
#include <vtksys/ios/sstream>
#include <sys/stat.h>
#include <vtkstd/string>
#include <vtkstd/vector>
vtkCxxRevisionMacro(vtkFacetReader, "1.3");
vtkCxxRevisionMacro(vtkFacetReader, "1.4");
vtkStandardNewMacro(vtkFacetReader);
//------------------------------------------------------------------------------
......@@ -289,7 +290,8 @@ int vtkFacetReader::RequestData(
}
char* strPtr = &(*stringBuffer.begin());
strcpy(strPtr, line.c_str());
istrstream lineStream(strPtr);
vtkstd::string str(strPtr, stringBuffer.size());
vtksys_ios::istringstream lineStream(str);
vtkIdType kk;
int material = -1, relativePartNumber = -1;
for ( kk = 0; kk < num_points_per_cell; kk ++ )
......
......@@ -40,7 +40,9 @@
#include "vtkTIFFWriter.h"
#include "vtkTexture.h"
vtkCxxRevisionMacro(vtkRIBExporter, "1.63");
#include <vtksys/ios/sstream>
vtkCxxRevisionMacro(vtkRIBExporter, "1.64");
vtkStandardNewMacro(vtkRIBExporter);
typedef double RtColor[3];
......@@ -837,7 +839,7 @@ void vtkRIBExporter::WritePolygons (vtkPolyData *polyData,
if ( pointData )
{
int cc, aa;
ostrstream str_with_warning_C4701;
vtksys_ios::ostringstream str_with_warning_C4701;
for ( cc = 0; cc < pointData->GetNumberOfArrays(); cc ++ )
{
vtkDataArray *array = pointData->GetArray(cc);
......@@ -855,15 +857,13 @@ void vtkRIBExporter::WritePolygons (vtkPolyData *polyData,
}
str_with_warning_C4701 << "] ";
}
str_with_warning_C4701 << ends;
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str() );
str_with_warning_C4701.rdbuf()->freeze(0);
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str().c_str() );
}
if ( cellData )
{
int cc, aa;
ostrstream str_with_warning_C4701;
vtksys_ios::ostringstream str_with_warning_C4701;
for ( cc = 0; cc < cellData->GetNumberOfArrays(); cc ++ )
{
vtkDataArray *array = cellData->GetArray(cc);
......@@ -881,15 +881,13 @@ void vtkRIBExporter::WritePolygons (vtkPolyData *polyData,
}
str_with_warning_C4701 << "] ";
}
str_with_warning_C4701 << ends;
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str() );
str_with_warning_C4701.rdbuf()->freeze(0);
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str().c_str() );
}
if ( fieldData )
{
int cc, aa;
ostrstream str_with_warning_C4701;
vtksys_ios::ostringstream str_with_warning_C4701;
for ( cc = 0; cc < fieldData->GetNumberOfArrays(); cc ++ )
{
......@@ -908,9 +906,7 @@ void vtkRIBExporter::WritePolygons (vtkPolyData *polyData,
}
str_with_warning_C4701 << "] ";
}
str_with_warning_C4701 << ends;
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str() );
str_with_warning_C4701.rdbuf()->freeze(0);
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str().c_str() );
}
}
......@@ -1093,7 +1089,7 @@ void vtkRIBExporter::WriteStrips (vtkPolyData *polyData,
if ( pointData )
{
int cc, aa;
ostrstream str_with_warning_C4701;
vtksys_ios::ostringstream str_with_warning_C4701;
for ( cc = 0; cc < pointData->GetNumberOfArrays(); cc ++ )
{
vtkDataArray *array = pointData->GetArray(cc);
......@@ -1111,15 +1107,13 @@ void vtkRIBExporter::WriteStrips (vtkPolyData *polyData,
}
str_with_warning_C4701 << "] ";
}
str_with_warning_C4701 << ends;
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str() );
str_with_warning_C4701.rdbuf()->freeze(0);
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str().c_str() );
}
if ( cellData )
{
int cc, aa;
ostrstream str_with_warning_C4701;
vtksys_ios::ostringstream str_with_warning_C4701;
for ( cc = 0; cc < cellData->GetNumberOfArrays(); cc ++ )
{
vtkDataArray *array = cellData->GetArray(cc);
......@@ -1137,15 +1131,13 @@ void vtkRIBExporter::WriteStrips (vtkPolyData *polyData,
}
str_with_warning_C4701 << "] ";
}
str_with_warning_C4701 << ends;
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str() );
str_with_warning_C4701.rdbuf()->freeze(0);
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str().c_str() );
}
if ( fieldData )
{
int cc, aa;
ostrstream str_with_warning_C4701;
vtksys_ios::ostringstream str_with_warning_C4701;
for ( cc = 0; cc < fieldData->GetNumberOfArrays(); cc ++ )
{
vtkDataArray *array = fieldData->GetArray(cc);
......@@ -1163,9 +1155,7 @@ void vtkRIBExporter::WriteStrips (vtkPolyData *polyData,
}
str_with_warning_C4701 << "] ";
}
str_with_warning_C4701 << ends;
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str() );
str_with_warning_C4701.rdbuf()->freeze(0);
fprintf ( this->FilePtr, "%s", str_with_warning_C4701.str().c_str() );
}
}
fprintf (this->FilePtr, "\n");
......
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