DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit d80b8bfce385849521183762ba5db6253eb92c68
parent b09a8ae435fa55559d68fdf41b84e1ef3349f098
Author: falkTX <falktx@falktx.com>
Date:   Mon, 24 Feb 2020 13:59:13 +0000

String: limit amount of characters in float conversion

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/extra/String.hpp | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/distrho/extra/String.hpp b/distrho/extra/String.hpp @@ -174,7 +174,7 @@ public: fBufferLen(0) { char strBuf[0xff+1]; - std::snprintf(strBuf, 0xff, "%f", value); + std::snprintf(strBuf, 0xff, "%.12g", static_cast<double>(value)); strBuf[0xff] = '\0'; _dup(strBuf); @@ -188,7 +188,7 @@ public: fBufferLen(0) { char strBuf[0xff+1]; - std::snprintf(strBuf, 0xff, "%g", value); + std::snprintf(strBuf, 0xff, "%.24g", value); strBuf[0xff] = '\0'; _dup(strBuf);