Skip to content
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

fix alignment of fields within mqoi_desc_t #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/mini_qoi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Initializes an mQOI image descriptor object.
*/
void mqoi_desc_init(mqoi_desc_t * desc) {
memset(desc, 0, sizeof(mqoi_desc_t));
desc->head = 3;
}

/*
Expand Down Expand Up @@ -90,7 +91,7 @@ uint8_t mqoi_desc_verify(mqoi_desc_t * desc, uint32_t * w, uint32_t * h) {
Returns true when the mQOI image descriptor object is completely populated.
*/
MQOI_INLINE bool mqoi_desc_done(const mqoi_desc_t * desc) {
return desc->head >= sizeof(mqoi_desc_t) - 1;
return desc->head >= sizeof(mqoi_desc_t) - 4;
}

// ==== mqoi_dec_t ====
Expand Down
2 changes: 1 addition & 1 deletion src/mini_qoi.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef union {
} mqoi_rgba_t;

typedef struct {
uint8_t head;
uint32_t head;

uint8_t magic[4];
uint8_t width[4]; // big-endian width
Expand Down