X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/490f72fd16e2587b191593163767e8a95f5ab99d..a7ba5d1efbd9bcaa39d47d7752c0382bd220a42f:/samples/opengl/penguin/dxfrenderer.cpp diff --git a/samples/opengl/penguin/dxfrenderer.cpp b/samples/opengl/penguin/dxfrenderer.cpp index d68eca6cf0..e03a362436 100644 --- a/samples/opengl/penguin/dxfrenderer.cpp +++ b/samples/opengl/penguin/dxfrenderer.cpp @@ -27,16 +27,14 @@ #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library" #endif -#ifdef __WXMAC__ -# ifdef __DARWIN__ -# include -# else -# include -# endif +#ifdef __DARWIN__ + #include #else -# include + #include #endif +#include + #include "dxfrenderer.h" #include "wx/listimpl.cpp" @@ -439,6 +437,22 @@ bool DXFRenderer::ParseTables(wxInputStream& stream) return false; } +// This method is used instead of numStr.ToDouble(d) because the latter +// (wxString::ToDouble()) takes the systems proper locale into account, +// whereas the implementation below works with the default locale. +// (Converting numbers that are formatted in the default locale can fail +// with system locales that use e.g. the comma as the decimal separator.) +static double ToDouble(const wxString& numStr) +{ + double d; + std::string numStr_(numStr.c_str()); + std::istringstream iss(numStr_); + + iss >> d; + + return d; +} + // parse entities section: save 3DFACE and LINE entities bool DXFRenderer::ParseEntities(wxInputStream& stream) { @@ -494,8 +508,8 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream) state = 2; else if (state > 0) { - double d; - line2.ToDouble(&d); + const double d=ToDouble(line2); + if (line1 == wxT("10")) v[0].x = d; else if (line1 == wxT("20"))