summaryrefslogtreecommitdiff
path: root/lib/sqfs/comp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/comp')
-rw-r--r--lib/sqfs/comp/compressor.c10
-rw-r--r--lib/sqfs/comp/gzip.c14
-rw-r--r--lib/sqfs/comp/lz4.c12
-rw-r--r--lib/sqfs/comp/lzma.c10
-rw-r--r--lib/sqfs/comp/lzo.c14
-rw-r--r--lib/sqfs/comp/xz.c18
-rw-r--r--lib/sqfs/comp/zstd.c10
7 files changed, 44 insertions, 44 deletions
diff --git a/lib/sqfs/comp/compressor.c b/lib/sqfs/comp/compressor.c
index 37f852c..bfc20b7 100644
--- a/lib/sqfs/comp/compressor.c
+++ b/lib/sqfs/comp/compressor.c
@@ -46,10 +46,10 @@ static const char *names[] = {
int sqfs_generic_write_options(sqfs_file_t *file, const void *data, size_t size)
{
- uint8_t buffer[size + 2];
+ sqfs_u8 buffer[size + 2];
int ret;
- *((uint16_t *)buffer) = htole16(0x8000 | size);
+ *((sqfs_u16 *)buffer) = htole16(0x8000 | size);
memcpy(buffer + 2, data, size);
ret = file->write_at(file, sizeof(sqfs_super_t),
@@ -62,7 +62,7 @@ int sqfs_generic_write_options(sqfs_file_t *file, const void *data, size_t size)
int sqfs_generic_read_options(sqfs_file_t *file, void *data, size_t size)
{
- uint8_t buffer[size + 2];
+ sqfs_u8 buffer[size + 2];
int ret;
ret = file->read_at(file, sizeof(sqfs_super_t),
@@ -70,7 +70,7 @@ int sqfs_generic_read_options(sqfs_file_t *file, void *data, size_t size)
if (ret)
return ret;
- if (le16toh(*((uint16_t *)buffer)) != (0x8000 | size))
+ if (le16toh(*((sqfs_u16 *)buffer)) != (0x8000 | size))
return SQFS_ERROR_CORRUPTED;
memcpy(data, buffer + 2, size);
@@ -120,7 +120,7 @@ int sqfs_compressor_id_from_name(const char *name, E_SQFS_COMPRESSOR *out)
int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg,
E_SQFS_COMPRESSOR id,
- size_t block_size, uint16_t flags)
+ size_t block_size, sqfs_u16 flags)
{
memset(cfg, 0, sizeof(*cfg));
diff --git a/lib/sqfs/comp/gzip.c b/lib/sqfs/comp/gzip.c
index 0c6f944..3dd8d10 100644
--- a/lib/sqfs/comp/gzip.c
+++ b/lib/sqfs/comp/gzip.c
@@ -16,9 +16,9 @@
#include "internal.h"
typedef struct {
- uint32_t level;
- uint16_t window;
- uint16_t strategies;
+ sqfs_u32 level;
+ sqfs_u16 window;
+ sqfs_u16 strategies;
} gzip_options_t;
typedef struct {
@@ -106,8 +106,8 @@ static int flag_to_zlib_strategy(int flag)
return 0;
}
-static int find_strategy(gzip_compressor_t *gzip, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static int find_strategy(gzip_compressor_t *gzip, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
int ret, strategy, selected = Z_DEFAULT_STRATEGY;
size_t i, length, minlength = 0;
@@ -148,8 +148,8 @@ static int find_strategy(gzip_compressor_t *gzip, const uint8_t *in,
return selected;
}
-static ssize_t gzip_do_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t gzip_do_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
gzip_compressor_t *gzip = (gzip_compressor_t *)base;
int ret, strategy = 0;
diff --git a/lib/sqfs/comp/lz4.c b/lib/sqfs/comp/lz4.c
index db44bc4..35fd629 100644
--- a/lib/sqfs/comp/lz4.c
+++ b/lib/sqfs/comp/lz4.c
@@ -22,8 +22,8 @@ typedef struct {
} lz4_compressor_t;
typedef struct {
- uint32_t version;
- uint32_t flags;
+ sqfs_u32 version;
+ sqfs_u32 flags;
} lz4_options;
#define LZ4LEGACY 1
@@ -59,8 +59,8 @@ static int lz4_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return 0;
}
-static ssize_t lz4_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lz4_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lz4_compressor_t *lz4 = (lz4_compressor_t *)base;
int ret;
@@ -79,8 +79,8 @@ static ssize_t lz4_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return ret;
}
-static ssize_t lz4_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lz4_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
int ret;
(void)base;
diff --git a/lib/sqfs/comp/lzma.c b/lib/sqfs/comp/lzma.c
index 57a942e..f4211fb 100644
--- a/lib/sqfs/comp/lzma.c
+++ b/lib/sqfs/comp/lzma.c
@@ -39,8 +39,8 @@ static int lzma_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return SQFS_ERROR_UNSUPPORTED;
}
-static ssize_t lzma_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzma_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lzma_compressor_t *lzma = (lzma_compressor_t *)base;
lzma_stream strm = LZMA_STREAM_INIT;
@@ -83,10 +83,10 @@ static ssize_t lzma_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return strm.total_out;
}
-static ssize_t lzma_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzma_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
- uint8_t lzma_header[LZMA_HEADER_SIZE];
+ sqfs_u8 lzma_header[LZMA_HEADER_SIZE];
lzma_stream strm = LZMA_STREAM_INIT;
size_t hdrsize;
int ret;
diff --git a/lib/sqfs/comp/lzo.c b/lib/sqfs/comp/lzo.c
index 0b140b8..9af3321 100644
--- a/lib/sqfs/comp/lzo.c
+++ b/lib/sqfs/comp/lzo.c
@@ -51,12 +51,12 @@ typedef struct {
int algorithm;
int level;
- uint8_t buffer[];
+ sqfs_u8 buffer[];
} lzo_compressor_t;
typedef struct {
- uint32_t algorithm;
- uint32_t level;
+ sqfs_u32 algorithm;
+ sqfs_u32 level;
} lzo_options_t;
static int lzo_write_options(sqfs_compressor_t *base, sqfs_file_t *file)
@@ -112,8 +112,8 @@ static int lzo_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return 0;
}
-static ssize_t lzo_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzo_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
lzo_uint len = outsize;
@@ -138,8 +138,8 @@ static ssize_t lzo_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return 0;
}
-static ssize_t lzo_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t lzo_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
lzo_uint len = outsize;
diff --git a/lib/sqfs/comp/xz.c b/lib/sqfs/comp/xz.c
index f0229e0..d905f2d 100644
--- a/lib/sqfs/comp/xz.c
+++ b/lib/sqfs/comp/xz.c
@@ -22,8 +22,8 @@ typedef struct {
} xz_compressor_t;
typedef struct {
- uint32_t dict_size;
- uint32_t flags;
+ sqfs_u32 dict_size;
+ sqfs_u32 flags;
} xz_options_t;
static bool is_dict_size_valid(size_t size)
@@ -75,8 +75,8 @@ static int xz_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
}
static ssize_t compress(xz_compressor_t *xz, lzma_vli filter,
- const uint8_t *in, size_t size,
- uint8_t *out, size_t outsize)
+ const sqfs_u8 *in, size_t size,
+ sqfs_u8 *out, size_t outsize)
{
lzma_filter filters[5];
lzma_options_lzma opt;
@@ -135,8 +135,8 @@ static lzma_vli flag_to_vli(int flag)
return LZMA_VLI_UNKNOWN;
}
-static ssize_t xz_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t xz_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
xz_compressor_t *xz = (xz_compressor_t *)base;
lzma_vli filter, selected = LZMA_VLI_UNKNOWN;
@@ -171,10 +171,10 @@ static ssize_t xz_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return compress(xz, selected, in, size, out, outsize);
}
-static ssize_t xz_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t xz_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
- uint64_t memlimit = 32 * 1024 * 1024;
+ sqfs_u64 memlimit = 32 * 1024 * 1024;
size_t dest_pos = 0;
size_t src_pos = 0;
lzma_ret ret;
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c
index 50440a0..81e369b 100644
--- a/lib/sqfs/comp/zstd.c
+++ b/lib/sqfs/comp/zstd.c
@@ -22,7 +22,7 @@ typedef struct {
} zstd_compressor_t;
typedef struct {
- uint32_t level;
+ sqfs_u32 level;
} zstd_options_t;
static int zstd_write_options(sqfs_compressor_t *base, sqfs_file_t *file)
@@ -51,8 +51,8 @@ static int zstd_read_options(sqfs_compressor_t *base, sqfs_file_t *file)
return 0;
}
-static ssize_t zstd_comp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
zstd_compressor_t *zstd = (zstd_compressor_t *)base;
size_t ret;
@@ -66,8 +66,8 @@ static ssize_t zstd_comp_block(sqfs_compressor_t *base, const uint8_t *in,
return ret < size ? ret : 0;
}
-static ssize_t zstd_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t zstd_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
+ size_t size, sqfs_u8 *out, size_t outsize)
{
size_t ret;
(void)base;