[PATCH 03/13] Avoid signed bitfields

John Keeping john at keeping.me.uk
Sun Mar 8 17:32:17 CET 2015


Bitfields are only defined for unsigned types.

Detected by sparse.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 ui-blob.c | 4 ++--
 ui-diff.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui-blob.c b/ui-blob.c
index a025bca..388a017 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -14,8 +14,8 @@
 struct walk_tree_context {
 	const char *match_path;
 	unsigned char *matched_sha1;
-	int found_path:1;
-	int file_only:1;
+	unsigned int found_path:1;
+	unsigned int file_only:1;
 };
 
 static int walk_tree(const unsigned char *sha1, struct strbuf *base,
diff --git a/ui-diff.c b/ui-diff.c
index 8eff178..1cf2ce0 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -31,7 +31,7 @@ static struct fileinfo {
 	unsigned int removed;
 	unsigned long old_size;
 	unsigned long new_size;
-	int binary:1;
+	unsigned int binary:1;
 } *items;
 
 static int use_ssdiff = 0;
-- 
2.3.1.308.g754cd77



More information about the CGit mailing list