- free (src->buffer);
-}
-
-void jpeg_wxio_src( j_decompress_ptr cinfo, wxInputStream& infile )
-{
- my_src_ptr src;
-
- if (cinfo->src == NULL) { /* first time for this JPEG object? */
- cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- sizeof(my_source_mgr));
- src = (my_src_ptr) cinfo->src;
- }
- src = (my_src_ptr) cinfo->src;
- src->pub.bytes_in_buffer = infile.GetSize(); /* forces fill_input_buffer on first read */
- src->buffer = (JOCTET *) malloc (infile.GetSize());
- src->pub.next_input_byte = src->buffer; /* until buffer loaded */
- infile.Read(src->buffer, infile.GetSize());
-
- src->pub.init_source = my_init_source;
- src->pub.fill_input_buffer = my_fill_input_buffer;
- src->pub.skip_input_data = my_skip_input_data;
- src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
- src->pub.term_source = my_term_source;
+ if (src->pub.bytes_in_buffer > 0)
+ src->stream->SeekI(-(long)src->pub.bytes_in_buffer, wxFromCurrent);
+ delete[] src->buffer;