From cbde8e8f823362248e0fb5433845185768759df0 Mon Sep 17 00:00:00 2001 From: "Marcos H. Woehrmann" Date: Mon, 20 Feb 2012 06:23:06 -0800 Subject: Revert 2e807ab6d4eecfce43561b9e8d5b66386a5165ee and fix fuzzy.c correctly. --- gs/toolbin/tests/fuzzy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gs/toolbin/tests/fuzzy.c b/gs/toolbin/tests/fuzzy.c index 9beb63893..8c1a4a5c0 100644 --- a/gs/toolbin/tests/fuzzy.c +++ b/gs/toolbin/tests/fuzzy.c @@ -472,11 +472,10 @@ fuzzy_diff_images (Image *image1, Image *image2, const FuzzyParams *fparams, { int width = MIN(image1->width, image2->width); int height = MIN(image1->height, image2->height); - int max_width = MAX(image1->height, image2->height); int max_height = MAX(image1->height, image2->height); int tolerance = fparams->tolerance; int window_size = fparams->window_size; - int row_bytes = max_width * 3; + int row_bytes = width * 3; unsigned int out_buffer_size = (image_out ? row_bytes : 0); int half_win = window_size >> 1; uchar **buf1 = alloc_window (row_bytes*2, window_size); @@ -490,7 +489,7 @@ fuzzy_diff_images (Image *image1, Image *image2, const FuzzyParams *fparams, if (image_out != NULL) { - out_buf = malloc(out_buffer_size); + out_buf = malloc(out_buffer_size*2); if (out_buf == NULL) printf ("Can't allocate output buffer.\n"); } @@ -534,7 +533,7 @@ fuzzy_diff_images (Image *image1, Image *image2, const FuzzyParams *fparams, goto ex; } if (out_buf) - memset(out_buf, 0, out_buffer_size); + memset(out_buf, 0, out_buffer_size*2); if (memcmp(rowmid1, rowmid2, width * 3)) { -- cgit v1.2.3