From 68d348d6cd945547d26e9b0d00ae3aa4e0b22eff Mon Sep 17 00:00:00 2001
From: Dominik Loidolt <dominik.loidolt@univie.ac.at>
Date: Wed, 28 Feb 2024 10:32:05 +0100
Subject: [PATCH] Some minor refactoring

---
 lib/common/compiler.h      | 4 ++--
 lib/icu_compress/cmp_icu.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/common/compiler.h b/lib/common/compiler.h
index fea1ca5..206ecc7 100644
--- a/lib/common/compiler.h
+++ b/lib/common/compiler.h
@@ -68,7 +68,7 @@
     ((b) > maximum_unsigned_value_of_type(a) - (a))
 
 
-#define __get_unaligned_t(type, ptr) ({								\
+#define __get_unaligned_t(type, ptr) __extension__ ({								\
 	const struct { type x; } __attribute__((packed)) *__pptr = (__typeof__(__pptr))(ptr);	\
 	__pptr->x;										\
 })
@@ -88,7 +88,7 @@
  * @note the size of the value is determined by the pointer type
  */
 
-#define get_unaligned(ptr)	__get_unaligned_t(__typeof__(*(ptr)), (ptr))
+#define get_unaligned(ptr) __get_unaligned_t(__typeof__(*(ptr)), (ptr))
 
 
 /**
diff --git a/lib/icu_compress/cmp_icu.c b/lib/icu_compress/cmp_icu.c
index 593740d..b2d4c5b 100644
--- a/lib/icu_compress/cmp_icu.c
+++ b/lib/icu_compress/cmp_icu.c
@@ -2305,7 +2305,7 @@ static int set_cmp_col_size(uint8_t *p, int cmp_col_size)
 	if (cmp_col_size > UINT16_MAX)
 		return -1;
 
-	v -= COLLECTION_HDR_SIZE+2;
+	v -= COLLECTION_HDR_SIZE+CMP_COLLECTION_FILD_SIZE;
 	if (p) {
 		memset(p, v >> 8, 1);
 		memset(p+1, v & 0xFF, 1);
@@ -2700,8 +2700,8 @@ int32_t compress_chunk(void *chunk, uint32_t chunk_size,
 		return -1;
 	}
 
-	err = cmp_ent_build_chunk_header((struct cmp_entity *)dst, chunk_size, &cfg,
-				      start_timestamp, cmp_size_byte);
+	err = cmp_ent_build_chunk_header((struct cmp_entity *)dst, chunk_size,
+					 &cfg, start_timestamp, cmp_size_byte);
 	if (err < 0)
 		return err;
 
-- 
GitLab