Have AVIF_FALSE and AVIF_TRUE be enums in the CI (#2712)

diff --git a/.github/workflows/ci-c-warnings.yml b/.github/workflows/ci-c-warnings.yml
index b98b18b..04f794a 100644
--- a/.github/workflows/ci-c-warnings.yml
+++ b/.github/workflows/ci-c-warnings.yml
@@ -16,10 +16,10 @@
     strategy:
       fail-fast: false
       # Generate the configurations:
-      # case 0: nodiscard
+      # case 0: nodiscard, case 1: use stdbool, case 2: use enums
       matrix:
         os: [ubuntu-latest, windows-latest]
-        case: [0]
+        case: [0, 1, 2]
 
     runs-on: ${{ matrix.os }}
 
@@ -54,6 +54,18 @@
       - name: Enable nodiscard
         if: ${{ matrix.case == 0}}
         run: echo "CMAKE_AVIF_FLAGS=\"-DAVIF_ENABLE_NODISCARD=ON\""  >> $GITHUB_ENV
+      - name: Use stdbool for AVIF_TRUE/AVIF_FALSE
+        if: ${{ matrix.case == 1}}
+        run: |
+          sed -i 's/#include <stdint.h>/#include <stdint.h>\n#include <stdbool.h>/' include/avif/avif.h
+          sed -i 's/typedef int avifBool;/typedef bool avifBool;/' include/avif/avif.h
+          sed -i 's/#define AVIF_TRUE 1/#define AVIF_TRUE true/' include/avif/avif.h
+          sed -i 's/#define AVIF_FALSE 0/#define AVIF_FALSE false/' include/avif/avif.h
+      - name: Use enums for AVIF_TRUE/AVIF_FALSE
+        if: ${{ matrix.case == 2}}
+        run: |
+          sed -i 's/#define AVIF_TRUE 1/enum avifTrueFalse_{ AVIF_TRUE = 1,/' include/avif/avif.h
+          sed -i 's/#define AVIF_FALSE 0/AVIF_FALSE = 0};/' include/avif/avif.h
 
       - name: Prepare libavif (cmake)
         run: >
diff --git a/apps/avifdec.c b/apps/avifdec.c
index f30a90c..d937aeb 100644
--- a/apps/avifdec.c
+++ b/apps/avifdec.c
@@ -359,7 +359,7 @@
 
     const avifBool decodeAllFrames = frameIndex == DECODE_ALL_FRAMES;
     int currIndex = decodeAllFrames ? 0 : frameIndex;
-    while (AVIF_TRUE) {
+    for (;;) {
         result = decodeAllFrames ? avifDecoderNextImage(decoder) : avifDecoderNthImage(decoder, frameIndex);
         if (result != AVIF_RESULT_OK) {
             break;
diff --git a/include/avif/internal.h b/include/avif/internal.h
index b920e22..236633f 100644
--- a/include/avif/internal.h
+++ b/include/avif/internal.h
@@ -62,8 +62,14 @@
 // AVIF_ASSERT_OR_RETURN() can be used instead of assert() for extra security in release builds.
 #ifdef NDEBUG
 #define AVIF_ASSERT_OR_RETURN(A) AVIF_CHECKERR((A), AVIF_RESULT_INTERNAL_ERROR)
+#define AVIF_ASSERT_NOT_REACHED_OR_RETURN  \
+    do {                                   \
+        avifBreakOnError();                \
+        return AVIF_RESULT_INTERNAL_ERROR; \
+    } while (0)
 #else
 #define AVIF_ASSERT_OR_RETURN(A) assert(A)
+#define AVIF_ASSERT_NOT_REACHED_OR_RETURN assert(0);
 #endif
 
 // ---------------------------------------------------------------------------
diff --git a/src/read.c b/src/read.c
index bc0e0fc..cf3e5e3 100644
--- a/src/read.c
+++ b/src/read.c
@@ -4001,7 +4001,7 @@
 static avifProperty * avifMetaCreateProperty(avifMeta * meta, const char * propertyType)
 {
     avifProperty * metaProperty = avifArrayPush(&meta->properties);
-    AVIF_CHECK(metaProperty);
+    AVIF_CHECKERR(metaProperty, NULL);
     memcpy(metaProperty->type, propertyType, 4);
     return metaProperty;
 }
@@ -4009,7 +4009,7 @@
 static avifProperty * avifDecoderItemAddProperty(avifDecoderItem * item, const avifProperty * metaProperty)
 {
     avifProperty * itemProperty = avifArrayPush(&item->properties);
-    AVIF_CHECK(itemProperty);
+    AVIF_CHECKERR(itemProperty, NULL);
     *itemProperty = *metaProperty;
     return itemProperty;
 }
@@ -5536,7 +5536,7 @@
     for (uint32_t dimgIdx = 0; dimgIdx < tileCount; ++dimgIdx) {
         if (dimgIdxToAlphaItemIdx[dimgIdx] >= meta->items.count) {
             avifFree(dimgIdxToAlphaItemIdx);
-            AVIF_ASSERT_OR_RETURN(AVIF_FALSE);
+            AVIF_ASSERT_NOT_REACHED_OR_RETURN;
         }
         avifDecoderItem * alphaTileItem = meta->items.item[dimgIdxToAlphaItemIdx[dimgIdx]];
         alphaTileItem->dimgForID = (*alphaItem)->id;
diff --git a/src/write.c b/src/write.c
index f914616..b8a87dc 100644
--- a/src/write.c
+++ b/src/write.c
@@ -2642,7 +2642,7 @@
 
     if (floatFlag) {
         // bit(2) bit_depth_log2_minus4;
-        AVIF_ASSERT_OR_RETURN(AVIF_FALSE);
+        AVIF_ASSERT_NOT_REACHED_OR_RETURN;
     } else {
         AVIF_CHECKRES(avifRWStreamWriteBits(s, image->depth > 8, 1)); // bit(1) high_bit_depth_flag;
         if (image->depth > 8) {
@@ -2710,7 +2710,7 @@
             AVIF_CHECKRES(avifRWStreamWriteBits(s, gainmapFloatFlag, 1)); // bit(1) gainmap_float_flag;
             if (gainmapFloatFlag) {
                 // bit(2) gainmap_bit_depth_log2_minus4;
-                AVIF_ASSERT_OR_RETURN(AVIF_FALSE);
+                AVIF_ASSERT_NOT_REACHED_OR_RETURN;
             } else {
                 AVIF_CHECKRES(avifRWStreamWriteBits(s, gainmap->depth > 8, 1)); // bit(1) gainmap_high_bit_depth_flag;
                 if (gainmap->depth > 8) {