diff options
| author | Andreas Schwab | 2015-01-26 18:56:18 +0100 |
|---|---|---|
| committer | Andreas Schwab | 2015-01-26 19:01:38 +0100 |
| commit | e912f35dc5e882ddc5124e3552ee68088204fb47 (patch) | |
| tree | 5fd4a74aaaadc7108bed29654d158668043300b1 /src/image.c | |
| parent | a9a3d429e6e53e2be0b20e84f9809dba1d03e52d (diff) | |
| download | emacs-e912f35dc5e882ddc5124e3552ee68088204fb47.tar.gz emacs-e912f35dc5e882ddc5124e3552ee68088204fb47.zip | |
* image.c (lookup_pixel_color): Reorder conditions that are
written backwards.
(x_to_xcolors): Likewise.
(x_detect_edges): Likewise.
(png_load_body): Likewise.
(gif_close): Likewise.
(gif_load): Likewise.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/image.c b/src/image.c index 9c09c5596b9..df299bbd164 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -4423,7 +4423,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel) | |||
| 4423 | Colormap cmap; | 4423 | Colormap cmap; |
| 4424 | bool rc; | 4424 | bool rc; |
| 4425 | 4425 | ||
| 4426 | if (ct_colors_allocated_max <= ct_colors_allocated) | 4426 | if (ct_colors_allocated >= ct_colors_allocated_max) |
| 4427 | return FRAME_FOREGROUND_PIXEL (f); | 4427 | return FRAME_FOREGROUND_PIXEL (f); |
| 4428 | 4428 | ||
| 4429 | #ifdef HAVE_X_WINDOWS | 4429 | #ifdef HAVE_X_WINDOWS |
| @@ -4554,7 +4554,7 @@ x_to_xcolors (struct frame *f, struct image *img, bool rgb_p) | |||
| 4554 | HGDIOBJ prev; | 4554 | HGDIOBJ prev; |
| 4555 | #endif /* HAVE_NTGUI */ | 4555 | #endif /* HAVE_NTGUI */ |
| 4556 | 4556 | ||
| 4557 | if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *colors / img->width < img->height) | 4557 | if (img->height > min (PTRDIFF_MAX, SIZE_MAX) / sizeof *colors / img->width) |
| 4558 | memory_full (SIZE_MAX); | 4558 | memory_full (SIZE_MAX); |
| 4559 | colors = xmalloc (sizeof *colors * img->width * img->height); | 4559 | colors = xmalloc (sizeof *colors * img->width * img->height); |
| 4560 | 4560 | ||
| @@ -4695,7 +4695,7 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus | |||
| 4695 | 4695 | ||
| 4696 | #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) | 4696 | #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) |
| 4697 | 4697 | ||
| 4698 | if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *new / img->width < img->height) | 4698 | if (img->height > min (PTRDIFF_MAX, SIZE_MAX) / sizeof *new / img->width) |
| 4699 | memory_full (SIZE_MAX); | 4699 | memory_full (SIZE_MAX); |
| 4700 | new = xmalloc (sizeof *new * img->width * img->height); | 4700 | new = xmalloc (sizeof *new * img->width * img->height); |
| 4701 | 4701 | ||
| @@ -5917,8 +5917,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) | |||
| 5917 | row_bytes = png_get_rowbytes (png_ptr, info_ptr); | 5917 | row_bytes = png_get_rowbytes (png_ptr, info_ptr); |
| 5918 | 5918 | ||
| 5919 | /* Allocate memory for the image. */ | 5919 | /* Allocate memory for the image. */ |
| 5920 | if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height | 5920 | if (height > min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows |
| 5921 | || min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height < row_bytes) | 5921 | || row_bytes > min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height) |
| 5922 | memory_full (SIZE_MAX); | 5922 | memory_full (SIZE_MAX); |
| 5923 | c->pixels = pixels = xmalloc (sizeof *pixels * row_bytes * height); | 5923 | c->pixels = pixels = xmalloc (sizeof *pixels * row_bytes * height); |
| 5924 | c->rows = rows = xmalloc (height * sizeof *rows); | 5924 | c->rows = rows = xmalloc (height * sizeof *rows); |
| @@ -7235,7 +7235,7 @@ gif_image_p (Lisp_Object object) | |||
| 7235 | # ifdef WINDOWSNT | 7235 | # ifdef WINDOWSNT |
| 7236 | 7236 | ||
| 7237 | /* GIF library details. */ | 7237 | /* GIF library details. */ |
| 7238 | # if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR) | 7238 | # if GIFLIB_MAJOR + (GIFLIB_MINOR >= 1) > 5 |
| 7239 | DEF_DLL_FN (int, DGifCloseFile, (GifFileType *, int *)); | 7239 | DEF_DLL_FN (int, DGifCloseFile, (GifFileType *, int *)); |
| 7240 | # else | 7240 | # else |
| 7241 | DEF_DLL_FN (int, DGifCloseFile, (GifFileType *)); | 7241 | DEF_DLL_FN (int, DGifCloseFile, (GifFileType *)); |
| @@ -7316,7 +7316,7 @@ gif_close (GifFileType *gif, int *err) | |||
| 7316 | { | 7316 | { |
| 7317 | int retval; | 7317 | int retval; |
| 7318 | 7318 | ||
| 7319 | #if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR) | 7319 | #if GIFLIB_MAJOR + (GIFLIB_MINOR >= 1) > 5 |
| 7320 | retval = DGifCloseFile (gif, err); | 7320 | retval = DGifCloseFile (gif, err); |
| 7321 | #else | 7321 | #else |
| 7322 | retval = DGifCloseFile (gif); | 7322 | retval = DGifCloseFile (gif); |
| @@ -7471,7 +7471,7 @@ gif_load (struct frame *f, struct image *img) | |||
| 7471 | int subimg_height = subimage->ImageDesc.Height; | 7471 | int subimg_height = subimage->ImageDesc.Height; |
| 7472 | int subimg_top = subimage->ImageDesc.Top; | 7472 | int subimg_top = subimage->ImageDesc.Top; |
| 7473 | int subimg_left = subimage->ImageDesc.Left; | 7473 | int subimg_left = subimage->ImageDesc.Left; |
| 7474 | if (! (0 <= subimg_width && 0 <= subimg_height | 7474 | if (! (subimg_width >= 0 && subimg_height >= 0 |
| 7475 | && 0 <= subimg_top && subimg_top <= height - subimg_height | 7475 | && 0 <= subimg_top && subimg_top <= height - subimg_height |
| 7476 | && 0 <= subimg_left && subimg_left <= width - subimg_width)) | 7476 | && 0 <= subimg_left && subimg_left <= width - subimg_width)) |
| 7477 | { | 7477 | { |