diff options
author | Simon Bünzli <zeniko@gmail.com> | 2014-01-02 21:27:15 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-01-06 13:13:35 +0000 |
commit | 9b92bac1ec135862132b1c49b977b53891b73d88 (patch) | |
tree | dfd5faac92aa678cc5c8b23ae626d347b9d17494 /source/fitz | |
parent | f6fe26922653b45519d406bd07840719cef1d979 (diff) | |
download | mupdf-9b92bac1ec135862132b1c49b977b53891b73d88.tar.xz |
fix various MSVC warnings
Some warnings we'd like to enable for MuPDF and still be able to
compile it with warnings as errors using MSVC (2008 to 2013):
* C4115: 'timeval' : named type definition in parentheses
* C4204: nonstandard extension used : non-constant aggregate initializer
* C4295: 'hex' : array is too small to include a terminating null character
* C4389: '==' : signed/unsigned mismatch
* C4702: unreachable code
* C4706: assignment within conditional expression
Also, globally disable C4701 which is frequently caused by MSVC not
being able to correctly figure out fz_try/fz_catch code flow.
And don't define isnan for VS2013 and later where that's no longer needed.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/draw-device.c | 4 | ||||
-rw-r--r-- | source/fitz/string.c | 2 | ||||
-rw-r--r-- | source/fitz/svg-device.c | 15 | ||||
-rw-r--r-- | source/fitz/time.c | 3 |
4 files changed, 16 insertions, 8 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 355022f3..cf3daa51 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -564,7 +564,9 @@ fz_draw_fill_text(fz_device *devp, fz_text *text, const fz_matrix *ctm, } else { - fz_matrix mat = {pixmap->w, 0.0, 0.0, pixmap->h, x + pixmap->x, y + pixmap->y}; + fz_matrix mat; + mat.a = pixmap->w; mat.b = mat.c = 0; mat.d = pixmap->h; + mat.e = x + pixmap->x; mat.f = y + pixmap->y; fz_paint_image(state->dest, &state->scissor, state->shape, pixmap, &mat, alpha * 255, !(devp->hints & FZ_DONT_INTERPOLATE_IMAGES)); } fz_drop_glyph(dev->ctx, glyph); diff --git a/source/fitz/string.c b/source/fitz/string.c index b29cdbdc..1442b205 100644 --- a/source/fitz/string.c +++ b/source/fitz/string.c @@ -5,7 +5,7 @@ fz_strsep(char **stringp, const char *delim) { char *ret = *stringp; if (!ret) return NULL; - if ((*stringp = strpbrk(*stringp, delim))) + if ((*stringp = strpbrk(*stringp, delim)) != NULL) *((*stringp)++) = '\0'; return ret; } diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index dc248f88..aa5ff74c 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -682,7 +682,10 @@ svg_dev_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float fz_context *ctx = dev->ctx; fz_output *out = sdev->out; fz_matrix local_ctm = *ctm; - fz_matrix scale = { 1.0f/image->w, 0, 0, 1.0f/image->h, 0, 0}; + fz_matrix scale = { 0 }; + + scale.a = 1.0f / image->w; + scale.d = 1.0f / image->h; fz_concat(&local_ctm, &scale, ctm); if (alpha != 1.0f) @@ -767,9 +770,12 @@ fz_colorspace *colorspace, float *color, float alpha) fz_context *ctx = dev->ctx; fz_output *out; fz_matrix local_ctm = *ctm; - fz_matrix scale = { 1.0f/image->w, 0, 0, 1.0f/image->h, 0, 0}; + fz_matrix scale = { 0 }; int mask = sdev->id++; + scale.a = 1.0f / image->w; + scale.d = 1.0f / image->h; + fz_concat(&local_ctm, &scale, ctm); out = start_def(sdev); fz_printf(out, "<mask id=\"ma%d\"><image", mask); @@ -808,9 +814,12 @@ svg_dev_clip_image_mask(fz_device *dev, fz_image *image, const fz_rect *rect, co fz_context *ctx = dev->ctx; fz_output *out; fz_matrix local_ctm = *ctm; - fz_matrix scale = { 1.0f/image->w, 0, 0, 1.0f/image->h, 0, 0}; + fz_matrix scale = { 0 }; int mask = sdev->id++; + scale.a = 1.0f / image->w; + scale.d = 1.0f / image->h; + fz_concat(&local_ctm, &scale, ctm); out = start_def(sdev); fz_printf(out, "<mask id=\"ma%d\"><image", mask); diff --git a/source/fitz/time.c b/source/fitz/time.c index 0e3d21b5..6b1d6255 100644 --- a/source/fitz/time.c +++ b/source/fitz/time.c @@ -9,9 +9,6 @@ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 -struct timeval; -struct timezone; - int gettimeofday(struct timeval *tv, struct timezone *tz) { FILETIME ft; |