diff --git a/examples/example_cmp_icu.c b/examples/example_cmp_icu.c
index ba704fcb2eeffcfb062082ab75be014766eaa8ce..f0d783e8523fc7e2177bcf81a57b1147a44a5600 100644
--- a/examples/example_cmp_icu.c
+++ b/examples/example_cmp_icu.c
@@ -39,7 +39,7 @@
 #define MODEL_COUNTER 1
 
 
-int demo_icu_compression(void)
+static int demo_icu_compression(void)
 {
 	struct cmp_cfg example_cfg;
 	struct cmp_entity *cmp_entity = NULL;
diff --git a/examples/example_cmp_rdcu.c b/examples/example_cmp_rdcu.c
index 9bf81cea40f715b6f563496768618a2c2e1e039e..93c76dfa469604502d9cf8ff41b1f72d86b62f6c 100644
--- a/examples/example_cmp_rdcu.c
+++ b/examples/example_cmp_rdcu.c
@@ -23,6 +23,7 @@
 
 #include <cmp_rdcu.h>
 #include <cmp_entity.h>
+#include <leon_inttypes.h>
 
 #define MAX_PAYLOAD_SIZE 4096
 #define DATA_SAMPLES 6  /* number of 16 bit samples to compress */
@@ -148,7 +149,7 @@ int demo_rdcu_compression(void)
 		/* get the size of the compression entity */
 		cmp_ent_size = cmp_ent_build(NULL, CMP_ASW_VERSION_ID,
 					     START_TIME, END_TIME, MODEL_ID, MODEL_COUNTER,
-					     &example_cfg, example_info.cmp_size);
+					     &example_cfg, (int)example_info.cmp_size);
 		if (!cmp_ent_size) {
 			printf("Error occurred during cmp_ent_build()\n");
 			return -1;
@@ -164,7 +165,7 @@ int demo_rdcu_compression(void)
 		/* now let us build the compression entity */
 		cmp_ent_size = cmp_ent_build(cmp_ent, CMP_ASW_VERSION_ID,
 					     START_TIME, END_TIME, MODEL_ID, MODEL_COUNTER,
-					     &example_cfg, example_info.cmp_size);
+					     &example_cfg, (int)example_info.cmp_size);
 		if (!cmp_ent_size) {
 			printf("Error occurred during cmp_ent_build()\n");
 			return -1;
@@ -186,7 +187,7 @@ int demo_rdcu_compression(void)
 		}
 
 		s = cmp_ent_get_size(cmp_ent);
-		printf("\n\nHere's the compressed data including the header (size %lu):\n"
+		printf("\n\nHere's the compressed data including the header (size %"PRIu32"):\n"
 		       "============================================================\n", s);
 		for (i = 0; i < s; i++) {
 			uint8_t *p = (uint8_t *)cmp_ent;
diff --git a/lib/common/byteorder.h b/lib/common/byteorder.h
index 634e184324ffbac06efd89a41d7f563bbd51b6c5..fc5ff3512c3be848dcb709c893321720cdf15e7e 100644
--- a/lib/common/byteorder.h
+++ b/lib/common/byteorder.h
@@ -56,7 +56,7 @@
 #ifndef __BIG_ENDIAN
 #  if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
 #    define __BIG_ENDIAN 4321
-#  elif defined(__clang__) && __BIG_ENDIAN__
+#  elif defined(__clang__) && defined(__BIG_ENDIAN__)
 #    define __BIG_ENDIAN 4321
 #  elif defined(__sparc__)
 #    define __BIG_ENDIAN 4321
@@ -66,7 +66,7 @@
 #ifndef __LITTLE_ENDIAN
 #  if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
 #    define __LITTLE_ENDIAN 1234
-#  elif defined(__clang__) && __LITTLE_ENDIAN__
+#  elif defined(__clang__) & defined(__LITTLE_ENDIAN__)
 #    define __LITTLE_ENDIAN 1234
 #  elif defined(_MSC_VER) && (_M_AMD64 || _M_IX86)
 #    define __LITTLE_ENDIAN 1234
diff --git a/lib/common/cmp_data_types.c b/lib/common/cmp_data_types.c
index f548702fb487d89d68b8f3dae91c63c724afaa02..11ebe418ddaea18a3643e4f2039ec22360eed06b 100644
--- a/lib/common/cmp_data_types.c
+++ b/lib/common/cmp_data_types.c
@@ -26,6 +26,12 @@
 #include "cmp_data_types.h"
 
 
+#ifdef __BIG_ENDIAN
+#  define CMP_IS_BIG_ENDIAN 1
+#else
+#  define CMP_IS_BIG_ENDIAN 0
+#endif
+
 /**
  * @brief get the collection timestamp from the collection header
  *
@@ -885,7 +891,9 @@ int be_to_cpu_data_type(void *data, uint32_t data_size_byte, enum cmp_data_type
 	}
 	samples = data_size_byte / sample_size;
 
-#ifdef __LITTLE_ENDIAN
+	if (CMP_IS_BIG_ENDIAN)
+		return 0;
+
 	switch (data_type) {
 	case DATA_TYPE_IMAGETTE:
 	case DATA_TYPE_IMAGETTE_ADAPTIVE:
@@ -949,7 +957,6 @@ int be_to_cpu_data_type(void *data, uint32_t data_size_byte, enum cmp_data_type
 		return -1;
 	/* LCOV_EXCL_STOP */
 	}
-#endif /* __LITTLE_ENDIAN */
 
 	return 0;
 }
diff --git a/lib/common/cmp_entity.c b/lib/common/cmp_entity.c
index 73f91679fff990a72c93aa0b34da6c586c8ffac3..056b41fa49337c4ba758bf929bf0f28daebe621c 100644
--- a/lib/common/cmp_entity.c
+++ b/lib/common/cmp_entity.c
@@ -2174,11 +2174,13 @@ static time_t my_timegm(struct tm *tm)
 uint64_t cmp_ent_create_timestamp(const struct timespec *ts)
 {
 	struct tm epoch_date = PLATO_EPOCH_DATE;
-	struct timespec epoch = { my_timegm(&epoch_date), 0 };
+	struct timespec epoch = {0, 0 };
 	struct timespec now = { 0, 0 };
 	double seconds;
 	uint64_t coarse, fine;
 
+	epoch.tv_sec = my_timegm(&epoch_date);
+
 	/* LCOV_EXCL_START */
 	/* if time cannot be represented as a time_t object epoch.tv_sec = -1 */
 	if (epoch.tv_sec == -1)
diff --git a/lib/decompress/cmp_max_used_bits_list.c b/lib/decompress/cmp_max_used_bits_list.c
index f4844ffc58da55b555523afe7281315fd0ae9491..31c14b2b92cbc76304b1ab4d52f23b968eadc4b3 100644
--- a/lib/decompress/cmp_max_used_bits_list.c
+++ b/lib/decompress/cmp_max_used_bits_list.c
@@ -24,6 +24,7 @@
 
 #include "../common/list.h"
 #include "../common/cmp_max_used_bits.h"
+#include "cmp_max_used_bits_list.h"
 
 
 struct list_item {
diff --git a/lib/decompress/decmp.c b/lib/decompress/decmp.c
index e21235043179574e2846210806fee839ba7f486e..27fde0941ad58467282e2af5e77e7185a92816c2 100644
--- a/lib/decompress/decmp.c
+++ b/lib/decompress/decmp.c
@@ -33,6 +33,7 @@
 
 #include "read_bitstream.h"
 #include "cmp_max_used_bits_list.h"
+#include "decmp.h"
 #include "../common/cmp_debug.h"
 #include "../common/cmp_support.h"
 #include "../common/cmp_entity.h"
@@ -400,7 +401,7 @@ static void configure_decoder_setup(struct decoder_setup *setup, struct bit_deco
  * @returns pointer to the collection data; NULL if col is NULL
  */
 
-void *get_collection_data(void *col)
+static void *get_collection_data(void *col)
 {
 	if (col)
 		col = (uint8_t *)col + COLLECTION_HDR_SIZE;
diff --git a/lib/icu_compress/cmp_icu.c b/lib/icu_compress/cmp_icu.c
index 36837c6441de21c2a4daf69c1ea411be7bff27e3..22919272f034cc8d64da0a9a7dc98a8d7d8deb71 100644
--- a/lib/icu_compress/cmp_icu.c
+++ b/lib/icu_compress/cmp_icu.c
@@ -109,7 +109,7 @@ enum chunk_type {
 	CHUNK_TYPE_SAT_IMAGETTE,
 	CHUNK_TYPE_OFFSET_BACKGROUND, /* N-CAM */
 	CHUNK_TYPE_SMEARING,
-	CHUNK_TYPE_F_CHAIN,
+	CHUNK_TYPE_F_CHAIN
 };
 
 
diff --git a/lib/rdcu_compress/cmp_rdcu.c b/lib/rdcu_compress/cmp_rdcu.c
index 7feeda49f3ef0f971414d476c49dec5f2e5887e2..6bfbffb6888843839cd52fc8908e31290797273d 100644
--- a/lib/rdcu_compress/cmp_rdcu.c
+++ b/lib/rdcu_compress/cmp_rdcu.c
@@ -34,6 +34,7 @@
 #include "cmp_rdcu_cfg.h"
 #include "rdcu_ctrl.h"
 #include "rdcu_rmap.h"
+#include "cmp_rdcu.h"
 
 
 #define RDCU_INTR_SIG_ENA 1 /* RDCU interrupt signal enabled */
diff --git a/lib/rdcu_compress/rmap.c b/lib/rdcu_compress/rmap.c
index 2361329552aabc07674e600a554e38ba6ad8b349..1ef7811c43fab9a34ea8d6f9748d202548aa6de4 100644
--- a/lib/rdcu_compress/rmap.c
+++ b/lib/rdcu_compress/rmap.c
@@ -571,7 +571,7 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf, uint32_t len)
 		size_t pkt_size = RMAP_DATA_START + n + pkt->data_len + 1; /* +1 for data CRC */
 
 		if (len < pkt_size) {
-			debug_print("buffer len is smaller than the contained RMAP packet; buf len: %" PRIu32 " bytes vs RMAP: %zu bytes needed",
+			debug_print("buffer len is smaller than the contained RMAP packet; buf len: %" PRIu32 " bytes vs RMAP: %lu bytes needed",
 				len, pkt_size);
 			goto error;
 		}
diff --git a/meson.build b/meson.build
index 86680eeccc3ce1037253abd65d9568a1d4183c1b..0bc9844c4d086b0abfd9814d8f54f646014b701d 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,7 @@ project('cmp_tool', 'c',
   license : 'GPL-2.0',
   default_options : [
     'warning_level=3',
-    'c_std=gnu99'
+    'c_std=gnu89'
   ]
 )
 
diff --git a/programs/cmp_io.c b/programs/cmp_io.c
index fd1100812924e37cca53084274b10e7bb53cdd3f..da755f7c56845ed9d374494ab297a1f0f07ad2d2 100644
--- a/programs/cmp_io.c
+++ b/programs/cmp_io.c
@@ -1201,7 +1201,7 @@ static __inline ssize_t str2uint8_arr(const char *str, uint8_t *data, uint32_t b
 			if (!data)  /* finished counting the sample */
 				break;
 
-			fprintf(stderr, "%s: %s: Error: The files do not contain enough data. Expected: 0x%x, has 0x%zx.\n",
+			fprintf(stderr, "%s: %s: Error: The files do not contain enough data. Expected: 0x%x, has 0x%lx.\n",
 				PROGRAM_NAME, file_name, buf_size, i);
 			return -1;
 		}
@@ -1459,7 +1459,7 @@ ssize_t read_file_cmp_entity(const char *file_name, struct cmp_entity *ent,
 			return -1;
 		}
 		if (size != (ssize_t)cmp_ent_get_size(ent)) {
-			fprintf(stderr, "%s: %s: The size of the compression entity set in the header of the compression entity is not the same size as the read-in file has. Expected: 0x%x, has 0x%zx.\n",
+			fprintf(stderr, "%s: %s: The size of the compression entity set in the header of the compression entity is not the same size as the read-in file has. Expected: 0x%x, has 0x%lx.\n",
 				PROGRAM_NAME, file_name, cmp_ent_get_size(ent), (size_t)size);
 			return -1;
 		}
diff --git a/programs/cmp_tool.c b/programs/cmp_tool.c
index 3dd5a9a7de253bc4ff6d1eae22f1888509a6d121..8f77e6293c7baac45f10762435a766902256a36b 100644
--- a/programs/cmp_tool.c
+++ b/programs/cmp_tool.c
@@ -76,7 +76,7 @@ enum {
 	LAST_INFO,
 	NO_HEADER,
 	MODEL_ID,
-	MODEL_COUTER,
+	MODEL_COUTER
 };
 
 static const struct option long_options[] = {