Index: poppler/Lexer.cc =================================================================== RCS file: /cvs/poppler/poppler/poppler/Lexer.cc,v retrieving revision 1.4 diff -u -r1.4 Lexer.cc --- poppler/Lexer.cc 28 Dec 2006 15:51:44 -0000 1.4 +++ poppler/Lexer.cc 1 Feb 2007 20:38:12 -0000 @@ -92,7 +92,7 @@ } } -int inline Lexer::getChar() { +int Lexer::getChar(GBool comesFromLook) { int c; if (LOOK_VALUE_NOT_CACHED != lookCharLastValueCached) { @@ -103,23 +103,33 @@ c = EOF; while (!curStr.isNone() && (c = curStr.streamGetChar()) == EOF) { - curStr.streamClose(); - curStr.free(); - ++strPtr; - if (strPtr < streams->getLength()) { - streams->get(strPtr, &curStr); - curStr.streamReset(); + if (comesFromLook == gTrue) { + return EOF; + } else { + curStr.streamClose(); + curStr.free(); + ++strPtr; + if (strPtr < streams->getLength()) { + streams->get(strPtr, &curStr); + curStr.streamReset(); + } } } return c; } -int inline Lexer::lookChar() { +int Lexer::lookChar() { + if (LOOK_VALUE_NOT_CACHED != lookCharLastValueCached) { return lookCharLastValueCached; } - lookCharLastValueCached = getChar(); - return lookCharLastValueCached; + lookCharLastValueCached = getChar(gTrue); + if (lookCharLastValueCached == EOF) { + lookCharLastValueCached = LOOK_VALUE_NOT_CACHED; + return EOF; + } else { + return lookCharLastValueCached; + } } Object *Lexer::getObj(Object *obj, int objNum) { Index: poppler/Lexer.h =================================================================== RCS file: /cvs/poppler/poppler/poppler/Lexer.h,v retrieving revision 1.4 diff -u -r1.4 Lexer.h --- poppler/Lexer.h 28 Dec 2006 15:51:44 -0000 1.4 +++ poppler/Lexer.h 1 Feb 2007 20:38:12 -0000 @@ -75,7 +75,7 @@ private: - int getChar(); + int getChar(GBool comesFromLook = gFalse); int lookChar(); Array *streams; // array of input streams