X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65f4ce38c6c83c60b8367c8aa92d962cba679949..a7ba5d1efbd9bcaa39d47d7752c0382bd220a42f:/samples/opengl/penguin/dxfrenderer.cpp diff --git a/samples/opengl/penguin/dxfrenderer.cpp b/samples/opengl/penguin/dxfrenderer.cpp index 3448b558ce..e03a362436 100644 --- a/samples/opengl/penguin/dxfrenderer.cpp +++ b/samples/opengl/penguin/dxfrenderer.cpp @@ -33,6 +33,8 @@ #include #endif +#include + #include "dxfrenderer.h" #include "wx/listimpl.cpp" @@ -435,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) { @@ -490,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"))