diff options
-rw-r--r-- | xps/ghostxps.h | 5 | ||||
-rw-r--r-- | xps/xpscff.c | 4 | ||||
-rw-r--r-- | xps/xpscolor.c | 14 | ||||
-rw-r--r-- | xps/xpsglyphs.c | 4 | ||||
-rw-r--r-- | xps/xpsgradient.c | 8 | ||||
-rw-r--r-- | xps/xpsjpeg.c | 4 | ||||
-rw-r--r-- | xps/xpsjxr.c | 6 | ||||
-rw-r--r-- | xps/xpspath.c | 6 | ||||
-rw-r--r-- | xps/xpspng.c | 4 | ||||
-rw-r--r-- | xps/xpstiff.c | 4 |
10 files changed, 30 insertions, 29 deletions
diff --git a/xps/ghostxps.h b/xps/ghostxps.h index 777619c4f..f89bb71b8 100644 --- a/xps/ghostxps.h +++ b/xps/ghostxps.h @@ -22,6 +22,9 @@ #include <stdlib.h> #include <ctype.h> /* for toupper() */ +/* Include zlib early to avoid offsetof redef problems on windows */ +#include "zlib.h" + #include "gp.h" #include "gsgc.h" @@ -72,8 +75,6 @@ #include "gsicc_cache.h" #include "gxpcolor.h" -#include "zlib.h" - #include "xpsfapi.h" #ifndef MIN diff --git a/xps/xpscff.c b/xps/xpscff.c index 7c076f43d..1ca38a38d 100644 --- a/xps/xpscff.c +++ b/xps/xpscff.c @@ -918,10 +918,10 @@ xps_init_postscript_font(xps_context_t *ctx, xps_font_t *font) pt1->data.nominalWidthX = 0; pt1->data.BlueFuzz = 1; - pt1->data.BlueScale = 0.039625; + pt1->data.BlueScale = 0.039625f; pt1->data.BlueShift = 7; pt1->data.BlueValues.count = 0; - pt1->data.ExpansionFactor = 0.06; + pt1->data.ExpansionFactor = 0.06f; pt1->data.ForceBold = 0; pt1->data.FamilyBlues.count = 0; pt1->data.FamilyOtherBlues.count = 0; diff --git a/xps/xpscolor.c b/xps/xpscolor.c index b7227f332..5f82b62e6 100644 --- a/xps/xpscolor.c +++ b/xps/xpscolor.c @@ -82,17 +82,17 @@ xps_parse_color(xps_context_t *ctx, char *base_uri, char *string, { if (strlen(string) == 9) { - samples[0] = unhex(string[1]) * 16 + unhex(string[2]); - samples[1] = unhex(string[3]) * 16 + unhex(string[4]); - samples[2] = unhex(string[5]) * 16 + unhex(string[6]); - samples[3] = unhex(string[7]) * 16 + unhex(string[8]); + samples[0] = (float)(unhex(string[1]) * 16 + unhex(string[2])); + samples[1] = (float)(unhex(string[3]) * 16 + unhex(string[4])); + samples[2] = (float)(unhex(string[5]) * 16 + unhex(string[6])); + samples[3] = (float)(unhex(string[7]) * 16 + unhex(string[8])); } else { samples[0] = 255.0; - samples[1] = unhex(string[1]) * 16 + unhex(string[2]); - samples[2] = unhex(string[3]) * 16 + unhex(string[4]); - samples[3] = unhex(string[5]) * 16 + unhex(string[6]); + samples[1] = (float)(unhex(string[1]) * 16 + unhex(string[2])); + samples[2] = (float)(unhex(string[3]) * 16 + unhex(string[4])); + samples[3] = (float)(unhex(string[5]) * 16 + unhex(string[6])); } samples[0] /= 255.0; diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c index 5f1c363d9..d6bdabbb9 100644 --- a/xps/xpsglyphs.c +++ b/xps/xpsglyphs.c @@ -384,7 +384,7 @@ xps_parse_glyphs_imp(xps_context_t *ctx, xps_font_t *font, float size, /* Adjust glyph offset and advance width for emboldening */ if (sim_bold) { - advance *= 1.02; + advance *= 1.02f; u_offset += 0.01 * size; v_offset += 0.01 * size; } @@ -471,7 +471,7 @@ xps_parse_glyphs(xps_context_t *ctx, int sim_bold = 0; int sim_italic = 0; - gs_matrix shear = { 1, 0, 0.36397, 1, 0, 0 }; /* shear by 20 degrees */ + gs_matrix shear = { 1, 0, 0.36397f, 1, 0, 0 }; /* shear by 20 degrees */ /* * Extract attributes and extended attributes. diff --git a/xps/xpsgradient.c b/xps/xpsgradient.c index bedbfecdd..0517d0c1d 100644 --- a/xps/xpsgradient.c +++ b/xps/xpsgradient.c @@ -100,7 +100,7 @@ xps_parse_gradient_stops(xps_context_t *ctx, char *base_uri, xps_item_t *node, int num_colors = gsicc_getsrc_channel_count(colorspace->cmm_icc_profile_data); for (i = 0; i < num_colors; i++) { - sample_in[i] = sample[i+1]*65535; + sample_in[i] = (unsigned short)(sample[i+1]*65535); } gscms_transform_color((gx_device *)(ctx->pgs->device), icclink, sample_in, sample_out, 2); @@ -605,7 +605,7 @@ xps_draw_one_linear_gradient(xps_context_t *ctx, * reach a reasonable limit for infinite cases. */ -static inline float point_inside_circle(float px, float py, float x, float y, float r) +static inline int point_inside_circle(float px, float py, float x, float y, float r) { float dx = px - x; float dy = py - y; @@ -840,8 +840,8 @@ xps_draw_linear_gradient(xps_context_t *ctx, xps_item_t *root, int spread, gs_fu if (dist[i] > d1) d1 = dist[i]; } - i0 = floor(d0 / len); - i1 = ceil(d1 / len); + i0 = (int)floor(d0 / len); + i1 = (int)ceil(d1 / len); for (i = i0; i < i1; i++) { diff --git a/xps/xpsjpeg.c b/xps/xpsjpeg.c index 29fc375c1..d419ed121 100644 --- a/xps/xpsjpeg.c +++ b/xps/xpsjpeg.c @@ -117,8 +117,8 @@ xps_decode_jpeg(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image) } else if (jddp.dinfo.density_unit == 2) { - image->xres = jddp.dinfo.X_density * 2.54; - image->yres = jddp.dinfo.Y_density * 2.54; + image->xres = (int)(jddp.dinfo.X_density * 2.54 + 0.5); + image->yres = (int)(jddp.dinfo.Y_density * 2.54 + 0.5); } else { diff --git a/xps/xpsjxr.c b/xps/xpsjxr.c index 94d9fcdf4..eae3f179c 100644 --- a/xps/xpsjxr.c +++ b/xps/xpsjxr.c @@ -66,7 +66,7 @@ scale_bits(int depth, int value) return CLAMP(value, 0, 255); case JXR_BD32F: bd32f.iv = value; - value = bd32f.fv * 255; + value = (int)(bd32f.fv * 255); return CLAMP(value, 0, 255); #if 0 case JXR_BDRESERVED: return value; @@ -211,8 +211,8 @@ xps_decode_jpegxr(xps_context_t *ctx, byte *buf, int len, xps_image_t *output) offset = jxrc_image_offset(container, 0); alpha_offset = jxrc_alpha_offset(container, 0); - output->xres = jxrc_width_resolution(container, 0); - output->yres = jxrc_height_resolution(container, 0); + output->xres = (int)jxrc_width_resolution(container, 0); + output->yres = (int)jxrc_height_resolution(container, 0); image = jxr_create_input(); jxr_set_PROFILE_IDC(image, 111); diff --git a/xps/xpspath.c b/xps/xpspath.c index e2e356cdd..d0e474cb0 100644 --- a/xps/xpspath.c +++ b/xps/xpspath.c @@ -96,9 +96,9 @@ xps_draw_arc_segment(xps_context_t *ctx, gs_matrix *mtx, float th0, float th1, i gs_point p; while (th1 < th0) - th1 += M_PI * 2.0; + th1 += (float)(M_PI * 2.0); - d = 1 * (M_PI / 180.0); /* 1-degree precision */ + d = (float)(1 * (M_PI / 180.0)); /* 1-degree precision */ if (iscw) { @@ -110,7 +110,7 @@ xps_draw_arc_segment(xps_context_t *ctx, gs_matrix *mtx, float th0, float th1, i } else { - th0 += M_PI * 2; + th0 += (float)(M_PI * 2); for (t = th0 - d; t > th1 + d/2; t -= d) { gs_point_transform(cos(t), sin(t), mtx, &p); diff --git a/xps/xpspng.c b/xps/xpspng.c index bcc54b730..dab9ac385 100644 --- a/xps/xpspng.c +++ b/xps/xpspng.c @@ -291,8 +291,8 @@ xps_decode_png(xps_context_t *ctx, byte *rbuf, int rlen, xps_image_t *image) { if (unit == PNG_RESOLUTION_METER) { - image->xres = xres * 0.0254 + 0.5; - image->yres = yres * 0.0254 + 0.5; + image->xres = (int)(xres * 0.0254 + 0.5); + image->yres = (int)(yres * 0.0254 + 0.5); } } diff --git a/xps/xpstiff.c b/xps/xpstiff.c index 28cd9f4c3..f0d84fc60 100644 --- a/xps/xpstiff.c +++ b/xps/xpstiff.c @@ -668,8 +668,8 @@ xps_decode_tiff_strips(xps_context_t *ctx, xps_tiff_t *tiff, xps_image_t *image) image->yres = tiff->yresolution; break; case 3: - image->xres = tiff->xresolution * 2.54 + 0.5; - image->yres = tiff->yresolution * 2.54 + 0.5; + image->xres = (int)(tiff->xresolution * 2.54 + 0.5); + image->yres = (int)(tiff->yresolution * 2.54 + 0.5); break; default: |