diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-05-30 20:11:14 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-07-09 10:12:50 -0400 |
commit | c53a1bc27c11e0c3cdf54e2beffd6cc220703a0b (patch) | |
tree | 448fe6a469786e94fa271a32bfa56afb5a2a76bf | |
parent | 68c6a862409028d9b62ca601df02f345d60f969e (diff) | |
download | xorg-lib-libXft-c53a1bc27c11e0c3cdf54e2beffd6cc220703a0b.tar.gz |
cleanup new compiler warnings
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | src/xftglyphs.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/xftglyphs.c b/src/xftglyphs.c index 5d8fefb..2e2ba67 100644 --- a/src/xftglyphs.c +++ b/src/xftglyphs.c @@ -244,8 +244,8 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target, unsigned char* src_buf = source->buffer; unsigned char* dst_line = target->buffer; int src_pitch = source->pitch; - int width = target->width; - int height = target->rows; + int width = (int) target->width; + int height = (int) target->rows; int pitch = target->pitch; int h; FT_Vector vector; @@ -255,7 +255,7 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target, int sample_count; if ( src_pitch < 0 ) - src_buf -= src_pitch * (source->rows - 1); + src_buf -= src_pitch * ((int) source->rows - 1); FT_Matrix_Invert(&inverse); @@ -263,8 +263,8 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target, vector.x = 1; vector.y = 1; FT_Vector_Transform(&vector, &inverse); - sampling_width = vector.x / 2; - sampling_height = vector.y / 2; + sampling_width = (int) vector.x / 2; + sampling_height = (int) vector.y / 2; sample_count = (2 * sampling_width + 1) * (2 * sampling_height + 1); for ( h = height; h > 0; h--, dst_line += pitch ) @@ -275,7 +275,7 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target, { unsigned char* src; -#define CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) +#define CLAMP(x, min, max) (int) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) /* compute target pixel location in source space */ vector.x = (x * 0x10000) + 0x10000 / 2; @@ -300,7 +300,7 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target, case FT_PIXEL_MODE_BGRA: /* scale by averaging all relevant source pixels, keep BGRA format */ { int sample_x, sample_y; - int bgra[4] = {}; + int bgra[4] = {0,0,0,0}; int i; for (sample_y = - sampling_height; sample_y < sampling_height + 1; ++sample_y) { @@ -315,7 +315,7 @@ _scaled_fill_xrender_bitmap( FT_Bitmap* target, } for (i = 0; i < 4; ++i) - dst_line[4 * x + i] = bgra[i] / sample_count; + dst_line[4 * x + i] = (unsigned char) (bgra[i] / sample_count); break; } } @@ -427,7 +427,7 @@ _fill_xrender_bitmap( FT_Bitmap* target, case FT_PIXEL_MODE_BGRA: /* Preserve BGRA format */ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) - memcpy( dstLine, srcLine, width * 4 ); + memcpy( dstLine, srcLine, (size_t) width * 4 ); break; case FT_PIXEL_MODE_LCD: @@ -542,15 +542,15 @@ _fill_xrender_bitmap( FT_Bitmap* target, static Picture _create_glyph_bgra_picture (Display *dpy, XRenderPictFormat *format, - int width, - int height, + unsigned width, + unsigned height, unsigned char *data) { XImage image = { - width, height, 0, ZPixmap, (char *)data, + (int) width, (int) height, 0, ZPixmap, (char *)data, dpy->byte_order, dpy->bitmap_unit, dpy->bitmap_bit_order, 32, 32, 0, 32, - 0, 0, 0 + 0, 0, 0, 0, {0} }; Picture picture; Pixmap pixmap; @@ -949,7 +949,8 @@ XftFontLoadGlyphs (Display *dpy, if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA) xftg->picture = _create_glyph_bgra_picture(dpy, font->format, - local.width, local.rows, + local.width, + local.rows, bufBitmap); else XRenderAddGlyphs (dpy, font->glyphset, &glyph, |