Browse Source

MSVC UTF-32 build fix.

tags/2021-05-28
jules 11 years ago
parent
commit
3c8fbc0bfe
4 changed files with 17 additions and 2 deletions
  1. +1
    -1
      modules/juce_core/native/juce_posix_SharedCode.h
  2. +10
    -0
      modules/juce_core/text/juce_StringPool.cpp
  3. +5
    -0
      modules/juce_core/text/juce_StringPool.h
  4. +1
    -1
      modules/juce_core/xml/juce_XmlElement.cpp

+ 1
- 1
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -1035,7 +1035,7 @@ public:
Array<char*> argv;
for (int i = 0; i < arguments.size(); ++i)
if (arguments[i].isNotEmpty())
argv.add (arguments[i].toUTF8().getAddress());
argv.add (const_cast<char*> (arguments[i].toUTF8().getAddress()));
argv.add (nullptr);


+ 10
- 0
modules/juce_core/text/juce_StringPool.cpp View File

@@ -121,6 +121,16 @@ String StringPool::getPooledString (String::CharPointerType start, String::CharP
return addPooledString (strings, StartEndString (start, end));
}
String StringPool::getPooledString (StringRef newString)
{
if (newString.isEmpty())
return String();
const ScopedLock sl (lock);
garbageCollectIfNeeded();
return addPooledString (strings, newString.text);
}
String StringPool::getPooledString (const String& newString)
{
if (newString.isEmpty())


+ 5
- 0
modules/juce_core/text/juce_StringPool.h View File

@@ -62,6 +62,11 @@ public:
*/
String getPooledString (const char* original);
/** Returns a pointer to a shared copy of the string that is passed in.
The pool will always return the same String object when asked for a string that matches it.
*/
String getPooledString (StringRef original);
/** Returns a pointer to a copy of the string that is passed in.
The pool will always return the same String object when asked for a string that matches it.
*/


+ 1
- 1
modules/juce_core/xml/juce_XmlElement.cpp View File

@@ -72,7 +72,7 @@ XmlElement::XmlElement (const char* tag)
}
XmlElement::XmlElement (StringRef tag)
: tagName (StringPool::getGlobalPool().getPooledString (tag.text.getAddress()))
: tagName (StringPool::getGlobalPool().getPooledString (tag))
{
sanityCheckTagName (tagName);
}


Loading…
Cancel
Save