jdatasrc.c revision 36a4ccccd33f5cc9df62949554af87129ced7f84
136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * jdatasrc.c
336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Copyright (C) 1994, Thomas G. Lane.
536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This file is part of the Independent JPEG Group's software.
636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * For conditions of distribution and use, see the accompanying README file.
736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This file contains decompression data source routines for the case of
936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * reading JPEG data from a file (or any stdio stream).  While these routines
1036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * are sufficient for most applications, some will want to use a different
1136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * source manager.
1236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * IMPORTANT: we assume that fread() will correctly transcribe an array of
1336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * JOCTETs from 8-bit-wide elements on external storage.  If char is wider
1436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * than 8 bits on your machine, you may need to do some tweaking.
1536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
1636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
1736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
1836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#include "jinclude.h"
1936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#include "jpeglib.h"
2036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#include "jerror.h"
2136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
2236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
2336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Expanded data source object for stdio input */
2436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
2536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef struct {
2636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  struct jpeg_source_mgr pub;	/* public fields */
2736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
2836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  FILE * infile;		/* source stream */
2936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JOCTET * buffer;		/* start of buffer */
3036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean start_of_file;	/* have we gotten any data yet? */
3136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane} my_source_mgr;
3236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
3336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef my_source_mgr * my_src_ptr;
3436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
3536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define INPUT_BUF_SIZE  4096	/* choose an efficiently fread'able size */
3636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
3736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
3836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
3936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Initialize source --- called by jpeg_read_header
4036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * before any data is actually read.
4136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
4236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
4336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. LaneMETHODDEF void
4436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Laneinit_source (j_decompress_ptr cinfo)
4536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane{
4636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  my_src_ptr src = (my_src_ptr) cinfo->src;
4736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
4836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* We reset the empty-input-file flag for each image,
4936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * but we don't clear the input buffer.
5036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * This is correct behavior for reading a series of images from one source.
5136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   */
5236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->start_of_file = TRUE;
5336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane}
5436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
5536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
5636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
5736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Fill the input buffer --- called whenever buffer is emptied.
5836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
5936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * In typical applications, this should read fresh data into the buffer
6036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * (ignoring the current state of next_input_byte & bytes_in_buffer),
6136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * reset the pointer & count to the start of the buffer, and return TRUE
6236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * indicating that the buffer has been reloaded.  It is not necessary to
6336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * fill the buffer entirely, only to obtain at least one more byte.
6436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
6536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * There is no such thing as an EOF return.  If the end of the file has been
6636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * reached, the routine has a choice of ERREXIT() or inserting fake data into
6736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * the buffer.  In most cases, generating a warning message and inserting a
6836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * fake EOI marker is the best course of action --- this will allow the
6936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * decompressor to output however much of the image is there.  However,
7036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * the resulting error message is misleading if the real problem is an empty
7136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * input file, so we handle that case specially.
7236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
7336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * In applications that need to be able to suspend compression due to input
7436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * not being available yet, a FALSE return indicates that no more data can be
7536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * obtained right now, but more may be forthcoming later.  In this situation,
7636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * the decompressor will return to its caller (with an indication of the
7736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * number of scanlines it has read, if any).  The application should resume
7836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * decompression after it has loaded more data into the input buffer.  Note
7936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * that there are substantial restrictions on the use of suspension --- see
8036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * the documentation.
8136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
8236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * When suspending, the decompressor will back up to a convenient restart point
8336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * (typically the start of the current MCU). next_input_byte & bytes_in_buffer
8436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * indicate where the restart point will be if the current call returns FALSE.
8536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Data beyond this point must be rescanned after resumption, so move it to
8636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * the front of the buffer rather than discarding it.
8736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
8836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
8936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. LaneMETHODDEF boolean
9036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanefill_input_buffer (j_decompress_ptr cinfo)
9136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane{
9236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  my_src_ptr src = (my_src_ptr) cinfo->src;
9336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  size_t nbytes;
9436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
9536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE);
9636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
9736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  if (nbytes <= 0) {
9836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    if (src->start_of_file)	/* Treat empty input file as fatal error */
9936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane      ERREXIT(cinfo, JERR_INPUT_EMPTY);
10036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    WARNMS(cinfo, JWRN_JPEG_EOF);
10136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    /* Insert a fake EOI marker */
10236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    src->buffer[0] = (JOCTET) 0xFF;
10336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    src->buffer[1] = (JOCTET) JPEG_EOI;
10436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    nbytes = 2;
10536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  }
10636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
10736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.next_input_byte = src->buffer;
10836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.bytes_in_buffer = nbytes;
10936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->start_of_file = FALSE;
11036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
11136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  return TRUE;
11236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane}
11336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
11436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
11536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
11636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Skip data --- used to skip over a potentially large amount of
11736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * uninteresting data (such as an APPn marker).
11836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
11936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Writers of suspendable-input applications must note that skip_input_data
12036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * is not granted the right to give a suspension return.  If the skip extends
12136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * beyond the data currently in the buffer, the buffer can be marked empty so
12236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * that the next read will cause a fill_input_buffer call that can suspend.
12336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Arranging for additional bytes to be discarded before reloading the input
12436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * buffer is the application writer's problem.
12536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
12636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
12736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. LaneMETHODDEF void
12836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Laneskip_input_data (j_decompress_ptr cinfo, long num_bytes)
12936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane{
13036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  my_src_ptr src = (my_src_ptr) cinfo->src;
13136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
13236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* Just a dumb implementation for now.  Could use fseek() except
13336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * it doesn't work on pipes.  Not clear that being smart is worth
13436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * any trouble anyway --- large skips are infrequent.
13536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   */
13636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  if (num_bytes > 0) {
13736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    while (num_bytes > (long) src->pub.bytes_in_buffer) {
13836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane      num_bytes -= (long) src->pub.bytes_in_buffer;
13936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane      (void) fill_input_buffer(cinfo);
14036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    }
14136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    src->pub.next_input_byte += (size_t) num_bytes;
14236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    src->pub.bytes_in_buffer -= (size_t) num_bytes;
14336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  }
14436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane}
14536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
14636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
14736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
14836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * An additional method that can be provided by data source modules is the
14936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * resync_to_restart method for error recovery in the presence of RST markers.
15036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * For the moment, this source module just uses the default resync method
15136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * provided by the JPEG library.  That method assumes that no backtracking
15236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * is possible.
15336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
15436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
15536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
15636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
15736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Terminate source --- called by jpeg_finish_decompress
15836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * after all data has been read.  Often a no-op.
15936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
16036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
16136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * application must deal with any cleanup that should happen even
16236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * for error exit.
16336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
16436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
16536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. LaneMETHODDEF void
16636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Laneterm_source (j_decompress_ptr cinfo)
16736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane{
16836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* no work necessary here */
16936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane}
17036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
17136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
17236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
17336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Prepare for input from a stdio stream.
17436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * The caller must have already opened the stream, and is responsible
17536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * for closing it after finishing decompression.
17636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
17736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
17836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. LaneGLOBAL void
17936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanejpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
18036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane{
18136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  my_src_ptr src;
18236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
18336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* The source object and input buffer are made permanent so that a series
18436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * of JPEG images can be read from the same file by calling jpeg_stdio_src
18536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * only before the first one.  (If we discarded the buffer at the end of
18636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * one image, we'd likely lose the start of the next one.)
18736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * This makes it unsafe to use this manager and a different source
18836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * manager serially with the same JPEG object.  Caveat programmer.
18936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   */
19036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  if (cinfo->src == NULL) {	/* first time for this JPEG object? */
19136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    cinfo->src = (struct jpeg_source_mgr *)
19236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
19336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				  SIZEOF(my_source_mgr));
19436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    src = (my_src_ptr) cinfo->src;
19536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane    src->buffer = (JOCTET *)
19636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
19736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				  INPUT_BUF_SIZE * SIZEOF(JOCTET));
19836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  }
19936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
20036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src = (my_src_ptr) cinfo->src;
20136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.init_source = init_source;
20236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.fill_input_buffer = fill_input_buffer;
20336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.skip_input_data = skip_input_data;
20436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
20536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.term_source = term_source;
20636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->infile = infile;
20736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
20836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  src->pub.next_input_byte = NULL; /* until buffer loaded */
20936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane}
210