$NetBSD: patch-bg,v 1.1 2010/10/01 21:32:34 spz Exp $

backport of changes necessary to apply the
security fixes for http://secunia.com/advisories/41596/
taken from http://cgit.freedesktop.org/poppler

--- poppler/Stream.h.orig	2010-06-08 20:06:31.000000000 +0000
+++ poppler/Stream.h
@@ -115,6 +115,7 @@ public:
   // Get next char from stream without using the predictor.
   // This is only used by StreamPredictor.
   virtual int getRawChar();
+  virtual void getRawChars(int nChars, int *buffer);
 
   // Get next char directly from stream source, without filtering it
   virtual int getUnfilteredChar () = 0;
@@ -596,11 +597,24 @@ public:
   virtual int getChar();
   virtual int lookChar();
   virtual int getRawChar();
+  virtual void getRawChars(int nChars, int *buffer);
   virtual GooString *getPSFilter(int psLevel, char *indent);
   virtual GBool isBinary(GBool last = gTrue);
 
 private:
 
+  inline int doGetRawChar() {
+    if (eof) {
+      return EOF;
+    }
+    if (seqIndex >= seqLength) {
+      if (!processNextCode()) {
+        return EOF;
+      }
+    }
+    return seqBuf[seqIndex++];
+  }
+
   StreamPredictor *pred;	// predictor
   int early;			// early parameter
   GBool eof;			// true if at eof
@@ -855,11 +869,25 @@ public:
   virtual int getChar();
   virtual int lookChar();
   virtual int getRawChar();
+  virtual void getRawChars(int nChars, int *buffer);
   virtual GooString *getPSFilter(int psLevel, char *indent);
   virtual GBool isBinary(GBool last = gTrue);
   virtual void unfilteredReset ();
 
 private:
+  inline int doGetRawChar() {
+    int c;
+
+    while (remain == 0) {
+      if (endOfBlock && eof)
+        return EOF;
+      readSome();
+    }
+    c = buf[index];
+    index = (index + 1) & flateMask;
+    --remain;
+    return c;
+  }
 
   StreamPredictor *pred;	// predictor
   Guchar buf[flateWindow];	// output data buffer
