Fixed compiler errors and warnings.

This commit is contained in:
Nathan Moinvaziri 2018-10-25 21:36:35 -07:00
parent d45af6d6e9
commit d2dc11ca57
6 changed files with 16 additions and 17 deletions

View File

@ -213,12 +213,12 @@ void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size)
mem->limit = size;
}
int32_t mz_stream_mem_get_buffer(void *stream, const void **buf)
int32_t mz_stream_mem_get_buffer(void *stream, const uint8_t **buf)
{
return mz_stream_mem_get_buffer_at(stream, 0, buf);
}
int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void **buf)
int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const uint8_t **buf)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
if (buf == NULL || position < 0 || mem->size < position || mem->buffer == NULL)
@ -227,7 +227,7 @@ int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void *
return MZ_OK;
}
int32_t mz_stream_mem_get_buffer_at_current(void *stream, const void **buf)
int32_t mz_stream_mem_get_buffer_at_current(void *stream, const uint8_t **buf)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
return mz_stream_mem_get_buffer_at(stream, mem->position, buf);

View File

@ -30,9 +30,9 @@ int32_t mz_stream_mem_close(void *stream);
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);
int32_t mz_stream_mem_get_buffer_at_current(void *stream, const void **buf);
int32_t mz_stream_mem_get_buffer(void *stream, const uint8_t **buf);
int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const uint8_t **buf);
int32_t mz_stream_mem_get_buffer_at_current(void *stream, const uint8_t **buf);
void mz_stream_mem_get_buffer_length(void *stream, int32_t *length);
void mz_stream_mem_set_buffer_limit(void *stream, int32_t limit);
void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size);

View File

@ -21,7 +21,7 @@
#include "mz.h"
#include "mz_strm.h"
#include "mz_strm_os_posix.h"
#include "mz_strm_os.h"
/***************************************************************************/

View File

@ -797,7 +797,7 @@ static int32_t mz_zip_entry_read_header(void *stream, uint8_t local, mz_zip_file
if ((err == MZ_OK) && (file_info->filename_size > 0))
{
mz_stream_mem_get_buffer(file_extra_stream, (const void **)&file_info->filename);
mz_stream_mem_get_buffer(file_extra_stream, &file_info->filename);
err = mz_stream_copy(file_extra_stream, stream, file_info->filename_size);
if (err == MZ_OK)
@ -808,7 +808,7 @@ static int32_t mz_zip_entry_read_header(void *stream, uint8_t local, mz_zip_file
if ((err == MZ_OK) && (file_info->extrafield_size > 0))
{
mz_stream_mem_get_buffer_at(file_extra_stream, seek, (const void **)&file_info->extrafield);
mz_stream_mem_get_buffer_at(file_extra_stream, seek, &file_info->extrafield);
err = mz_stream_copy(file_extra_stream, stream, file_info->extrafield_size);
if (err == MZ_OK)
@ -939,7 +939,7 @@ static int32_t mz_zip_entry_read_header(void *stream, uint8_t local, mz_zip_file
if ((err == MZ_OK) && (file_info->comment_size > 0))
{
mz_stream_mem_get_buffer_at(file_extra_stream, seek, (const void **)&file_info->comment);
mz_stream_mem_get_buffer_at(file_extra_stream, seek, &file_info->comment);
err = mz_stream_copy(file_extra_stream, stream, file_info->comment_size);
if (err == MZ_OK)
@ -1544,17 +1544,17 @@ int32_t mz_zip_entry_write_open(void *handle, const mz_zip_file *file_info, int1
// Copy filename, extrafield, and comment internally
if (file_info->filename != NULL)
{
mz_stream_mem_get_buffer_at_current(zip->file_info_stream, (const void **)&zip->file_info.filename);
mz_stream_mem_get_buffer_at_current(zip->file_info_stream, &zip->file_info.filename);
mz_stream_write_chars(zip->file_info_stream, file_info->filename, 1);
}
if (file_info->extrafield != NULL)
{
mz_stream_mem_get_buffer_at_current(zip->file_info_stream, (const void **)&zip->file_info.extrafield);
mz_stream_mem_get_buffer_at_current(zip->file_info_stream, &zip->file_info.extrafield);
mz_stream_write(zip->file_info_stream, file_info->extrafield, file_info->extrafield_size);
}
if (file_info->comment != NULL)
{
mz_stream_mem_get_buffer_at_current(zip->file_info_stream, (const void **)&zip->file_info.comment);
mz_stream_mem_get_buffer_at_current(zip->file_info_stream, &zip->file_info.comment);
mz_stream_write_chars(zip->file_info_stream, file_info->comment, 1);
}

View File

@ -239,8 +239,7 @@ int32_t mz_zip_reader_unzip_cd(void *handle)
void *file_extra_stream = NULL;
uint64_t number_entry = 0;
int32_t err = MZ_OK;
uint16_t field_type = 0;
uint16_t field_length = 0;
err = mz_zip_reader_goto_first_entry(handle);
if (err != MZ_OK)
@ -1176,7 +1175,7 @@ int32_t mz_zip_writer_zip_cd(void *handle, uint16_t compress_method, int32_t fla
mz_stream_write_uint64(file_extra_stream, number_entry);
mz_stream_mem_get_buffer(file_extra_stream, &cd_file.extrafield);
mz_stream_mem_get_buffer(file_extra_stream, (const void **)&cd_file.extrafield);
mz_stream_mem_get_buffer_length(file_extra_stream, &extrafield_size);
cd_file.extrafield_size = (uint16_t)extrafield_size;

View File

@ -372,7 +372,7 @@ void test_stream_mem(void)
mz_zip_delete(&zip_handle);
mz_stream_mem_get_buffer(write_mem_stream, (void **)&buffer_ptr);
mz_stream_mem_get_buffer(write_mem_stream, &buffer_ptr);
mz_stream_mem_seek(write_mem_stream, 0, MZ_SEEK_END);
buffer_size = (int32_t)mz_stream_mem_tell(write_mem_stream);