mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[c++ options] Fix locale dependency in test-gnc-option-scheme-output.
Created by using std::to_string() in GncOptionRangeValue::serialize. It wraps sprintf that reads the locale. Use ostringstream instead.
This commit is contained in:
parent
e9f6bf7a5c
commit
1eecb9f5c0
@ -139,7 +139,7 @@
|
|||||||
" (if (exact-integer? value)
|
" (if (exact-integer? value)
|
||||||
(if (< value 100)
|
(if (< value 100)
|
||||||
(format #f "'(percent . ~d)" value)
|
(format #f "'(percent . ~d)" value)
|
||||||
(format #f "'(pixels . ~f)" value))
|
(format #f "'(pixels . ~d)" value))
|
||||||
(format #f "'~f" value)
|
(format #f "'~f" value)
|
||||||
)))
|
)))
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
* *
|
* *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
//#include "options.h"
|
|
||||||
#include "gnc-option-impl.hpp"
|
#include "gnc-option-impl.hpp"
|
||||||
#include "gnc-datetime.hpp"
|
#include "gnc-datetime.hpp"
|
||||||
#include "guid.hpp"
|
#include "guid.hpp"
|
||||||
@ -832,7 +831,13 @@ template <typename ValueType> std::string
|
|||||||
GncOptionRangeValue<ValueType>::serialize() const noexcept
|
GncOptionRangeValue<ValueType>::serialize() const noexcept
|
||||||
{
|
{
|
||||||
if constexpr (std::is_arithmetic_v<ValueType>)
|
if constexpr (std::is_arithmetic_v<ValueType>)
|
||||||
return std::to_string(m_value);
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
if constexpr(is_same_decayed_v<ValueType, double>)
|
||||||
|
ostr << std::showpoint << std::fixed;
|
||||||
|
ostr << m_value;
|
||||||
|
return ostr.str();
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user