diff dwt/browser/Mozilla.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children db5a898b2119
line wrap: on
line diff
--- a/dwt/browser/Mozilla.d	Wed Aug 27 14:10:03 2008 +0200
+++ b/dwt/browser/Mozilla.d	Wed Aug 27 14:30:35 2008 +0200
@@ -230,7 +230,7 @@
         bool initLoaded = false;
         bool IsXULRunner = false;
 
-        String greInitialized = System.getProperty (GRE_INITIALIZED); 
+        String greInitialized = System.getProperty cast(GRE_INITIALIZED); 
         if ("true".equals (greInitialized)) { //$NON-NLS-1$
             /* 
              * Another browser has already initialized xulrunner in this process,
@@ -239,7 +239,7 @@
             Initialized = true;
         }
 
-        String mozillaPath = System.getProperty (XULRUNNER_PATH);
+        String mozillaPath = System.getProperty cast(XULRUNNER_PATH);
         /*
         * Browser clients that ship XULRunner in a plug-in must have an opportunity 
         * to set the dwt.browser.XULRunnerPath system property to point
@@ -253,7 +253,7 @@
         if (mozillaPath is null) {
             try {
                 Class.forName ("dwt.browser.XULRunnerInitializer"); //$NON-NLS-1$
-                mozillaPath = System.getProperty (XULRUNNER_PATH);
+                mozillaPath = System.getProperty cast(XULRUNNER_PATH);
             } catch (ClassNotFoundException e) {
                 /* no fragment is providing this class, which is the typical case */
             }
@@ -333,7 +333,7 @@
                     rc = XPCOMInit.XPCOMGlueStartup (path);
                     if (rc !is XPCOM.NS_OK) {
                         IsXULRunner = false;    /* failed */
-                        mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
+                        mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf cast(SEPARATOR_OS));
                         if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + mozillaPath); //$NON-NLS-1$
                     } else {
                         XPCOMInitWasGlued = true;
@@ -362,7 +362,7 @@
              * Remove the trailing xpcom lib name from mozillaPath because the
              * Mozilla.initialize and NS_InitXPCOM2 invocations require a directory name only.
              */ 
-            mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
+            mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf cast(SEPARATOR_OS));
         } else {
             if ((style & DWT.MOZILLA) !is 0) {
                 browser.dispose ();
@@ -718,11 +718,11 @@
         String language = locale.getLanguage ();
         String country = locale.getCountry ();
         StringBuffer stringBuffer = new StringBuffer (language);
-        stringBuffer.append (SEPARATOR_LOCALE);
+        stringBuffer.append cast(SEPARATOR_LOCALE);
         stringBuffer.append (country.toLowerCase ());
-        stringBuffer.append (TOKENIZER_LOCALE);
+        stringBuffer.append cast(TOKENIZER_LOCALE);
         stringBuffer.append (language);
-        stringBuffer.append (TOKENIZER_LOCALE);
+        stringBuffer.append cast(TOKENIZER_LOCALE);
         String newLocales = stringBuffer.toString ();
 
         int start, end = -1;
@@ -836,8 +836,8 @@
         * Check for proxy values set as documented java properties and update mozilla's
         * preferences with these values if needed.
         */
-        String proxyHost = System.getProperty (PROPERTY_PROXYHOST);
-        String proxyPortString = System.getProperty (PROPERTY_PROXYPORT);
+        String proxyHost = System.getProperty cast(PROPERTY_PROXYHOST);
+        String proxyPortString = System.getProperty cast(PROPERTY_PROXYPORT);
 
         int port = -1;
         if (proxyPortString !is null) {
@@ -986,7 +986,7 @@
         Initialized = true;
     }
 
-    if (display.getData (DISPOSE_LISTENER_HOOKED) is null) {
+    if (display.getData cast(DISPOSE_LISTENER_HOOKED) is null) {
         display.setData (DISPOSE_LISTENER_HOOKED, DISPOSE_LISTENER_HOOKED);
         display.addListener (DWT.Dispose, new Listener () {
             public void handleEvent (Event event) {
@@ -1327,27 +1327,27 @@
         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 OnStateChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3]);}
-        public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4], (int)/*64*/args[5]);}
+        public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);}
+        public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/args[5]);}
         public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);}
-        public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], (int)/*64*/args[2], args[3]);}
-        public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], (int)/*64*/args[2]);}
+        public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], cast(int)/*64*/args[2], args[3]);}
+        public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);}
     };
     
     webBrowserChrome = new XPCOMObject (new int[] {2, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 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 SetStatus ((int)/*64*/args[0], args[1]);}
+        public int /*long*/ method3 (int /*long*/[] args) {return SetStatus (cast(int)/*64*/args[0], args[1]);}
         public int /*long*/ method4 (int /*long*/[] args) {return GetWebBrowser (args[0]);}
         public int /*long*/ method5 (int /*long*/[] args) {return SetWebBrowser (args[0]);}
         public int /*long*/ method6 (int /*long*/[] args) {return GetChromeFlags (args[0]);}
-        public int /*long*/ method7 (int /*long*/[] args) {return SetChromeFlags ((int)/*64*/args[0]);}
+        public int /*long*/ method7 (int /*long*/[] args) {return SetChromeFlags (cast(int)/*64*/args[0]);}
         public int /*long*/ method8 (int /*long*/[] args) {return DestroyBrowserWindow ();}
-        public int /*long*/ method9 (int /*long*/[] args) {return SizeBrowserTo ((int)/*64*/args[0], (int)/*64*/args[1]);}
+        public int /*long*/ method9 (int /*long*/[] args) {return SizeBrowserTo (cast(int)/*64*/args[0], cast(int)/*64*/args[1]);}
         public int /*long*/ method10 (int /*long*/[] args) {return ShowAsModal ();}
         public int /*long*/ method11 (int /*long*/[] args) {return IsWindowModal (args[0]);}
-        public int /*long*/ method12 (int /*long*/[] args) {return ExitModalEventLoop ((int)/*64*/args[0]);}
+        public int /*long*/ method12 (int /*long*/[] args) {return ExitModalEventLoop (cast(int)/*64*/args[0]);}
     };
     
     webBrowserChromeFocus = new XPCOMObject (new int[] {2, 0, 0, 0, 0}) {
@@ -1362,11 +1362,11 @@
         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 SetDimensions ((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4]);}
-        public int /*long*/ method4 (int /*long*/[] args) {return GetDimensions ((int)/*64*/args[0], args[1], args[2], args[3], args[4]);}
+        public int /*long*/ method3 (int /*long*/[] args) {return SetDimensions (cast(int)/*64*/args[0], cast(int)/*64*/args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4]);}
+        public int /*long*/ method4 (int /*long*/[] args) {return GetDimensions (cast(int)/*64*/args[0], args[1], args[2], args[3], args[4]);}
         public int /*long*/ method5 (int /*long*/[] args) {return SetFocus ();}
         public int /*long*/ method6 (int /*long*/[] args) {return GetVisibility (args[0]);}
-        public int /*long*/ method7 (int /*long*/[] args) {return SetVisibility ((int)/*64*/args[0]);}
+        public int /*long*/ method7 (int /*long*/[] args) {return SetVisibility (cast(int)/*64*/args[0]);}
         public int /*long*/ method8 (int /*long*/[] args) {return GetTitle (args[0]);}
         public int /*long*/ method9 (int /*long*/[] args) {return SetTitle (args[0]);}
         public int /*long*/ method10 (int /*long*/[] args) {return GetSiteWindow (args[0]);}
@@ -1390,7 +1390,7 @@
         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 OnShowContextMenu ((int)/*64*/args[0], args[1], args[2]);}
+        public int /*long*/ method3 (int /*long*/[] args) {return OnShowContextMenu (cast(int)/*64*/args[0], args[1], args[2]);}
     };
     
     uriContentListener = new XPCOMObject (new int[] {2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) {
@@ -1398,9 +1398,9 @@
         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 OnStartURIOpen (args[0], args[1]);}
-        public int /*long*/ method4 (int /*long*/[] args) {return DoContent (args[0], (int)/*64*/args[1], args[2], args[3], args[4]);}
+        public int /*long*/ method4 (int /*long*/[] args) {return DoContent (args[0], cast(int)/*64*/args[1], args[2], args[3], args[4]);}
         public int /*long*/ method5 (int /*long*/[] args) {return IsPreferred (args[0], args[1], args[2]);}
-        public int /*long*/ method6 (int /*long*/[] args) {return CanHandleContent (args[0], (int)/*64*/args[1], args[2], args[3]);}
+        public int /*long*/ method6 (int /*long*/[] args) {return CanHandleContent (args[0], cast(int)/*64*/args[1], args[2], args[3]);}
         public int /*long*/ method7 (int /*long*/[] args) {return GetLoadCookie (args[0]);}
         public int /*long*/ method8 (int /*long*/[] args) {return SetLoadCookie (args[0]);}
         public int /*long*/ method9 (int /*long*/[] args) {return GetParentContentListener (args[0]);}
@@ -1411,7 +1411,7 @@
         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 OnShowTooltip ((int)/*64*/args[0], (int)/*64*/args[1], args[2]);}
+        public int /*long*/ method3 (int /*long*/[] args) {return OnShowTooltip (cast(int)/*64*/args[0], cast(int)/*64*/args[1], args[2]);}
         public int /*long*/ method4 (int /*long*/[] args) {return OnHideTooltip ();}        
     };
 
@@ -1606,7 +1606,7 @@
      * If the URI indicates that the page is being rendered from memory
      * (via setText()) then set it to about:blank to be consistent with IE.
      */
-    if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK;
+    if (location.equals cast(URI_FROMMEMORY)) location = ABOUT_BLANK;
     return location;
 }
 
@@ -1714,7 +1714,7 @@
 
     Enumeration elements = unhookedDOMWindows.elements ();
     while (elements.hasMoreElements ()) {
-        LONG ptrObject = (LONG)elements.nextElement ();
+        LONG ptrObject = cast(LONG)elements.nextElement ();
         new nsISupports (ptrObject.value).Release ();
     }
     unhookedDOMWindows = null;
@@ -2249,7 +2249,7 @@
         domWindow.Release ();
 
         /*
-        * Feature in Mozilla.  When a request is redirected (STATE_REDIRECTING),
+        * Feature in Mozilla.  When a request is redirected cast(STATE_REDIRECTING),
         * it never reaches the state STATE_STOP and it is replaced with a new request.
         * The new request is received when it is in the state STATE_STOP.
         * To handle this case,  the variable request is set to 0 when the corresponding
@@ -2378,7 +2378,7 @@
      * to about:blank and fires the corresponding navigation events.  Do not send
      * this event on to the user since it is not expected.
      */
-    if (!IsPre_1_8 && aRequest is 0 && url.startsWith (ABOUT_BLANK)) return XPCOM.NS_OK;
+    if (!IsPre_1_8 && aRequest is 0 && url.startsWith cast(ABOUT_BLANK)) return XPCOM.NS_OK;
 
     LocationEvent event = new LocationEvent (browser);
     event.display = browser.getDisplay ();
@@ -2388,7 +2388,7 @@
      * If the URI indicates that the page is being rendered from memory
      * (via setText()) then set it to about:blank to be consistent with IE.
      */
-    if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK;
+    if (event.location.equals cast(URI_FROMMEMORY)) event.location = ABOUT_BLANK;
     event.top = aTop[0] is aDOMWindow[0];
     for (int i = 0; i < locationListeners.length; i++) {
         locationListeners[i].changed (event);
@@ -2757,7 +2757,7 @@
          * listeners should not be notified of internal transitions like "javascipt:..."
          * because this is an implementation side-effect, not a true navigate
          */
-        if (!value.startsWith (PREFIX_JAVASCRIPT)) {
+        if (!value.startsWith cast(PREFIX_JAVASCRIPT)) {
             LocationEvent event = new LocationEvent (browser);
             event.display = browser.getDisplay();
             event.widget = browser;
@@ -2766,7 +2766,7 @@
              * If the URI indicates that the page is being rendered from memory
              * (via setText()) then set it to about:blank to be consistent with IE.
              */
-            if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK;
+            if (event.location.equals cast(URI_FROMMEMORY)) event.location = ABOUT_BLANK;
             event.doit = doit;
             for (int i = 0; i < locationListeners.length; i++) {
                 locationListeners[i].changing (event);
@@ -3081,7 +3081,7 @@
         keyEvent.widget = browser;
         keyEvent.type = DWT.KeyDown;
         keyEvent.keyCode = lastKeyCode;
-        keyEvent.character = (char)lastCharCode;
+        keyEvent.character = cast(wchar)lastCharCode;
         keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0);
         browser.notifyListeners (keyEvent.type, keyEvent);
         if (!keyEvent.doit || browser.isDisposed ()) {
@@ -3128,7 +3128,7 @@
         keyEvent.widget = browser;
         keyEvent.type = DWT.KeyUp;
         keyEvent.keyCode = lastKeyCode;
-        keyEvent.character = (char)lastCharCode;
+        keyEvent.character = cast(wchar)lastCharCode;
         keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0);
         switch (lastKeyCode) {
             case DWT.SHIFT: