aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2014-02-20 06:26:50 (EST)
committerGerrit Code Review @ Eclipse.org2014-02-21 05:24:26 (EST)
commit24fdfd9c26f6e2472ad6e0a091d30c9851d291d5 (patch)
tree0a07bf500aafaab94096b8e9fb05a46a106be16b
parente0600fb1abcb2cf38d0f6ba6cbf9786e300f666e (diff)
downloadeclipse.platform.swt-24fdfd9c26f6e2472ad6e0a091d30c9851d291d5.zip
eclipse.platform.swt-24fdfd9c26f6e2472ad6e0a091d30c9851d291d5.tar.gz
eclipse.platform.swt-24fdfd9c26f6e2472ad6e0a091d30c9851d291d5.tar.bz2
Bug 421653 FileDialog can not open a directory correctly on aix gtk swtrefs/changes/94/22294/4
we're removing the calls to realpath() as the minimum supported GTK version is 2.10 now Change-Id: I142f8db4aa6948de19656596c570a5a4d5c2b806 Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c39
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java27
6 files changed, 26 insertions, 71 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 2c8b2f4..bcf88db 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -10330,18 +10330,22 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1file_1chooser_1get_1uris)
#ifndef NO__1gtk_1file_1chooser_1set_1current_1folder
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1file_1chooser_1set_1current_1folder)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
{
+ jbyte *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1set_1current_1folder_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
/*
- gtk_file_chooser_set_current_folder(arg0, arg1);
+ gtk_file_chooser_set_current_folder(arg0, lparg1);
*/
{
OS_LOAD_FUNCTION(fp, gtk_file_chooser_set_current_folder)
if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ ((void (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1);
}
}
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1set_1current_1folder_FUNC);
}
#endif
@@ -10428,18 +10432,22 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1file_1chooser_1set_1extra_1widget)
#ifndef NO__1gtk_1file_1chooser_1set_1filename
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1file_1chooser_1set_1filename)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
{
+ jbyte *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1set_1filename_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
/*
- gtk_file_chooser_set_filename(arg0, arg1);
+ gtk_file_chooser_set_filename(arg0, lparg1);
*/
{
OS_LOAD_FUNCTION(fp, gtk_file_chooser_set_filename)
if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ ((void (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1);
}
}
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1set_1filename_FUNC);
}
#endif
@@ -22431,25 +22439,6 @@ fail:
}
#endif
-#ifndef NO_realpath
-JNIEXPORT jintLong JNICALL OS_NATIVE(realpath)
- (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1)
-{
- jbyte *lparg0=NULL;
- jbyte *lparg1=NULL;
- jintLong rc = 0;
- OS_NATIVE_ENTER(env, that, realpath_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
- rc = (jintLong)realpath((const char *)lparg0, (char *)lparg1);
-fail:
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- OS_NATIVE_EXIT(env, that, realpath_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_strcmp
JNIEXPORT jint JNICALL OS_NATIVE(strcmp)
(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 576b8eb..5515e42 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2014 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -1818,7 +1818,6 @@ char * OS_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_gtk_XVisibilityEvent_2JJ",
#endif
"pangoLayoutNewProc_1CALLBACK",
- "realpath",
"strcmp",
};
#define NATIVE_FUNCTION_COUNT sizeof(OS_nativeFunctionNames) / sizeof(char*)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index b42f0f7..fe88658 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2014 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -1828,6 +1828,5 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_gtk_XVisibilityEvent_2JJ_FUNC,
#endif
pangoLayoutNewProc_1CALLBACK_FUNC,
- realpath_FUNC,
strcmp_FUNC,
} OS_FUNCS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 9e77c1b..e167f43 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -715,12 +715,6 @@ public static final native int XFocusChangeEvent_sizeof();
public static final native int XVisibilityEvent_sizeof();
public static final native int XWindowChanges_sizeof();
public static final native long /*int*/ localeconv_decimal_point();
-/**
- * @param path cast=(const char *)
- * @param realPath cast=(char *)
- */
-public static final native long /*int*/ realpath(byte[] path, byte[] realPath);
-
/** Object private fields accessors */
@@ -7512,8 +7506,8 @@ public static final long /*int*/ gtk_file_chooser_get_filter(long /*int*/ choose
}
}
/** @method flags=dynamic */
-public static final native void _gtk_file_chooser_set_current_folder(long /*int*/ chooser, long /*int*/ filename);
-public static final void gtk_file_chooser_set_current_folder(long /*int*/ chooser, long /*int*/ filename) {
+public static final native void _gtk_file_chooser_set_current_folder(long /*int*/ chooser, byte [] filename);
+public static final void gtk_file_chooser_set_current_folder(long /*int*/ chooser, byte [] filename) {
lock.lock();
try {
_gtk_file_chooser_set_current_folder(chooser, filename);
@@ -7572,8 +7566,8 @@ public static final void gtk_file_chooser_set_extra_widget(long /*int*/ chooser,
}
}
/** @method flags=dynamic */
-public static final native void _gtk_file_chooser_set_filename(long /*int*/ chooser, long /*int*/ name);
-public static final void gtk_file_chooser_set_filename(long /*int*/ chooser, long /*int*/ name) {
+public static final native void _gtk_file_chooser_set_filename(long /*int*/ chooser, byte [] name);
+public static final void gtk_file_chooser_set_filename(long /*int*/ chooser, byte [] name) {
lock.lock();
try {
_gtk_file_chooser_set_filename(chooser, name);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
index 4563d29..e3c8ea3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -144,16 +144,7 @@ String openChooserDialog () {
}
stringBuffer.append (filterPath);
byte [] buffer = Converter.wcsToMbcs (null, stringBuffer.toString (), true);
- /*
- * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6
- * when setting a file name that is not a true canonical path.
- * The fix is to use the canonical path.
- */
- long /*int*/ ptr = OS.realpath (buffer, null);
- if (ptr != 0) {
- OS.gtk_file_chooser_set_current_folder (handle, ptr);
- OS.g_free (ptr);
- }
+ OS.gtk_file_chooser_set_current_folder (handle, buffer);
}
if (message.length () > 0) {
byte [] buffer = Converter.wcsToMbcs (null, message, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
index 96845a2..a4f4c39 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
@@ -386,15 +386,7 @@ void presetChooserDialog () {
} else {
/* filename must be a full path */
byte [] buffer = Converter.wcsToMbcs (null, SEPARATOR + filterPath, true);
-
- /*
- * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6
- * when setting a file name that is not a true canonical path.
- * The fix is to use the canonical path.
- */
- long /*int*/ ptr = OS.realpath (buffer, null);
- OS.gtk_file_chooser_set_current_folder (handle, ptr);
- OS.g_free (ptr);
+ OS.gtk_file_chooser_set_current_folder (handle, buffer);
}
}
if (fileName.length () > 0) {
@@ -418,19 +410,10 @@ void presetChooserDialog () {
if (uriMode) {
OS.gtk_file_chooser_set_uri (handle, buffer);
} else {
- /*
- * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6
- * when setting a file name that is not a true canonical path.
- * The fix is to use the canonical path.
- */
- long /*int*/ ptr = OS.realpath (buffer, null);
- if (ptr != 0) {
- if (fileName.length() > 0) {
- OS.gtk_file_chooser_set_filename (handle, ptr);
- } else {
- OS.gtk_file_chooser_set_current_folder (handle, ptr);
- }
- OS.g_free (ptr);
+ if (fileName.length() > 0) {
+ OS.gtk_file_chooser_set_filename (handle, buffer);
+ } else {
+ OS.gtk_file_chooser_set_current_folder (handle, buffer);
}
}
}