summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/io_stdin.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/sqfshelper/io_stdin.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/sqfshelper/io_stdin.c')
-rw-r--r--lib/sqfshelper/io_stdin.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/sqfshelper/io_stdin.c b/lib/sqfshelper/io_stdin.c
index 8568f5e..fec8db7 100644
--- a/lib/sqfshelper/io_stdin.c
+++ b/lib/sqfshelper/io_stdin.c
@@ -19,8 +19,8 @@ typedef struct {
sqfs_file_t base;
const sparse_map_t *map;
- uint64_t offset;
- uint64_t size;
+ sqfs_u64 offset;
+ sqfs_u64 size;
} sqfs_file_stdin_t;
@@ -29,13 +29,13 @@ static void stdin_destroy(sqfs_file_t *base)
free(base);
}
-static int stdin_read_at(sqfs_file_t *base, uint64_t offset,
+static int stdin_read_at(sqfs_file_t *base, sqfs_u64 offset,
void *buffer, size_t size)
{
sqfs_file_stdin_t *file = (sqfs_file_stdin_t *)base;
size_t temp_size = 0;
- uint8_t *temp = NULL;
- uint64_t diff;
+ sqfs_u8 *temp = NULL;
+ sqfs_u64 diff;
ssize_t ret;
if (offset < file->offset)
@@ -52,7 +52,7 @@ static int stdin_read_at(sqfs_file_t *base, uint64_t offset,
while (size > 0) {
if (offset > file->offset) {
diff = file->offset - offset;
- diff = diff > (uint64_t)temp_size ? temp_size : diff;
+ diff = diff > (sqfs_u64)temp_size ? temp_size : diff;
ret = read(STDIN_FILENO, temp, diff);
} else {
@@ -80,11 +80,11 @@ static int stdin_read_at(sqfs_file_t *base, uint64_t offset,
return 0;
}
-static int stdin_read_condensed(sqfs_file_t *base, uint64_t offset,
+static int stdin_read_condensed(sqfs_file_t *base, sqfs_u64 offset,
void *buffer, size_t size)
{
sqfs_file_stdin_t *file = (sqfs_file_stdin_t *)base;
- uint64_t poffset = 0, src_start;
+ sqfs_u64 poffset = 0, src_start;
size_t dst_start, diff, count;
const sparse_map_t *it;
int err;
@@ -134,25 +134,25 @@ static int stdin_read_condensed(sqfs_file_t *base, uint64_t offset,
return 0;
}
-static int stdin_write_at(sqfs_file_t *base, uint64_t offset,
+static int stdin_write_at(sqfs_file_t *base, sqfs_u64 offset,
const void *buffer, size_t size)
{
(void)base; (void)offset; (void)buffer; (void)size;
return SQFS_ERROR_IO;
}
-static uint64_t stdin_get_size(const sqfs_file_t *base)
+static sqfs_u64 stdin_get_size(const sqfs_file_t *base)
{
return ((const sqfs_file_stdin_t *)base)->size;
}
-static int stdin_truncate(sqfs_file_t *base, uint64_t size)
+static int stdin_truncate(sqfs_file_t *base, sqfs_u64 size)
{
(void)base; (void)size;
return SQFS_ERROR_IO;
}
-sqfs_file_t *sqfs_get_stdin_file(const sparse_map_t *map, uint64_t size)
+sqfs_file_t *sqfs_get_stdin_file(const sparse_map_t *map, sqfs_u64 size)
{
sqfs_file_stdin_t *file = calloc(1, sizeof(*file));
sqfs_file_t *base = (sqfs_file_t *)file;