From: ouv Date: Mon, 2 Nov 2009 12:24:42 +0000 (+0000) Subject: Kernel_Utils::Localizer - common interface to solve problems with non-"C" locales X-Git-Tag: V5_1_3rc2~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=625eaaf4971c7318cce42469346ed9345c2517af;p=modules%2Fgeom.git Kernel_Utils::Localizer - common interface to solve problems with non-"C" locales --- diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx index 8d477f541..cf2407d3f 100644 --- a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx @@ -28,6 +28,8 @@ #include +#include + // OCCT Includes #include #include @@ -79,15 +81,11 @@ Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; // Set "C" numeric locale to save numbers correctly - std::string aCurLocale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); + Kernel_Utils::Localizer loc; // create sketcher Sketcher_Profile aProfile (aCommand.ToCString()); - // Return previous locale - setlocale(LC_NUMERIC, aCurLocale.data()); - if (!aProfile.IsDone()) { Standard_ConstructionError::Raise("Sketcher creation failed"); } diff --git a/src/IGESExport/IGESExport.cxx b/src/IGESExport/IGESExport.cxx index d1ccdbf1e..72e6cb2fa 100644 --- a/src/IGESExport/IGESExport.cxx +++ b/src/IGESExport/IGESExport.cxx @@ -26,6 +26,8 @@ // #include "utilities.h" +#include + #include #include #include @@ -74,8 +76,7 @@ IGESEXPORT_EXPORT aBrepMode = 1; // Set "C" numeric locale to save numbers correctly - std::string aCurLocale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); + Kernel_Utils::Localizer loc; // initialize writer IGESControl_Controller::Init(); @@ -90,7 +91,6 @@ IGESEXPORT_EXPORT bool ok = ICW.Write( theFileName.ToCString() ); // Return previous locale - setlocale(LC_NUMERIC, aCurLocale.data()); if ( ok ) return 1; } diff --git a/src/IGESImport/IGESImport.cxx b/src/IGESImport/IGESImport.cxx index 3b272ac56..ec51293b0 100644 --- a/src/IGESImport/IGESImport.cxx +++ b/src/IGESImport/IGESImport.cxx @@ -26,6 +26,8 @@ // #include "utilities.h" +#include + #include #include #include @@ -72,8 +74,7 @@ IGESIMPORT_EXPORT const TDF_Label&) { // Set "C" numeric locale to save numbers correctly - std::string aCurLocale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); + Kernel_Utils::Localizer loc; IGESControl_Reader aReader; TopoDS_Shape aResShape; @@ -103,8 +104,6 @@ IGESIMPORT_EXPORT TopoDS_Vertex V; B.MakeVertex(V,P,1.e-7); aResShape = V; - // Return previous locale before return from import - setlocale(LC_NUMERIC, aCurLocale.data()); return aResShape; } if( theFormatName == "IGES_SCALE" ) { @@ -155,8 +154,6 @@ IGESIMPORT_EXPORT theError = aFail->GetMessageString(); aResShape.Nullify(); } - // Return previous locale - setlocale(LC_NUMERIC, aCurLocale.data()); return aResShape; } } diff --git a/src/STEPExport/STEPExport.cxx b/src/STEPExport/STEPExport.cxx index eaff4f68e..6c2e9fac1 100644 --- a/src/STEPExport/STEPExport.cxx +++ b/src/STEPExport/STEPExport.cxx @@ -26,6 +26,8 @@ // #include "utilities.h" +#include + #include #include @@ -68,8 +70,7 @@ STEPEXPORT_EXPORT try { // Set "C" numeric locale to save numbers correctly - std::string aCurLocale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); + Kernel_Utils::Localizer loc; IFSelect_ReturnStatus status ; //VRV: OCC 4.0 migration @@ -83,7 +84,6 @@ STEPEXPORT_EXPORT status = aWriter.Write( theFileName.ToCString() ); // Return previous locale - setlocale(LC_NUMERIC, aCurLocale.data()); if ( status == IFSelect_RetDone ) return 1; } diff --git a/src/STEPImport/STEPImport.cxx b/src/STEPImport/STEPImport.cxx index dc91b95eb..e4786f2aa 100644 --- a/src/STEPImport/STEPImport.cxx +++ b/src/STEPImport/STEPImport.cxx @@ -26,6 +26,8 @@ // #include "utilities.h" +#include + #include #include @@ -75,8 +77,7 @@ STEPIMPORT_EXPORT { MESSAGE("Import STEP model from file " << theFileName.ToCString()); // Set "C" numeric locale to save numbers correctly - std::string aCurLocale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); + Kernel_Utils::Localizer loc; TopoDS_Shape aResShape; //VRV: OCC 4.0 migration STEPControl_Reader aReader; @@ -156,7 +157,6 @@ STEPIMPORT_EXPORT aResShape.Nullify(); } // Return previous locale - setlocale(LC_NUMERIC, aCurLocale.data()); return aResShape; } }