From aee41decdc26f6477ec995b68884a7439f0e1bfd Mon Sep 17 00:00:00 2001 From: AlexBeattie42 <30098201+alexbeattie42@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:04:59 +0300 Subject: [PATCH] Update locale string parsing --- OpenSim/Common/IO.cpp | 6 +++--- OpenSim/Common/IO.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/OpenSim/Common/IO.cpp b/OpenSim/Common/IO.cpp index c43fe0b083..15394fc329 100644 --- a/OpenSim/Common/IO.cpp +++ b/OpenSim/Common/IO.cpp @@ -65,7 +65,7 @@ int IO::_Pad = 8; int IO::_Precision = 8; char IO::_DoubleFormat[] = "%16.8lf"; bool IO::_PrintOfflineDocuments = true; -std::string IO::_locale = std::locale::classic().name(); +std::locale _locale = std::locale::classic(); //============================================================================= @@ -480,9 +480,9 @@ OpenOutputFile(const string &aFileName,ios_base::openmode mode) double IO:: stod(const std::string& __str, std::size_t* __idx) { - double result; std::istringstream iss(__str); - iss.imbue(std::locale(_locale)); + iss.imbue(_locale); + double result = 0.0; iss >> result; return result; } diff --git a/OpenSim/Common/IO.h b/OpenSim/Common/IO.h index 495f8775de..b07d653a2f 100644 --- a/OpenSim/Common/IO.h +++ b/OpenSim/Common/IO.h @@ -66,8 +66,6 @@ class OSIMCOMMON_API IO { static char _DoubleFormat[IO_DBLFMTLEN]; /** Whether offline documents should also be printed when Object::print is called. */ static bool _PrintOfflineDocuments; - /** Locale specifier for reading and writing files */ - static std::string _locale; //=============================================================================