Stream.h (xpdf-4.03) | : | Stream.h (xpdf-4.04) | ||
---|---|---|---|---|
skipping to change at line 83 | skipping to change at line 83 | |||
// Destructor. | // Destructor. | |||
virtual ~Stream(); | virtual ~Stream(); | |||
virtual Stream *copy() = 0; | virtual Stream *copy() = 0; | |||
// Get kind of stream. | // Get kind of stream. | |||
virtual StreamKind getKind() = 0; | virtual StreamKind getKind() = 0; | |||
virtual GBool isEmbedStream() { return gFalse; } | virtual GBool isEmbedStream() { return gFalse; } | |||
// Disable checking for 'decompression bombs', i.e., cases where the | ||||
// encryption ratio looks suspiciously high. This should be called | ||||
// for things like images which (a) can have very high compression | ||||
// ratios in certain cases, and (b) have fixed data sizes controlled | ||||
// by the reader. | ||||
virtual void disableDecompressionBombChecking() {} | ||||
// Reset stream to beginning. | // Reset stream to beginning. | |||
virtual void reset() = 0; | virtual void reset() = 0; | |||
// Close down the stream. | // Close down the stream. | |||
virtual void close(); | virtual void close(); | |||
// Get next char from stream. | // Get next char from stream. | |||
virtual int getChar() = 0; | virtual int getChar() = 0; | |||
// Peek at next char in stream. | // Peek at next char in stream. | |||
skipping to change at line 195 | skipping to change at line 202 | |||
// FilterStream | // FilterStream | |||
// | // | |||
// This is the base class for all streams that filter another stream. | // This is the base class for all streams that filter another stream. | |||
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ | |||
class FilterStream: public Stream { | class FilterStream: public Stream { | |||
public: | public: | |||
FilterStream(Stream *strA); | FilterStream(Stream *strA); | |||
virtual ~FilterStream(); | virtual ~FilterStream(); | |||
virtual void disableDecompressionBombChecking() | ||||
{ str->disableDecompressionBombChecking(); } | ||||
virtual void close(); | virtual void close(); | |||
virtual GFileOffset getPos() { return str->getPos(); } | virtual GFileOffset getPos() { return str->getPos(); } | |||
virtual void setPos(GFileOffset pos, int dir = 0); | virtual void setPos(GFileOffset pos, int dir = 0); | |||
virtual BaseStream *getBaseStream() { return str->getBaseStream(); } | virtual BaseStream *getBaseStream() { return str->getBaseStream(); } | |||
virtual Stream *getUndecodedStream() { return str->getUndecodedStream(); } | virtual Stream *getUndecodedStream() { return str->getUndecodedStream(); } | |||
virtual Dict *getDict() { return str->getDict(); } | virtual Dict *getDict() { return str->getDict(); } | |||
virtual Stream *getNextStream() { return str; } | virtual Stream *getNextStream() { return str; } | |||
protected: | protected: | |||
skipping to change at line 474 | skipping to change at line 483 | |||
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ | |||
class LZWStream: public FilterStream { | class LZWStream: public FilterStream { | |||
public: | public: | |||
LZWStream(Stream *strA, int predictor, int columns, int colors, | LZWStream(Stream *strA, int predictor, int columns, int colors, | |||
int bits, int earlyA); | int bits, int earlyA); | |||
virtual ~LZWStream(); | virtual ~LZWStream(); | |||
virtual Stream *copy(); | virtual Stream *copy(); | |||
virtual StreamKind getKind() { return strLZW; } | virtual StreamKind getKind() { return strLZW; } | |||
virtual void disableDecompressionBombChecking(); | ||||
virtual void reset(); | virtual void reset(); | |||
virtual int getChar(); | virtual int getChar(); | |||
virtual int lookChar(); | virtual int lookChar(); | |||
virtual int getRawChar(); | virtual int getRawChar(); | |||
virtual int getBlock(char *blk, int size); | virtual int getBlock(char *blk, int size); | |||
virtual GString *getPSFilter(int psLevel, const char *indent, | virtual GString *getPSFilter(int psLevel, const char *indent, | |||
GBool okToReadStream); | GBool okToReadStream); | |||
virtual GBool isBinary(GBool last = gTrue); | virtual GBool isBinary(GBool last = gTrue); | |||
private: | private: | |||
skipping to change at line 503 | skipping to change at line 513 | |||
Guchar tail; | Guchar tail; | |||
} table[4097]; | } table[4097]; | |||
int nextCode; // next code to be used | int nextCode; // next code to be used | |||
int nextBits; // number of bits in next code word | int nextBits; // number of bits in next code word | |||
int prevCode; // previous code used in stream | int prevCode; // previous code used in stream | |||
int newChar; // next char to be added to table | int newChar; // next char to be added to table | |||
Guchar seqBuf[4097]; // buffer for current sequence | Guchar seqBuf[4097]; // buffer for current sequence | |||
int seqLength; // length of current sequence | int seqLength; // length of current sequence | |||
int seqIndex; // index into current sequence | int seqIndex; // index into current sequence | |||
GBool first; // first code after a table clear | GBool first; // first code after a table clear | |||
GBool checkForDecompressionBombs; | ||||
unsigned long long totalIn; // total number of encoded bytes read so far | unsigned long long totalIn; // total number of encoded bytes read so far | |||
unsigned long long totalOut; // total number of bytes decoded so far | unsigned long long totalOut; // total number of bytes decoded so far | |||
GBool processNextCode(); | GBool processNextCode(); | |||
void clearTable(); | void clearTable(); | |||
int getCode(); | int getCode(); | |||
}; | }; | |||
//------------------------------------------------------------------------ | //------------------------------------------------------------------------ | |||
// RunLengthStream | // RunLengthStream | |||
skipping to change at line 695 | skipping to change at line 706 | |||
GBool fillBuf(); | GBool fillBuf(); | |||
static void errorExit(j_common_ptr d); | static void errorExit(j_common_ptr d); | |||
static void errorMessage(j_common_ptr d); | static void errorMessage(j_common_ptr d); | |||
static void initSourceCbk(j_decompress_ptr d); | static void initSourceCbk(j_decompress_ptr d); | |||
static boolean fillInputBufferCbk(j_decompress_ptr d); | static boolean fillInputBufferCbk(j_decompress_ptr d); | |||
static void skipInputDataCbk(j_decompress_ptr d, long numBytes); | static void skipInputDataCbk(j_decompress_ptr d, long numBytes); | |||
static void termSourceCbk(j_decompress_ptr d); | static void termSourceCbk(j_decompress_ptr d); | |||
#else // HAVE_JPEGLIB | #else // HAVE_JPEGLIB | |||
GBool prepared; // set after prepare() is called | ||||
GBool progressive; // set if in progressive mode | GBool progressive; // set if in progressive mode | |||
GBool interleaved; // set if in interleaved mode | GBool interleaved; // set if in interleaved mode | |||
int width, height; // image size | int width, height; // image size | |||
int mcuWidth, mcuHeight; // size of min coding unit, in data units | int mcuWidth, mcuHeight; // size of min coding unit, in data units | |||
int bufWidth, bufHeight; // frameBuf size | int bufWidth, bufHeight; // frameBuf size | |||
DCTCompInfo compInfo[4]; // info for each component | DCTCompInfo compInfo[4]; // info for each component | |||
DCTScanInfo scanInfo; // info for the current scan | DCTScanInfo scanInfo; // info for the current scan | |||
int numComps; // number of components in image | int numComps; // number of components in image | |||
int colorXform; // color transform: -1 = unspecified | int colorXform; // color transform: -1 = unspecified | |||
// 0 = none | // 0 = none | |||
skipping to change at line 726 | skipping to change at line 738 | |||
Guchar *rowBufPtr; // current position within rowBuf | Guchar *rowBufPtr; // current position within rowBuf | |||
Guchar *rowBufEnd; // end of valid data in rowBuf | Guchar *rowBufEnd; // end of valid data in rowBuf | |||
int *frameBuf[4]; // buffer for frame (progressive mode) | int *frameBuf[4]; // buffer for frame (progressive mode) | |||
int comp, x, y; // current position within image/MCU | int comp, x, y; // current position within image/MCU | |||
int restartCtr; // MCUs left until restart | int restartCtr; // MCUs left until restart | |||
int restartMarker; // next restart marker | int restartMarker; // next restart marker | |||
int eobRun; // number of EOBs left in the current run | int eobRun; // number of EOBs left in the current run | |||
int inputBuf; // input buffer for variable length codes | int inputBuf; // input buffer for variable length codes | |||
int inputBits; // number of valid bits in input buffer | int inputBits; // number of valid bits in input buffer | |||
void prepare(); | ||||
void restart(); | void restart(); | |||
GBool readMCURow(); | GBool readMCURow(); | |||
void readScan(); | void readScan(); | |||
GBool readDataUnit(DCTHuffTable *dcHuffTable, | GBool readDataUnit(DCTHuffTable *dcHuffTable, | |||
DCTHuffTable *acHuffTable, | DCTHuffTable *acHuffTable, | |||
int *prevDC, int data[64]); | int *prevDC, int data[64]); | |||
GBool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, | GBool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, | |||
DCTHuffTable *acHuffTable, | DCTHuffTable *acHuffTable, | |||
int *prevDC, int data[64]); | int *prevDC, int data[64]); | |||
void decodeImage(); | void decodeImage(); | |||
skipping to change at line 793 | skipping to change at line 806 | |||
}; | }; | |||
class FlateStream: public FilterStream { | class FlateStream: public FilterStream { | |||
public: | public: | |||
FlateStream(Stream *strA, int predictor, int columns, | FlateStream(Stream *strA, int predictor, int columns, | |||
int colors, int bits); | int colors, int bits); | |||
virtual ~FlateStream(); | virtual ~FlateStream(); | |||
virtual Stream *copy(); | virtual Stream *copy(); | |||
virtual StreamKind getKind() { return strFlate; } | virtual StreamKind getKind() { return strFlate; } | |||
virtual void disableDecompressionBombChecking(); | ||||
virtual void reset(); | virtual void reset(); | |||
virtual int getChar(); | virtual int getChar(); | |||
virtual int lookChar(); | virtual int lookChar(); | |||
virtual int getRawChar(); | virtual int getRawChar(); | |||
virtual int getBlock(char *blk, int size); | virtual int getBlock(char *blk, int size); | |||
virtual GString *getPSFilter(int psLevel, const char *indent, | virtual GString *getPSFilter(int psLevel, const char *indent, | |||
GBool okToReadStream); | GBool okToReadStream); | |||
virtual GBool isBinary(GBool last = gTrue); | virtual GBool isBinary(GBool last = gTrue); | |||
private: | private: | |||
skipping to change at line 818 | skipping to change at line 832 | |||
int codeBuf; // input buffer | int codeBuf; // input buffer | |||
int codeSize; // number of bits in input buffer | int codeSize; // number of bits in input buffer | |||
int // literal and distance code lengths | int // literal and distance code lengths | |||
codeLengths[flateMaxLitCodes + flateMaxDistCodes]; | codeLengths[flateMaxLitCodes + flateMaxDistCodes]; | |||
FlateHuffmanTab litCodeTab; // literal code table | FlateHuffmanTab litCodeTab; // literal code table | |||
FlateHuffmanTab distCodeTab; // distance code table | FlateHuffmanTab distCodeTab; // distance code table | |||
GBool compressedBlock; // set if reading a compressed block | GBool compressedBlock; // set if reading a compressed block | |||
int blockLen; // remaining length of uncompressed block | int blockLen; // remaining length of uncompressed block | |||
GBool endOfBlock; // set when end of block is reached | GBool endOfBlock; // set when end of block is reached | |||
GBool eof; // set when end of stream is reached | GBool eof; // set when end of stream is reached | |||
GBool checkForDecompressionBombs; | ||||
unsigned long long totalIn; // total number of encoded bytes read so far | unsigned long long totalIn; // total number of encoded bytes read so far | |||
unsigned long long totalOut; // total number of bytes decoded so far | unsigned long long totalOut; // total number of bytes decoded so far | |||
static int // code length code reordering | static int // code length code reordering | |||
codeLenCodeMap[flateMaxCodeLenCodes]; | codeLenCodeMap[flateMaxCodeLenCodes]; | |||
static FlateDecode // length decoding info | static FlateDecode // length decoding info | |||
lengthDecode[flateMaxLitCodes-257]; | lengthDecode[flateMaxLitCodes-257]; | |||
static FlateDecode // distance decoding info | static FlateDecode // distance decoding info | |||
distDecode[flateMaxDistCodes]; | distDecode[flateMaxDistCodes]; | |||
static FlateHuffmanTab // fixed literal code table | static FlateHuffmanTab // fixed literal code table | |||
End of changes. 8 change blocks. | ||||
0 lines changed or deleted | 15 lines changed or added |