diff --git a/libtransmission/utils.cc b/libtransmission/utils.cc index 38954e3b5..948f0a111 100644 --- a/libtransmission/utils.cc +++ b/libtransmission/utils.cc @@ -9,7 +9,6 @@ #include #include // DBL_DIG #include -#include // localeconv() #include // SIZE_MAX #include // getenv() #include /* strerror() */ @@ -514,10 +513,10 @@ std::vector tr_parseNumberRange(std::string_view str) double tr_truncd(double x, int decimal_places) { auto buf = std::array{}; - auto const [out, len] = fmt::format_to_n(std::data(buf), std::size(buf) - 1, "{:.{}Lf}", x, DBL_DIG); + auto const [out, len] = fmt::format_to_n(std::data(buf), std::size(buf) - 1, "{:.{}f}", x, DBL_DIG); *out = '\0'; - if (auto* const pt = strstr(std::data(buf), localeconv()->decimal_point); pt != nullptr) + if (auto* const pt = strchr(std::data(buf), '.'); pt != nullptr) { pt[decimal_places != 0 ? decimal_places + 1 : 0] = '\0'; }