@@ -521,22 +521,12 @@ StringPairArray ProjectExporter::BuildConfiguration::getAllPreprocessorDefs() co | |||||
StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const | StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const | ||||
{ | { | ||||
StringArray s; | |||||
s.addTokens (getHeaderSearchPathString(), ";", String::empty); | |||||
s.trim(); | |||||
s.removeEmptyStrings(); | |||||
s.removeDuplicates (false); | |||||
return s; | |||||
return getSearchPathsFromString (getHeaderSearchPathString()); | |||||
} | } | ||||
StringArray ProjectExporter::BuildConfiguration::getLibrarySearchPaths() const | StringArray ProjectExporter::BuildConfiguration::getLibrarySearchPaths() const | ||||
{ | { | ||||
StringArray s; | |||||
s.addTokens (getLibrarySearchPathString(), ";", String::empty); | |||||
s.trim(); | |||||
s.removeEmptyStrings(); | |||||
s.removeDuplicates (false); | |||||
return s; | |||||
return getSearchPathsFromString (getLibrarySearchPathString()); | |||||
} | } | ||||
String ProjectExporter::BuildConfiguration::getGCCLibraryPathFlags() const | String ProjectExporter::BuildConfiguration::getGCCLibraryPathFlags() const | ||||
@@ -901,15 +901,7 @@ String Project::getModuleID (int index) const | |||||
//============================================================================== | //============================================================================== | ||||
ValueTree Project::getExporters() | ValueTree Project::getExporters() | ||||
{ | { | ||||
ValueTree exporters (projectRoot.getChildWithName (Tags::exporters)); | |||||
if (! exporters.isValid()) | |||||
{ | |||||
projectRoot.addChild (ValueTree (Tags::exporters), 0, getUndoManagerFor (projectRoot)); | |||||
exporters = getExporters(); | |||||
} | |||||
return exporters; | |||||
return projectRoot.getOrCreateChildWithName (Tags::exporters, nullptr); | |||||
} | } | ||||
int Project::getNumExporters() | int Project::getNumExporters() | ||||
@@ -339,10 +339,10 @@ namespace CodeHelpers | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
static int calculateHash (const String& s, const int hashMultiplier) | |||||
static unsigned int calculateHash (const String& s, const int hashMultiplier) | |||||
{ | { | ||||
const char* t = s.toUTF8(); | const char* t = s.toUTF8(); | ||||
int hash = 0; | |||||
unsigned int hash = 0; | |||||
while (*t != 0) | while (*t != 0) | ||||
hash = hashMultiplier * hash + *t++; | hash = hashMultiplier * hash + *t++; | ||||
@@ -360,11 +360,11 @@ namespace CodeHelpers | |||||
for (;;) | for (;;) | ||||
{ | { | ||||
SortedSet <int> hashes; | |||||
SortedSet <unsigned int> hashes; | |||||
bool collision = false; | bool collision = false; | ||||
for (int i = allStrings.size(); --i >= 0;) | for (int i = allStrings.size(); --i >= 0;) | ||||
{ | { | ||||
const int hash = calculateHash (allStrings[i], v); | |||||
const unsigned int hash = calculateHash (allStrings[i], v); | |||||
if (hashes.contains (hash)) | if (hashes.contains (hash)) | ||||
{ | { | ||||
collision = true; | collision = true; | ||||
@@ -390,7 +390,7 @@ namespace CodeHelpers | |||||
const String indent (String::repeatedString (" ", indentLevel)); | const String indent (String::repeatedString (" ", indentLevel)); | ||||
const int hashMultiplier = findBestHashMultiplier (strings); | const int hashMultiplier = findBestHashMultiplier (strings); | ||||
out << indent << "int hash = 0;" << newLine | |||||
out << indent << "unsigned int hash = 0;" << newLine | |||||
<< indent << "if (" << utf8PointerVariable << " != 0)" << newLine | << indent << "if (" << utf8PointerVariable << " != 0)" << newLine | ||||
<< indent << " while (*" << utf8PointerVariable << " != 0)" << newLine | << indent << " while (*" << utf8PointerVariable << " != 0)" << newLine | ||||
<< indent << " hash = " << hashMultiplier << " * hash + *" << utf8PointerVariable << "++;" << newLine | << indent << " hash = " << hashMultiplier << " * hash + *" << utf8PointerVariable << "++;" << newLine | ||||
@@ -162,6 +162,16 @@ String replacePreprocessorDefs (const StringPairArray& definitions, String sourc | |||||
return sourceString; | return sourceString; | ||||
} | } | ||||
StringArray getSearchPathsFromString (const String& searchPath) | |||||
{ | |||||
StringArray s; | |||||
s.addTokens (searchPath, ";", String::empty); | |||||
s.trim(); | |||||
s.removeEmptyStrings(); | |||||
s.removeDuplicates (false); | |||||
return s; | |||||
} | |||||
//============================================================================== | //============================================================================== | ||||
void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX, bool scrollY) | void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX, bool scrollY) | ||||
{ | { | ||||
@@ -37,6 +37,8 @@ StringPairArray mergePreprocessorDefs (StringPairArray inheritedDefs, const Stri | |||||
String createGCCPreprocessorFlags (const StringPairArray& defs); | String createGCCPreprocessorFlags (const StringPairArray& defs); | ||||
String replacePreprocessorDefs (const StringPairArray& definitions, String sourceString); | String replacePreprocessorDefs (const StringPairArray& definitions, String sourceString); | ||||
StringArray getSearchPathsFromString (const String& searchPath); | |||||
void setValueIfVoid (Value value, const var& defaultValue); | void setValueIfVoid (Value value, const var& defaultValue); | ||||
//============================================================================== | //============================================================================== | ||||