You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sj...@apache.org on 2008/03/26 18:10:04 UTC

svn commit: r641411 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java

Author: sjanuary
Date: Wed Mar 26 10:09:56 2008
New Revision: 641411

URL: http://svn.apache.org/viewvc?rev=641411&view=rev
Log:
Partial fix for HARMONY-5645 ([classlib][pack200] Pack200 - still some issues with maximal encoding (non -E1))

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java?rev=641411&r1=641410&r2=641411&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java Wed Mar 26 10:09:56 2008
@@ -58,12 +58,11 @@
         // read table of favorites first
         long smallest = Long.MAX_VALUE;
         long last = 0;
-        long value = 0; // TODO Are these sensible starting points?
+        long value = 0;
         int k = -1;
         while( true ) {
-            last = value;
             value = favouredCodec.decode(in,last);
-            if ( value == smallest || value == last)
+            if (k > -1 && (value == smallest || value == last))
                 break;
             favoured[++k] = value;
             if (Math.abs(smallest) > Math.abs(value)) {
@@ -72,6 +71,7 @@
                 // ensure that -X and +X -> +X
                 smallest = Math.abs(smallest);
             }
+            last = value;
         }
         // if tokenCodec needs to be derived from the T, L and K values
         if (tokenCodec == null) {