harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r641271 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
Date Wed, 26 Mar 2008 11:56:55 GMT
Author: sjanuary
Date: Wed Mar 26 04:56:52 2008
New Revision: 641271

URL: http://svn.apache.org/viewvc?rev=641271&view=rev
Log:
Fix for HARMONY-5630 ([classlib][pack200] Long.MAX_VALUE not decoded correctly)

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

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=641271&r1=641270&r2=641271&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
Wed Mar 26 04:56:52 2008
@@ -95,15 +95,6 @@
             // First element should not be discarded
             band = codec.decodeInts(count - 1, in, first);
         }
-//        if(!negativesAllowed && codec != codecUsed) {
-//            if(codecUsed instanceof BHSDCodec && ((BHSDCodec)codecUsed).isSigned())
{
-//                for (int i = 0; i < band.length; i++) {
-//                    while(band[i] < 0) {
-//                        band[i] += ((BHSDCodec)codecUsed).cardinality();
-//                    }
-//                }
-//            }
-//        }
         if(codecUsed instanceof BHSDCodec && ((BHSDCodec)codecUsed).isDelta()) {
             BHSDCodec bhsd = (BHSDCodec)codecUsed;
             long cardinality = bhsd.cardinality();
@@ -303,10 +294,10 @@
             result[i] = new long[counts[i]];
             sum += counts[i];
         }
-        long[] hi = null;
+        int[] hi = null;
         int[] lo;
         if(hiCodec != null) {
-            hi = decodeBandLong(name, in, hiCodec, sum);
+            hi = decodeBandInt(name, in, hiCodec, sum);
             lo = decodeBandInt(name, in, loCodec, sum);
         } else {
             lo = decodeBandInt(name, in, loCodec, sum);
@@ -316,7 +307,7 @@
         for (int i = 0; i < result.length; i++) {
             for (int j = 0; j < result[i].length; j++) {
                 if(hi != null) {
-                    result[i][j] = (hi[index] << 32) | lo[index];
+                    result[i][j] = ((long)hi[index] << 32) | (lo[index] & 4294967295L);
                 } else {
                     result[i][j] = lo[index];
                 }



Mime
View raw message