1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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

@@ -405,10 +405,10 @@ static const Standard_Real vtab[] =
je = jx*9;
if (jx > jj) {
valdiv = 1.;
if (jx >= 100 || grexp) return atof(ligne); // issue de secours
if (jx >= 100 || grexp) return Atof(ligne); // issue de secours
} else {
k = jj*9;
if (jj >= 100 || grexp || (k-je >= 900)) return atof(ligne); // issue de secours
if (jj >= 100 || grexp || (k-je >= 900)) return Atof(ligne); // issue de secours
valdiv = vtab[k-je];
je = k;
}

View File

@@ -55,8 +55,8 @@ Interface_FloatWriter::Interface_FloatWriter (const Standard_Integer chars)
strcpy(therangeform ,"%f");
} else {
char pourcent = '%'; char point = '.';
sprintf(themainform, "%c%d%c%dE",pourcent,chars+2,point,chars);
sprintf(therangeform, "%c%d%c%df",pourcent,chars+2,point,chars);
Sprintf(themainform, "%c%d%c%dE",pourcent,chars+2,point,chars);
Sprintf(therangeform, "%c%d%c%df",pourcent,chars+2,point,chars);
}
therange1 = 0.1; therange2 = 1000.;
thezerosup = Standard_True;
@@ -111,10 +111,10 @@ Standard_Integer Interface_FloatWriter::Convert (const Standard_Real val,
//
if ( (val >= R1 && val < R2) ||
(val <= -R1 && val > -R2) ) {
sprintf(pText,rangeform,val);
Sprintf(pText,rangeform,val);
}
else {
sprintf(pText,mainform,val);
Sprintf(pText,mainform,val);
}
if (zsup) {

View File

@@ -184,9 +184,9 @@ Standard_Boolean Interface_Static::Init
else if (init[0] == 'i' && init[2] == 'a')
unstat->SetIntegerLimit (Standard_True ,atoi(&init[iblc]));
else if (init[0] == 'r' && init[2] == 'i')
unstat->SetRealLimit (Standard_False,atof(&init[iblc]));
unstat->SetRealLimit (Standard_False,Atof(&init[iblc]));
else if (init[0] == 'r' && init[2] == 'a')
unstat->SetRealLimit (Standard_True ,atof(&init[iblc]));
unstat->SetRealLimit (Standard_True ,Atof(&init[iblc]));
else if (init[0] == 'u')
unstat->SetUnitDef (&init[iblc]);
else if (init[0] == 'e' && init[1] == 'm')
@@ -249,12 +249,12 @@ Standard_CString Interface_Static::CDef
if (part[0] == 'i') {
Standard_Integer ilim;
if (!stat->IntegerLimit((part[2] == 'a'),ilim)) return "";
sprintf(defmess,"%d",ilim); return defmess;
Sprintf(defmess,"%d",ilim); return defmess;
}
if (part[0] == 'r') {
Standard_Real rlim;
if (!stat->RealLimit((part[2] == 'a'),rlim)) return "";
sprintf(defmess,"%f",rlim); return defmess;
Sprintf(defmess,"%f",rlim); return defmess;
}
if (part[0] == 'u') return stat->UnitDef();
return "";