Browse Source

Import juce fix, convert strings to float using system locale

tags/2018-04-16
falkTX 6 years ago
parent
commit
4982628c24
2 changed files with 15 additions and 1 deletions
  1. +1
    -0
      libs/juce/source/modules/juce_core/system/juce_StandardHeader.h
  2. +14
    -1
      libs/juce/source/modules/juce_core/text/juce_CharacterFunctions.h

+ 1
- 0
libs/juce/source/modules/juce_core/system/juce_StandardHeader.h View File

@@ -50,6 +50,7 @@
#include <functional>
#include <algorithm>
#include <limits>
#include <sstream>
//==============================================================================
#include "juce_CompilerSupport.h"


+ 14
- 1
libs/juce/source/modules/juce_core/text/juce_CharacterFunctions.h View File

@@ -213,9 +213,22 @@ public:
if (exponentMagnitude > std::numeric_limits<double>::max_exponent10)
return std::numeric_limits<double>::quiet_NaN();
if (exponentMagnitude == 0)
*currentCharacter++ = '0';
}
double result = 0;
const size_t stringSize = (size_t) (currentCharacter - &buffer[0]) + 1;
if (stringSize > 1)
{
std::istringstream is (std::string (&buffer[0], stringSize));
is.imbue (std::locale ("C"));
is >> result;
}
return strtod (&buffer[0], nullptr);
return result;
}
/** Parses a character string, to read a floating-point value. */


Loading…
Cancel
Save