[gs-cvs] rev 6954 - trunk/gs/src

lpd at ghostscript.com lpd at ghostscript.com
Wed Aug 2 14:38:04 PDT 2006


Author: lpd
Date: 2006-08-02 14:38:04 -0700 (Wed, 02 Aug 2006)
New Revision: 6954

Modified:
   trunk/gs/src/iutil.c
Log:
Fixes eq and ne so that an array is never eq to a packedarray, even if both
have zero length.


Modified: trunk/gs/src/iutil.c
===================================================================
--- trunk/gs/src/iutil.c	2006-08-02 21:10:17 UTC (rev 6953)
+++ trunk/gs/src/iutil.c	2006-08-02 21:38:04 UTC (rev 6954)
@@ -113,13 +113,20 @@
 		name_string_ref(mem, pref2, &nref);
 		pref2 = &nref;
 		break;
-
-		/* differing array types can match if length is 0 */
-	    case t_array:
+		/*
+		 * Differing implementations of packedarray can be eq,
+		 * if the length is zero, but an array is never eq to a
+		 * packedarray.
+		 */
 	    case t_mixedarray:
 	    case t_shortarray:
-		return r_is_array(pref2) &&
-		       r_size(pref1) == 0 && r_size(pref2) == 0;
+		/*
+		 * Since r_type(pref1) is one of the above, this is a
+		 * clever fast check for r_type(pref2) being the other.
+		 */
+		return ((int)r_type(pref1) + (int)r_type(pref2) ==
+			t_mixedarray + t_shortarray) &&
+		    r_size(pref1) == 0 && r_size(pref2) == 0;
 	    default:
 		if (r_btype(pref1) != r_btype(pref2))
 		    return false;



More information about the gs-cvs mailing list