From 40232f4bd4d7e8e001f7d1e8f120606f59b2c147 Mon Sep 17 00:00:00 2001
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Date: Fri, 27 Sep 2019 18:15:40 +0200
Subject: 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>
---
 lib/fstree/fstree.c            | 2 +-
 lib/fstree/source_date_epoch.c | 4 ++--
 lib/fstree/xattr.c             | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

(limited to 'lib/fstree')

diff --git a/lib/fstree/fstree.c b/lib/fstree/fstree.c
index c7c4a23..357fd3d 100644
--- a/lib/fstree/fstree.c
+++ b/lib/fstree/fstree.c
@@ -66,7 +66,7 @@ static int process_defaults(struct stat *sb, char *subopts)
 				goto fail_uv;
 			if (lval > 07777)
 				goto fail_ov;
-			sb->st_mode = S_IFDIR | (uint16_t)lval;
+			sb->st_mode = S_IFDIR | (sqfs_u16)lval;
 			break;
 		case DEF_MTIME:
 			lval = strtol(value, NULL, 0);
diff --git a/lib/fstree/source_date_epoch.c b/lib/fstree/source_date_epoch.c
index bbf2e42..9b47d56 100644
--- a/lib/fstree/source_date_epoch.c
+++ b/lib/fstree/source_date_epoch.c
@@ -11,10 +11,10 @@
 #include <stdio.h>
 #include <ctype.h>
 
-uint32_t get_source_date_epoch(void)
+sqfs_u32 get_source_date_epoch(void)
 {
 	const char *str, *ptr;
-	uint32_t x, tval = 0;
+	sqfs_u32 x, tval = 0;
 
 	str = getenv("SOURCE_DATE_EPOCH");
 
diff --git a/lib/fstree/xattr.c b/lib/fstree/xattr.c
index c37c734..45ea8a6 100644
--- a/lib/fstree/xattr.c
+++ b/lib/fstree/xattr.c
@@ -38,10 +38,10 @@ static tree_xattr_t *grow_xattr_block(tree_xattr_t *xattr)
 	if (xattr != NULL) {
 		if (SZ_MUL_OV(xattr->max_attr, 2, &new_count))
 			goto fail_ov;
-		old_size = sizeof(*xattr) + sizeof(uint64_t) * xattr->max_attr;
+		old_size = sizeof(*xattr) + sizeof(sqfs_u64) * xattr->max_attr;
 	}
 
-	if (SZ_MUL_OV(sizeof(uint64_t), new_count, &new_size) ||
+	if (SZ_MUL_OV(sizeof(sqfs_u64), new_count, &new_size) ||
 	    SZ_ADD_OV(sizeof(*xattr), new_size, &new_size)) {
 		goto fail_ov;
 	}
@@ -75,7 +75,7 @@ int fstree_add_xattr(fstree_t *fs, tree_node_t *node,
 	if (str_table_get_index(&fs->xattr_values, value, &value_idx))
 		return -1;
 
-	if (sizeof(size_t) > sizeof(uint32_t)) {
+	if (sizeof(size_t) > sizeof(sqfs_u32)) {
 		if (key_idx > 0xFFFFFFFFUL) {
 			fputs("Too many unique xattr keys\n", stderr);
 			return -1;
@@ -116,7 +116,7 @@ static int cmp_attr(const void *lhs, const void *rhs)
 
 void fstree_xattr_reindex(fstree_t *fs)
 {
-	uint32_t key_idx, value_idx;
+	sqfs_u32 key_idx, value_idx;
 	size_t i, index = 0;
 	tree_xattr_t *it;
 
-- 
cgit v1.2.3