String::appendCharPointer build error UTF32


#1

I'm getting a couple of build errors with JUCE_STRING_UTF_TYPE 32 with this new function. The following has fixed it for me:

void String::appendCharPointer (const CharPointerType startOfTextToAppend,
                                const CharPointerType endOfTextToAppend)
{
    jassert (startOfTextToAppend.getAddress() != nullptr && endOfTextToAppend.getAddress() != nullptr);
    jassert (startOfTextToAppend.getAddress() <= endOfTextToAppend.getAddress());
    const size_t extraBytesNeeded = sizeof (CharPointerType::CharType) * (endOfTextToAppend.getAddress() - startOfTextToAppend.getAddress());
    if (extraBytesNeeded > 0)
    {
        const size_t byteOffsetOfNull = getByteOffsetOfEnd();
        preallocateBytes (byteOffsetOfNull + extraBytesNeeded);
        CharPointerType::CharType* const newStringStart = addBytesToPointer (text.getAddress(), (int) byteOffsetOfNull);
        memcpy (newStringStart, startOfTextToAppend.getAddress(), extraBytesNeeded);
        CharPointerType (newStringStart + (extraBytesNeeded / sizeof (CharPointerType::CharType))).writeNull();
    }
}

#2

Thanks, you're right that there's a problem there - I'll check something in shortly to sort it out!