Changeset 31711 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 16, 2010 4:32:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/glue-java.xsl
r31708 r31711 295 295 <xsl:when test="($G_vboxGlueStyle='xpcom')"> 296 296 <xsl:choose> 297 <xsl:when test="$type='unsigned long long'">298 <!-- stupid, rewrite the bridge -->299 <xsl:value-of select="'double'" />300 </xsl:when>301 302 297 <xsl:when test="$type='long long'"> 303 298 <xsl:value-of select="'long'" /> … … 391 386 <xsl:when test="//enum[@name=$type]"> 392 387 <xsl:value-of select="concat($G_virtualBoxPackageCom, '.', $type)" /> 393 </xsl:when>394 395 <xsl:when test="$type='unsigned long long'">396 <xsl:value-of select="'BigInteger'" />397 388 </xsl:when> 398 389 … … 553 544 </xsl:call-template> 554 545 </xsl:variable> 555 <xsl:value-of select="concat('Helper.wrap(', $elemgluetype, '.class, ', $value,'.toSafeArray())')"/> 546 <xsl:choose> 547 <xsl:when test="($idltype='octet')"> 548 <xsl:value-of select="concat('Helper.wrapBytes(', $value, '.toSafeArray())')"/> 549 </xsl:when> 550 <xsl:otherwise> 551 <xsl:value-of select="concat('Helper.wrap(', $elemgluetype, '.class, ', $value,'.toSafeArray())')"/> 552 </xsl:otherwise> 553 </xsl:choose> 556 554 </xsl:when> 557 555 … … 599 597 <xsl:when test="$idltype='long long'"> 600 598 <xsl:value-of select="concat($value,'.getLong()')"/> 601 </xsl:when>602 603 <xsl:when test="$idltype='unsigned long long'">604 <xsl:value-of select="concat('Helper.longToBigInteger(',$value,'.getLong())')"/>605 599 </xsl:when> 606 600 … … 817 811 </xsl:otherwise> 818 812 </xsl:choose> 819 </xsl:when>820 821 <xsl:when test="$idltype='unsigned long long'">822 <xsl:value-of select="concat('Helper.bigIntegerToDouble(', $value,')')"/>823 813 </xsl:when> 824 814 … … 1957 1947 </xsl:call-template> 1958 1948 1959 <xsl:text>import java.math.BigInteger; </xsl:text>1960 1949 <xsl:text>import java.util.List; </xsl:text> 1961 1950 … … 2008 1997 </xsl:call-template> 2009 1998 2010 <xsl:text>import java.math.BigInteger; </xsl:text>2011 1999 <xsl:text>import java.util.List; </xsl:text> 2012 2000 … … 2032 2020 </xsl:call-template> 2033 2021 2034 <xsl:text>import java.math.BigInteger; </xsl:text>2035 2022 <xsl:text>import java.util.List; </xsl:text> 2036 2023 … … 2202 2189 import java.lang.reflect.Constructor; 2203 2190 import java.lang.reflect.InvocationTargetException; 2204 import java.math.BigInteger;2205 2191 2206 2192 public class Helper { … … 2280 2266 } 2281 2267 2282 public static List<BigInteger> wrapUnsignedLongLong(double vals[]) {2283 List<BigInteger> ret = new ArrayList<BigInteger>(vals.length);2284 for (double v : vals) {2285 ret.add(doubleToBigInteger(v));2286 }2287 return ret;2288 }2289 2290 2291 2268 public static short[] unwrap(List<Short> vals) { 2292 2269 if (vals==null) … … 2433 2410 return ret; 2434 2411 } 2435 2436 /* We do loose precision here */2437 public static BigInteger doubleToBigInteger(double val) {2438 return new BigInteger(Long.toString((long)val));2439 }2440 public static double bigIntegerToDouble(BigInteger val) {2441 return val.doubleValue();2442 }2443 2412 } 2444 2413 ]]></xsl:text> … … 2702 2671 import java.lang.reflect.Constructor; 2703 2672 import java.lang.reflect.InvocationTargetException; 2704 import java.math.BigInteger;2705 2673 import com.jacob.com.*; 2706 2674 … … 2798 2766 } 2799 2767 2768 public static byte[] wrapBytes(SafeArray sa) { 2769 if (sa==null) return null; 2770 2771 int saLen = sa.getUBound() - sa.getLBound() + 1; 2772 2773 byte[] ret = new byte[saLen]; 2774 int j = 0; 2775 for (int i = sa.getLBound(); i <= sa.getUBound(); i++) 2776 { 2777 Variant v = sa.getVariant(i); 2778 // come upo with more effective approach!!! 2779 ret[j++] = v.getByte(); 2780 } 2781 return ret; 2782 } 2783 2800 2784 @SuppressWarnings("unchecked") 2801 2785 public static <T> List<T> wrap(Class<T> wrapperClass, SafeArray sa) { … … 2943 2927 return ret; 2944 2928 } 2945 2946 public static BigInteger longToBigInteger(long value) { 2947 return BigInteger.valueOf(value); 2948 } 2949 2929 2950 2930 /* We have very long invoke lists sometimes */ 2951 2931 public static Variant invoke(Dispatch d, String method, Object ... args)
Note:
See TracChangeset
for help on using the changeset viewer.