From fc1e9e9f7f047e348a34fd691ceda0cd383e9d4f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 17 Feb 2016 23:20:48 +0100 Subject: [PATCH] Fix initialisation on locale with comma as numerical separator --- init.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.cpp b/init.cpp index b9e68ab..2bade83 100644 --- a/init.cpp +++ b/init.cpp @@ -379,7 +379,10 @@ double get_glsl_version() // Now we have something on the form X.YY. We convert it to a float, and hope // that if it's inexact (e.g. 1.30), atof() will round the same way the // compiler will. - float glsl_version = atof(glsl_version_str); + std::istringstream locale_convert(glsl_version_str); + locale_convert.imbue(std::locale("C")); + double glsl_version; + locale_convert >> glsl_version; free(glsl_version_str); return glsl_version; -- 2.39.2