[gs-cvs] rev 7747 - trunk/gs/toolbin/tests

alexcher at ghostscript.com alexcher at ghostscript.com
Mon Feb 26 08:24:17 PST 2007


Author: alexcher
Date: 2007-02-26 08:24:17 -0800 (Mon, 26 Feb 2007)
New Revision: 7747

Modified:
   trunk/gs/toolbin/tests/fuzzy.c
Log:
Fix indeterministic behavior of fuzzy.c with -w > 1. Initialize the rest of
the window buffer that would be uninitialized before half_win lines is read.


Modified: trunk/gs/toolbin/tests/fuzzy.c
===================================================================
--- trunk/gs/toolbin/tests/fuzzy.c	2007-02-25 20:46:03 UTC (rev 7746)
+++ trunk/gs/toolbin/tests/fuzzy.c	2007-02-26 16:24:17 UTC (rev 7747)
@@ -474,7 +474,20 @@
 	    goto ex;
 	}
     }
+  /* Initialie remaining scanlines if height < half_win */
+  for (; y < half_win; y++) {
+    memcpy(buf1[half_win - y], buf1[half_win], width * 3); 
+    memcpy(buf2[half_win - y], buf2[half_win], width * 3);
+  }
 
+  /* Initialie the rest of the buffer that would be uninitialised */
+  /* before half_win lines is read, because check_window() always */
+  /* peeks into the whole window */
+  for (y = 0; y < half_win; y++) {
+    memcpy(buf1[half_win + y + 1], buf1[half_win], width * 3);
+    memcpy(buf2[half_win + y + 1], buf2[half_win], width * 3);
+  }
+
   /* Do compare : */
   freport->n_diff = 0;
   freport->n_outof_tolerance = 0;



More information about the gs-cvs mailing list