mirror of
https://github.com/zlib-ng/minizip-ng
synced 2025-03-28 21:13:18 +00:00
Fixed buffered stream not being reset for reading after close.
Added ability to get buffer length for memory stream.
This commit is contained in:
parent
30e859be0b
commit
669f5a3086
@ -350,6 +350,11 @@ int32_t mz_stream_buffered_close(void *stream)
|
||||
mz_stream_buffered_print(stream, "write efficency %.02f%%\n",
|
||||
(buffered->writebuf_hits / ((float)buffered->writebuf_hits + buffered->writebuf_misses)) * 100);
|
||||
|
||||
buffered->readbuf_len = 0;
|
||||
buffered->readbuf_pos = 0;
|
||||
buffered->writebuf_len = 0;
|
||||
buffered->writebuf_pos = 0;
|
||||
|
||||
return mz_stream_close(buffered->stream.base);
|
||||
}
|
||||
|
||||
|
@ -228,6 +228,12 @@ int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void *
|
||||
return MZ_OK;
|
||||
}
|
||||
|
||||
void mz_stream_mem_get_buffer_length(void *stream, int32_t *length)
|
||||
{
|
||||
mz_stream_mem *mem = (mz_stream_mem *)stream;
|
||||
*length = mem->limit;
|
||||
}
|
||||
|
||||
void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size)
|
||||
{
|
||||
mz_stream_mem *mem = (mz_stream_mem *)stream;
|
||||
|
@ -34,6 +34,7 @@ int32_t mz_stream_mem_error(void *stream);
|
||||
void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size);
|
||||
int32_t mz_stream_mem_get_buffer(void *stream, const void **buf);
|
||||
int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void **buf);
|
||||
void mz_stream_mem_get_buffer_length(void *stream, int32_t *length);
|
||||
void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size);
|
||||
|
||||
void* mz_stream_mem_create(void **stream);
|
||||
|
Loading…
x
Reference in New Issue
Block a user