-
Notifications
You must be signed in to change notification settings - Fork 254
Have AVIF_FALSE and AVIF_TRUE be enums #2712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8bd272f
e9d5df0
eef44ef
da6062e
279e267
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,10 @@ jobs: | |
| 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 }} | ||
|
|
||
|
|
@@ -53,6 +53,18 @@ jobs: | |
| - 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we add these two alternative definitions of If we want to patch avif.h, we may want to add comments around the definition of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think adding two guards (for stdbool and enum) is a lot of noise for a public header no? Especially just for a CI usage (not even a test). |
||
|
|
||
| - name: Prepare libavif (cmake) | ||
| run: > | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need this alternative definition? Does stdbool not catch all the bugs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, cf the other PR: both found different bugs .....