@@ -1035,7 +1035,7 @@ public: | |||||
Array<char*> argv; | Array<char*> argv; | ||||
for (int i = 0; i < arguments.size(); ++i) | for (int i = 0; i < arguments.size(); ++i) | ||||
if (arguments[i].isNotEmpty()) | if (arguments[i].isNotEmpty()) | ||||
argv.add (arguments[i].toUTF8().getAddress()); | |||||
argv.add (const_cast<char*> (arguments[i].toUTF8().getAddress())); | |||||
argv.add (nullptr); | argv.add (nullptr); | ||||
@@ -121,6 +121,16 @@ String StringPool::getPooledString (String::CharPointerType start, String::CharP | |||||
return addPooledString (strings, StartEndString (start, end)); | 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) | String StringPool::getPooledString (const String& newString) | ||||
{ | { | ||||
if (newString.isEmpty()) | if (newString.isEmpty()) | ||||
@@ -62,6 +62,11 @@ public: | |||||
*/ | */ | ||||
String getPooledString (const char* original); | 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. | /** 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. | The pool will always return the same String object when asked for a string that matches it. | ||||
*/ | */ | ||||
@@ -72,7 +72,7 @@ XmlElement::XmlElement (const char* tag) | |||||
} | } | ||||
XmlElement::XmlElement (StringRef tag) | XmlElement::XmlElement (StringRef tag) | ||||
: tagName (StringPool::getGlobalPool().getPooledString (tag.text.getAddress())) | |||||
: tagName (StringPool::getGlobalPool().getPooledString (tag)) | |||||
{ | { | ||||
sanityCheckTagName (tagName); | sanityCheckTagName (tagName); | ||||
} | } | ||||