Remove CStr::FromDouble

In most places `fmt::format` is used because it's locale indidendant.
For the user reporter the locale dependant form of `fmt::format` is used
because it's shown to the user.
This commit is contained in:
phosit
2026-08-06 19:09:46 +02:00
parent e4b72711e6
commit 45ea0432a2
7 changed files with 18 additions and 24 deletions
+7 -4
View File
@@ -106,18 +106,21 @@ bool JSI_GUISize::construct(JSContext* cx, uint argc, JS::Value* vp)
}
// Produces "10", "-10", "50%", "50%-10", "50%+10", etc
CStr JSI_GUISize::ToPercentString(double pix, double per)
std::string JSI_GUISize::ToPercentString(double pix, double per)
{
if (per == 0)
return CStr::FromDouble(pix);
return fmt::format("{}", pix);
return CStr::FromDouble(per)+"%"+(pix == 0.0 ? CStr() : pix > 0.0 ? CStr("+")+CStr::FromDouble(pix) : CStr::FromDouble(pix));
if (pix == 0.0)
return fmt::format("{}%", per);
return fmt::format("{}%{:+}", per, pix);
}
bool JSI_GUISize::toString(JSContext* cx, uint argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
CStr buffer;
std::string buffer;
Script::Request rq(cx);
double val, valr;