Browse Source

Import juce fix, convert strings to float using system locale

Fixes #506
tags/1.9.8
falkTX 7 years ago
parent
commit
04cec05845
2 changed files with 15 additions and 1 deletions
  1. +1
    -0
      source/modules/juce_core/system/juce_StandardHeader.h
  2. +14
    -1
      source/modules/juce_core/text/juce_CharacterFunctions.h

+ 1
- 0
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
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