diff dwt/browser/InputStream.d @ 348:9a4d7706df52

Test Update to fix linux XPCOM interface issues
author John Reimer <terminal.node@gmail.com>
date Fri, 31 Oct 2008 21:46:44 -0700
parents 2e591eb01162
children
line wrap: on
line diff
--- a/dwt/browser/InputStream.d	Wed Oct 29 20:12:27 2008 -0700
+++ b/dwt/browser/InputStream.d	Fri Oct 31 21:46:44 2008 -0700
@@ -32,39 +32,15 @@
 this (byte[] buffer) {
     this.buffer = buffer;
     index = 0;
-    //createCOMInterfaces ();
 }
 
+extern(System)
 nsrefcnt AddRef () {
     refCount++;
     return refCount;
 }
-/+
-void createCOMInterfaces () {
-    /* Create each of the interfaces that this object implements */
-    inputStream = new XPCOMObject (new int[] {2, 0, 0, 0, 1, 3, 4, 1}) {
-        public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
-        public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
-        public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
-        public int /*long*/ method3 (int /*long*/[] args) {return Close ();}
-        public int /*long*/ method4 (int /*long*/[] args) {return Available (args[0]);}
-        public int /*long*/ method5 (int /*long*/[] args) {return Read (args[0], (int)/*64*/args[1], args[2]);}
-        public int /*long*/ method6 (int /*long*/[] args) {return ReadSegments (args[0], args[1], (int)/*64*/args[2], args[3]);}
-        public int /*long*/ method7 (int /*long*/[] args) {return IsNonBlocking (args[0]);}
-    };
-}
 
-void disposeCOMInterfaces () {
-    if (inputStream !is null) {
-        inputStream.dispose ();
-        inputStream = null; 
-    }
-}
-
-int /*long*/ getAddress () {
-    return inputStream.getAddress ();
-}
-+/
+extern(System)
 nsresult QueryInterface (nsID* riid, void** ppvObject) {
     if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
     //nsID guid = new nsID ();
@@ -83,21 +59,24 @@
     *ppvObject = null;
     return XPCOM.NS_ERROR_NO_INTERFACE;
 }
-            
+
+extern(System)
 nsrefcnt Release () {
     refCount--;
     //if (refCount is 0) disposeCOMInterfaces ();
     return refCount;
 }
-    
+
 /* nsIInputStream implementation */
 
+extern(System)
 nsresult Close () {
     buffer = null;
     index = 0;
     return XPCOM.NS_OK;
 }
 
+extern(System)
 nsresult Available (PRUint32* _retval) {
     PRUint32 available = buffer is null ? 0 : buffer.length - index;
     *_retval = available;
@@ -105,6 +84,7 @@
     return XPCOM.NS_OK;
 }
 
+extern(System)
 nsresult Read(byte* aBuf, PRUint32 aCount, PRUint32* _retval) {
     int max = Math.min (aCount, buffer is null ? 0 : buffer.length - index);
     if (aBuf is null)
@@ -120,6 +100,7 @@
     return XPCOM.NS_OK;
 }
 
+extern(System)
 nsresult ReadSegments (nsWriteSegmentFun aWriter, void* aClosure, PRUint32 aCount, PRUint32* _retval) {
     int max = Math.min (aCount, buffer is null ? 0 : buffer.length - index);
     PRUint32 cnt = max;
@@ -135,6 +116,7 @@
     return XPCOM.NS_OK;
 }
 
+extern(System)
 nsresult IsNonBlocking (PRBool* _retval) {
     /* blocking */
     *_retval = 0;