From 9fb57f7a056d1f5ee9924b4e85a4a1d38f083f89 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 4 Dec 2012 20:51:28 +0000 Subject: [PATCH] Fix to CharPointer_UTF8::operator-- --- modules/juce_core/text/juce_CharPointer_UTF8.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/juce_core/text/juce_CharPointer_UTF8.h b/modules/juce_core/text/juce_CharPointer_UTF8.h index 838e840545..75351c133b 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF8.h +++ b/modules/juce_core/text/juce_CharPointer_UTF8.h @@ -134,18 +134,10 @@ public: /** Moves this pointer back to the previous character in the string. */ CharPointer_UTF8& operator--() noexcept { - const char n = *--data; + int count = 0; - if ((n & 0xc0) == 0xc0) - { - int count = 3; - - do - { - --data; - } - while ((*data & 0xc0) == 0xc0 && --count >= 0); - } + while ((*--data & 0xc0) == 0x80 && ++count < 4) + {} return *this; }