Skip to content

Commit

Permalink
Fixed bugs compiling liblzma with libcompression.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Oct 25, 2020
1 parent 1a7e7e4 commit a734386
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 56 deletions.
35 changes: 0 additions & 35 deletions mz_strm_libcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,38 +389,3 @@ void *mz_stream_zlib_create(void **stream) {
void *mz_stream_zlib_get_interface(void) {
return (void *)&mz_stream_zlib_vtbl;
}

/***************************************************************************/

static mz_stream_vtbl mz_stream_lzma_vtbl = {
mz_stream_libcomp_open,
mz_stream_libcomp_is_open,
mz_stream_libcomp_read,
mz_stream_libcomp_write,
mz_stream_libcomp_tell,
mz_stream_libcomp_seek,
mz_stream_libcomp_close,
mz_stream_libcomp_error,
mz_stream_lzma_create,
mz_stream_libcomp_delete,
mz_stream_libcomp_get_prop_int64,
mz_stream_libcomp_set_prop_int64
};

void *mz_stream_lzma_create(void **stream) {
mz_stream_libcomp *libcomp = NULL;
void *stream_int = NULL;
mz_stream_libcomp_create(&stream_int);
if (stream_int != NULL) {
libcomp = (mz_stream_libcomp *)stream_int;
libcomp->stream.vtbl = &mz_stream_lzma_vtbl;
libcomp->method = MZ_COMPRESS_METHOD_XZ;
}
if (stream != NULL)
*stream = stream_int;
return stream_int;
}

void *mz_stream_lzma_get_interface(void) {
return (void *)&mz_stream_lzma_vtbl;
}
20 changes: 0 additions & 20 deletions mz_strm_libcomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,6 @@ void* mz_stream_zlib_get_crc32_update(void);

/***************************************************************************/

int32_t mz_stream_lzma_open(void *stream, const char *filename, int32_t mode);
int32_t mz_stream_lzma_is_open(void *stream);
int32_t mz_stream_lzma_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_lzma_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_lzma_tell(void *stream);
int32_t mz_stream_lzma_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_lzma_close(void *stream);
int32_t mz_stream_lzma_error(void *stream);

int32_t mz_stream_lzma_get_prop_int64(void *stream, int32_t prop, int64_t *value);
int32_t mz_stream_lzma_set_prop_int64(void *stream, int32_t prop, int64_t value);

void* mz_stream_lzma_create(void **stream);
void mz_stream_lzma_delete(void **stream);

void* mz_stream_lzma_get_interface(void);
void* mz_stream_lzma_get_crc32_update(void);

/***************************************************************************/

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion mz_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ static int32_t mz_zip_entry_open_int(void *handle, uint8_t raw, int16_t compress
#endif
#ifdef HAVE_LIBCOMP
else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) {
mz_stream_lzma_create(&zip->compress_stream);
mz_stream_libcomp_create(&zip->compress_stream);
mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD,
zip->file_info.compression_method);
}
Expand Down

0 comments on commit a734386

Please sign in to comment.