From c2cfd294d21e6da8a86191bdd00af0772379737c Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 22 Jan 2015 15:13:18 +1100 Subject: Fix compilation failure of C++11 on Windows using gcc. --- src/Document.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index c88f8ba42..a44a51f12 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2347,6 +2347,9 @@ public: doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) { buffered[0] = 0; buffered[1] = 0; + if (doc) { + ReadCharacter(); + } } UTF8Iterator(const UTF8Iterator &other) { doc = other.doc; @@ -2369,10 +2372,8 @@ public: } return *this; } - wchar_t operator*() { - if (lenCharacters == 0) { - ReadCharacter(); - } + wchar_t operator*() const { + assert(lenCharacters != 0); return buffered[characterIndex]; } UTF8Iterator &operator++() { -- cgit v1.2.3