Deleted Added
full compact
common.h (292588) common.h (312518)
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file common.h
4/// \brief Definitions common to the whole liblzma library
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 74 unchanged lines hidden (view full) ---

83
84/// Special return value (lzma_ret) to indicate that a timeout was reached
85/// and lzma_code() must not return LZMA_BUF_ERROR. This is converted to
86/// LZMA_OK in lzma_code(). This is not in the lzma_ret enumeration because
87/// there's no need to have it in the public API.
88#define LZMA_TIMED_OUT 32
89
90
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file common.h
4/// \brief Definitions common to the whole liblzma library
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 74 unchanged lines hidden (view full) ---

83
84/// Special return value (lzma_ret) to indicate that a timeout was reached
85/// and lzma_code() must not return LZMA_BUF_ERROR. This is converted to
86/// LZMA_OK in lzma_code(). This is not in the lzma_ret enumeration because
87/// there's no need to have it in the public API.
88#define LZMA_TIMED_OUT 32
89
90
91/// Type of encoder/decoder specific data; the actual structure is defined
92/// differently in different coders.
93typedef struct lzma_coder_s lzma_coder;
94
95typedef struct lzma_next_coder_s lzma_next_coder;
96
97typedef struct lzma_filter_info_s lzma_filter_info;
98
99
100/// Type of a function used to initialize a filter encoder or decoder
101typedef lzma_ret (*lzma_init_function)(
102 lzma_next_coder *next, const lzma_allocator *allocator,
103 const lzma_filter_info *filters);
104
105/// Type of a function to do some kind of coding work (filters, Stream,
106/// Block encoders/decoders etc.). Some special coders use don't use both
107/// input and output buffers, but for simplicity they still use this same
108/// function prototype.
109typedef lzma_ret (*lzma_code_function)(
91typedef struct lzma_next_coder_s lzma_next_coder;
92
93typedef struct lzma_filter_info_s lzma_filter_info;
94
95
96/// Type of a function used to initialize a filter encoder or decoder
97typedef lzma_ret (*lzma_init_function)(
98 lzma_next_coder *next, const lzma_allocator *allocator,
99 const lzma_filter_info *filters);
100
101/// Type of a function to do some kind of coding work (filters, Stream,
102/// Block encoders/decoders etc.). Some special coders use don't use both
103/// input and output buffers, but for simplicity they still use this same
104/// function prototype.
105typedef lzma_ret (*lzma_code_function)(
110 lzma_coder *coder, const lzma_allocator *allocator,
106 void *coder, const lzma_allocator *allocator,
111 const uint8_t *restrict in, size_t *restrict in_pos,
112 size_t in_size, uint8_t *restrict out,
113 size_t *restrict out_pos, size_t out_size,
114 lzma_action action);
115
116/// Type of a function to free the memory allocated for the coder
117typedef void (*lzma_end_function)(
107 const uint8_t *restrict in, size_t *restrict in_pos,
108 size_t in_size, uint8_t *restrict out,
109 size_t *restrict out_pos, size_t out_size,
110 lzma_action action);
111
112/// Type of a function to free the memory allocated for the coder
113typedef void (*lzma_end_function)(
118 lzma_coder *coder, const lzma_allocator *allocator);
114 void *coder, const lzma_allocator *allocator);
119
120
121/// Raw coder validates and converts an array of lzma_filter structures to
122/// an array of lzma_filter_info structures. This array is used with
123/// lzma_next_filter_init to initialize the filter chain.
124struct lzma_filter_info_s {
125 /// Filter ID. This is used only by the encoder
126 /// with lzma_filters_update().

--- 6 unchanged lines hidden (view full) ---

133 /// Pointer to filter's options structure
134 void *options;
135};
136
137
138/// Hold data and function pointers of the next filter in the chain.
139struct lzma_next_coder_s {
140 /// Pointer to coder-specific data
115
116
117/// Raw coder validates and converts an array of lzma_filter structures to
118/// an array of lzma_filter_info structures. This array is used with
119/// lzma_next_filter_init to initialize the filter chain.
120struct lzma_filter_info_s {
121 /// Filter ID. This is used only by the encoder
122 /// with lzma_filters_update().

--- 6 unchanged lines hidden (view full) ---

129 /// Pointer to filter's options structure
130 void *options;
131};
132
133
134/// Hold data and function pointers of the next filter in the chain.
135struct lzma_next_coder_s {
136 /// Pointer to coder-specific data
141 lzma_coder *coder;
137 void *coder;
142
143 /// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't
144 /// point to a filter coder.
145 lzma_vli id;
146
147 /// "Pointer" to init function. This is never called here.
148 /// We need only to detect if we are initializing a coder
149 /// that was allocated earlier. See lzma_next_coder_init and

--- 5 unchanged lines hidden (view full) ---

155
156 /// Pointer to function to free lzma_next_coder.coder. This can
157 /// be NULL; in that case, lzma_free is called to free
158 /// lzma_next_coder.coder.
159 lzma_end_function end;
160
161 /// Pointer to a function to get progress information. If this is NULL,
162 /// lzma_stream.total_in and .total_out are used instead.
138
139 /// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't
140 /// point to a filter coder.
141 lzma_vli id;
142
143 /// "Pointer" to init function. This is never called here.
144 /// We need only to detect if we are initializing a coder
145 /// that was allocated earlier. See lzma_next_coder_init and

--- 5 unchanged lines hidden (view full) ---

151
152 /// Pointer to function to free lzma_next_coder.coder. This can
153 /// be NULL; in that case, lzma_free is called to free
154 /// lzma_next_coder.coder.
155 lzma_end_function end;
156
157 /// Pointer to a function to get progress information. If this is NULL,
158 /// lzma_stream.total_in and .total_out are used instead.
163 void (*get_progress)(lzma_coder *coder,
159 void (*get_progress)(void *coder,
164 uint64_t *progress_in, uint64_t *progress_out);
165
166 /// Pointer to function to return the type of the integrity check.
167 /// Most coders won't support this.
160 uint64_t *progress_in, uint64_t *progress_out);
161
162 /// Pointer to function to return the type of the integrity check.
163 /// Most coders won't support this.
168 lzma_check (*get_check)(const lzma_coder *coder);
164 lzma_check (*get_check)(const void *coder);
169
170 /// Pointer to function to get and/or change the memory usage limit.
171 /// If new_memlimit == 0, the limit is not changed.
165
166 /// Pointer to function to get and/or change the memory usage limit.
167 /// If new_memlimit == 0, the limit is not changed.
172 lzma_ret (*memconfig)(lzma_coder *coder, uint64_t *memusage,
168 lzma_ret (*memconfig)(void *coder, uint64_t *memusage,
173 uint64_t *old_memlimit, uint64_t new_memlimit);
174
175 /// Update the filter-specific options or the whole filter chain
176 /// in the encoder.
169 uint64_t *old_memlimit, uint64_t new_memlimit);
170
171 /// Update the filter-specific options or the whole filter chain
172 /// in the encoder.
177 lzma_ret (*update)(lzma_coder *coder, const lzma_allocator *allocator,
173 lzma_ret (*update)(void *coder, const lzma_allocator *allocator,
178 const lzma_filter *filters,
179 const lzma_filter *reversed_filters);
180};
181
182
183/// Macro to initialize lzma_next_coder structure
184#define LZMA_NEXT_CODER_INIT \
185 (lzma_next_coder){ \

--- 133 unchanged lines hidden ---
174 const lzma_filter *filters,
175 const lzma_filter *reversed_filters);
176};
177
178
179/// Macro to initialize lzma_next_coder structure
180#define LZMA_NEXT_CODER_INIT \
181 (lzma_next_coder){ \

--- 133 unchanged lines hidden ---