fix missing const at r/o buffers

This commit is contained in:
Sergey Markelov 2025-09-10 23:21:41 -07:00 committed by Nathan Moinvaziri
parent 8183c025de
commit 5d6cbe974d
4 changed files with 8 additions and 8 deletions

View file

@ -92,7 +92,7 @@ uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size)
} }
#if defined(HAVE_WZAES) #if defined(HAVE_WZAES)
int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt, int32_t salt_length, int32_t mz_crypt_pbkdf2(const uint8_t *password, int32_t password_length, const uint8_t *salt, int32_t salt_length,
uint32_t iteration_count, uint8_t *key, uint16_t key_length) { uint32_t iteration_count, uint8_t *key, uint16_t key_length) {
void *hmac1 = NULL; void *hmac1 = NULL;
void *hmac2 = NULL; void *hmac2 = NULL;

View file

@ -19,7 +19,7 @@ extern "C" {
uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size); uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size);
int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt, int32_t salt_length, int32_t mz_crypt_pbkdf2(const uint8_t *password, int32_t password_length, const uint8_t *salt, int32_t salt_length,
uint32_t iteration_count, uint8_t *key, uint16_t key_length); uint32_t iteration_count, uint8_t *key, uint16_t key_length);
/***************************************************************************/ /***************************************************************************/

View file

@ -185,7 +185,7 @@ int32_t mz_zip_reader_open_file_in_memory(void *handle, const char *path) {
return err; return err;
} }
int32_t mz_zip_reader_open_buffer(void *handle, uint8_t *buf, int32_t len, uint8_t copy) { int32_t mz_zip_reader_open_buffer(void *handle, const uint8_t *buf, int32_t len, uint8_t copy) {
mz_zip_reader *reader = (mz_zip_reader *)handle; mz_zip_reader *reader = (mz_zip_reader *)handle;
int32_t err = MZ_OK; int32_t err = MZ_OK;
@ -204,7 +204,7 @@ int32_t mz_zip_reader_open_buffer(void *handle, uint8_t *buf, int32_t len, uint8
mz_stream_mem_seek(reader->mem_stream, 0, MZ_SEEK_SET); mz_stream_mem_seek(reader->mem_stream, 0, MZ_SEEK_SET);
} else { } else {
mz_stream_mem_open(reader->mem_stream, NULL, MZ_OPEN_MODE_READ); mz_stream_mem_open(reader->mem_stream, NULL, MZ_OPEN_MODE_READ);
mz_stream_mem_set_buffer(reader->mem_stream, buf, len); mz_stream_mem_set_buffer(reader->mem_stream, (void *)buf, len);
} }
if (err == MZ_OK) if (err == MZ_OK)
@ -1587,7 +1587,7 @@ int32_t mz_zip_writer_add_info(void *handle, void *stream, mz_stream_read_cb rea
return err; return err;
} }
int32_t mz_zip_writer_add_buffer(void *handle, void *buf, int32_t len, mz_zip_file *file_info) { int32_t mz_zip_writer_add_buffer(void *handle, const void *buf, int32_t len, mz_zip_file *file_info) {
mz_zip_writer *writer = (mz_zip_writer *)handle; mz_zip_writer *writer = (mz_zip_writer *)handle;
void *mem_stream = NULL; void *mem_stream = NULL;
int32_t err = MZ_OK; int32_t err = MZ_OK;
@ -1602,7 +1602,7 @@ int32_t mz_zip_writer_add_buffer(void *handle, void *buf, int32_t len, mz_zip_fi
if (!mem_stream) if (!mem_stream)
return MZ_STREAM_ERROR; return MZ_STREAM_ERROR;
mz_stream_mem_set_buffer(mem_stream, buf, len); mz_stream_mem_set_buffer(mem_stream, (void *)buf, len);
err = mz_stream_mem_open(mem_stream, NULL, MZ_OPEN_MODE_READ); err = mz_stream_mem_open(mem_stream, NULL, MZ_OPEN_MODE_READ);
if (err == MZ_OK) if (err == MZ_OK)

View file

@ -37,7 +37,7 @@ int32_t mz_zip_reader_open_file(void *handle, const char *path);
int32_t mz_zip_reader_open_file_in_memory(void *handle, const char *path); int32_t mz_zip_reader_open_file_in_memory(void *handle, const char *path);
/* Opens zip file from a file path into memory for faster access */ /* Opens zip file from a file path into memory for faster access */
int32_t mz_zip_reader_open_buffer(void *handle, uint8_t *buf, int32_t len, uint8_t copy); int32_t mz_zip_reader_open_buffer(void *handle, const uint8_t *buf, int32_t len, uint8_t copy);
/* Opens zip file from memory buffer */ /* Opens zip file from memory buffer */
int32_t mz_zip_reader_close(void *handle); int32_t mz_zip_reader_close(void *handle);
@ -197,7 +197,7 @@ int32_t mz_zip_writer_add_process(void *handle, void *stream, mz_stream_read_cb
int32_t mz_zip_writer_add_info(void *handle, void *stream, mz_stream_read_cb read_cb, mz_zip_file *file_info); int32_t mz_zip_writer_add_info(void *handle, void *stream, mz_stream_read_cb read_cb, mz_zip_file *file_info);
/* Adds an entry to the zip based on the info */ /* Adds an entry to the zip based on the info */
int32_t mz_zip_writer_add_buffer(void *handle, void *buf, int32_t len, mz_zip_file *file_info); int32_t mz_zip_writer_add_buffer(void *handle, const void *buf, int32_t len, mz_zip_file *file_info);
/* Adds an entry to the zip with a memory buffer */ /* Adds an entry to the zip with a memory buffer */
int32_t mz_zip_writer_add_file(void *handle, const char *path, const char *filename_in_zip); int32_t mz_zip_writer_add_file(void *handle, const char *path, const char *filename_in_zip);