Browse Source

String: limit amount of characters in float conversion

Signed-off-by: falkTX <falktx@falktx.com>
pull/232/head
falkTX 5 years ago
parent
commit
d80b8bfce3
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      distrho/extra/String.hpp

+ 2
- 2
distrho/extra/String.hpp View File

@@ -174,7 +174,7 @@ public:
fBufferLen(0) fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%f", value);
std::snprintf(strBuf, 0xff, "%.12g", static_cast<double>(value));
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_dup(strBuf); _dup(strBuf);
@@ -188,7 +188,7 @@ public:
fBufferLen(0) fBufferLen(0)
{ {
char strBuf[0xff+1]; char strBuf[0xff+1];
std::snprintf(strBuf, 0xff, "%g", value);
std::snprintf(strBuf, 0xff, "%.24g", value);
strBuf[0xff] = '\0'; strBuf[0xff] = '\0';


_dup(strBuf); _dup(strBuf);


Loading…
Cancel
Save