1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
19 #include "../server/mystdio.h"
27 //------------------------------------------------------------------------
41 strWeird
// internal-use stream types
44 enum StreamColorSpaceMode
{
51 //------------------------------------------------------------------------
52 // Stream (base class)
53 //------------------------------------------------------------------------
64 // Reference counting.
65 int incRef() { return ++ref
; }
66 int decRef() { return --ref
; }
68 // Get kind of stream.
69 virtual StreamKind
getKind() = 0;
71 // Reset stream to beginning.
72 virtual void reset() = 0;
74 // Close down the stream.
77 // Get next char from stream.
78 virtual int getChar() = 0;
80 // Peek at next char in stream.
81 virtual int lookChar() = 0;
83 // Get next char from stream without using the predictor.
84 // This is only used by StreamPredictor.
85 virtual int getRawChar();
87 // Get next line from stream.
88 virtual char *getLine(char *buf
, int size
);
90 // Get current position in file.
91 virtual int getPos() = 0;
93 // Go to a position in the stream. If <dir> is negative, the
94 // position is from the end of the file; otherwise the position is
95 // from the start of the file.
96 virtual void setPos(Guint pos
, int dir
= 0) = 0;
98 // Get PostScript command for the filter(s).
99 virtual GString
*getPSFilter(int psLevel
, char *indent
);
101 // Does this stream type potentially contain non-printable chars?
102 virtual GBool
isBinary(GBool last
= gTrue
) = 0;
104 // Get the BaseStream of this stream.
105 virtual BaseStream
*getBaseStream() = 0;
107 // Get the dictionary associated with this stream.
108 virtual Dict
*getDict() = 0;
110 // Is this an encoding filter?
111 virtual GBool
isEncoder() { return gFalse
; }
113 virtual void preRead(int pos
, int length
) {}
114 virtual void removeParts() {}
116 // Get image parameters which are defined by the stream contents.
117 virtual void getImageParams(int *bitsPerComponent
,
118 StreamColorSpaceMode
*csMode
) {}
120 // Add filters to this stream according to the parameters in <dict>.
121 // Returns the new stream.
122 Stream
*addFilters(Object
*dict
);
126 Stream
*makeFilter(char *name
, Stream
*str
, Object
*params
);
128 int ref
; // reference count
131 //------------------------------------------------------------------------
134 // This is the base class for all streams that read directly from a file.
135 //------------------------------------------------------------------------
137 class BaseStream
: public Stream
{
140 BaseStream(Object
*dictA
);
141 virtual ~BaseStream();
142 virtual Stream
*makeSubStream(Guint start
, GBool limited
,
143 Guint length
, Object
*dict
) = 0;
144 virtual void setPos(Guint pos
, int dir
= 0) = 0;
145 virtual GBool
isBinary(GBool last
= gTrue
) { return last
; }
146 virtual BaseStream
*getBaseStream() { return this; }
147 virtual Dict
*getDict() { return dict
.getDict(); }
149 // Get/set position of first byte of stream within the file.
150 virtual Guint
getStart() = 0;
151 virtual void moveStart(int delta
) = 0;
153 // Set decryption for this stream.
154 virtual void doDecryption(Guchar
*fileKey
, int keyLength
,
155 int objNum
, int objGen
);
166 //------------------------------------------------------------------------
169 // This is the base class for all streams that filter another stream.
170 //------------------------------------------------------------------------
172 class FilterStream
: public Stream
{
175 FilterStream(Stream
*strA
);
176 virtual ~FilterStream();
177 virtual void close();
178 virtual int getPos() { return str
->getPos(); }
179 virtual void setPos(Guint pos
, int dir
= 0);
180 virtual BaseStream
*getBaseStream() { return str
->getBaseStream(); }
181 virtual Dict
*getDict() { return str
->getDict(); }
188 //------------------------------------------------------------------------
190 //------------------------------------------------------------------------
195 // Create an image stream object for an image with the specified
196 // parameters. Note that these are the actual image parameters,
197 // which may be different from the predictor parameters.
198 ImageStream(Stream
*strA
, int widthA
, int nCompsA
, int nBitsA
);
205 // Gets the next pixel from the stream. <pix> should be able to hold
206 // at least nComps elements. Returns false at end of file.
207 GBool
getPixel(Guchar
*pix
);
209 // Returns a pointer to the next line of pixels. Returns NULL at
213 // Skip an entire line from the image.
218 Stream
*str
; // base stream
219 int width
; // pixels per line
220 int nComps
; // components per pixel
221 int nBits
; // bits per component
222 int nVals
; // components per line
223 Guchar
*imgLine
; // line buffer
224 int imgIdx
; // current index in imgLine
227 //------------------------------------------------------------------------
229 //------------------------------------------------------------------------
231 class StreamPredictor
{
234 // Create a predictor object. Note that the parameters are for the
235 // predictor, and may not match the actual image parameters.
236 StreamPredictor(Stream
*strA
, int predictorA
,
237 int widthA
, int nCompsA
, int nBitsA
);
241 GBool
isOk() { return ok
; }
250 Stream
*str
; // base stream
251 int predictor
; // predictor
252 int width
; // pixels per line
253 int nComps
; // components per pixel
254 int nBits
; // bits per component
255 int nVals
; // components per line
256 int pixBytes
; // bytes per pixel
257 int rowBytes
; // bytes per line
258 Guchar
*predLine
; // line buffer
259 int predIdx
; // current index in predLine
263 //------------------------------------------------------------------------
265 //------------------------------------------------------------------------
267 #define fileStreamBufSize 256
269 class FileStream
: public BaseStream
{
272 FileStream(myFILE
*fA
, Guint startA
, GBool limitedA
,
273 Guint lengthA
, Object
*dictA
);
274 virtual ~FileStream();
275 virtual Stream
*makeSubStream(Guint startA
, GBool limitedA
,
276 Guint lengthA
, Object
*dictA
);
277 virtual StreamKind
getKind() { return strFile
; }
278 virtual void reset();
279 virtual void close();
280 virtual int getChar()
281 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
++ & 0xff); }
282 virtual int lookChar()
283 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
& 0xff); }
284 virtual int getPos() { return bufPos
+ (bufPtr
- buf
); }
285 virtual void setPos(Guint pos
, int dir
= 0);
286 virtual Guint
getStart() { return start
; }
287 virtual void moveStart(int delta
);
288 virtual void preRead(int pos
, int length
);
289 virtual void removeParts();
299 char buf
[fileStreamBufSize
];
307 //------------------------------------------------------------------------
309 //------------------------------------------------------------------------
311 class MemStream
: public BaseStream
{
314 MemStream(char *bufA
, Guint startA
, Guint lengthA
, Object
*dictA
);
315 virtual ~MemStream();
316 virtual Stream
*makeSubStream(Guint start
, GBool limited
,
317 Guint lengthA
, Object
*dictA
);
318 virtual StreamKind
getKind() { return strWeird
; }
319 virtual void reset();
320 virtual void close();
321 virtual int getChar()
322 { return (bufPtr
< bufEnd
) ? (*bufPtr
++ & 0xff) : EOF
; }
323 virtual int lookChar()
324 { return (bufPtr
< bufEnd
) ? (*bufPtr
& 0xff) : EOF
; }
325 virtual int getPos() { return (int)(bufPtr
- buf
); }
326 virtual void setPos(Guint pos
, int dir
= 0);
327 virtual Guint
getStart() { return start
; }
328 virtual void moveStart(int delta
);
329 virtual void doDecryption(Guchar
*fileKey
, int keyLength
,
330 int objNum
, int objGen
);
342 //------------------------------------------------------------------------
345 // This is a special stream type used for embedded streams (inline
346 // images). It reads directly from the base stream -- after the
347 // EmbedStream is deleted, reads from the base stream will proceed where
348 // the BaseStream left off. Note that this is very different behavior
349 // that creating a new FileStream (using makeSubStream).
350 //------------------------------------------------------------------------
352 class EmbedStream
: public BaseStream
{
355 EmbedStream(Stream
*strA
, Object
*dictA
, GBool limitedA
, Guint lengthA
);
356 virtual ~EmbedStream();
357 virtual Stream
*makeSubStream(Guint start
, GBool limitedA
,
358 Guint lengthA
, Object
*dictA
);
359 virtual StreamKind
getKind() { return str
->getKind(); }
360 virtual void reset() {}
361 virtual int getChar();
362 virtual int lookChar();
363 virtual int getPos() { return str
->getPos(); }
364 virtual void setPos(Guint pos
, int dir
= 0);
365 virtual Guint
getStart();
366 virtual void moveStart(int delta
);
375 //------------------------------------------------------------------------
377 //------------------------------------------------------------------------
379 class ASCIIHexStream
: public FilterStream
{
382 ASCIIHexStream(Stream
*strA
);
383 virtual ~ASCIIHexStream();
384 virtual StreamKind
getKind() { return strASCIIHex
; }
385 virtual void reset();
386 virtual int getChar()
387 { int c
= lookChar(); buf
= EOF
; return c
; }
388 virtual int lookChar();
389 virtual int getPos() { return str
->getPos(); }
390 virtual GString
*getPSFilter(int psLevel
, char *indent
);
391 virtual GBool
isBinary(GBool last
= gTrue
);
399 //------------------------------------------------------------------------
401 //------------------------------------------------------------------------
403 class ASCII85Stream
: public FilterStream
{
406 ASCII85Stream(Stream
*strA
);
407 virtual ~ASCII85Stream();
408 virtual StreamKind
getKind() { return strASCII85
; }
409 virtual void reset();
410 virtual int getChar()
411 { int ch
= lookChar(); ++index
; return ch
; }
412 virtual int lookChar();
413 virtual GString
*getPSFilter(int psLevel
, char *indent
);
414 virtual GBool
isBinary(GBool last
= gTrue
);
424 //------------------------------------------------------------------------
426 //------------------------------------------------------------------------
428 class LZWStream
: public FilterStream
{
431 LZWStream(Stream
*strA
, int predictor
, int columns
, int colors
,
432 int bits
, int earlyA
);
433 virtual ~LZWStream();
434 virtual StreamKind
getKind() { return strLZW
; }
435 virtual void reset();
436 virtual int getChar();
437 virtual int lookChar();
438 virtual int getRawChar();
439 virtual GString
*getPSFilter(int psLevel
, char *indent
);
440 virtual GBool
isBinary(GBool last
= gTrue
);
444 StreamPredictor
*pred
; // predictor
445 int early
; // early parameter
446 GBool eof
; // true if at eof
447 int inputBuf
; // input buffer
448 int inputBits
; // number of bits in input buffer
449 struct { // decoding table
454 int nextCode
; // next code to be used
455 int nextBits
; // number of bits in next code word
456 int prevCode
; // previous code used in stream
457 int newChar
; // next char to be added to table
458 Guchar seqBuf
[4097]; // buffer for current sequence
459 int seqLength
; // length of current sequence
460 int seqIndex
; // index into current sequence
461 GBool first
; // first code after a table clear
463 GBool
processNextCode();
468 //------------------------------------------------------------------------
470 //------------------------------------------------------------------------
472 class RunLengthStream
: public FilterStream
{
475 RunLengthStream(Stream
*strA
);
476 virtual ~RunLengthStream();
477 virtual StreamKind
getKind() { return strRunLength
; }
478 virtual void reset();
479 virtual int getChar()
480 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
++ & 0xff); }
481 virtual int lookChar()
482 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
& 0xff); }
483 virtual GString
*getPSFilter(int psLevel
, char *indent
);
484 virtual GBool
isBinary(GBool last
= gTrue
);
488 char buf
[128]; // buffer
489 char *bufPtr
; // next char to read
490 char *bufEnd
; // end of buffer
496 //------------------------------------------------------------------------
498 //------------------------------------------------------------------------
500 struct CCITTCodeTable
;
502 class CCITTFaxStream
: public FilterStream
{
505 CCITTFaxStream(Stream
*strA
, int encodingA
, GBool endOfLineA
,
506 GBool byteAlignA
, int columnsA
, int rowsA
,
507 GBool endOfBlockA
, GBool blackA
);
508 virtual ~CCITTFaxStream();
509 virtual StreamKind
getKind() { return strCCITTFax
; }
510 virtual void reset();
511 virtual int getChar()
512 { int c
= lookChar(); buf
= EOF
; return c
; }
513 virtual int lookChar();
514 virtual GString
*getPSFilter(int psLevel
, char *indent
);
515 virtual GBool
isBinary(GBool last
= gTrue
);
519 int encoding
; // 'K' parameter
520 GBool endOfLine
; // 'EndOfLine' parameter
521 GBool byteAlign
; // 'EncodedByteAlign' parameter
522 int columns
; // 'Columns' parameter
523 int rows
; // 'Rows' parameter
524 GBool endOfBlock
; // 'EndOfBlock' parameter
525 GBool black
; // 'BlackIs1' parameter
526 GBool eof
; // true if at eof
527 GBool nextLine2D
; // true if next line uses 2D encoding
528 int row
; // current row
529 int inputBuf
; // input buffer
530 int inputBits
; // number of bits in input buffer
531 short *refLine
; // reference line changing elements
532 int b1
; // index into refLine
533 short *codingLine
; // coding line changing elements
534 int a0
; // index into codingLine
535 int outputBits
; // remaining ouput bits
536 int buf
; // character buffer
538 short getTwoDimCode();
539 short getWhiteCode();
540 short getBlackCode();
541 short lookBits(int n
);
542 void eatBits(int n
) { if ((inputBits
-= n
) < 0) inputBits
= 0; }
545 //------------------------------------------------------------------------
547 //------------------------------------------------------------------------
549 // DCT component info
551 int id
; // component ID
552 int hSample
, vSample
; // horiz/vert sampling resolutions
553 int quantTable
; // quantization table number
554 int prevDC
; // DC coefficient accumulator
558 GBool comp
[4]; // comp[i] is set if component i is
559 // included in this scan
560 int numComps
; // number of components in the scan
561 int dcHuffTable
[4]; // DC Huffman table numbers
562 int acHuffTable
[4]; // AC Huffman table numbers
563 int firstCoeff
, lastCoeff
; // first and last DCT coefficient
564 int ah
, al
; // successive approximation parameters
567 // DCT Huffman decoding table
568 struct DCTHuffTable
{
569 Guchar firstSym
[17]; // first symbol for this bit length
570 Gushort firstCode
[17]; // first code for this bit length
571 Gushort numCodes
[17]; // number of codes of this bit length
572 Guchar sym
[256]; // symbols
575 class DCTStream
: public FilterStream
{
578 DCTStream(Stream
*strA
);
579 virtual ~DCTStream();
580 virtual StreamKind
getKind() { return strDCT
; }
581 virtual void reset();
582 virtual int getChar();
583 virtual int lookChar();
584 virtual GString
*getPSFilter(int psLevel
, char *indent
);
585 virtual GBool
isBinary(GBool last
= gTrue
);
586 Stream
*getRawStream() { return str
; }
590 GBool progressive
; // set if in progressive mode
591 GBool interleaved
; // set if in interleaved mode
592 int width
, height
; // image size
593 int mcuWidth
, mcuHeight
; // size of min coding unit, in data units
594 int bufWidth
, bufHeight
; // frameBuf size
595 DCTCompInfo compInfo
[4]; // info for each component
596 DCTScanInfo scanInfo
; // info for the current scan
597 int numComps
; // number of components in image
598 int colorXform
; // need YCbCr-to-RGB transform?
599 GBool gotJFIFMarker
; // set if APP0 JFIF marker was present
600 GBool gotAdobeMarker
; // set if APP14 Adobe marker was present
601 int restartInterval
; // restart interval, in MCUs
602 Gushort quantTables
[4][64]; // quantization tables
603 int numQuantTables
; // number of quantization tables
604 DCTHuffTable dcHuffTables
[4]; // DC Huffman tables
605 DCTHuffTable acHuffTables
[4]; // AC Huffman tables
606 int numDCHuffTables
; // number of DC Huffman tables
607 int numACHuffTables
; // number of AC Huffman tables
608 Guchar
*rowBuf
[4][32]; // buffer for one MCU (non-progressive mode)
609 int *frameBuf
[4]; // buffer for frame (progressive mode)
610 int comp
, x
, y
, dy
; // current position within image/MCU
611 int restartCtr
; // MCUs left until restart
612 int restartMarker
; // next restart marker
613 int eobRun
; // number of EOBs left in the current run
614 int inputBuf
; // input buffer for variable length codes
615 int inputBits
; // number of valid bits in input buffer
620 GBool
readDataUnit(DCTHuffTable
*dcHuffTable
,
621 DCTHuffTable
*acHuffTable
,
622 int *prevDC
, int data
[64]);
623 GBool
readProgressiveDataUnit(DCTHuffTable
*dcHuffTable
,
624 DCTHuffTable
*acHuffTable
,
625 int *prevDC
, int data
[64]);
627 void transformDataUnit(Gushort
*quantTable
,
628 int dataIn
[64], Guchar dataOut
[64]);
629 int readHuffSym(DCTHuffTable
*table
);
630 int readAmp(int size
);
633 GBool
readBaselineSOF();
634 GBool
readProgressiveSOF();
635 GBool
readScanInfo();
636 GBool
readQuantTables();
637 GBool
readHuffmanTables();
638 GBool
readRestartInterval();
639 GBool
readJFIFMarker();
640 GBool
readAdobeMarker();
646 //------------------------------------------------------------------------
648 //------------------------------------------------------------------------
650 #define flateWindow 32768 // buffer size
651 #define flateMask (flateWindow-1)
652 #define flateMaxHuffman 15 // max Huffman code length
653 #define flateMaxCodeLenCodes 19 // max # code length codes
654 #define flateMaxLitCodes 288 // max # literal codes
655 #define flateMaxDistCodes 30 // max # distance codes
657 // Huffman code table entry
659 Gushort len
; // code length, in bits
660 Gushort val
; // value represented by this code
663 struct FlateHuffmanTab
{
668 // Decoding info for length and distance code words
670 int bits
; // # extra bits
671 int first
; // first length/distance
674 class FlateStream
: public FilterStream
{
677 FlateStream(Stream
*strA
, int predictor
, int columns
,
678 int colors
, int bits
);
679 virtual ~FlateStream();
680 virtual StreamKind
getKind() { return strFlate
; }
681 virtual void reset();
682 virtual int getChar();
683 virtual int lookChar();
684 virtual int getRawChar();
685 virtual GString
*getPSFilter(int psLevel
, char *indent
);
686 virtual GBool
isBinary(GBool last
= gTrue
);
690 StreamPredictor
*pred
; // predictor
691 Guchar buf
[flateWindow
]; // output data buffer
692 int index
; // current index into output buffer
693 int remain
; // number valid bytes in output buffer
694 int codeBuf
; // input buffer
695 int codeSize
; // number of bits in input buffer
696 int // literal and distance code lengths
697 codeLengths
[flateMaxLitCodes
+ flateMaxDistCodes
];
698 FlateHuffmanTab litCodeTab
; // literal code table
699 FlateHuffmanTab distCodeTab
; // distance code table
700 GBool compressedBlock
; // set if reading a compressed block
701 int blockLen
; // remaining length of uncompressed block
702 GBool endOfBlock
; // set when end of block is reached
703 GBool eof
; // set when end of stream is reached
705 static int // code length code reordering
706 codeLenCodeMap
[flateMaxCodeLenCodes
];
707 static FlateDecode
// length decoding info
708 lengthDecode
[flateMaxLitCodes
-257];
709 static FlateDecode
// distance decoding info
710 distDecode
[flateMaxDistCodes
];
711 static FlateHuffmanTab
// fixed literal code table
713 static FlateHuffmanTab
// fixed distance code table
718 void loadFixedCodes();
719 GBool
readDynamicCodes();
720 void compHuffmanCodes(int *lengths
, int n
, FlateHuffmanTab
*tab
);
721 int getHuffmanCodeWord(FlateHuffmanTab
*tab
);
722 int getCodeWord(int bits
);
725 //------------------------------------------------------------------------
727 //------------------------------------------------------------------------
729 class EOFStream
: public FilterStream
{
732 EOFStream(Stream
*strA
);
733 virtual ~EOFStream();
734 virtual StreamKind
getKind() { return strWeird
; }
735 virtual void reset() {}
736 virtual int getChar() { return EOF
; }
737 virtual int lookChar() { return EOF
; }
738 virtual GString
*getPSFilter(int psLevel
, char *indent
) { return NULL
; }
739 virtual GBool
isBinary(GBool last
= gTrue
) { return gFalse
; }
742 //------------------------------------------------------------------------
743 // FixedLengthEncoder
744 //------------------------------------------------------------------------
746 class FixedLengthEncoder
: public FilterStream
{
749 FixedLengthEncoder(Stream
*strA
, int lengthA
);
750 ~FixedLengthEncoder();
751 virtual StreamKind
getKind() { return strWeird
; }
752 virtual void reset();
753 virtual int getChar();
754 virtual int lookChar();
755 virtual GString
*getPSFilter(int psLevel
, char *indent
) { return NULL
; }
756 virtual GBool
isBinary(GBool last
= gTrue
);
757 virtual GBool
isEncoder() { return gTrue
; }
765 //------------------------------------------------------------------------
767 //------------------------------------------------------------------------
769 class ASCIIHexEncoder
: public FilterStream
{
772 ASCIIHexEncoder(Stream
*strA
);
773 virtual ~ASCIIHexEncoder();
774 virtual StreamKind
getKind() { return strWeird
; }
775 virtual void reset();
776 virtual int getChar()
777 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
++ & 0xff); }
778 virtual int lookChar()
779 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
& 0xff); }
780 virtual GString
*getPSFilter(int psLevel
, char *indent
) { return NULL
; }
781 virtual GBool
isBinary(GBool last
= gTrue
) { return gFalse
; }
782 virtual GBool
isEncoder() { return gTrue
; }
795 //------------------------------------------------------------------------
797 //------------------------------------------------------------------------
799 class ASCII85Encoder
: public FilterStream
{
802 ASCII85Encoder(Stream
*strA
);
803 virtual ~ASCII85Encoder();
804 virtual StreamKind
getKind() { return strWeird
; }
805 virtual void reset();
806 virtual int getChar()
807 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
++ & 0xff); }
808 virtual int lookChar()
809 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
& 0xff); }
810 virtual GString
*getPSFilter(int psLevel
, char *indent
) { return NULL
; }
811 virtual GBool
isBinary(GBool last
= gTrue
) { return gFalse
; }
812 virtual GBool
isEncoder() { return gTrue
; }
825 //------------------------------------------------------------------------
827 //------------------------------------------------------------------------
829 class RunLengthEncoder
: public FilterStream
{
832 RunLengthEncoder(Stream
*strA
);
833 virtual ~RunLengthEncoder();
834 virtual StreamKind
getKind() { return strWeird
; }
835 virtual void reset();
836 virtual int getChar()
837 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
++ & 0xff); }
838 virtual int lookChar()
839 { return (bufPtr
>= bufEnd
&& !fillBuf()) ? EOF
: (*bufPtr
& 0xff); }
840 virtual GString
*getPSFilter(int psLevel
, char *indent
) { return NULL
; }
841 virtual GBool
isBinary(GBool last
= gTrue
) { return gTrue
; }
842 virtual GBool
isEncoder() { return gTrue
; }
855 //------------------------------------------------------------------------
857 //------------------------------------------------------------------------
859 class StrStream
: public BaseStream
{
862 StrStream(GString
*str
, Object
*dict1
);
863 virtual ~StrStream();
864 virtual Stream
*makeSubStream(Guint start
, GBool limited
, Guint length
, Object
*dict
)
866 virtual StreamKind
getKind() { return strString
; }
867 virtual void reset() { bufPtr
= buf
; }
868 virtual int getChar()
869 { return bufPtr
>= bufEnd
? EOF
: (*bufPtr
++ & 0xff); }
870 virtual int lookChar()
871 { return bufPtr
>= bufEnd
? EOF
: (*bufPtr
& 0xff); }
872 virtual int getPos() { return bufPtr
- buf
; }
873 virtual void setPos(Guint pos1
, int dir
) { bufPtr
= (dir
< 0 ? bufEnd
- pos1
: buf
+ pos1
); }
874 virtual GBool
isBinary(GBool last
= gTrue
) { return last
; }
875 virtual Guint
getStart() { return 0; }
876 virtual void moveStart(int delta
) {}