From 05aa252f9ff14e9f455e828a991937fb6c1920fc Mon Sep 17 00:00:00 2001 From: hugovk Date: Sun, 29 Jan 2017 18:50:30 +0200 Subject: [PATCH] Tabs to spaces and add defensive brackets --- libImaging/Fill.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/libImaging/Fill.c b/libImaging/Fill.c index 1e8dbf9d8..15107b6d6 100644 --- a/libImaging/Fill.c +++ b/libImaging/Fill.c @@ -64,15 +64,18 @@ ImagingFillLinearGradient(const char *mode) Imaging im; int y; - if (strlen(mode) != 1) - return (Imaging) ImagingError_ModeError(); + if (strlen(mode) != 1) { + return (Imaging) ImagingError_ModeError(); + } im = ImagingNew(mode, 256, 256); - if (!im) - return NULL; + if (!im) { + return NULL; + } - for (y = 0; y < 256; y++) - memset(im->image8[y], (unsigned char) y, 256); + for (y = 0; y < 256; y++) { + memset(im->image8[y], (unsigned char) y, 256); + } return im; } @@ -84,21 +87,25 @@ ImagingFillRadialGradient(const char *mode) int x, y; int d; - if (strlen(mode) != 1) - return (Imaging) ImagingError_ModeError(); + if (strlen(mode) != 1) { + return (Imaging) ImagingError_ModeError(); + } im = ImagingNew(mode, 256, 256); - if (!im) - return NULL; + if (!im) { + return NULL; + } - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) { - d = (int) sqrt((double) ((x-128)*(x-128) + (y-128)*(y-128)) * 2.0); - if (d >= 255) - im->image8[y][x] = 255; - else - im->image8[y][x] = d; - } + for (y = 0; y < 256; y++) { + for (x = 0; x < 256; x++) { + d = (int) sqrt((double) ((x-128)*(x-128) + (y-128)*(y-128)) * 2.0); + if (d >= 255) { + im->image8[y][x] = 255; + } else { + im->image8[y][x] = d; + } + } + } return im; }