From: Mikko Rasa Date: Thu, 3 May 2018 11:01:59 +0000 (+0300) Subject: Use unsigned char for image data X-Git-Url: http://git.tdb.fi/?p=ttf2png.git;a=commitdiff_plain;h=59f8fe66098f933c68dd61e8f0b94f3cf8d698a7 Use unsigned char for image data --- 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);