Skip to content

Commit

Permalink
replace size_t casts on pointers with uintptr_t
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Jul 30, 2021
1 parent d58746b commit 6095925
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,8 @@ int Render_Line_##NAME(TTF_Font *font, SDL_Surface *textbuf, int xstart, int yst
/* Compute dst */ \
dst = (Uint8 *)textbuf->pixels + y * textbuf->pitch + x * bpp; \
/* Align dst, get remainder, shift & align glyph width */ \
remainder = ((size_t)dst & alignment) / bpp; \
dst = (Uint8 *)((size_t)dst & ~alignment); \
remainder = ((uintptr_t)dst & alignment) / bpp; \
dst = (Uint8 *)((uintptr_t)dst & ~alignment); \
image->buffer -= remainder; \
image->width = (image->width + remainder + alignment) & ~alignment; \
/* Compute srcskip, dstskip */ \
Expand Down Expand Up @@ -1263,7 +1263,7 @@ static SDL_Surface* Create_Surface_Solid(int width, int height, SDL_Color fg, Ui
}

/* address is aligned */
pixels = (void *)(((size_t)ptr + sizeof(void *) + alignment) & ~alignment);
pixels = (void *)(((uintptr_t)ptr + sizeof(void *) + alignment) & ~alignment);
((void **)pixels)[-1] = ptr;

textbuf = SDL_CreateRGBSurfaceWithFormatFrom(pixels, width, height, 0, pitch, SDL_PIXELFORMAT_INDEX8);
Expand Down Expand Up @@ -1327,7 +1327,7 @@ static SDL_Surface* Create_Surface_Shaded(int width, int height, SDL_Color fg, S
}

/* address is aligned */
pixels = (void *)(((size_t)ptr + sizeof(void *) + alignment) & ~alignment);
pixels = (void *)(((uintptr_t)ptr + sizeof(void *) + alignment) & ~alignment);
((void **)pixels)[-1] = ptr;

textbuf = SDL_CreateRGBSurfaceWithFormatFrom(pixels, width, height, 0, pitch, SDL_PIXELFORMAT_INDEX8);
Expand Down Expand Up @@ -1424,7 +1424,7 @@ static SDL_Surface *Create_Surface_Blended(int width, int height, SDL_Color fg,
}

/* address is aligned */
pixels = (void *)(((size_t)ptr + sizeof(void *) + alignment) & ~alignment);
pixels = (void *)(((uintptr_t)ptr + sizeof(void *) + alignment) & ~alignment);
((void **)pixels)[-1] = ptr;

textbuf = SDL_CreateRGBSurfaceWithFormatFrom(pixels, width, height, 0, pitch, SDL_PIXELFORMAT_ARGB8888);
Expand Down Expand Up @@ -3345,7 +3345,7 @@ static SDL_Surface* TTF_Render_Wrapped_Internal(TTF_Font *font, const char *text

do {
int extent = 0, max_count = 0, char_count = 0;
size_t save_textlen = (size_t)-1;
size_t save_textlen = (size_t)(-1);
char *save_text = NULL;

if (numLines >= maxNumLines) {
Expand Down

0 comments on commit 6095925

Please # to comment.