CET 20-01-01 Adobe way of growing the dictionary

Alex Cherepanov <[email protected]> Sun, 18 Feb 2007 10:26:17 -0500
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------020500090602090600080502
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Reproduce the algorithm used by Adobe to grow the dictionary
to match CET 20-01-01.

DIFFERENCES:
None: no comparefiles or CET differences.

The main question for the reviewer: do we need this adjustment
at all ?


--------------020500090602090600080502
Content-Type: text/plain;
 name="20-01-01.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="20-01-01.diff"

Index: gs/src/idict.c
===================================================================
--- gs/src/idict.c	(revision 7709)
+++ gs/src/idict.c	(working copy)
@@ -790,8 +790,14 @@
     dict *pdict = pdref->value.pdict;
     /* We might have maxlength < npairs, if */
     /* dict_round_size increased the size. */
-    ulong new_size = (ulong) d_maxlength(pdict) * 3 / 2 + 2;
-
+    ulong new_size = (ulong) d_maxlength(pdict);
+    /* Adobe does this */
+    if (new_size < 20)       
+        new_size += 10;
+    else if (new_size < 200)
+        new_size *= 2;
+    else
+        new_size += new_size / 2;
 #if arch_sizeof_int < arch_sizeof_long
     if (new_size > max_uint)
 	new_size = max_uint;


--------------020500090602090600080502
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review

--------------020500090602090600080502--