Skip to content

Change avifRWStreamFinishBox to return avifResult#3209

Merged
wantehchang merged 2 commits into
AOMediaCodec:mainfrom
wantehchang:change-avifRWStreamFinishBox-return-value
May 20, 2026
Merged

Change avifRWStreamFinishBox to return avifResult#3209
wantehchang merged 2 commits into
AOMediaCodec:mainfrom
wantehchang:change-avifRWStreamFinishBox-return-value

Conversation

@wantehchang
Copy link
Copy Markdown
Member

@wantehchang wantehchang commented May 19, 2026

Follow up on PR #3207. Allow error handling.

@wantehchang wantehchang requested a review from y-guyon May 19, 2026 17:29
@wantehchang wantehchang force-pushed the change-avifRWStreamFinishBox-return-value branch from cddd578 to b5882a5 Compare May 19, 2026 17:30
Comment thread include/avif/internal.h
// 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);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove this AVIF_NODISCARD after this PR passes the CI workflows.

Comment thread src/write.c
avifRWStreamFinishBox(&s, ipco);
dedup = NULL;
AVIF_CHECKRES(result);
AVIF_CHECKRES(avifRWStreamFinishBox(&s, ipco));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I moved the statement dedup = NULL; immediately after the avifItemPropertyDedupDestroy(dedup) call here.

@wantehchang wantehchang requested a review from vigneshvg May 20, 2026 15:25
Comment thread src/stream.c
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;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread tests/gtest/avifstreamtest.cc Outdated
@wantehchang wantehchang merged commit b76fe84 into AOMediaCodec:main May 20, 2026
25 checks passed
@wantehchang wantehchang deleted the change-avifRWStreamFinishBox-return-value branch May 20, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants