summaryrefslogtreecommitdiff
path: root/lib/sqfs/meta_writer.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-27 18:15:40 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-27 18:15:40 +0200
commit40232f4bd4d7e8e001f7d1e8f120606f59b2c147 (patch)
tree5d763f4f22a487fd2e669efe0970615096f1f5fd /lib/sqfs/meta_writer.c
parentf6904a98bffe0bce5fc6aac408c141a25c0e05ab (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/meta_writer.c')
-rw-r--r--lib/sqfs/meta_writer.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sqfs/meta_writer.c b/lib/sqfs/meta_writer.c
index 2edc91a..a5ce366 100644
--- a/lib/sqfs/meta_writer.c
+++ b/lib/sqfs/meta_writer.c
@@ -22,7 +22,7 @@ typedef struct meta_block_t {
struct meta_block_t *next;
/* possibly compressed data with 2 byte header */
- uint8_t data[SQFS_META_BLOCK_SIZE + 2];
+ sqfs_u8 data[SQFS_META_BLOCK_SIZE + 2];
} meta_block_t;
struct sqfs_meta_writer_t {
@@ -39,7 +39,7 @@ struct sqfs_meta_writer_t {
sqfs_compressor_t *cmp;
/* The raw data chunk that data is appended to */
- uint8_t data[SQFS_META_BLOCK_SIZE];
+ sqfs_u8 data[SQFS_META_BLOCK_SIZE];
int flags;
meta_block_t *list;
@@ -48,8 +48,8 @@ struct sqfs_meta_writer_t {
static int write_block(sqfs_file_t *file, meta_block_t *outblk)
{
- size_t count = le16toh(((uint16_t *)outblk->data)[0]) & 0x7FFF;
- uint64_t off = file->get_size(file);
+ size_t count = le16toh(((sqfs_u16 *)outblk->data)[0]) & 0x7FFF;
+ sqfs_u64 off = file->get_size(file);
return file->write_at(file, off, outblk->data, count + 2);
}
@@ -107,10 +107,10 @@ int sqfs_meta_writer_flush(sqfs_meta_writer_t *m)
}
if (ret > 0) {
- ((uint16_t *)outblk->data)[0] = htole16(ret);
+ ((sqfs_u16 *)outblk->data)[0] = htole16(ret);
count = ret + 2;
} else {
- ((uint16_t *)outblk->data)[0] = htole16(m->offset | 0x8000);
+ ((sqfs_u16 *)outblk->data)[0] = htole16(m->offset | 0x8000);
memcpy(outblk->data + 2, m->data, m->offset);
count = m->offset + 2;
}
@@ -167,8 +167,8 @@ int sqfs_meta_writer_append(sqfs_meta_writer_t *m, const void *data,
}
void sqfs_meta_writer_get_position(const sqfs_meta_writer_t *m,
- uint64_t *block_start,
- uint32_t *offset)
+ sqfs_u64 *block_start,
+ sqfs_u32 *offset)
{
*block_start = m->block_offset;
*offset = m->offset;