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

Cleaned up use of pointers in PNG library #5

Merged
merged 2 commits into from
Jun 21, 2017
Merged
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
14 changes: 7 additions & 7 deletions src/gdisp/gdisp_image_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ static bool_t PNG_zCopyInput(PNG_decode *d, unsigned length) {
WRAP_ZBUF(d->z.bufend);
if (d->z.bufend == d->z.bufpos) { // Buffer full?
d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_COPY;
((unsigned *)d->z.tmp)[0] = length;
(d->z.tmp)[0] = length;
return TRUE;
}
}
Expand Down Expand Up @@ -570,8 +570,8 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) {
WRAP_ZBUF(offset);
if (d->z.bufend == d->z.bufpos) { // Buffer full?
d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_OFFSET;
((unsigned *)d->z.tmp)[0] = length;
((unsigned *)d->z.tmp)[1] = offset;
(d->z.tmp)[0] = length;
(d->z.tmp)[1] = offset;
return TRUE;
}
}
Expand Down Expand Up @@ -630,8 +630,8 @@ static bool_t PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset)
WRAP_ZBUF(offset);
if (d->z.bufend == d->z.bufpos) { // Buffer full?
d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_OFFSET;
((unsigned *)d->z.tmp)[0] = length;
((unsigned *)d->z.tmp)[1] = offset;
(d->z.tmp)[0] = length;
(d->z.tmp)[1] = offset;
return TRUE;
}
}
Expand All @@ -653,15 +653,15 @@ static uint8_t PNG_zGetByte(PNG_decode *d) {
return 0xFF;
break;
case PNG_ZFLG_RESUME_COPY: // Resume uncompressed block copy for length bytes
if (!PNG_zCopyInput(d, ((unsigned *)d->z.tmp)[0]))
if (!PNG_zCopyInput(d, (d->z.tmp)[0]))
return 0xFF;
break;
case PNG_ZFLG_RESUME_INFLATE: // Resume compressed block
if (!PNG_zInflateBlock(d))
return 0xFF;
break;
case PNG_ZFLG_RESUME_OFFSET: // Resume compressed block using offset copy for length bytes
if (!PNG_zResumeOffset(d, ((unsigned *)d->z.tmp)[0], ((unsigned *)d->z.tmp)[1]))
if (!PNG_zResumeOffset(d, (d->z.tmp)[0], (d->z.tmp)[1]))
return 0xFF;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gdisp/gdisp_image_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define _GDISP_IMAGE_SUPPORT_H

/* Base endian handling routines */
#define gdispImageGetVar(type, p, idx) (*(type *)(((uint8_t *)(p))+(idx)))
#define gdispImageGetVar(type, p, idx) (*(type*) ((intptr_t) p + idx))
#define gdispImageGetByte(type, p, idx, shift) (((type)gdispImageGetVar(uint8_t, p, idx))<<(shift))
#define gdispImageSwap16(w) ((((uint16_t)(w))>>8)|(((uint16_t)(w))<<8))
#define gdispImageSwap32(dw) ((((uint32_t)(w))>>24)|((((uint32_t)(w))&0x00FF0000)>>8)\
Expand Down