diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-27 18:15:40 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-27 18:15:40 +0200 |
commit | 40232f4bd4d7e8e001f7d1e8f120606f59b2c147 (patch) | |
tree | 5d763f4f22a487fd2e669efe0970615096f1f5fd /lib/sqfs/comp/compressor.c | |
parent | f6904a98bffe0bce5fc6aac408c141a25c0e05ab (diff) |
Cleanup: replace fixed with data types with typedefs
This is a fully automated search and replace, i.e. I ran this:
git grep -l uint8_t | xargs sed -i 's/uint8_t/sqfs_u8/g'
git grep -l uint16_t | xargs sed -i 's/uint16_t/sqfs_u16/g'
git grep -l uint32_t | xargs sed -i 's/uint32_t/sqfs_u32/g'
git grep -l uint64_t | xargs sed -i 's/uint64_t/sqfs_u64/g'
git grep -l int8_t | xargs sed -i 's/int8_t/sqfs_s8/g'
git grep -l int16_t | xargs sed -i 's/int16_t/sqfs_s16/g'
git grep -l int32_t | xargs sed -i 's/int32_t/sqfs_s32/g'
git grep -l int64_t | xargs sed -i 's/int64_t/sqfs_s64/g'
and than added the appropriate definitions to sqfs/predef.h
The whole point being better compatibillity with platforms that may
not have an stdint.h with the propper definitions.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/comp/compressor.c')
-rw-r--r-- | lib/sqfs/comp/compressor.c | 10 |
1 files changed, 5 insertions, 5 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)); |