@@ -47,48 +47,54 @@ using namespace IfcParse;
4747// strtod_l() is used and a reference to the "C" locale is obtained here. The alternative is
4848// to use std::istringstream::imbue(std::locale::classic()), but there are subtleties in
4949// parsing in MSVC2010 and it appears to be much slower.
50- #ifdef _MSC_VER
50+ #if defined(_MSC_VER)
51+
5152static _locale_t locale = (_locale_t ) 0 ;
5253void init_locale () {
5354 if (locale == (_locale_t ) 0 ) {
5455 locale = _create_locale (LC_NUMERIC, " C" );
5556 }
5657}
57- // #else
58- #endif
5958
60- #ifdef __APPLE__
61- #include < xlocale.h>
62- // #endif
63- static locale_t locale = (locale_t ) 0 ;
64- void init_locale () {
65- if (locale == (locale_t ) 0 ) {
66- locale = newlocale (LC_NUMERIC_MASK, " C" , (locale_t ) 0 );
67- }
68- }
69- #endif
59+ #else
7060
71- #ifdef __MINGW64__
61+ #if defined( __MINGW64__) || defined(__MINGW32__)
7262#include < locale>
7363#include < sstream>
7464
7565typedef void * locale_t ;
76- static locale_t locale = (locale_t ) 0 ;
66+ static locale_t locale = (locale_t )0 ;
7767
7868void init_locale () {}
7969
8070double strtod_l (const char * start, char ** end, locale_t loc) {
81- double d;
82- std::stringstream ss;
83- ss.imbue (std::locale::classic ());
84- ss << start;
85- ss >> d;
86- size_t nread = ss.tellg ();
87- *end = const_cast <char *>(start) + nread;
88- return d;
71+ double d;
72+ std::stringstream ss;
73+ ss.imbue (std::locale::classic ());
74+ ss << start;
75+ ss >> d;
76+ size_t nread = ss.tellg ();
77+ *end = const_cast <char *>(start) + nread;
78+ return d;
8979}
80+
81+ #else
82+
83+ #ifdef __APPLE__
84+ #include < xlocale.h>
85+ #endif
86+ #include < locale.h>
87+
88+ static locale_t locale = (locale_t )0 ;
89+ void init_locale () {
90+ if (locale == (locale_t )0 ) {
91+ locale = newlocale (LC_NUMERIC_MASK, " C" , (locale_t )0 );
92+ }
93+ }
94+
9095#endif
9196
97+ #endif
9298
9399//
94100// Opens the file, gets the filesize and reads a chunk in memory
0 commit comments