summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2011-09-08 14:19:56 -0400
committerGrant Gayed <grant_gayed@ca.ibm.com>2011-09-08 14:19:56 -0400
commitd25451b43d1f0c218b5f22e738f00694bf5a616b (patch)
tree6b5d7ae289afc53a7cd25c78c4d7c219abe7d448
parent4222a621d2928b548c2e30cc0978e442beedb1d5 (diff)
downloadeclipse.platform.swt-d25451b43d1f0c218b5f22e738f00694bf5a616b.tar.gz
eclipse.platform.swt-d25451b43d1f0c218b5f22e738f00694bf5a616b.tar.xz
eclipse.platform.swt-d25451b43d1f0c218b5f22e738f00694bf5a616b.zip
Bug 357138 - [Mozilla] should not use nsIFile.getNative*()
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Download.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java16
3 files changed, 24 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Download.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Download.java
index 3114c9af8f..32f98c0493 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Download.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Download.java
@@ -205,15 +205,15 @@ int Init (int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName,
target.Release ();
} else { /* < 1.7 */
nsILocalFile target = new nsILocalFile (aTarget);
- int /*long*/ aNativeTarget = XPCOM.nsEmbedCString_new ();
- rc = target.GetNativeLeafName (aNativeTarget);
+ int /*long*/ aNativeTarget = XPCOM.nsEmbedString_new ();
+ rc = target.GetLeafName (aNativeTarget);
if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- length = XPCOM.nsEmbedCString_Length (aNativeTarget);
- buffer = XPCOM.nsEmbedCString_get (aNativeTarget);
- dest = new byte[length];
- XPCOM.memmove (dest, buffer, length);
- XPCOM.nsEmbedCString_delete (aNativeTarget);
- filename = new String (dest);
+ length = XPCOM.nsEmbedString_Length (aNativeTarget);
+ buffer = XPCOM.nsEmbedString_get (aNativeTarget);
+ char[] chars = new char[length];
+ XPCOM.memmove (chars, buffer, length * 2);
+ XPCOM.nsEmbedString_delete (aNativeTarget);
+ filename = new String (chars);
}
Listener listener = new Listener () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker.java
index cb7b397ec9..52f7d006fb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker.java
@@ -211,14 +211,14 @@ int GetFile (int /*long*/ aFile) {
int SetDisplayDirectory (int /*long*/ aDisplayDirectory) {
if (aDisplayDirectory == 0) return XPCOM.NS_OK;
nsILocalFile file = new nsILocalFile (aDisplayDirectory);
- int /*long*/ pathname = XPCOM.nsEmbedCString_new ();
- file.GetNativePath (pathname);
- int length = XPCOM.nsEmbedCString_Length (pathname);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get (pathname);
- byte[] bytes = new byte[length];
- XPCOM.memmove (bytes, buffer, length);
- XPCOM.nsEmbedCString_delete (pathname);
- char[] chars = MozillaDelegate.mbcsToWcs (null, bytes);
+ int /*long*/ pathname = XPCOM.nsEmbedString_new ();
+ int rc = file.GetPath (pathname);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ int length = XPCOM.nsEmbedString_Length (pathname);
+ int /*long*/ buffer = XPCOM.nsEmbedString_get (pathname);
+ char[] chars = new char[length];
+ XPCOM.memmove (chars, buffer, length * 2);
+ XPCOM.nsEmbedString_delete (pathname);
directory = new String (chars);
return XPCOM.NS_OK;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
index 78944cc44b..150635f476 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
@@ -1458,17 +1458,17 @@ static String getMozillaPath () {
nsIFile mozillaDir = new nsIFile (result[0]);
result[0] = 0;
- int /*long*/ path = XPCOM.nsEmbedCString_new ();
- rc = mozillaDir.GetNativePath (path);
+ int /*long*/ path = XPCOM.nsEmbedString_new ();
+ rc = mozillaDir.GetPath (path);
if (rc != XPCOM.NS_OK) error (rc);
- int length = XPCOM.nsEmbedCString_Length (path);
- int /*long*/ ptr = XPCOM.nsEmbedCString_get (path);
- buffer = new byte[length];
- XPCOM.memmove (buffer, ptr, length);
- XPCOM.nsEmbedCString_delete (path);
+ int length = XPCOM.nsEmbedString_Length (path);
+ int /*long*/ ptr = XPCOM.nsEmbedString_get (path);
+ char[] chars = new char[length];
+ XPCOM.memmove (chars, ptr, length * 2);
+ XPCOM.nsEmbedString_delete (path);
mozillaDir.Release ();
- return new String (MozillaDelegate.mbcsToWcs (null, buffer)) + SEPARATOR_OS;
+ return new String (chars) + SEPARATOR_OS;
}
int getNextFunctionIndex () {