Linux build fixes (for LLVM)
authorPat Thoyts <pat.thoyts@gmail.com>
Fri, 19 Sep 2025 13:20:43 +0000 (14:20 +0100)
committerPat Thoyts <pat.thoyts@gmail.com>
Fri, 19 Sep 2025 13:20:43 +0000 (14:20 +0100)
CMakeLists.txt
exif.c
jpegrdr.c
srfdump.c

index 63eb0e1393083a10d6aa8be46134ca6313605f65..a136d62848984b7734b42c41fe7546553770a392 100644 (file)
@@ -6,7 +6,7 @@ target_compile_features(srfdump PRIVATE c_std_11)
 if (WIN32)
   target_compile_definitions(srfdump PRIVATE -DWIN32 -D_CRT_SECURE_NO_WARNINGS)
 else()
-  target_compile_definitions(srfdump PRIVATE -pedantic)
+  #target_compile_options(srfdump PRIVATE -pedantic)
 endif()
 
 add_executable(srfinfo srfinfo.c surfacefile.h)
@@ -14,7 +14,7 @@ target_compile_features(srfinfo PRIVATE c_std_11)
 if (WIN32)
   target_compile_definitions(srfinfo PRIVATE -DWIN32 -D_CRT_SECURE_NO_WARNINGS)
 else()
-  target_compile_definitions(srfinfo PRIVATE -pedantic)
+  #target_compile_options(srfinfo PRIVATE -pedantic)
 endif()
 
 add_executable(jpegrdr jpegrdr.c exif.c exif.h)
@@ -22,5 +22,5 @@ target_compile_features(jpegrdr PRIVATE c_std_11)
 if (WIN32)
   target_compile_definitions(jpegrdr PRIVATE -DWIN32 -D_CRT_SECURE_NO_WARNINGS)
 else()
-  target_compile_definitions(jpegrdr PRIVATE -pedantic)
+  #target_compile_options(jpegrdr PRIVATE -pedantic)
 endif()
diff --git a/exif.c b/exif.c
index c6730300baa0d08292256335480f513455faa74a..97decbbb5555f743dccd39fa0b2000b1ecb03ec9 100644 (file)
--- a/exif.c
+++ b/exif.c
@@ -20,28 +20,28 @@ static const char *EXIF_TYPE_NAMES[11] = {
 
 static bool big_endian_data = false;
 
-inline int32_t get_int32(const uint8_t* data)
+static int32_t get_int32(const uint8_t* data)
 {
     if (big_endian_data)
         return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24);
     return (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
 }
 
-inline uint32_t get_uint32(const uint8_t* data)
+static uint32_t get_uint32(const uint8_t* data)
 {
     if (big_endian_data)
         return (data[3] << 0) | (data[2] << 8) | (data[1] << 16) | (data[0] << 24);
     return (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
 }
 
-inline uint16_t get_int16(const uint8_t* data)
+static uint16_t get_int16(const uint8_t* data)
 {
     if (big_endian_data)
         return (data[1] << 0) | (data[0] << 8);
     return (data[0] << 0) | (data[1] << 8);
 }
 
-inline uint16_t get_uint16(const uint8_t* data)
+static uint16_t get_uint16(const uint8_t* data)
 {
     if (big_endian_data)
         return (data[1] << 0) | (data[0] << 8);
@@ -191,8 +191,11 @@ void exif_print_item(const exif_item_t* item)
         item->tag, EXIF_TYPE_NAMES[item->type], item->count);
     if (item->type == EXIF_TYPE_ASCII)
         fprintf(stderr, "'%s'", item->u.strVal);
-    else if (item->type == EXIF_TYPE_UNDEFINED && item->count > 8)
+    else if ((item->type == EXIF_TYPE_UNDEFINED
+              || item->type == EXIF_TYPE_BYTE) && item->count > 8)
+    {
         fprintf(stderr, "[%hu bytes]", item->count);
+    }
     else
     {
         for (uint16_t n = 0; n < item->count; ++n)
index ccffad25973e0df2223845fbf5eedf745f8a1336..8642b579a3228f8626f8b97ea7862c108736bcd7 100644 (file)
--- a/jpegrdr.c
+++ b/jpegrdr.c
@@ -4,7 +4,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <assert.h>
-#include <crtdbg.h>
 #include "exif.h"
 
 typedef uint16_t marker_t;
index 7bf83004924b23342ab02c21052b4d846251c763..ce297faa8d3a98ffc848d31b0cc8ad828b1fbc3b 100644 (file)
--- a/srfdump.c
+++ b/srfdump.c
@@ -157,7 +157,7 @@ static int SrfDump(FILE *fp)
         if (hdr.num_images < 10)
         {
             for (uint32_t n = 0; n < hdr.num_images + 1; ++n)
-                printf("    %lu: %#08x\n", n, offsets[n]);
+                printf("    %u: %#08x\n", n, offsets[n]);
         }
         printf("  image base: %#08x\n", table_base);
 #ifdef WIN32