Cleanup, fixed formatting.

This commit is contained in:
Nathan Moinvaziri 2018-07-11 15:34:45 -07:00
parent d7814e9b8d
commit b0a005644d
7 changed files with 69 additions and 59 deletions

View File

@ -304,21 +304,23 @@ int32_t mz_stream_aes_get_prop_int64(void *stream, int32_t prop, int64_t *value)
{
case MZ_STREAM_PROP_TOTAL_IN:
*value = aes->total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = aes->total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = aes->max_total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = MZ_AES_SALT_LENGTH(aes->encryption_mode) + MZ_AES_PW_VERIFY_SIZE;
return MZ_OK;
break;
case MZ_STREAM_PROP_FOOTER_SIZE:
*value = MZ_AES_AUTHCODE_SIZE;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
int32_t mz_stream_aes_set_prop_int64(void *stream, int32_t prop, int64_t value)
@ -328,9 +330,11 @@ int32_t mz_stream_aes_set_prop_int64(void *stream, int32_t prop, int64_t value)
{
case MZ_STREAM_PROP_TOTAL_IN_MAX:
aes->max_total_in = value;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
void *mz_stream_aes_create(void **stream)

View File

@ -340,18 +340,20 @@ int32_t mz_stream_bzip_get_prop_int64(void *stream, int32_t prop, int64_t *value
{
case MZ_STREAM_PROP_TOTAL_IN:
*value = bzip->total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = bzip->max_total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = bzip->total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = 0;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
int32_t mz_stream_bzip_set_prop_int64(void *stream, int32_t prop, int64_t value)

View File

@ -17,8 +17,6 @@
#include "zlib.h"
#endif
#include <time.h>
#include "mz.h"
#include "mz_strm.h"
#include "mz_strm_crc32.h"
@ -142,12 +140,14 @@ int32_t mz_stream_crc32_get_prop_int64(void *stream, int32_t prop, int64_t *valu
{
case MZ_STREAM_PROP_TOTAL_IN:
*value = crc32->total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = crc32->total_out;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
void *mz_stream_crc32_create(void **stream)
@ -161,16 +161,6 @@ void *mz_stream_crc32_create(void **stream)
crc32->stream.vtbl = &mz_stream_crc32_vtbl;
}
#ifdef HAVE_ZLIB
crc32->update =
(mz_stream_crc32_update)mz_stream_zlib_get_crc32_update();
#elif defined(HAVE_LZMA)
crc32->update =
(mz_stream_crc32_update)mz_stream_lzma_get_crc32_update();
#else
#error ZLIB or LZMA required for CRC32
#endif
if (stream != NULL)
*stream = crc32;

View File

@ -359,21 +359,23 @@ int32_t mz_stream_lzma_get_prop_int64(void *stream, int32_t prop, int64_t *value
{
case MZ_STREAM_PROP_TOTAL_IN:
*value = lzma->total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = lzma->max_total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = lzma->total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT_MAX:
*value = lzma->max_total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = MZ_LZMA_HEADER_SIZE;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
int32_t mz_stream_lzma_set_prop_int64(void *stream, int32_t prop, int64_t value)
@ -386,17 +388,19 @@ int32_t mz_stream_lzma_set_prop_int64(void *stream, int32_t prop, int64_t value)
lzma->preset = LZMA_PRESET_EXTREME;
else
lzma->preset = LZMA_PRESET_DEFAULT;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
lzma->max_total_in = value;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT_MAX:
if (value < -1)
return MZ_PARAM_ERROR;
lzma->max_total_out = value;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
void *mz_stream_lzma_create(void **stream)

View File

@ -136,7 +136,7 @@ int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode)
int16_t i = 0;
//uint8_t verify1 = 0;
uint8_t verify2 = 0;
uint8_t header[RAND_HEAD_LEN] = { 0 };
uint8_t header[RAND_HEAD_LEN];
const char *password = path;
pkcrypt->total_in = 0;
@ -293,18 +293,20 @@ int32_t mz_stream_pkcrypt_get_prop_int64(void *stream, int32_t prop, int64_t *va
{
case MZ_STREAM_PROP_TOTAL_IN:
*value = pkcrypt->total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = pkcrypt->total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = RAND_HEAD_LEN;
return MZ_OK;
break;
case MZ_STREAM_PROP_FOOTER_SIZE:
*value = 0;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
void *mz_stream_pkcrypt_create(void **stream)

View File

@ -338,15 +338,17 @@ int32_t mz_stream_split_get_prop_int64(void *stream, int32_t prop, int64_t *valu
{
case MZ_STREAM_PROP_TOTAL_OUT:
*value = split->total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_DISK_NUMBER:
*value = split->number_disk;
return MZ_OK;
break;
case MZ_STREAM_PROP_DISK_SIZE:
*value = split->disk_size;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
int32_t mz_stream_split_set_prop_int64(void *stream, int32_t prop, int64_t value)
@ -356,12 +358,14 @@ int32_t mz_stream_split_set_prop_int64(void *stream, int32_t prop, int64_t value
{
case MZ_STREAM_PROP_DISK_NUMBER:
split->number_disk = (int32_t)value;
return MZ_OK;
break;
case MZ_STREAM_PROP_DISK_SIZE:
split->disk_size = value;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
void *mz_stream_split_create(void **stream)

View File

@ -352,18 +352,20 @@ int32_t mz_stream_zlib_get_prop_int64(void *stream, int32_t prop, int64_t *value
{
case MZ_STREAM_PROP_TOTAL_IN:
*value = zlib->total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = zlib->max_total_in;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = zlib->total_out;
return MZ_OK;
break;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = 0;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
int32_t mz_stream_zlib_set_prop_int64(void *stream, int32_t prop, int64_t value)
@ -373,12 +375,14 @@ int32_t mz_stream_zlib_set_prop_int64(void *stream, int32_t prop, int64_t value)
{
case MZ_STREAM_PROP_COMPRESS_LEVEL:
zlib->level = (int16_t)value;
return MZ_OK;
break;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
zlib->max_total_in = value;
return MZ_OK;
break;
default:
return MZ_EXIST_ERROR;
}
return MZ_EXIST_ERROR;
return MZ_OK;
}
void *mz_stream_zlib_create(void **stream)