Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/geom.git] / src / GEOMClient / GEOM_Client.cxx
index f892de7f05a5b25d825b74bc958a4c3707d7cb58..0e07e69d3bbd9a8ae93aeff9206695e316728869 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client
 //  File   : GEOM_Client.cxx
 //  Author : Yves FRICAUD/Lucien PIGNOLONI
 //  Module : GEOM
 //  $Header$
-
+//
 #include <Standard_Stream.hxx>
 
 #include <Standard_Stream.hxx>
 
-#include <strstream>
+#include <sstream>
 
 #include "GEOM_Client.hxx"
 #include <SALOMEconfig.h>
@@ -69,7 +70,8 @@ TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr a
   Engines::Container_var ctn_server = geom->GetContainerRef();
   long                   pid_server = ctn_server->getPID();
 
-  if ( (pid_client==pid_server) && (strcmp(hst_client.c_str(), ctn_server->getHostName())==0) ) {
+  CORBA::String_var hostname = ctn_server->getHostName();
+  if ( pid_client == pid_server && !strcmp(hst_client.c_str(), hostname.in()) ) {
     TopoDS_Shape* S = (TopoDS_Shape*)(aShape->getShape());
     return(*S);
   } else {
@@ -79,7 +81,7 @@ TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr a
     int sizebuf = SeqFile->length();
     char* buf;
     buf = (char*) &SeqFile[0];
-    std::istrstream streamBrep(buf,sizebuf);
+    std::istringstream streamBrep(buf);
     BRep_Builder aBuilder;
     BRepTools::Read(S, streamBrep, aBuilder);
     return(S);