Change avifRWStreamFinishBox to return avifResult#3209
Merged
wantehchang merged 2 commits intoMay 20, 2026
Merged
Conversation
Follow up on PR AOMediaCodec#3207. Allow error handling.
cddd578 to
b5882a5
Compare
wantehchang
commented
May 19, 2026
| // marker is the offset of the size field in stream, returned by a previous | ||
| // avifRWStreamWriteBox() or avifRWStreamWriteFullBox() call. | ||
| void avifRWStreamFinishBox(avifRWStream * stream, avifBoxMarker marker); | ||
| AVIF_NODISCARD avifResult avifRWStreamFinishBox(avifRWStream * stream, avifBoxMarker marker); |
Member
Author
There was a problem hiding this comment.
I can remove this AVIF_NODISCARD after this PR passes the CI workflows.
wantehchang
commented
May 19, 2026
| avifRWStreamFinishBox(&s, ipco); | ||
| dedup = NULL; | ||
| AVIF_CHECKRES(result); | ||
| AVIF_CHECKRES(avifRWStreamFinishBox(&s, ipco)); |
Member
Author
There was a problem hiding this comment.
Note that I moved the statement dedup = NULL; immediately after the avifItemPropertyDedupDestroy(dedup) call here.
wantehchang
commented
May 20, 2026
| AVIF_CHECKERR(boxSize <= UINT32_MAX, AVIF_RESULT_INVALID_ARGUMENT); | ||
| uint32_t noSize = avifHTONL((uint32_t)boxSize); | ||
| memcpy(stream->raw->data + marker, &noSize, sizeof(uint32_t)); | ||
| return AVIF_RESULT_OK; |
Member
Author
There was a problem hiding this comment.
Please review. Only this file and the change at src/write.c:3480 (annotated with a comment) need to be checked carefully. All the other changes are mechanical changes. Thanks!
vigneshvg
approved these changes
May 20, 2026
vigneshvg
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up on PR #3207. Allow error handling.