You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2008/08/22 09:15:27 UTC

svn commit: r687988 [6/11] - in /harmony/enhanced/classlib/branches/java6: ./ depends/build/ depends/build/platform/ depends/jars/ depends/jars/icu4jni_3.4/ depends/manifests/bcel-5.2/ depends/manifests/bcel-5.2/META-INF/ make/ modules/accessibility/ m...

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/FormatterTest.java Fri Aug 22 00:15:00 2008
@@ -29,11 +29,13 @@
 import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.math.MathContext;
 import java.nio.charset.Charset;
 import java.security.Permission;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
 import java.util.DuplicateFormatFlagsException;
 import java.util.FormatFlagsConversionMismatchException;
 import java.util.Formattable;
@@ -56,6 +58,7 @@
 import junit.framework.TestCase;
 
 public class FormatterTest extends TestCase {
+	private boolean root;
 
     class MockAppendable implements Appendable {
         public Appendable append(CharSequence arg0) throws IOException {
@@ -247,12 +250,13 @@
         assertEquals(0, fileWithContent.length());
         f.close();
 
-        // FIXME This exception will not be thrown out on linux.
-        try {
-            f = new Formatter(readOnly.getPath());
-            fail("should throw FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            // expected
+        if(!root){
+        	try {
+                f = new Formatter(readOnly.getPath());
+                fail("should throw FileNotFoundException");
+            } catch (FileNotFoundException e) {
+                // expected
+            }
         }
 
         SecurityManager oldsm = System.getSecurityManager();
@@ -302,12 +306,13 @@
         assertEquals(0, fileWithContent.length());
         f.close();
 
-        // FIXME This exception will not be thrown out on linux.
-        try {
-            f = new Formatter(readOnly.getPath(), "UTF-16BE");
-            fail("should throw FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            // expected
+        if(!root){
+        	try {
+                f = new Formatter(readOnly.getPath(), "UTF-16BE");
+                fail("should throw FileNotFoundException");
+            } catch (FileNotFoundException e) {
+                // expected
+            }
         }
 
         SecurityManager oldsm = System.getSecurityManager();
@@ -365,14 +370,16 @@
         assertEquals(0, fileWithContent.length());
         f.close();
 
-        try {
-            f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
-                    .name(), Locale.ITALY);
-            fail("should throw FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            // expected
+        if(!root){
+        	try {
+                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
+                        .name(), Locale.ITALY);
+                fail("should throw FileNotFoundException");
+            } catch (FileNotFoundException e) {
+                // expected
+            }
         }
-
+        
         SecurityManager oldsm = System.getSecurityManager();
         System.setSecurityManager(new MockSecurityManager());
         try {
@@ -406,14 +413,15 @@
         assertEquals(0, fileWithContent.length());
         f.close();
 
-        // FIXME This exception will not be thrown out on linux.
-        try {
-            f = new Formatter(readOnly);
-            fail("should throw FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            // expected
+        if(!root){
+        	try {
+                f = new Formatter(readOnly);
+                fail("should throw FileNotFoundException");
+            } catch (FileNotFoundException e) {
+                // expected
+            }
         }
-
+        
         SecurityManager oldsm = System.getSecurityManager();
         System.setSecurityManager(new MockSecurityManager());
         try {
@@ -447,12 +455,13 @@
         assertEquals(0, fileWithContent.length());
         f.close();
 
-        // FIXME This exception will not be thrown out on linux.
-        try {
-            f = new Formatter(readOnly, Charset.defaultCharset().name());
-            fail("should throw FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            // expected
+        if(!root){
+        	try {
+                f = new Formatter(readOnly, Charset.defaultCharset().name());
+                fail("should throw FileNotFoundException");
+            } catch (FileNotFoundException e) {
+                // expected
+            }
         }
 
         SecurityManager oldsm = System.getSecurityManager();
@@ -534,13 +543,14 @@
         assertEquals(0, fileWithContent.length());
         f.close();
 
-        // FIXME This exception will not be thrown out on linux.
-        try {
-            f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
-                    .name(), Locale.ITALY);
-            fail("should throw FileNotFoundException");
-        } catch (FileNotFoundException e) {
-            // expected
+        if(!root){
+        	try {
+                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
+                        .name(), Locale.ITALY);
+                fail("should throw FileNotFoundException");
+            } catch (FileNotFoundException e) {
+                // expected
+            }
         }
 
         SecurityManager oldsm = System.getSecurityManager();
@@ -4238,10 +4248,49 @@
         assertEquals("Wrong dec float value from valueOf ", BigDecimalLayoutForm.DECIMAL_FLOAT, decFloat);
     }
     
+    /*
+     * Regression test for Harmony-5845
+     * test the short name for timezone whether uses DaylightTime or not
+     */
+    public void test_DaylightTime() {
+        Calendar c1 = new GregorianCalendar(2007, 0, 1);
+        Calendar c2 = new GregorianCalendar(2007, 7, 1);
+
+        for (String tz : TimeZone.getAvailableIDs()) {
+            if (tz.equals("America/Los_Angeles")) {
+                c1.setTimeZone(TimeZone.getTimeZone(tz));
+                c2.setTimeZone(TimeZone.getTimeZone(tz));
+                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("PSTPDT"));
+            }
+            if (tz.equals("America/Panama")) {
+                c1.setTimeZone(TimeZone.getTimeZone(tz));
+                c2.setTimeZone(TimeZone.getTimeZone(tz));
+                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("ESTEST"));
+            }
+        }
+    }
+    
+    /*
+     * Regression test for Harmony-5845
+     * test scientific notation to follow RI's behavior
+     */
+    public void test_ScientificNotation() {
+        Formatter f = new Formatter();
+        MathContext mc = new MathContext(30);
+        BigDecimal value = new BigDecimal(0.1, mc);
+        f.format("%.30G", value);
+
+        String result = f.toString();
+        String expected = "0.100000000000000005551115123126";
+        assertEquals(expected, result);
+    }
+
+    
     /**
      * Setup resource files for testing
      */
     protected void setUp() throws IOException {
+        root = System.getProperty("user.name").equalsIgnoreCase("root");
         notExist = File.createTempFile("notexist", null);
         notExist.delete();
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java Fri Aug 22 00:15:00 2008
@@ -128,7 +128,7 @@
 	 */
 	public void test_ConstructorLjava_util_TimeZone() {
 		// Test for method java.util.GregorianCalendar(java.util.TimeZone)
-		Date date = new Date();
+		Date date = new Date(2008,1,1);
 		TimeZone.getDefault();
 		GregorianCalendar gc1 = new GregorianCalendar(TimeZone
 				.getTimeZone("EST"));
@@ -167,7 +167,7 @@
 	public void test_ConstructorLjava_util_TimeZoneLjava_util_Locale() {
 		// Test for method java.util.GregorianCalendar(java.util.TimeZone,
 		// java.util.Locale)
-		Date date = new Date();
+		Date date = new Date(2008,1,1);
 		TimeZone.getDefault();
 		GregorianCalendar gc1 = new GregorianCalendar(TimeZone
 				.getTimeZone("EST"), Locale.JAPAN);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java Fri Aug 22 00:15:00 2008
@@ -18,6 +18,7 @@
 package org.apache.harmony.luni.tests.java.util;
 
 import java.util.Calendar;
+import java.util.Date;
 import java.util.Formatter;
 import java.util.GregorianCalendar;
 import java.util.Locale;
@@ -147,8 +148,9 @@
                              "GMT+05:20", TimeZone.getTimeZone("GMT+520").getID());
 		assertEquals("Must return proper GMT formatted string for GMT+052 (eg. GMT+08:20).",
                              "GMT+00:52", TimeZone.getTimeZone("GMT+052").getID());
-		assertEquals("Must return proper GMT formatted string for GMT-0 (eg. GMT+08:20).",
-                             "GMT-00:00", TimeZone.getTimeZone("GMT-0").getID());
+        // GMT-0 is an available ID in ICU, so replace it with GMT-00
+		assertEquals("Must return proper GMT formatted string for GMT-00 (eg. GMT+08:20).",
+                             "GMT-00:00", TimeZone.getTimeZone("GMT-00").getID());
 	}
 
 	/**
@@ -188,6 +190,18 @@
         }
     }
     
+    /*
+     * Regression for HARMONY-5860
+     */
+    public void test_GetTimezoneOffset() {
+        // America/Toronto is lazy initialized 
+        TimeZone.setDefault(TimeZone.getTimeZone("America/Toronto"));
+        Date date = new Date(07, 2, 24);
+        assertEquals(300, date.getTimezoneOffset());
+        date = new Date(99, 8, 1);
+        assertEquals(240, date.getTimezoneOffset());
+    }
+    
 	protected void setUp() {
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/math/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/build.xml Fri Aug 22 00:15:00 2008
@@ -164,6 +164,11 @@
             showoutput="on"
             dir="${basedir}"
             jvm="${test.jre.home}/bin/java">
+
+            <assertions enableSystemAssertions="true">
+                <enable />
+            </assertions>
+
             <jvmarg line="${hy.test.vmargs}" />
 
             <classpath>

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigDecimal.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigDecimal.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigDecimal.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigDecimal.java Fri Aug 22 00:15:00 2008
@@ -743,7 +743,7 @@
             
         } else {
             // Checking if:  remainder * 2 >= scaledDivisor 
-            compRem = remainder.abs().shiftLeft(1).compareTo(scaledDivisor.abs());
+            compRem = remainder.abs().shiftLeftOneBit().compareTo(scaledDivisor.abs());
             compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0,
                     sign * (5 + compRem), roundingMode);
         }
@@ -875,7 +875,7 @@
         // Calculating the exact quotient with at least 'mc.precision()' digits
         if (quotAndRem[1].signum() != 0) {
             // Checking if:   2 * remainder >= divisor ?
-            compRem = quotAndRem[1].shiftLeft(1).compareTo( divisor.getUnscaledValue() );
+            compRem = quotAndRem[1].shiftLeftOneBit().compareTo( divisor.getUnscaledValue() );
             // quot := quot * 10 + r;     with 'r' in {-6,-5,-4, 0,+4,+5,+6}
             integerQuot = integerQuot.multiply(BigInteger.TEN)
             .add(BigInteger.valueOf(quotAndRem[0].signum() * (5 + compRem)));
@@ -1691,7 +1691,7 @@
             // Computing (mantisa * 2^k) / 10^s
             quotAndRem = mantisa.divideAndRemainder(powerOfTen);
             // To check if the fractional part >= 0.5
-            compRem = quotAndRem[1].shiftLeft(1).compareTo(powerOfTen);
+            compRem = quotAndRem[1].shiftLeftOneBit().compareTo(powerOfTen);
             // To add two rounded bits at end of mantisa
             mantisa = quotAndRem[0].shiftLeft(2).add(
                     BigInteger.valueOf((compRem * (compRem + 3)) / 2 + 1));
@@ -1791,7 +1791,7 @@
         // If the discarded fraction is non-zero, perform rounding
         if (integerAndFraction[1].signum() != 0) {
             // To check if the discarded fraction >= 0.5
-            compRem = (integerAndFraction[1].abs().shiftLeft(1).compareTo(sizeOfFraction));
+            compRem = (integerAndFraction[1].abs().shiftLeftOneBit().compareTo(sizeOfFraction));
             // To look if there is a carry
             compRem =  roundingBehavior( integerAndFraction[0].testBit(0) ? 1 : 0,
                     integerAndFraction[1].signum() * (5 + compRem),

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigInteger.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigInteger.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigInteger.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BigInteger.java Fri Aug 22 00:15:00 2008
@@ -65,6 +65,15 @@
             new BigInteger(1, 6), new BigInteger(1, 7), new BigInteger(1, 8),
             new BigInteger(1, 9), TEN };
 
+    static final BigInteger[] TWO_POWS;
+
+    static {
+        TWO_POWS = new BigInteger[32];
+        for(int i = 0; i < TWO_POWS.length; i++) {
+            TWO_POWS[i] = BigInteger.valueOf(1L<<i);
+        }
+    }
+
     private transient int firstNonzeroDigit = -2;
 
     /* Serialized Fields */
@@ -423,6 +432,10 @@
                 this, -n));
     }
 
+    BigInteger shiftLeftOneBit() {
+        return (sign == 0) ? this : BitLevel.shiftLeftOneBit(this);
+    }
+
     public int bitLength() {
         return BitLevel.bitLength(this);
     }
@@ -647,12 +660,10 @@
         // calculate by shifting.
         if (!testBit(0)) {
             int x = 1;
-            BigInteger factor = BigInteger.ONE.shiftLeft(exp);
             while (!testBit(x)) {
-                factor = factor.shiftLeft(exp);
                 x++;
             }
-            return factor.multiply(this.shiftRight(x).pow(exp));
+            return getPowerOfTwo(x*exp).multiply(this.shiftRight(x).pow(exp));
         }
         return Multiplication.pow(this, exp);
     }
@@ -971,4 +982,16 @@
     void unCache() {
         firstNonzeroDigit = -2;
     }
+
+    static BigInteger getPowerOfTwo(int exp) {
+        if(exp < TWO_POWS.length) {
+            return TWO_POWS[exp];
+        }
+        int intCount = exp >> 5;
+        int bitN = exp & 31;
+        int resDigits[] = new int[intCount+1];
+        resDigits[intCount] = 1 << bitN;
+        return new BigInteger(1, intCount+1, resDigits);
+    }
 }
+

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/BitLevel.java Fri Aug 22 00:15:00 2008
@@ -169,6 +169,28 @@
         }
     }
 
+    static void shiftLeftOneBit(int result[], int source[], int srcLen) {
+        int carry = 0;
+        for(int i = 0; i < srcLen; i++) {
+            int val = source[i];
+            result[i] = (val << 1) | carry;
+            carry = val >>> 31;
+        }
+        if(carry != 0) {
+            result[srcLen] = carry;
+        }
+    }
+
+    static BigInteger shiftLeftOneBit(BigInteger source) {
+        int srcLen = source.numberLength;
+        int resLen = srcLen + 1;
+        int resDigits[] = new int[resLen];
+        shiftLeftOneBit(resDigits, source.digits, srcLen);
+        BigInteger result = new BigInteger(source.sign, resLen, resDigits);
+        result.cutOffLeadingZeroes();
+        return result;
+    }
+
     /** @see BigInteger#shiftRight(int) */
     static BigInteger shiftRight(BigInteger source, int count) {
         int intCount = count >> 5; // count of integers

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Division.java Fri Aug 22 00:15:00 2008
@@ -136,7 +136,7 @@
             if (guessDigit != 0) {
                 int borrow = Division.multiplyAndSubtract(normA, j
                         - normBLength, normB, normBLength,
-                        guessDigit & 0xffffffffL);
+                        guessDigit);
                 // Step D5: check the borrow
                 if (borrow != 0) {
                     // Step D6: compensating addition
@@ -353,29 +353,21 @@
      * @param c the multiplier of b
      * @return the carry element of subtraction
      */
-    static int multiplyAndSubtract(int a[], int start, int b[], int bLen, long c) {
-        int i;
-        int carry = 0;
-        long product;
-        int productInt;
-
-        for (i = 0; i < bLen; i++) {
-            product = c * (b[i] & 0xffffffffL);
-            productInt = (int) product;
-            productInt += carry;
-            carry = (int) (product >> 32)
-                    + ((productInt ^ 0x80000000) < (carry ^ 0x80000000) ? 1 : 0);
-            productInt = a[start + i] - productInt;
-            if ((productInt ^ 0x80000000) > (a[start + i] ^ 0x80000000)) {
-                carry++;
-            }
-            a[start + i] = productInt;
-        }
-        product = (a[start + i] & 0xffffffffL)
-                - (carry & 0xffffffffL);
-        a[start + i] = (int) product;
-        carry = (int) (product >> 32); // -1 or 0
-        return carry;
+    static int multiplyAndSubtract(int a[], int start, int b[], int bLen, int c) {
+        long carry0 = 0;
+        long carry1 = 0;
+        
+        for (int i = 0; i < bLen; i++) {
+            carry0 = Multiplication.unsignedMultAddAdd(b[i], c, (int)carry0, 0);
+            carry1 = (a[start+i] & 0xffffffffL) - (carry0 & 0xffffffffL) + carry1;
+            a[start+i] = (int)carry1;
+            carry1 >>=  32; // -1 or 0
+            carry0 >>>= 32;
+        }
+        
+        carry1 = (a[start + bLen] & 0xffffffffL) - carry0 + carry1;
+        a[start + bLen] = (int)carry1;
+        return (int)(carry1 >> 32); // -1 or 0
     }
 
     /**
@@ -503,52 +495,10 @@
         }
         
         int m = p.numberLength * 32;
-        
-        Object[] save = almostMonInv(a, p);
-        BigInteger r = ( (BigInteger) save[0] );
-        int k = ( (Integer) save[1] ).intValue();
-//		assert ( k >= n && k <= m + n );
-        
-        long n1 = calcN(p);
-        
-        if (k > m) {
-            r = monPro(r, BigInteger.ONE, p, n1);
-            k = k - m;
-//			assert k < m;
-        }
-        r = monPro(r, BigInteger.ONE.shiftLeft(m - k), p, n1);
-        return r;
-        }
-    
-    /**
-     * Calculate the first digit of the inverse
-     */
-    private static long calcN(BigInteger a) {
-        long m0 = a.digits[0] & 0xFFFFFFFFL;
-        long n2 = 1L; // this is a'[0]
-        long powerOfTwo = 2L;
-        
-        do {
-            if (( ( m0 * n2 ) & powerOfTwo ) != 0) {
-                n2 |= powerOfTwo;
-        }
-            powerOfTwo <<= 1;
-        } while (powerOfTwo < 0x100000000L);
-        n2 = -n2;
-        return n2;
-        }
-    
-    /**
-     * Used for an intermediate result of the modInverse algorithm
-     * @return the pair: ((BigInteger)r, (Integer)k) where r == a^(-1) * 2^k mod (module)
-     */
-    private static Object[] almostMonInv(BigInteger a, BigInteger module) {
         // PRE: a \in [1, p - 1]
         BigInteger u, v, r, s;
-        // make copy to use inplace method
-        u = module.copy();
+        u = p.copy();  // make copy to use inplace method
         v = a.copy();
-        
         int max = Math.max(v.numberLength, u.numberLength);
         r = new BigInteger(1, 1, new int[max + 1]);
         s = new BigInteger(1, 1, new int[max + 1]);
@@ -571,9 +521,8 @@
             BitLevel.inplaceShiftRight(v, lsbv);
             BitLevel.inplaceShiftLeft(s, lsbu);
             k += lsbv - lsbu;
-            
-    }
-
+        }
+        
         r.sign = 1;
         while (v.signum() > 0) {
             // INV v >= 0, u >= 0, v odd, u odd (except last iteration when v is even (0))
@@ -584,8 +533,7 @@
                 BitLevel.inplaceShiftRight(u, toShift);
                 Elementary.inplaceAdd(r, s);
                 BitLevel.inplaceShiftLeft(s, toShift);
-                k += toShift;
-                
+                k += toShift;                
             }
             
             while (u.compareTo(v) <= BigInteger.EQUALS) {
@@ -597,25 +545,48 @@
                 Elementary.inplaceAdd(s, r);
                 BitLevel.inplaceShiftLeft(r, toShift);
                 k += toShift;
-                
             }
-            
         }
         if (!u.isOne()){
             // in u is stored the gcd
             // math.19: BigInteger not invertible.
             throw new ArithmeticException(Messages.getString("math.19"));
         }
+        if (r.compareTo(p) >= BigInteger.EQUALS) {
+            Elementary.inplaceSubtract(r, p);
+        }
         
-        if (r.compareTo(module) >= BigInteger.EQUALS) {
-            Elementary.inplaceSubtract(r, module);
+        r = p.subtract(r);
+
+        // Have pair: ((BigInteger)r, (Integer)k) where r == a^(-1) * 2^k mod (module)		
+        int n1 = calcN(p);
+        if (k > m) {
+            r = monPro(r, BigInteger.ONE, p, n1);
+            k = k - m;
         }
-        r = module.subtract(r);
         
-        return new Object[] { r, k };
+        r = monPro(r, BigInteger.getPowerOfTwo(m - k), p, n1);
+        return r;
     }
     
     /**
+     * Calculate the first digit of the inverse
+     */
+    private static int calcN(BigInteger a) {
+        long m0 = a.digits[0] & 0xFFFFFFFFL;
+        long n2 = 1L; // this is a'[0]
+        long powerOfTwo = 2L;
+        do {
+            if (((m0 * n2) & powerOfTwo) != 0) {
+                n2 |= powerOfTwo;
+            }
+            powerOfTwo <<= 1;
+        } while (powerOfTwo < 0x100000000L);
+        n2 = -n2;
+        return (int)(n2 & 0xFFFFFFFFL);
+    }
+
+    /**
      * @return bi == abs(2^exp)
      */
     private static boolean isPowerOfTwo(BigInteger bi, int exp) {
@@ -754,7 +725,7 @@
         return r;
     }
     
-    static BigInteger squareAndMultiply(BigInteger x2, BigInteger a2, BigInteger exponent,BigInteger modulus, long n2  ){
+    static BigInteger squareAndMultiply(BigInteger x2, BigInteger a2, BigInteger exponent,BigInteger modulus, int n2  ){
         BigInteger res = x2;
         for (int i = exponent.bitLength() - 1; i >= 0; i--) {
             res = monPro(res,res,modulus, n2);
@@ -771,7 +742,7 @@
      *@see #oddModPow(BigInteger, BigInteger,
      *                           BigInteger)
      */
-    static BigInteger slidingWindow(BigInteger x2, BigInteger a2, BigInteger exponent,BigInteger modulus, long n2){
+    static BigInteger slidingWindow(BigInteger x2, BigInteger a2, BigInteger exponent,BigInteger modulus, int n2){
         // fill odd low pows of a2
         BigInteger pows[] = new BigInteger[8];
         BigInteger res = x2;
@@ -780,7 +751,7 @@
         int acc3;
         pows[0] = a2;
         
-        x3 = monSquare(a2,modulus,n2);
+        x3 = monPro(a2,a2,modulus,n2);
         for (int i = 1; i <= 7; i++){
             pows[i] = monPro(pows[i-1],x3,modulus,n2) ;
         }
@@ -802,12 +773,12 @@
                 }
                 
                 for(int j = acc3; j <= i; j++) {
-                    res = monSquare(res,modulus,n2);
+                    res = monPro(res,res,modulus,n2);
                 }
                 res = monPro(pows[(lowexp-1)>>1], res, modulus,n2);
                 i = acc3 ;
             }else{
-                res = monSquare(res, modulus, n2) ;
+                res = monPro(res, res, modulus, n2) ;
             }
         }
         return res;
@@ -818,11 +789,11 @@
      * requires that all parameters be positive and the modulus be odd. >
      * 
      * @see BigInteger#modPow(BigInteger, BigInteger)
-     * @see #monPro(BigInteger, BigInteger, BigInteger, long)
+     * @see #monPro(BigInteger, BigInteger, BigInteger, int)
      * @see #slidingWindow(BigInteger, BigInteger, BigInteger, BigInteger,
-     *                      long)
+     *                      int)
      * @see #squareAndMultiply(BigInteger, BigInteger, BigInteger, BigInteger,
-     *                      long)
+     *                      int)
      */
     static BigInteger oddModPow(BigInteger base, BigInteger exponent,
             BigInteger modulus) {
@@ -831,22 +802,11 @@
         // n-residue of base [base * r (mod modulus)]
         BigInteger a2 = base.shiftLeft(k).mod(modulus);
         // n-residue of base [1 * r (mod modulus)]
-        BigInteger x2 = BigInteger.ZERO.setBit(k).mod(modulus);
+        BigInteger x2 = BigInteger.getPowerOfTwo(k).mod(modulus);
         BigInteger res;
         // Compute (modulus[0]^(-1)) (mod 2^32) for odd modulus
         
-        long m0 = modulus.digits[0] & 0xFFFFFFFFL;
-        long n2 = 1L; // this is n'[0]
-        long powerOfTwo = 2L;
-        // compute n2
-        do {
-            if (((m0 * n2) & powerOfTwo) != 0) {
-                n2 |= powerOfTwo;
-            }
-            powerOfTwo <<= 1;
-        } while (powerOfTwo < 0x100000000L);
-        n2 = -n2;
-
+        int n2 = calcN(modulus);
         if( modulus.numberLength == 1 ){
             res = squareAndMultiply(x2,a2, exponent, modulus,n2);
         } else {
@@ -884,7 +844,7 @@
         BigInteger y = (x2.subtract(x1)).multiply(qInv);
         inplaceModPow2(y, j);
         if (y.sign < 0) {
-            y = y.add(BigInteger.ZERO.setBit(j));
+            y = y.add(BigInteger.getPowerOfTwo(j));
         }
         // STEP 5: Compute and return: x1 + q * y
         return x1.add(q.multiply(y));
@@ -924,75 +884,33 @@
         return res;
     }
 
-    /** Implements the Montgomery Square of a BigInteger.
-     * @see #monPro(BigInteger, BigInteger, BigInteger,
-     * long)
-     */
-    static BigInteger monSquare(BigInteger aBig, BigInteger modulus,
-            long n2){
-        if(modulus.numberLength == 1){
-            return monPro(aBig, aBig, modulus, n2);
-        }
-        //Squaring
-        int [] a = aBig.digits;
-        int [] n = modulus.digits;
-        int s = modulus.numberLength;
-        
-        //Multiplying...
-        int [] t = new int [(s<<1) + 1];
-        long cs;
-        
-        int limit = Math.min(s,aBig.numberLength );
-        for(int i=0; i<limit; i++){
-            cs = 0;
-            for (int j=i+1; j<limit; j++){
-                cs += (0xFFFFFFFFL & t[i+j]) + (0xFFFFFFFFL & a[i]) * (0xFFFFFFFFL & a[j]) ;
-                t[i+j] = (int) cs;
-                cs >>>= 32;
+    private static void monReduction(int[] res, BigInteger modulus, int n2) {
+
+        /* res + m*modulus_digits */
+        int[] modulus_digits = modulus.digits;
+        int modulusLen = modulus.numberLength;
+        long outerCarry = 0;
+        
+        for (int i = 0; i < modulusLen; i++){
+            long innnerCarry = 0;
+            int m = (int) Multiplication.unsignedMultAddAdd(res[i],n2,0,0);
+            for(int j = 0; j < modulusLen; j++){
+                innnerCarry =  Multiplication.unsignedMultAddAdd(m, modulus_digits[j], res[i+j], (int)innnerCarry);
+                res[i+j] = (int) innnerCarry;
+                innnerCarry >>>= 32;
             }
-            
-            t[i+limit] = (int) cs;
+
+            outerCarry += (res[i+modulusLen] & 0xFFFFFFFFL) + innnerCarry;
+            res[i+modulusLen] = (int) outerCarry;
+            outerCarry >>>= 32;
         }
-        BitLevel.shiftLeft( t, t, 0, 1 );
         
-        cs = 0;
-        long carry = 0;
-        for(int i=0, index = 0; i< s; i++, index++){
-            cs += (0xFFFFFFFFL & a[i]) * (0xFFFFFFFFL & a[i]) + (t[index] & 0xFFFFFFFFL);
-            t[index] = (int) cs;
-            cs >>>= 32;
-            index++;
-            cs += t[index] & 0xFFFFFFFFL ;
-            t[index] = (int)cs;
-            cs >>>= 32;
-        }
-        
-        //Reducing...
-        /* t + m*n */
-        int m = 0;
-        int i, j;
-        cs = carry = 0;
-        for (i=0; i<s; i++){
-            cs = 0;
-            m = (int) ((t[i] & 0xFFFFFFFFL) * (n2 & 0xFFFFFFFFL));
-            for(j=0; j<s; j++){
-                cs = (t[i+j] & 0xFFFFFFFFL) +  (m & 0xFFFFFFFFL)  * (n[j] & 0xFFFFFFFFL) + (cs >>> 32);
-                t[i+j] = (int) cs;
-            }
-            //Adding C to the result
-            carry += (t[i+s] & 0xFFFFFFFFL) + ( (cs>>>32) & 0xFFFFFFFFL);
-            t[i+s] = (int) carry;
-            carry >>>=32;
-        }
-        
-        t[s<<1] = (int) carry;
-        
-        /* t / r  */
-        for(j=0; j<s+1; j++){
-            t[j] = t[j+s];
+        res[modulusLen << 1] = (int) outerCarry;
+        
+        /* res / r  */        
+        for(int j = 0; j < modulusLen+1; j++){
+            res[j] = res[j+modulusLen];
         }
-        /*step 3*/
-        return finalSubtraction(t, s, s, modulus );
     }
     
     /**
@@ -1008,82 +926,46 @@
      *                  Multiplication Algorithms"
      * @see #modPowOdd(BigInteger, BigInteger, BigInteger)
      */
-    static BigInteger monPro(BigInteger a, BigInteger b, BigInteger modulus,
-            long n2) {
-        int aFirst = a.numberLength - 1;
-        int bFirst = b.numberLength - 1;
-        int s = modulus.numberLength;
-        int n[] = modulus.digits;
-
-        int m;
-        int i, j;
-        int t[] = new int[(s << 1) + 1];
-        long product;
-        long C;
-        long aI;
-
-        for (i = 0; i < s; i++) {
-            C = 0;
-            aI = (i > aFirst) ? 0 : (a.digits[i] & 0xFFFFFFFFL);
-            for (j = 0; j < s; j++) {
-                product = (t[j] & 0xFFFFFFFFL) + C
-                        + ((j > bFirst) ? 0 : (b.digits[j] & 0xFFFFFFFFL) * aI);
-                C = product >>> 32;
-                t[j] = (int) product;
-            }
-            product = (t[s] & 0xFFFFFFFFL) + C;
-            C = product >>> 32;
-            t[s] = (int) product;
-            t[s + 1] = (int) C;
-
-            m = (int) ((t[0] & 0xFFFFFFFFL) * n2);
-            product = (t[0] & 0xFFFFFFFFL) + (m & 0xFFFFFFFFL)
-                    * (n[0] & 0xFFFFFFFFL);
-            C = (int) (product >>> 32);
-            for (j = 1; j < s; j++) {
-                product = (t[j] & 0xFFFFFFFFL) + (C & 0xFFFFFFFFL)
-                        + (m & 0xFFFFFFFFL) * (n[j] & 0xFFFFFFFFL);
-                C = product >>> 32;
-                t[j - 1] = (int) product;
-            }
-            product = (t[s] & 0xFFFFFFFFL) + (C & 0xFFFFFFFFL);
-            C = product >>> 32;
-            t[s - 1] = (int) product;
-            t[s] = t[s + 1] + (int) C;
-        }
-        
-        return finalSubtraction(t, t.length-1 ,s, modulus);
-        
-    }
-    /*Performs the final reduction of the Montgomery algorithm.
-     *@see monPro(BigInteger, BigInteger, BigInteger,
-     *long )
-     *@see monSquare(BigInteger, BigInteger ,
-     *long)
+    static BigInteger monPro(BigInteger a, BigInteger b, BigInteger modulus, int n2) {
+        int modulusLen = modulus.numberLength;
+        int res[] = new int[(modulusLen << 1) + 1];
+        Multiplication.multArraysPAP(a.digits, Math.min(modulusLen, a.numberLength),
+                                      b.digits, Math.min(modulusLen, b.numberLength), res);
+        monReduction(res,modulus,n2);
+        return finalSubtraction(res, modulus);
+        
+    }
+    
+    /**
+     * Performs the final reduction of the Montgomery algorithm.
+     * @see monPro(BigInteger, BigInteger, BigInteger, long)
+     * @see monSquare(BigInteger, BigInteger, long)
      */
-    static BigInteger finalSubtraction(int t[], int tLength ,int s, BigInteger modulus){
+    static BigInteger finalSubtraction(int res[], BigInteger modulus){
+        
         // skipping leading zeros
-        int i;
-        int n[] = modulus.digits;
-        boolean lower = false;
-        
-        for (i = tLength; (i > 0) && (t[i] == 0); i--)
-            ;
-
-        if (i == s - 1) {
-            for (; (i >= 0) && (t[i] == n[i]); i--)
-                ;
-            lower = (i >= 0) && (t[i] & 0xFFFFFFFFL) < (n[i] & 0xFFFFFFFFL);
-        } else {
-            lower = (i < s - 1);
+        int modulusLen = modulus.numberLength;
+        boolean doSub = res[modulusLen]!=0;
+        if(!doSub) {
+            int modulusDigits[] = modulus.digits;
+            doSub = true;
+            for(int i = modulusLen - 1; i >= 0; i--) {
+                if(res[i] != modulusDigits[i]) {
+                    doSub = (res[i] != 0) && ((res[i] & 0xFFFFFFFFL) > (modulusDigits[i] & 0xFFFFFFFFL));
+                    break;
+                }
+            }
         }
-        BigInteger res = new BigInteger(1, s+1, t);
-        // if (t >= n) compute (t - n)
-        if (!lower) {
-            Elementary.inplaceSubtract(res, modulus);
+        
+        BigInteger result = new BigInteger(1, modulusLen+1, res);
+        
+        // if (res >= modulusDigits) compute (res - modulusDigits)
+        if (doSub) {
+            Elementary.inplaceSubtract(result, modulus);
         }
-        res.cutOffLeadingZeroes();
-        return res;
+        
+        result.cutOffLeadingZeroes();
+        return result;
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/math/src/main/java/java/math/Multiplication.java Fri Aug 22 00:15:00 2008
@@ -233,8 +233,7 @@
         int resSign = (a.sign != b.sign) ? -1 : 1;
         // A special case when both numbers don't exceed int
         if (resLength == 2) {
-            long val = (a.digits[0] & 0xFFFFFFFFL)
-            * (b.digits[0] & 0xFFFFFFFFL);
+            long val = unsignedMultAddAdd(a.digits[0], b.digits[0], 0, 0);
             int valueLo = (int)val;
             int valueHi = (int)(val >>> 32);
             return ((valueHi == 0)
@@ -244,27 +243,43 @@
         int[] aDigits = a.digits;
         int[] bDigits = b.digits;
         int resDigits[] = new int[resLength];
-        long carry;
-        long bDigit;
-        int i, j, m;
         // Common case
-        for (j = 0; j < bLen; j++) {
-            carry = 0;
-            bDigit = (bDigits[j] & 0xFFFFFFFFL);
-            for (i = 0, m = j; i < aLen; i++, m++) {
-                carry += (aDigits[i] & 0xFFFFFFFFL)
-                * bDigit
-                + (resDigits[m] & 0xFFFFFFFFL);
-                resDigits[m] = (int)carry;
-                carry >>>= 32;
-            }
-            resDigits[m] = (int) carry;
-        }
+        multArraysPAP(aDigits, aLen, bDigits, bLen, resDigits);
         BigInteger result = new BigInteger(resSign, resLength, resDigits);
         result.cutOffLeadingZeroes();
         return result;
     }
 
+    static void multArraysPAP(int[] aDigits, int aLen, int[] bDigits, int bLen, int[] resDigits) {
+        if(aLen == 0 || bLen == 0) return;
+            
+        if(aLen == 1) {
+            resDigits[bLen] = multiplyByInt(resDigits, bDigits, bLen, aDigits[0]);
+        } else if(bLen == 1) {
+            resDigits[aLen] = multiplyByInt(resDigits, aDigits, aLen, bDigits[0]);
+        } else {
+            multPAP(aDigits, bDigits, resDigits, aLen, bLen);
+        }
+    }
+
+    static void multPAP(int a[], int b[], int t[], int aLen, int bLen) {
+        if(a == b && aLen == bLen) {
+            square(a, aLen, t);
+            return;
+        }
+        
+        for(int i = 0; i < aLen; i++){
+            long carry = 0;
+            int aI = a[i];
+            for (int j = 0; j < bLen; j++){
+               carry = unsignedMultAddAdd(aI, b[j], t[i+j], (int)carry);
+               t[i+j] = (int) carry;
+               carry >>>= 32;
+             }
+             t[i+bLen] = (int) carry;
+        }
+    }
+
     /**
      * Multiplies an array of integers by an integer value
      * and saves the result in {@code res}.
@@ -275,9 +290,8 @@
      */
     private static int multiplyByInt(int res[], int a[], final int aSize, final int factor) {
         long carry = 0;
-
         for (int i = 0; i < aSize; i++) {
-            carry += (a[i] & 0xFFFFFFFFL) * (factor & 0xFFFFFFFFL);
+            carry = unsignedMultAddAdd(a[i], factor, (int)carry, 0);
             res[i] = (int)carry;
             carry >>>= 32;
         }
@@ -311,7 +325,7 @@
         int[] aDigits = val.digits;
         
         if (aNumberLength == 1) {
-            long res = (aDigits[0] & 0xFFFFFFFFL) * (factor);
+            long res = unsignedMultAddAdd(aDigits[0], factor, 0, 0);
             int resLo = (int)res;
             int resHi = (int)(res >>> 32);
             return ((resHi == 0)
@@ -344,7 +358,7 @@
                 acc = acc.multiply(acc); // square
             }
             else{
-                acc = new BigInteger(1, square(acc.digits, acc.numberLength));
+                acc = new BigInteger(1, square(acc.digits, acc.numberLength, new int [acc.numberLength<<1]));
             }
         }
         // exponent == 1, multiply one more time
@@ -355,37 +369,34 @@
     /**
      *  Performs a<sup>2</sup>
      *  @param a The number to square.
-     *  @param length The length of the number to square.
+     *  @param aLen The length of the number to square.
      */ 
-    static int[] square(int[] a, int s) {
-        int [] t = new int [s<<1];
-        long cs;
-        long aI;
-        for(int i=0; i<s; i++){
-            cs = 0;
-            aI = (0xFFFFFFFFL & a[i]);
-            for (int j=i+1; j<s; j++){
-                cs += (0xFFFFFFFFL & t[i+j]) + aI * (0xFFFFFFFFL & a[j]) ;
-                t[i+j] = (int) cs;
-                cs >>>= 32;
+    static int[] square(int[] a, int aLen, int[] res) {
+        long carry;
+        
+        for(int i = 0; i < aLen; i++){
+            carry = 0;            
+            for (int j = i+1; j < aLen; j++){
+                carry = unsignedMultAddAdd(a[i], a[j], res[i+j], (int)carry);
+                res[i+j] = (int) carry;
+                carry >>>= 32;
             }
-            
-            t[i+s] = (int) cs;
+            res[i+aLen] = (int) carry;
         }
-        BitLevel.shiftLeft( t, t, 0, 1 );
-        cs = 0;
         
-        for(int i=0, index = 0; i< s; i++, index++){
-            aI = (0xFFFFFFFFL & a[i]);
-            cs += aI * aI  + (t[index] & 0xFFFFFFFFL);
-            t[index] = (int) cs;
-            cs >>>= 32;
+        BitLevel.shiftLeftOneBit(res, res, aLen << 1);
+        
+        carry = 0;
+        for(int i = 0, index = 0; i < aLen; i++, index++){            
+            carry = unsignedMultAddAdd(a[i], a[i], res[index],(int)carry);
+            res[index] = (int) carry;
+            carry >>>= 32;
             index++;
-            cs += t[index] & 0xFFFFFFFFL ;
-            t[index] = (int)cs;
-            cs >>>= 32;
+            carry += res[index] & 0xFFFFFFFFL;
+            res[index] = (int)carry;
+            carry >>>= 32;
         }
-        return t;
+        return res;
     }
 
     /**
@@ -483,4 +494,23 @@
             return val.multiply(bigFivePows[1].pow(exp));
         }
     }
+
+    /**
+     * Computes the value unsigned ((uint)a*(uint)b + (uint)c + (uint)d). This
+     * method could improve the readability and performance of the code.
+     * 
+     * @param a
+     *            parameter 1
+     * @param b
+     *            parameter 2
+     * @param c
+     *            parameter 3
+     * @param d
+     *            parameter 4
+     * @return value of expression
+     */
+    static long unsignedMultAddAdd(int a, int b, int c, int d) {
+        return (a & 0xFFFFFFFFL) * (b & 0xFFFFFFFFL) + (c & 0xFFFFFFFFL) + (d & 0xFFFFFFFFL);
+    }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/misc/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/build.xml Fri Aug 22 00:15:00 2008
@@ -189,6 +189,11 @@
                showoutput="on"
                dir="${basedir}"
                jvm="${test.jre.home}/bin/java">
+
+            <assertions enableSystemAssertions="true">
+                <enable />
+            </assertions>
+
             <jvmarg line="${hy.test.vmargs}" />
 
             <jvmarg value="-Xbootclasspath/a:${hy.misc.bin.test}${path.separator}${basedir}/../../${junit.jar}"/>

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/build.xml Fri Aug 22 00:15:00 2008
@@ -210,6 +210,11 @@
                showoutput="on"
                dir="${basedir}"
                jvm="${test.jre.home}/bin/java">
+
+            <assertions enableSystemAssertions="true">
+                <enable />
+            </assertions>
+
             <jvmarg line="${hy.test.vmargs}" />
 
             <classpath>

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java Fri Aug 22 00:15:00 2008
@@ -121,7 +121,9 @@
 
     // This content is a point used to set in connect_withtimeout() in pending
     // mode.
-    private Long connectContext = Long.valueOf(0L);
+    // Must be a new instance of Long (i.e. not valueOf) as it's value may
+    // be modified by native code.
+    private Long connectContext = new Long(0L);
 
     // Used to store the trafficClass value which is simply returned
     // as the value that was set. We also need it to pass it to methods

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/shared/DirectBufferUtil.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/shared/DirectBufferUtil.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/shared/DirectBufferUtil.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/shared/DirectBufferUtil.c Fri Aug 22 00:15:00 2008
@@ -15,6 +15,7 @@
  */
 
 #include <jni.h>
+#include "hycomp.h"
 
 JNIEXPORT jobject JNICALL NewDirectByteBuffer(JNIEnv * , void*, jlong );
 JNIEXPORT void* JNICALL GetDirectBufferAddress(JNIEnv * , jobject );
@@ -49,7 +50,7 @@
 	  if (!onMethod){
 	      	  return NULL;
 	  }
-	  platformaddress = (*env)->CallStaticObjectMethod(env, platformaddressClass, onMethod, (jlong)address);
+	  platformaddress = (*env)->CallStaticObjectMethod(env, platformaddressClass, onMethod, (jlong)(IDATA)address);
 	  return (*env)->NewObject(env, directBufferClass, newBufferMethod, 
                                 platformaddress, (jint)capacity, (jint)0);
   }
@@ -89,7 +90,7 @@
 	  if (!toLongMethod){
 	      	  return 0;
 	  }
-	  return (void*)(*env)->CallLongMethod(env, platformAddr, toLongMethod);	  
+	  return (void*)(IDATA)(*env)->CallLongMethod(env, platformAddr, toLongMethod);	  
   }
 
 /*

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/EpollSelectorImpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/EpollSelectorImpl.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/EpollSelectorImpl.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/native/nio/unix/EpollSelectorImpl.c Fri Aug 22 00:15:00 2008
@@ -192,7 +192,7 @@
     jint * fdsArray;
     jint * opsArray;
     int result;
-    int isCopy;
+    jboolean isCopy;
     int c;
     int temp;
     
@@ -225,10 +225,10 @@
 #endif
 
     // copying out the results, pinning might help here...
-    isCopy = NULL;
+    isCopy = JNI_FALSE;
     fdsArray = (*env)->GetIntArrayElements(env, fds, &isCopy);
 
-    isCopy = NULL;
+    isCopy = JNI_FALSE;
     opsArray = (*env)->GetIntArrayElements(env, ops, &isCopy);
 
     for(c = 0; c < result; c++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java Fri Aug 22 00:15:00 2008
@@ -102,25 +102,6 @@
     }
 
     /**
-     * @tests {@link java.nio.MappedByteBuffer#isLoaded()}
-     */
-    public void test_isload() throws IOException {
-        FileInputStream fileInputStream = new FileInputStream(tmpFile);
-        FileChannel fileChannelRead = fileInputStream.getChannel();
-        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
-                fileChannelRead.size());
-
-        assertFalse(mmbRead.isLoaded());
-
-        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
-        FileChannel fileChannelReadWrite = randomFile.getChannel();
-        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
-                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
-
-        assertFalse(mmbReadWrite.isLoaded());
-    }
-
-    /**
      * @tests {@link java.nio.MappedByteBuffer#load()}
      */
     public void test_load() throws IOException {

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/build.xml Fri Aug 22 00:15:00 2008
@@ -193,6 +193,11 @@
                showoutput="on"
                dir="${basedir}"
                jvm="${test.jre.home}/bin/java">
+
+            <assertions enableSystemAssertions="true">
+                <enable />
+            </assertions>
+
             <jvmarg line="${hy.test.vmargs}" />
 
             <classpath>

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/UTF_8.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/UTF_8.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/UTF_8.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/UTF_8.java Fri Aug 22 00:15:00 2008
@@ -61,6 +61,8 @@
               401536, // (011o0000b << 12)+(1o000000b <<  6)+(1o000000b)
             29892736  // (0111o000b << 18)+(1o000000b << 12)+(1o000000b << 6)+(1o000000b)
     };
+    
+    private static final int lowerEncodingLimit[] = { -1, 0x80, 0x800, 0x10000 };
 
     public UTF_8(String canonicalName, String[] aliases) {
         super(canonicalName, aliases);
@@ -131,7 +133,7 @@
                         if (tail == -1) {
                             in.position(inIndex - in.arrayOffset());
                             out.position(outIndex - out.arrayOffset());
-                            return CoderResult.unmappableForLength(1);
+                            return CoderResult.malformedForLength(1);
                         }
                         if (inIndexLimit - inIndex < 1 + tail) {
                             break;
@@ -147,6 +149,12 @@
                             jchar = (jchar << 6) + nextByte;
                         }
                         jchar -= remainingNumbers[tail];
+                        if (jchar < lowerEncodingLimit[tail]) {
+                            // Should have been encoded in fewer octets
+                            in.position(inIndex - in.arrayOffset());
+                            out.position(outIndex - out.arrayOffset());
+                            return CoderResult.malformedForLength(1);
+                        }
                         inIndex += tail;
                     }
                     cArr[outIndex++] = (char) jchar;
@@ -168,7 +176,7 @@
                             jchar = jchar & 0x7F;
                             int tail = remainingBytes[jchar];
                             if (tail == -1) {
-                                return CoderResult.unmappableForLength(1);
+                                return CoderResult.malformedForLength(1);
                             }
                             if (limit - pos < 1 + tail) {
                                 return CoderResult.UNDERFLOW;
@@ -184,6 +192,10 @@
                                 jchar = (jchar << 6) + nextByte;
                             }
                             jchar -= remainingNumbers[tail];
+                            if (jchar < lowerEncodingLimit[tail]) {
+                                // Should have been encoded in a fewer octets
+                                return CoderResult.malformedForLength(1);
+                            }
                             pos += tail;
                         }
                         pos++;

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1250.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1250.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1250.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1250.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "CP_1250.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_CP_11250_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1251.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1251.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1251.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1251.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "CP_1251.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_CP_11251_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1252.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1252.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1252.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1252.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "CP_1252.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_CP_11252_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1253.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1253.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1253.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1253.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "CP_1253.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_CP_11253_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1254.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1254.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1254.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1254.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "CP_1254.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_CP_11254_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1257.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1257.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1257.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/CP_1257.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "CP_1257.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_CP_11257_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/IBM866.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/IBM866.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/IBM866.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/IBM866.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM866.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_IBM866_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_1.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_1.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_1.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_1.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_1.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT jint JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_11_00024Decoder_nDecode
   (JNIEnv *env, jobject obj, jcharArray outArr, jint arrPosition, jint remaining, jlong inAddr, jint absolutePos)

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_13.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_13.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_13.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_13.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_13.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_113_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_15.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_15.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_15.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_15.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_15.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_115_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_2.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_2.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_2.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_2.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_2.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_12_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_4.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_4.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_4.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_4.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_4.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_14_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_5.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_5.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_5.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_5.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_5.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_15_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_7.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_7.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_7.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_7.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_7.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_17_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_9.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_9.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_9.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/ISO_8859_9.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "ISO_8859_9.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_ISO_18859_19_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/KOI8_R.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/KOI8_R.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/KOI8_R.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/KOI8_R.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "KOI8_R.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_KOI8_1R_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/US_ASCII.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/US_ASCII.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/US_ASCII.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/US_ASCII.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "US_ASCII.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT jint JNICALL Java_org_apache_harmony_niochar_charset_US_1ASCII_00024Decoder_nDecode
   (JNIEnv *env, jobject obj, jcharArray outArr, jint arrPosition, jint remaining, jlong inAddr, jint absolutePos) 

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5.c Fri Aug 22 00:15:00 2008
@@ -16,7 +16,7 @@
  */
 
 #include "Big5.h"
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
         static const int decodeIndex[] = {
          0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5_HKSCS.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5_HKSCS.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5_HKSCS.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/Big5_HKSCS.c Fri Aug 22 00:15:00 2008
@@ -16,7 +16,7 @@
  */
 
 #include "Big5_HKSCS.h"
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
         static const int decodeIndex[] = {
          0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/EUC_KR.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/EUC_KR.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/EUC_KR.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/EUC_KR.c Fri Aug 22 00:15:00 2008
@@ -16,7 +16,7 @@
  */
 
 #include "EUC_KR.h"
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
         static const int decodeIndex[] = {
          0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c Fri Aug 22 00:15:00 2008
@@ -16,7 +16,7 @@
  */
 
 #include "GB18030.h"
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 #define linear(b1, b2, b3, b4) ((((b1)*10+(b2))*126L+(b3))*10L+(b4))
 static jbyte * unLinear(jint lin) {

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB2312.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB2312.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB2312.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB2312.c Fri Aug 22 00:15:00 2008
@@ -16,7 +16,7 @@
  */
 
 #include "GB2312.h"
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
         static const int decodeIndex[] = {
          0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GBK.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GBK.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GBK.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GBK.c Fri Aug 22 00:15:00 2008
@@ -16,7 +16,7 @@
  */
 
 #include "GBK.h"
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
         static const int decodeIndex[] = {
          0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM00858.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM00858.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM00858.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM00858.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM00858.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM00858_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01140.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01140.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01140.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01140.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01140.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01140_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01141.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01141.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01141.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01141.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01141.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01141_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01142.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01142.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01142.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01142.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01142.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01142_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01143.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01143.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01143.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01143.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01143.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01143_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01144.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01144.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01144.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01144.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01144.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01144_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01145.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01145.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01145.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01145.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01145.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01145_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01146.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01146.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01146.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01146.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01146.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01146_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01147.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01147.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01147.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01147.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01147.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01147_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01148.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01148.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01148.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01148.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01148.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01148_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01149.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01149.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01149.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM01149.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM01149.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM01149_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM037.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM037.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM037.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM037.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM037.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM037_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1026.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1026.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1026.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1026.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM1026.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM1026_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1047.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1047.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1047.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/IBM1047.c Fri Aug 22 00:15:00 2008
@@ -17,7 +17,7 @@
 
 #include "IBM1047.h"
 
-#define jlong2addr(a, x) ((a *)((int)(x)))
+#include "hycomp.h"
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_IBM1047_00024Encoder_nEncode
   (JNIEnv *env, jobject obj, jlong outAddr, jint absolutePos, jcharArray array, jint arrayOffset, jintArray result){