mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Missed a strtod in kicad legacy pcb parsing
This commit is contained in:
parent
9dd642b66c
commit
2b8542861c
@ -57,7 +57,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <cerrno>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -2920,13 +2919,13 @@ BIU PCB_IO_KICAD_LEGACY::biuParse( const char* aValue, const char** nptrptr )
|
|||||||
|
|
||||||
EDA_ANGLE PCB_IO_KICAD_LEGACY::degParse( const char* aValue, const char** nptrptr )
|
EDA_ANGLE PCB_IO_KICAD_LEGACY::degParse( const char* aValue, const char** nptrptr )
|
||||||
{
|
{
|
||||||
char* nptr;
|
const char* end = aValue;
|
||||||
|
double fval{};
|
||||||
|
fast_float::from_chars_result result = fast_float::from_chars( aValue, aValue + strlen( aValue ), fval,
|
||||||
|
fast_float::chars_format::skip_white_space );
|
||||||
|
end = result.ptr;
|
||||||
|
|
||||||
errno = 0;
|
if( result.ec != std::errc() )
|
||||||
|
|
||||||
double fval = strtod( aValue, &nptr );
|
|
||||||
|
|
||||||
if( errno )
|
|
||||||
{
|
{
|
||||||
m_error.Printf( _( "Invalid floating point number in file: '%s'\nline: %d, offset: %d" ),
|
m_error.Printf( _( "Invalid floating point number in file: '%s'\nline: %d, offset: %d" ),
|
||||||
m_reader->GetSource().GetData(),
|
m_reader->GetSource().GetData(),
|
||||||
@ -2936,7 +2935,7 @@ EDA_ANGLE PCB_IO_KICAD_LEGACY::degParse( const char* aValue, const char** nptrpt
|
|||||||
THROW_IO_ERROR( m_error );
|
THROW_IO_ERROR( m_error );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aValue == nptr )
|
if( aValue == end )
|
||||||
{
|
{
|
||||||
m_error.Printf( _( "Missing floating point number in file: '%s'\nline: %d, offset: %d" ),
|
m_error.Printf( _( "Missing floating point number in file: '%s'\nline: %d, offset: %d" ),
|
||||||
m_reader->GetSource().GetData(),
|
m_reader->GetSource().GetData(),
|
||||||
@ -2947,7 +2946,7 @@ EDA_ANGLE PCB_IO_KICAD_LEGACY::degParse( const char* aValue, const char** nptrpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( nptrptr )
|
if( nptrptr )
|
||||||
*nptrptr = nptr;
|
*nptrptr = end;
|
||||||
|
|
||||||
return EDA_ANGLE( fval, TENTHS_OF_A_DEGREE_T );
|
return EDA_ANGLE( fval, TENTHS_OF_A_DEGREE_T );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user