diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcomapi.c')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcomapi.c | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcomapi.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcomapi.c index 1b1a340..9b1fa75 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcomapi.c +++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcomapi.c | |||
@@ -1,106 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | * jcomapi.c | 2 | * jcomapi.c |
3 | * | 3 | * |
4 | * Copyright (C) 1994-1997, Thomas G. Lane. | 4 | * Copyright (C) 1994-1997, Thomas G. Lane. |
5 | * This file is part of the Independent JPEG Group's software. | 5 | * This file is part of the Independent JPEG Group's software. |
6 | * For conditions of distribution and use, see the accompanying README file. | 6 | * For conditions of distribution and use, see the accompanying README file. |
7 | * | 7 | * |
8 | * This file contains application interface routines that are used for both | 8 | * This file contains application interface routines that are used for both |
9 | * compression and decompression. | 9 | * compression and decompression. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define JPEG_INTERNALS | 12 | #define JPEG_INTERNALS |
13 | #include "jinclude.h" | 13 | #include "jinclude.h" |
14 | #include "jpeglib.h" | 14 | #include "jpeglib.h" |
15 | 15 | ||
16 | 16 | ||
17 | /* | 17 | /* |
18 | * Abort processing of a JPEG compression or decompression operation, | 18 | * Abort processing of a JPEG compression or decompression operation, |
19 | * but don't destroy the object itself. | 19 | * but don't destroy the object itself. |
20 | * | 20 | * |
21 | * For this, we merely clean up all the nonpermanent memory pools. | 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 | 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. | 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 | 24 | * Closing a data source or destination, if necessary, is the application's |
25 | * responsibility. | 25 | * responsibility. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | GLOBAL(void) | 28 | GLOBAL(void) |
29 | jpeg_abort (j_common_ptr cinfo) | 29 | jpeg_abort (j_common_ptr cinfo) |
30 | { | 30 | { |
31 | int pool; | 31 | int pool; |
32 | 32 | ||
33 | /* Do nothing if called on a not-initialized or destroyed JPEG object. */ | 33 | /* Do nothing if called on a not-initialized or destroyed JPEG object. */ |
34 | if (cinfo->mem == NULL) | 34 | if (cinfo->mem == NULL) |
35 | return; | 35 | return; |
36 | 36 | ||
37 | /* Releasing pools in reverse order might help avoid fragmentation | 37 | /* Releasing pools in reverse order might help avoid fragmentation |
38 | * with some (brain-damaged) malloc libraries. | 38 | * with some (brain-damaged) malloc libraries. |
39 | */ | 39 | */ |
40 | for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { | 40 | for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { |
41 | (*cinfo->mem->free_pool) (cinfo, pool); | 41 | (*cinfo->mem->free_pool) (cinfo, pool); |
42 | } | 42 | } |
43 | 43 | ||
44 | /* Reset overall state for possible reuse of object */ | 44 | /* Reset overall state for possible reuse of object */ |
45 | if (cinfo->is_decompressor) { | 45 | if (cinfo->is_decompressor) { |
46 | cinfo->global_state = DSTATE_START; | 46 | cinfo->global_state = DSTATE_START; |
47 | /* Try to keep application from accessing now-deleted marker list. | 47 | /* Try to keep application from accessing now-deleted marker list. |
48 | * A bit kludgy to do it here, but this is the most central place. | 48 | * A bit kludgy to do it here, but this is the most central place. |
49 | */ | 49 | */ |
50 | ((j_decompress_ptr) cinfo)->marker_list = NULL; | 50 | ((j_decompress_ptr) cinfo)->marker_list = NULL; |
51 | } else { | 51 | } else { |
52 | cinfo->global_state = CSTATE_START; | 52 | cinfo->global_state = CSTATE_START; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | /* | 57 | /* |
58 | * Destruction of a JPEG object. | 58 | * Destruction of a JPEG object. |
59 | * | 59 | * |
60 | * Everything gets deallocated except the master jpeg_compress_struct itself | 60 | * Everything gets deallocated except the master jpeg_compress_struct itself |
61 | * and the error manager struct. Both of these are supplied by the application | 61 | * and the error manager struct. Both of these are supplied by the application |
62 | * and must be freed, if necessary, by the application. (Often they are on | 62 | * and must be freed, if necessary, by the application. (Often they are on |
63 | * the stack and so don't need to be freed anyway.) | 63 | * the stack and so don't need to be freed anyway.) |
64 | * Closing a data source or destination, if necessary, is the application's | 64 | * Closing a data source or destination, if necessary, is the application's |
65 | * responsibility. | 65 | * responsibility. |
66 | */ | 66 | */ |
67 | 67 | ||
68 | GLOBAL(void) | 68 | GLOBAL(void) |
69 | jpeg_destroy (j_common_ptr cinfo) | 69 | jpeg_destroy (j_common_ptr cinfo) |
70 | { | 70 | { |
71 | /* We need only tell the memory manager to release everything. */ | 71 | /* We need only tell the memory manager to release everything. */ |
72 | /* NB: mem pointer is NULL if memory mgr failed to initialize. */ | 72 | /* NB: mem pointer is NULL if memory mgr failed to initialize. */ |
73 | if (cinfo->mem != NULL) | 73 | if (cinfo->mem != NULL) |
74 | (*cinfo->mem->self_destruct) (cinfo); | 74 | (*cinfo->mem->self_destruct) (cinfo); |
75 | cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ | 75 | cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ |
76 | cinfo->global_state = 0; /* mark it destroyed */ | 76 | cinfo->global_state = 0; /* mark it destroyed */ |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | /* | 80 | /* |
81 | * Convenience routines for allocating quantization and Huffman tables. | 81 | * Convenience routines for allocating quantization and Huffman tables. |
82 | * (Would jutils.c be a more reasonable place to put these?) | 82 | * (Would jutils.c be a more reasonable place to put these?) |
83 | */ | 83 | */ |
84 | 84 | ||
85 | GLOBAL(JQUANT_TBL *) | 85 | GLOBAL(JQUANT_TBL *) |
86 | jpeg_alloc_quant_table (j_common_ptr cinfo) | 86 | jpeg_alloc_quant_table (j_common_ptr cinfo) |
87 | { | 87 | { |
88 | JQUANT_TBL *tbl; | 88 | JQUANT_TBL *tbl; |
89 | 89 | ||
90 | tbl = (JQUANT_TBL *) | 90 | tbl = (JQUANT_TBL *) |
91 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); | 91 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); |
92 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ | 92 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ |
93 | return tbl; | 93 | return tbl; |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | GLOBAL(JHUFF_TBL *) | 97 | GLOBAL(JHUFF_TBL *) |
98 | jpeg_alloc_huff_table (j_common_ptr cinfo) | 98 | jpeg_alloc_huff_table (j_common_ptr cinfo) |
99 | { | 99 | { |
100 | JHUFF_TBL *tbl; | 100 | JHUFF_TBL *tbl; |
101 | 101 | ||
102 | tbl = (JHUFF_TBL *) | 102 | tbl = (JHUFF_TBL *) |
103 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); | 103 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); |
104 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ | 104 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ |
105 | return tbl; | 105 | return tbl; |
106 | } | 106 | } |