0020907: Werror in GEOM: integrate patch from Erwan ADAM

This commit is contained in:
vsr 2010-06-17 12:01:25 +00:00
parent ccaa4673b9
commit 164d68508e
4 changed files with 11 additions and 12 deletions

View File

@ -30,7 +30,7 @@
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include <strstream> #include <sstream>
#include "GEOM_Client.hxx" #include "GEOM_Client.hxx"
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
@ -81,7 +81,7 @@ TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr a
int sizebuf = SeqFile->length(); int sizebuf = SeqFile->length();
char* buf; char* buf;
buf = (char*) &SeqFile[0]; buf = (char*) &SeqFile[0];
std::istrstream streamBrep(buf,sizebuf); std::istringstream streamBrep(buf);
BRep_Builder aBuilder; BRep_Builder aBuilder;
BRepTools::Read(S, streamBrep, aBuilder); BRepTools::Read(S, streamBrep, aBuilder);
return(S); return(S);

View File

@ -32,6 +32,9 @@
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(GEOM_Gen)
# #
#ifdef HAVE_FINITE
#undef HAVE_FINITE // E.A. fix a warning about redefinition of HAVE_FINITE in re-inclusion of Standard_values.h
#endif
#ifndef _TColStd_SequenceOfAsciiString_HeaderFile #ifndef _TColStd_SequenceOfAsciiString_HeaderFile
#include <TColStd_SequenceOfAsciiString.hxx> #include <TColStd_SequenceOfAsciiString.hxx>
#endif #endif

View File

@ -30,8 +30,7 @@
#include "GEOM_Object_i.hh" #include "GEOM_Object_i.hh"
#include <set> #include <set>
#include <strstream> #include <sstream>
//#include <sstream>
#include "Utils_CorbaException.hxx" #include "Utils_CorbaException.hxx"
#include "OpUtil.hxx" #include "OpUtil.hxx"
@ -679,7 +678,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
// Retrieve a TopoDS_Shape from byte stream // Retrieve a TopoDS_Shape from byte stream
TopoDS_Shape aTopology; TopoDS_Shape aTopology;
std::istrstream aStreamedBrep((char*) &theStream[0], theStream.length()); std::istringstream aStreamedBrep((char*) &theStream[0]);
BRep_Builder aBuilder; BRep_Builder aBuilder;
try { try {
BRepTools::Read(aTopology, aStreamedBrep, aBuilder); BRepTools::Read(aTopology, aStreamedBrep, aBuilder);

View File

@ -28,8 +28,7 @@
#include "utilities.h" #include "utilities.h"
#include <fstream> #include <fstream>
#include <strstream> #include <sstream>
//#include <sstream>
#include <OpUtil.hxx> #include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx> #include <Utils_ExceptHandlers.hxx>
@ -343,18 +342,16 @@ SALOMEDS::TMPFile* GEOM_Object_i::GetShapeStream()
if(aShape.IsNull()) return NULL; if(aShape.IsNull()) return NULL;
std::ostrstream streamShape; std::ostringstream streamShape;
//Write TopoDS_Shape in ASCII format to the stream //Write TopoDS_Shape in ASCII format to the stream
BRepTools::Write(aShape, streamShape); BRepTools::Write(aShape, streamShape);
//Returns the number of bytes that have been stored in the stream's buffer. //Returns the number of bytes that have been stored in the stream's buffer.
int size = streamShape.pcount(); int size = streamShape.str().size();
char* buf = new char [size]; char* buf = new char [size];
//Get pointer on internal character array in ostrstream //Get pointer on internal character array in ostrstream
char* valueOfStream = streamShape.str(); const char* valueOfStream = streamShape.str().c_str();
//Create copy of ostrstream content //Create copy of ostrstream content
memcpy(buf, valueOfStream, size); memcpy(buf, valueOfStream, size);
//Allow automatic deletion of ostrstream content
streamShape.rdbuf()->freeze(0);
CORBA::Octet* OctetBuf = (CORBA::Octet*)buf; CORBA::Octet* OctetBuf = (CORBA::Octet*)buf;
SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size,size,OctetBuf,1); SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size,size,OctetBuf,1);