File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ jobs:
1616 strategy :
1717 fail-fast : false
1818 # Generate the configurations:
19- # case 0: nodiscard
19+ # case 0: nodiscard, case 1: use stdbool, case 2: use enums
2020 matrix :
2121 os : [ubuntu-latest, windows-latest]
22- case : [0]
22+ case : [0, 1, 2 ]
2323
2424 runs-on : ${{ matrix.os }}
2525
5353 - name : Enable nodiscard
5454 if : ${{ matrix.case == 0}}
5555 run : echo "CMAKE_AVIF_FLAGS=\"-DAVIF_ENABLE_NODISCARD=ON\"" >> $GITHUB_ENV
56+ - name : Use stdbool for AVIF_TRUE/AVIF_FALSE
57+ if : ${{ matrix.case == 1}}
58+ run : |
59+ sed -i 's/#include <stdint.h>/#include <stdint.h>\n#include <stdbool.h>/' include/avif/avif.h
60+ sed -i 's/typedef int avifBool;/typedef bool avifBool;/' include/avif/avif.h
61+ sed -i 's/#define AVIF_TRUE 1/#define AVIF_TRUE true/' include/avif/avif.h
62+ sed -i 's/#define AVIF_FALSE 0/#define AVIF_FALSE false/' include/avif/avif.h
63+ - name : Use enums for AVIF_TRUE/AVIF_FALSE
64+ if : ${{ matrix.case == 2}}
65+ run : |
66+ sed -i 's/#define AVIF_TRUE 1/enum avifTrueFalse_{ AVIF_TRUE 1,/' include/avif/avif.h
67+ sed -i 's/#define AVIF_FALSE 0/AVIF_FALSE 0};/' include/avif/avif.h
5668
5769 - name : Prepare libavif (cmake)
5870 run : >
Original file line number Diff line number Diff line change @@ -85,11 +85,11 @@ extern "C" {
8585 ((AVIF_VERSION_MAJOR * 1000000 ) + (AVIF_VERSION_MINOR * 10000 ) + (AVIF_VERSION_PATCH * 100 ) + AVIF_VERSION_DEVEL)
8686
8787typedef int avifBool;
88- typedef enum avifTrueFalse
88+ enum avifTrueFalse_
8989{
9090 AVIF_FALSE = 0 ,
9191 AVIF_TRUE = 1
92- } avifTrueFalse ;
92+ };
9393
9494#define AVIF_DIAGNOSTICS_ERROR_BUFFER_SIZE 256
9595
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ static inline void avifBreakOnError()
6969 } while (0)
7070#else
7171#define AVIF_ASSERT_OR_RETURN (A ) assert(A)
72- #define AVIF_ASSERT_NOT_REACHED_OR_RETURN assert(AVIF_FALSE );
72+ #define AVIF_ASSERT_NOT_REACHED_OR_RETURN assert(0 );
7373#endif
7474
7575// ---------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments