UTF32 Build Error


#1

Hey Jules,

 

The following commit broke UTF32 building: https://github.com/julianstorer/JUCE/commit/4317f60173a896c63068d8f9851e9db34c610654

 

juce_XmlElement.cpp - line 643


XmlElement* XmlElement::createNewChildElement (StringRef childTagName)
{
    XmlElement* const newElement = new XmlElement (childTagName);
    addChildElement (newElement);
    return newElement;
}

The first line that creates a new XmlElement is the only error:

'juce::XmlElement::XmlElement(const wchar_t *)' : cannot convert argument 1 from 'juce::StringRef' to 'const juce::String &' (..\..\..\juce\modules\juce_core\juce_core.cpp)

#2

Drat you UTF32 people! Thanks for the heads-up, should be ok now!


#3

Now that that one is fixed there's another build error

 

juce_XmlElement.cpp - line 74

XmlElement::XmlElement (StringRef tag)
    : tagName (StringPool::getGlobalPool().getPooledString (tag.text.getAddress()))
{
    sanityCheckTagName (tagName);
}
​

The error:

error C2664: 'juce::String juce::StringPool::getPooledString(juce::String::CharPointerType,juce::String::CharPointerType)' : cannot convert argument 1 from 'juce::CharPointer_UTF32::CharType *' to 'const juce::String &' (..\..\..\juce\modules\juce_core\juce_core.cpp)
1>          Reason: cannot convert from 'juce::CharPointer_UTF32::CharType *' to 'const juce::String'
1>          No constructor could take the source type, or constructor overload resolution was ambiguous

getPooledString() isn't overloaded to accept the UTF_32 char type returned from tag.text.getAddress().


#4

Sigh.. It's always MSVC that causes trouble, isn't it.. Ok, thanks, should work fine on all compilers now!


#5

Got a new build error popping up.

static String addEscapeChars (StringRef s)
{
    MemoryOutputStream out;
    writeEscapeChars (out, s.text, -1, -1, false, true, true);
    return out.toUTF8();
}

 
void writeEscapeChars(juce::OutputStream &,const char *,const int,const int,const bool,const bool,const bool)' : cannot convert argument 2 from 'juce::String::CharPointerType' to 'const char *'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called


#6

Ah sorry, it should use toString(), not toUTF8() .. I'll sort that out right away.