From 59f8fe66098f933c68dd61e8f0b94f3cf8d698a7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 3 May 2018 14:01:59 +0300 Subject: [PATCH] Use unsigned char for image data --- ttf2png.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ttf2png.c b/ttf2png.c index 62e56ac..eabe1ca 100644 --- a/ttf2png.c +++ b/ttf2png.c @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA typedef struct sImage { unsigned w, h; - char *data; + unsigned char *data; } Image; typedef struct sGlyph @@ -628,7 +628,7 @@ int copy_bitmap(const FT_Bitmap *bmp, Image *image) { unsigned x, y; unsigned char *src; - char *dst; + unsigned char *dst; image->w = bmp->width; image->h = bmp->rows; @@ -638,7 +638,7 @@ int copy_bitmap(const FT_Bitmap *bmp, Image *image) return 0; } - image->data = (char *)malloc(image->w*image->h); + image->data = (unsigned char *)malloc(image->w*image->h); if(!image->data) { fprintf(stderr, "Cannot allocate %d bytes of memory for glyph\n", image->w*image->h); @@ -745,7 +745,7 @@ int render_grid(Font *font, unsigned cellw, unsigned cellh, unsigned cpl, bool s if(!npot) font->image.h = round_to_pot(font->image.h); - font->image.data = (char *)alloc_image_data(font->image.w, font->image.h); + font->image.data = (unsigned char *)alloc_image_data(font->image.w, font->image.h); if(!font->image.data) return -1; memset(font->image.data, 255, font->image.w*font->image.h); @@ -822,7 +822,7 @@ int render_packed(Font *font, unsigned margin, unsigned padding, bool npot) glyphs. Since glyphs are rectangular and the image is filled starting from the top, it's enough to track the number of used pixels at the top of each column. */ - font->image.data = (char *)alloc_image_data(font->image.w, font->image.h); + font->image.data = (unsigned char *)alloc_image_data(font->image.w, font->image.h); if(!font->image.data) return -1; memset(font->image.data, 255, font->image.w*font->image.h); -- 2.43.0