Skip to content

Commit 92f314f

Browse files
committed
fix(xz): Fix incorrect prototype of xz_decompress()'s error callback function
1 parent 74bfdda commit 92f314f

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

components/utilities/xz/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ChangeLog
22

3+
## v1.0.1 - 2025-2-20
4+
5+
### bugfix:
6+
7+
- Fix incorrect prototype of the `error` callback of `xz_decompress`
8+
39
## v1.0.0 - 2023-2-10
410

511
First release version.

components/utilities/xz/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.0.0"
1+
version: "1.0.1"
22
description: xz decompression utility
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/utilities/xz
44
dependencies:

components/utilities/xz/include/xz_decompress.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" {
1717
* of the native XZ decoder API. The single-call mode can be used only when
1818
* both input and output buffers are available as a single chunk, i.e. when
1919
* fill() and flush() won't be used.
20-
*
20+
*
2121
* @param[in] in pointer to the input buffer to be decompressed
2222
* @param[in] in_size size of the input buffer
2323
* @param[in] fill pointer to the function used to read compressed data
@@ -34,7 +34,7 @@ int xz_decompress(unsigned char *in, int in_size,
3434
int (*fill)(void *dest, unsigned int size),
3535
int (*flush)(void *src, unsigned int size),
3636
unsigned char *out, int *in_used,
37-
void (*error)(char *x));
37+
void (*error)(const char *x));
3838

3939
#ifdef __cplusplus
4040
}

components/utilities/xz/src/xz_decompress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int xz_decompress(unsigned char *in, int in_size,
125125
int (*fill)(void *dest, unsigned int size),
126126
int (*flush)(void *src, unsigned int size),
127127
unsigned char *out, int *in_used,
128-
void (*error)(char *x))
128+
void (*error)(const char *x))
129129
{
130130
struct xz_buf b;
131131
struct xz_dec *s;

examples/utilities/xz_decompress_file/main/xz_decompress_file_example_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static size_t filled_length;
2424

2525
static const char *TAG = "xz decompress";
2626

27-
static void error(char *msg)
27+
static void error(const char *msg)
2828
{
2929
ESP_LOGE("xz_test", "%s", msg);
3030
}
@@ -53,7 +53,7 @@ static void test_buf_to_buf(void)
5353
* Read compressed data from in_buf, and write decompressed data to out_buf.
5454
* When you can estimate how much data will be extracted, you can use this API like this.
5555
*/
56-
int ret = xz_decompress((unsigned char *)xz_compressed_file_start, compressed_file_length, NULL, NULL, (unsigned char *)out_buf, &decompressed_count, error);
56+
int ret = xz_decompress((unsigned char *)xz_compressed_file_start, compressed_file_length, NULL, NULL, (unsigned char *)out_buf, &decompressed_count, &error);
5757
// Display the read contents from the decompressed buf
5858
ESP_LOGI(TAG, "decompress data:\n%s", out_buf);
5959
ESP_LOGI(TAG, "ret = %d, decompressed count is %d", ret, decompressed_count);

0 commit comments

Comments
 (0)