poppler/Stream.cc | 69 --------------------------------------------------------------------- poppler/Stream.h | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 80 deletions(-) diff --git a/poppler/Stream.cc b/poppler/Stream.cc index d2dd761..38032c1 100644 --- a/poppler/Stream.cc +++ b/poppler/Stream.cc @@ -607,24 +607,6 @@ StreamPredictor::~StreamPredictor() { gfree(predLine); } -int StreamPredictor::lookChar() { - if (predIdx >= rowBytes) { - if (!getNextLine()) { - return EOF; - } - } - return predLine[predIdx]; -} - -int StreamPredictor::getChar() { - if (predIdx >= rowBytes) { - if (!getNextLine()) { - return EOF; - } - } - return predLine[predIdx++]; -} - int StreamPredictor::getChars(int nChars, Guchar *buffer) { int n, m; @@ -1074,21 +1056,6 @@ Stream *EmbedStream::makeSubStream(Goffset start, GBool limitedA, return NULL; } -int EmbedStream::getChar() { - if (limited && !length) { - return EOF; - } - --length; - return str->getChar(); -} - -int EmbedStream::lookChar() { - if (limited && !length) { - return EOF; - } - return str->lookChar(); -} - int EmbedStream::getChars(int nChars, Guchar *buffer) { if (nChars <= 0) { return 0; @@ -1349,10 +1316,6 @@ void LZWStream::getRawChars(int nChars, int *buffer) { buffer[i] = doGetRawChar(); } -int LZWStream::getRawChar() { - return doGetRawChar(); -} - int LZWStream::getChars(int nChars, Guchar *buffer) { int n, m; @@ -4580,13 +4543,6 @@ void FlateStream::reset() { eof = gFalse; } -int FlateStream::getChar() { - if (pred) { - return pred->getChar(); - } - return doGetRawChar(); -} - int FlateStream::getChars(int nChars, Guchar *buffer) { if (pred) { return pred->getChars(nChars, buffer); @@ -4620,10 +4576,6 @@ void FlateStream::getRawChars(int nChars, int *buffer) { buffer[i] = doGetRawChar(); } -int FlateStream::getRawChar() { - return doGetRawChar(); -} - GooString *FlateStream::getPSFilter(int psLevel, const char *indent) { GooString *s; @@ -5012,14 +4964,6 @@ int BufStream::getChar() { return c; } -int BufStream::lookChar() { - return buf[0]; -} - -int BufStream::lookChar(int idx) { - return buf[idx]; -} - GBool BufStream::isBinary(GBool last) { return str->isBinary(gTrue); } @@ -5044,19 +4988,6 @@ void FixedLengthEncoder::reset() { count = 0; } -int FixedLengthEncoder::getChar() { - if (length >= 0 && count >= length) - return EOF; - ++count; - return str->getChar(); -} - -int FixedLengthEncoder::lookChar() { - if (length >= 0 && count >= length) - return EOF; - return str->getChar(); -} - GBool FixedLengthEncoder::isBinary(GBool last) { return str->isBinary(gTrue); } diff --git a/poppler/Stream.h b/poppler/Stream.h index 00b2925..80d0576 100644 --- a/poppler/Stream.h +++ b/poppler/Stream.h @@ -415,8 +415,8 @@ public: GBool isOk() { return ok; } - int lookChar(); - int getChar(); + inline int lookChar() { return (predIdx >= rowBytes && !getNextLine()) ? EOF : predLine[predIdx]; } + inline int getChar() { return (predIdx >= rowBytes && !getNextLine()) ? EOF : predLine[predIdx++]; } int getChars(int nChars, Guchar *buffer); private: @@ -615,8 +615,8 @@ public: Goffset lengthA, Object *dictA); virtual StreamKind getKind() { return str->getKind(); } virtual void reset() {} - virtual int getChar(); - virtual int lookChar(); + virtual inline int getChar() { if (limited && !length) { return EOF; } --length; return str->getChar(); } + virtual inline int lookChar() { return (limited && !length) ? EOF: str->lookChar(); } virtual Goffset getPos() { return str->getPos(); } virtual void setPos(Goffset pos, int dir = 0); virtual Goffset getStart(); @@ -697,7 +697,7 @@ public: virtual void reset(); virtual int getChar(); virtual int lookChar(); - virtual int getRawChar(); + virtual inline int getRawChar() { return doGetRawChar(); } virtual void getRawChars(int nChars, int *buffer); virtual GooString *getPSFilter(int psLevel, const char *indent); virtual GBool isBinary(GBool last = gTrue); @@ -979,9 +979,9 @@ public: virtual ~FlateStream(); virtual StreamKind getKind() { return strFlate; } virtual void reset(); - virtual int getChar(); + virtual inline int getChar() { return pred ? pred->getChar(): doGetRawChar(); } virtual int lookChar(); - virtual int getRawChar(); + virtual inline int getRawChar() { return doGetRawChar(); } virtual void getRawChars(int nChars, int *buffer); virtual GooString *getPSFilter(int psLevel, const char *indent); virtual GBool isBinary(GBool last = gTrue); @@ -1071,12 +1071,12 @@ public: virtual StreamKind getKind() { return strWeird; } virtual void reset(); virtual int getChar(); - virtual int lookChar(); + virtual inline int lookChar() { return buf[0]; } virtual GooString *getPSFilter(int psLevel, const char *indent) { return NULL; } virtual GBool isBinary(GBool last = gTrue); - int lookChar(int idx); + inline int lookChar(int idx) { return buf[idx]; } private: @@ -1095,8 +1095,8 @@ public: ~FixedLengthEncoder(); virtual StreamKind getKind() { return strWeird; } virtual void reset(); - virtual int getChar(); - virtual int lookChar(); + virtual inline int getChar() { if (length >= 0 && count >= length) return EOF; ++count; return str->getChar(); } + virtual inline int lookChar() { return (length >= 0 && count >= length) ? EOF: str->getChar(); } virtual GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) { return NULL; } virtual GBool isBinary(GBool /*last = gTrue*/); virtual GBool isEncoder() { return gTrue; }