Browse Source

String: Fix logical error in hex parsing code

v6.1.6
reuk 3 years ago
parent
commit
fdfc279bea
2 changed files with 5 additions and 2 deletions
  1. +2
    -2
      modules/juce_core/text/juce_CharacterFunctions.h
  2. +3
    -0
      modules/juce_core/text/juce_String.cpp

+ 2
- 2
modules/juce_core/text/juce_CharacterFunctions.h View File

@@ -500,10 +500,10 @@ public:
while (! t.isEmpty())
{
auto hexValue = static_cast<ResultType> (CharacterFunctions::getHexDigitValue (t.getAndAdvance()));
auto hexValue = CharacterFunctions::getHexDigitValue (t.getAndAdvance());
if (hexValue >= 0)
result = static_cast<ResultType> (result << 4) | hexValue;
result = static_cast<ResultType> (result << 4) | static_cast<ResultType> (hexValue);
}
return result;


+ 3
- 0
modules/juce_core/text/juce_String.cpp View File

@@ -2467,6 +2467,9 @@ public:
expect (String (StringRef ("abc")) == StringRef ("abc"));
expect (String ("abc") + StringRef ("def") == "abcdef");
expect (String ("0x00").getHexValue32() == 0);
expect (String ("0x100").getHexValue32() == 256);
String s2 ("123");
s2 << ((int) 4) << ((short) 5) << "678" << L"9" << '0';
s2 += "xyz";


Loading…
Cancel
Save