mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-22 17:06:36 -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 (< value 100)
|
||||
(format #f "'(percent . ~d)" value)
|
||||
(format #f "'(pixels . ~f)" value))
|
||||
(format #f "'(pixels . ~d)" value))
|
||||
(format #f "'~f" value)
|
||||
)))
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
//#include "options.h"
|
||||
#include "gnc-option-impl.hpp"
|
||||
#include "gnc-datetime.hpp"
|
||||
#include "guid.hpp"
|
||||
@ -832,7 +831,13 @@ template <typename ValueType> std::string
|
||||
GncOptionRangeValue<ValueType>::serialize() const noexcept
|
||||
{
|
||||
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 "";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user