1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0022898: IGES import fails in german environment

Added DRAW command dlocale to set and query current locale of the C subsystem
Equivalents of C functions working with conversions of strings to/from reals added in Standard_CString, providing locale-independent behavior (using always "C" locale)
In DRAW packages, calls to atof() and atoi() are replaced by direct calls to Draw::Atof() and Draw::Atoi(), respectively, instead of substituting by #define
Use of atof(), strtod(), and *scanf() involving floating point conversions in OCCT code replaced by locale-independent Atof() and Strtod()
Calls to sprintf() involving floating point in OCCT code are replaced by call to locale-independent Sprintf(), except a few places where converted strings are used immediately for display in the 3d viewer
Changes of global locale are eliminated throughout OCCT code
Proposed correction for GNU libC where v*printf_l functions are absent
Added test case (bugs xde bug22898) for data exchange operations with non-standard locale
Use xlocale on Mac OS X and within glibc
Corrected strtod_l wrapper
Generate error rather than warning
Introduce Standard_CLocaleSentry replacement for removed OSD_Localizer
Standard_CLocaleSentry - copy locale string
Standard_CLocaleSentry - use _configthreadlocale on Windows
Standard_CLocaleSentry::GetCLocale() - return locale_t rather than void*
Corrected misprint in ~Standard_CLocaleSentry()
Use French locale in bug22898 test case
Mark test case as skipped if locale is unavailable on tested system.
Use fr_FR locale for tests on Mac OS X
This commit is contained in:
abv
2013-02-01 18:41:16 +04:00
parent 3bea4c165c
commit 91322f44fd
203 changed files with 2707 additions and 2807 deletions

View File

@@ -164,7 +164,7 @@ static Standard_Integer DFOpenAttribute (Draw_Interpretor& di,
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True));
const Standard_Integer index = atoi(a[2]);
const Standard_Integer index = Draw::Atoi(a[2]);
TCollection_AsciiString list = browser->OpenAttribute(index);
di<<list.ToCString();
return 0;

View File

@@ -80,6 +80,7 @@ Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Stor
}
else {
myIStream->precision(17);
myIStream->imbue (std::locale::classic()); // always use C locale
SetOpenMode(aMode);
}
}
@@ -91,6 +92,7 @@ Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Stor
}
else {
myOStream->precision(17);
myOStream->imbue (std::locale::classic()); // make sure to always use C locale
SetOpenMode(aMode);
}
}
@@ -113,6 +115,7 @@ Storage_Error DDF_IOStream::Open(istream* anIStream)
SetOpenMode(Storage_VSRead);
myIStream = anIStream;
myIStream->precision(17);
myIStream->imbue (std::locale::classic()); // use always C locale
SetName("DDF_IOStream");
return Storage_VSOk; // ou Storage_VSAlreadyOpen ?
}
@@ -128,6 +131,7 @@ Storage_Error DDF_IOStream::Open(ostream* anOStream)
SetOpenMode(Storage_VSWrite);
myOStream = anOStream;
myOStream->precision(17);
myOStream->imbue (std::locale::classic()); // use always C locale
SetName("DDF_IOStream");
return Storage_VSOk; // ou Storage_VSAlreadyOpen ?
}

View File

@@ -112,7 +112,7 @@ static Standard_Integer CommitTran (Draw_Interpretor& di,
Handle(DDF_Transaction) tr = DDF_TStack.Top();
di<<"Commit transaction # "<<tr->Transaction()<<" # "<<DF->Transaction()<<"\n";
Standard_Boolean withDelta = Standard_False;
if (n > 2) withDelta = (atoi(a[2]) != 0);
if (n > 2) withDelta = (Draw::Atoi(a[2]) != 0);
DDF_LastDelta = tr->Commit(withDelta);
DDF_TStack.Pop();
}
@@ -169,7 +169,7 @@ static Standard_Integer Undo (Draw_Interpretor& di,
Handle(TDF_Data) DF;
if (DDF::GetDF (a[1], DF)) {
Standard_Boolean withDelta = Standard_False;
if (n > 2) withDelta = (atoi(a[2]) != 0);
if (n > 2) withDelta = (Draw::Atoi(a[2]) != 0);
if (!DDF_LastDelta.IsNull()) {
if (DF->IsApplicable(DDF_LastDelta)) {
Handle(TDF_Delta) tmp = DF->Undo(DDF_LastDelta,withDelta);