diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | src/gd_filter.c | 6 | ||||
-rw-r--r-- | src/gd_interpolation.c | 11 |
3 files changed, 16 insertions, 5 deletions
@@ -25,6 +25,10 @@ libimagequant-prefix src/deps.mk deps Release_GD + +# CMake build directory +/build + # Autotools related files. *.l[ao] .deps diff --git a/src/gd_filter.c b/src/gd_filter.c index a3119f7..3ea8732 100644 --- a/src/gd_filter.c +++ b/src/gd_filter.c @@ -15,7 +15,11 @@ #include <time.h> #include <math.h> -#define NDEBUG /* Uncomment to enable assertions. */ +#undef NDEBUG +/* Comment out this line to enable asserts. + * TODO: This logic really belongs in cmake and configure. + */ +#define NDEBUG 1 #include <assert.h> typedef int (BGD_STDCALL *FuncPtr)(gdImagePtr, int, int); diff --git a/src/gd_interpolation.c b/src/gd_interpolation.c index 860a9e6..bebecf2 100644 --- a/src/gd_interpolation.c +++ b/src/gd_interpolation.c @@ -61,9 +61,12 @@ TODO: #include <stdlib.h> #include <string.h> #include <math.h> -#include <assert.h> -#define NDEBUG 1 /* TODO: disable/enable assertions in configure. */ +#undef NDEBUG +/* Comment out this line to enable asserts. + * TODO: This logic really belongs in cmake and configure. + */ +#define NDEBUG 1 #include <assert.h> #include "gd.h" @@ -1634,7 +1637,7 @@ BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int ne { gdImagePtr im_scaled = NULL; - if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) { + if (src == NULL || (uintmax_t)src->interpolation_id >= GD_METHOD_COUNT) { return 0; } @@ -2515,7 +2518,7 @@ BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id) { - if (im == NULL || id < 0 || id > GD_METHOD_COUNT) { + if (im == NULL || id < 0 || (uintmax_t)id > GD_METHOD_COUNT) { return 0; } |