mirror of
				https://github.com/eledio-devices/thirdparty-miniz.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	Merge pull request #106 from lumag/inflateReset
Implement inflateReset() function
This commit is contained in:
		
							
								
								
									
										26
									
								
								miniz.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								miniz.c
									
									
									
									
									
								
							| @@ -397,6 +397,32 @@ int mz_inflateInit(mz_streamp pStream) | ||||
|     return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS); | ||||
| } | ||||
|  | ||||
| int mz_inflateReset(mz_streamp pStream) | ||||
| { | ||||
|     inflate_state *pDecomp; | ||||
|     if (!pStream) | ||||
|         return MZ_STREAM_ERROR; | ||||
|  | ||||
|     pStream->data_type = 0; | ||||
|     pStream->adler = 0; | ||||
|     pStream->msg = NULL; | ||||
|     pStream->total_in = 0; | ||||
|     pStream->total_out = 0; | ||||
|     pStream->reserved = 0; | ||||
|  | ||||
|     pDecomp = (inflate_state *)pStream->state; | ||||
|  | ||||
|     tinfl_init(&pDecomp->m_decomp); | ||||
|     pDecomp->m_dict_ofs = 0; | ||||
|     pDecomp->m_dict_avail = 0; | ||||
|     pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT; | ||||
|     pDecomp->m_first_call = 1; | ||||
|     pDecomp->m_has_flushed = 0; | ||||
|     /* pDecomp->m_window_bits = window_bits */; | ||||
|  | ||||
|     return MZ_OK; | ||||
| } | ||||
|  | ||||
| int mz_inflate(mz_streamp pStream, int flush) | ||||
| { | ||||
|     inflate_state *pState; | ||||
|   | ||||
							
								
								
									
										6
									
								
								miniz.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								miniz.h
									
									
									
									
									
								
							| @@ -24,7 +24,7 @@ | ||||
|      zlib replacement in many apps: | ||||
|         The z_stream struct, optional memory allocation callbacks | ||||
|         deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound | ||||
|         inflateInit/inflateInit2/inflate/inflateEnd | ||||
|         inflateInit/inflateInit2/inflate/inflateReset/inflateEnd | ||||
|         compress, compress2, compressBound, uncompress | ||||
|         CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines. | ||||
|         Supports raw deflate streams or standard zlib streams with adler-32 checking. | ||||
| @@ -362,6 +362,9 @@ int mz_inflateInit(mz_streamp pStream); | ||||
| /* window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). */ | ||||
| int mz_inflateInit2(mz_streamp pStream, int window_bits); | ||||
|  | ||||
| /* Quickly resets a compressor without having to reallocate anything. Same as calling mz_inflateEnd() followed by mz_inflateInit()/mz_inflateInit2(). */ | ||||
| int mz_inflateReset(mz_streamp pStream); | ||||
|  | ||||
| /* Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. */ | ||||
| /* Parameters: */ | ||||
| /*   pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. */ | ||||
| @@ -445,6 +448,7 @@ typedef void *const voidpc; | ||||
| #define compressBound mz_compressBound | ||||
| #define inflateInit mz_inflateInit | ||||
| #define inflateInit2 mz_inflateInit2 | ||||
| #define inflateReset mz_inflateReset | ||||
| #define inflate mz_inflate | ||||
| #define inflateEnd mz_inflateEnd | ||||
| #define uncompress mz_uncompress | ||||
|   | ||||
		Reference in New Issue
	
	Block a user