source: trunk/src/3rdparty/libjpeg/jcomapi.c@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 3.0 KB
Line 
1/*
2 * jcomapi.c
3 *
4 * Copyright (C) 1994-1997, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
7 *
8 * This file contains application interface routines that are used for both
9 * compression and decompression.
10 */
11
12#define JPEG_INTERNALS
13#include "jinclude.h"
14#include "jpeglib.h"
15
16
17/*
18 * Abort processing of a JPEG compression or decompression operation,
19 * but don't destroy the object itself.
20 *
21 * For this, we merely clean up all the nonpermanent memory pools.
22 * Note that temp files (virtual arrays) are not allowed to belong to
23 * the permanent pool, so we will be able to close all temp files here.
24 * Closing a data source or destination, if necessary, is the application's
25 * responsibility.
26 */
27
28GLOBAL(void)
29jpeg_abort (j_common_ptr cinfo)
30{
31 int pool;
32
33 /* Do nothing if called on a not-initialized or destroyed JPEG object. */
34 if (cinfo->mem == NULL)
35 return;
36
37 /* Releasing pools in reverse order might help avoid fragmentation
38 * with some (brain-damaged) malloc libraries.
39 */
40 for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {