Ensure file reads always use the C-locale variant
Str2Double assumes current locale. We usually switch the locale when reading files but we should be using the function that explicitly gets the C-locale conversion.
This commit is contained in:
parent
a2041073ee
commit
9f09c3872f
|
@ -144,7 +144,7 @@ double Convert<double>( const wxString& aValue )
|
|||
{
|
||||
double value;
|
||||
|
||||
if( aValue.ToDouble( &value ) )
|
||||
if( aValue.ToCDouble( &value ) )
|
||||
return value;
|
||||
else
|
||||
throw XML_PARSER_ERROR( "Conversion to double failed. Original value: '" +
|
||||
|
|
|
@ -149,8 +149,8 @@ int PinNumbers::Compare( const PinNumber& lhs, const PinNumber& rhs )
|
|||
|
||||
double val1, val2;
|
||||
|
||||
comp1.ToDouble( &val1 );
|
||||
comp2.ToDouble( &val2 );
|
||||
comp1.ToCDouble( &val1 );
|
||||
comp2.ToCDouble( &val2 );
|
||||
|
||||
if( val1 < val2 )
|
||||
{
|
||||
|
|
|
@ -162,6 +162,8 @@ double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false );
|
|||
/**
|
||||
* Function DoubleValueFromString
|
||||
* converts \a aTextValue to a double
|
||||
* @warning This utilizes the current locale and will break if decimal formats differ
|
||||
*
|
||||
* @param aUnits The units of \a aTextValue.
|
||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||
* @param aUseMils Indicates mils should be used for imperial units (inches).
|
||||
|
@ -173,6 +175,7 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool
|
|||
/**
|
||||
* Function ValueFromString
|
||||
* converts \a aTextValue in \a aUnits to internal units used by the application.
|
||||
* @warning This utilizes the current locale and will break if decimal formats differ
|
||||
*
|
||||
* @param aUnits The units of \a aTextValue.
|
||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||
|
|
|
@ -162,9 +162,9 @@ void ERULES::parse( wxXmlNode* aRules )
|
|||
psElongationOffset = wxAtoi( value );
|
||||
|
||||
else if( name == "mvStopFrame" )
|
||||
value.ToDouble( &mvStopFrame );
|
||||
value.ToCDouble( &mvStopFrame );
|
||||
else if( name == "mvCreamFrame" )
|
||||
value.ToDouble( &mvCreamFrame );
|
||||
value.ToCDouble( &mvCreamFrame );
|
||||
else if( name == "mlMinStopFrame" )
|
||||
mlMinStopFrame = parseEagle( value );
|
||||
else if( name == "mlMaxStopFrame" )
|
||||
|
@ -175,7 +175,7 @@ void ERULES::parse( wxXmlNode* aRules )
|
|||
mlMaxCreamFrame = parseEagle( value );
|
||||
|
||||
else if( name == "srRoundness" )
|
||||
value.ToDouble( &srRoundness );
|
||||
value.ToCDouble( &srRoundness );
|
||||
else if( name == "srMinRoundness" )
|
||||
srMinRoundness = parseEagle( value );
|
||||
else if( name == "srMaxRoundness" )
|
||||
|
@ -189,14 +189,14 @@ void ERULES::parse( wxXmlNode* aRules )
|
|||
psFirst = wxAtoi( value );
|
||||
|
||||
else if( name == "rvPadTop" )
|
||||
value.ToDouble( &rvPadTop );
|
||||
value.ToCDouble( &rvPadTop );
|
||||
else if( name == "rlMinPadTop" )
|
||||
rlMinPadTop = parseEagle( value );
|
||||
else if( name == "rlMaxPadTop" )
|
||||
rlMaxPadTop = parseEagle( value );
|
||||
|
||||
else if( name == "rvViaOuter" )
|
||||
value.ToDouble( &rvViaOuter );
|
||||
value.ToCDouble( &rvViaOuter );
|
||||
else if( name == "rlMinViaOuter" )
|
||||
rlMinViaOuter = parseEagle( value );
|
||||
else if( name == "rlMaxViaOuter" )
|
||||
|
|
|
@ -143,7 +143,7 @@ double StrToDoublePrecisionUnits( const wxString& aStr, char aAxe, const wxStrin
|
|||
|
||||
if( u == wxT( 'm' ) )
|
||||
{
|
||||
ls.ToDouble( &i );
|
||||
ls.ToCDouble( &i );
|
||||
#ifdef PCAD2KICAD_SCALE_SCH_TO_INCH_GRID
|
||||
if( aActualConversion == wxT( "SCH" )
|
||||
|| aActualConversion == wxT( "SCHLIB" ) )
|
||||
|
@ -153,7 +153,7 @@ double StrToDoublePrecisionUnits( const wxString& aStr, char aAxe, const wxStrin
|
|||
}
|
||||
else
|
||||
{
|
||||
ls.ToDouble( &i );
|
||||
ls.ToCDouble( &i );
|
||||
i = Mils2iu( i );
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ int StrToInt1Units( const wxString& aStr )
|
|||
{
|
||||
double num, precision = 10;
|
||||
|
||||
aStr.ToDouble( &num );
|
||||
aStr.ToCDouble( &num );
|
||||
return KiROUND( num * precision );
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
|||
|
||||
while( plist.HasMoreTokens() )
|
||||
{
|
||||
if( plist.GetNextToken().ToDouble( &point ) )
|
||||
if( plist.GetNextToken().ToCDouble( &point ) )
|
||||
{
|
||||
// note: coordinates are multiplied by 2.54 to retain
|
||||
// legacy behavior of 1 X3D unit = 0.1 inch; the SG*
|
||||
|
|
|
@ -263,7 +263,7 @@ bool X3D::ParseSFFloat( const wxString& aSource, float& aResult )
|
|||
wxStringTokenizer tokens( aSource );
|
||||
|
||||
double x = 0;
|
||||
bool ret = tokens.GetNextToken().ToDouble( &x );
|
||||
bool ret = tokens.GetNextToken().ToCDouble( &x );
|
||||
|
||||
aResult = x;
|
||||
return ret;
|
||||
|
@ -278,9 +278,9 @@ bool X3D::ParseSFVec3( const wxString& aSource, WRLVEC3F& aResult )
|
|||
double y = 0;
|
||||
double z = 0;
|
||||
|
||||
bool ret = tokens.GetNextToken().ToDouble( &x )
|
||||
&& tokens.GetNextToken().ToDouble( &y )
|
||||
&& tokens.GetNextToken().ToDouble( &z );
|
||||
bool ret = tokens.GetNextToken().ToCDouble( &x )
|
||||
&& tokens.GetNextToken().ToCDouble( &y )
|
||||
&& tokens.GetNextToken().ToCDouble( &z );
|
||||
|
||||
aResult.x = x;
|
||||
aResult.y = y;
|
||||
|
@ -299,10 +299,10 @@ bool X3D::ParseSFRotation( const wxString& aSource, WRLROTATION& aResult )
|
|||
double z = 0;
|
||||
double w = 0;
|
||||
|
||||
bool ret = tokens.GetNextToken().ToDouble( &x )
|
||||
&& tokens.GetNextToken().ToDouble( &y )
|
||||
&& tokens.GetNextToken().ToDouble( &z )
|
||||
&& tokens.GetNextToken().ToDouble( &w );
|
||||
bool ret = tokens.GetNextToken().ToCDouble( &x )
|
||||
&& tokens.GetNextToken().ToCDouble( &y )
|
||||
&& tokens.GetNextToken().ToCDouble( &z )
|
||||
&& tokens.GetNextToken().ToCDouble( &w );
|
||||
|
||||
aResult.x = x;
|
||||
aResult.y = y;
|
||||
|
|
Loading…
Reference in New Issue