Commit 2975f207 for libheif
commit 2975f207ee6ec5eee6db36a8bcfa60f176fbdde2
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Fri May 22 17:34:08 2026 +0200
add CI test that each public header is a pure C file that is self-contained (#1812)
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index b47626ac..afed0b2c 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -26,6 +26,20 @@ jobs:
run: |
./scripts/run-ci.sh
+ c-api-headers:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Install compilers
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y gcc clang
+
+ - name: Check that public headers are valid C
+ run: |
+ ./scripts/check-c-headers.sh
+
licenses:
env:
CHECK_LICENSES: 1
diff --git a/libheif/api/libheif/heif_library.h b/libheif/api/libheif/heif_library.h
index f6fbcb81..73610aa0 100644
--- a/libheif/api/libheif/heif_library.h
+++ b/libheif/api/libheif/heif_library.h
@@ -49,6 +49,12 @@ extern "C" {
// 1.19 6 7 2 1 1 1
// 1.20 7 7 2 1 1 1
+// TODO (v1.23.0): factor the LIBHEIF_API export macro out into its own tiny,
+// dependency-free header (e.g. heif_export.h) and include it from both this
+// header and heif_error.h. Currently heif_error.h is not self-contained: it
+// uses LIBHEIF_API but cannot include heif_library.h because the two headers
+// are mutually dependent (heif_library.h needs the heif_error type). Breaking
+// this cycle would let every public header compile standalone as C.
#if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
#ifdef LIBHEIF_EXPORTS
#define LIBHEIF_API __declspec(dllexport)
@@ -169,7 +175,7 @@ typedef enum heif_plugin_type
typedef struct heif_plugin_info
{
int version; // version of this info struct
- enum heif_plugin_type type;
+ heif_plugin_type type;
const void* plugin;
void* internal_handle; // for internal use only
} heif_plugin_info;
diff --git a/libheif/api/libheif/heif_properties.h b/libheif/api/libheif/heif_properties.h
index 0dec3a37..d1fc6528 100644
--- a/libheif/api/libheif/heif_properties.h
+++ b/libheif/api/libheif/heif_properties.h
@@ -319,7 +319,10 @@ int heif_image_get_polarization_pattern_index_for_component(const heif_image*,
// --- Sensor bad pixels map (ISO 23001-17, Section 6.1.7)
-struct heif_bad_pixel { uint32_t row; uint32_t column; };
+typedef struct heif_bad_pixel
+{
+ uint32_t row; uint32_t column;
+} heif_bad_pixel;
// Add a sensor bad pixels map to an image.
// component_indices: array of component indices this map applies to (may be NULL if num_component_indices == 0,
@@ -335,7 +338,7 @@ heif_error heif_image_add_sensor_bad_pixels_map(heif_image*,
uint32_t num_bad_columns,
const uint32_t* bad_columns,
uint32_t num_bad_pixels,
- const struct heif_bad_pixel* bad_pixels);
+ const heif_bad_pixel* bad_pixels);
// Returns the number of sensor bad pixels maps on this image (0 if none).
LIBHEIF_API