| @@ -90,9 +90,9 @@ public: | |||||
| uint32 n = (uint32) (uint8) byte; | uint32 n = (uint32) (uint8) byte; | ||||
| uint32 mask = 0x7f; | uint32 mask = 0x7f; | ||||
| uint32 bit = 0x40; | uint32 bit = 0x40; | ||||
| size_t numExtraValues = 0; | |||||
| int numExtraValues = 0; | |||||
| while ((n & bit) != 0 && bit > 0x10) | |||||
| while ((n & bit) != 0 && bit > 0x8) | |||||
| { | { | ||||
| mask >>= 1; | mask >>= 1; | ||||
| ++numExtraValues; | ++numExtraValues; | ||||
| @@ -101,9 +101,9 @@ public: | |||||
| n &= mask; | n &= mask; | ||||
| for (size_t i = 1; i <= numExtraValues; ++i) | |||||
| for (int i = 1; i <= numExtraValues; ++i) | |||||
| { | { | ||||
| const uint8 nextByte = (uint8) data [i]; | |||||
| const uint32 nextByte = (uint32) (uint8) data[i]; | |||||
| if ((nextByte & 0xc0) != 0x80) | if ((nextByte & 0xc0) != 0x80) | ||||
| break; | break; | ||||
| @@ -312,9 +312,8 @@ public: | |||||
| static size_t getBytesRequiredFor (CharPointer text) noexcept | static size_t getBytesRequiredFor (CharPointer text) noexcept | ||||
| { | { | ||||
| size_t count = 0; | size_t count = 0; | ||||
| juce_wchar n; | |||||
| while ((n = text.getAndAdvance()) != 0) | |||||
| while (juce_wchar n = text.getAndAdvance()) | |||||
| count += getBytesRequiredFor (n); | count += getBytesRequiredFor (n); | ||||
| return count; | return count; | ||||
| @@ -331,15 +331,8 @@ public: | |||||
| template <typename DestCharPointerType, typename SrcCharPointerType> | template <typename DestCharPointerType, typename SrcCharPointerType> | ||||
| static void copyAll (DestCharPointerType& dest, SrcCharPointerType src) noexcept | static void copyAll (DestCharPointerType& dest, SrcCharPointerType src) noexcept | ||||
| { | { | ||||
| for (;;) | |||||
| { | |||||
| const juce_wchar c = src.getAndAdvance(); | |||||
| if (c == 0) | |||||
| break; | |||||
| while (juce_wchar c = src.getAndAdvance()) | |||||
| dest.write (c); | dest.write (c); | ||||
| } | |||||
| dest.writeNull(); | dest.writeNull(); | ||||
| } | } | ||||
| @@ -86,12 +86,7 @@ public: | |||||
| if (text.getAddress() == nullptr || text.isEmpty()) | if (text.getAddress() == nullptr || text.isEmpty()) | ||||
| return CharPointerType (&(emptyString.text)); | return CharPointerType (&(emptyString.text)); | ||||
| CharPointer t (text); | |||||
| size_t bytesNeeded = sizeof (CharType); | |||||
| while (! t.isEmpty()) | |||||
| bytesNeeded += CharPointerType::getBytesRequiredFor (t.getAndAdvance()); | |||||
| const size_t bytesNeeded = sizeof (CharType) + CharPointerType::getBytesRequiredFor (text); | |||||
| const CharPointerType dest (createUninitialisedBytes (bytesNeeded)); | const CharPointerType dest (createUninitialisedBytes (bytesNeeded)); | ||||
| CharPointerType (dest).writeAll (text); | CharPointerType (dest).writeAll (text); | ||||
| return dest; | return dest; | ||||