diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-06-18 15:21:00 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-06-18 15:22:52 -0400 |
commit | 6cfe3d127e0b01ad97a0805575f2dfaa61a02410 (patch) | |
tree | 12501248c7a43286b2832fc8bf798f3a7725ca54 | |
parent | f5471f1dce5662b63a70164ff03da95148af503a (diff) | |
download | eclipse.platform.swt-6cfe3d127e0b01ad97a0805575f2dfaa61a02410.tar.gz eclipse.platform.swt-6cfe3d127e0b01ad97a0805575f2dfaa61a02410.tar.xz eclipse.platform.swt-6cfe3d127e0b01ad97a0805575f2dfaa61a02410.zip |
Bug 376448 - [DBCS4.2] AIX 7, DirectoryDialog returns 'null' if selected
path contains DBCS characters
Bug 377246 - [DBCS] AIX 7: FileDialog returns 'null' if selected path
contains DBCS characters
8 files changed, 49 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java index 8b0338f891..57958316ea 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java @@ -174,12 +174,14 @@ public Object nativeToJava(TransferData transferData) { int /*long*/ localePtr = OS.g_filename_from_uri(files[i], null, error); OS.g_free(files[i]); if (error[0] != 0 || localePtr == 0) continue; - int /*long*/ utf8Ptr = OS.g_filename_to_utf8(localePtr, -1, null, null, error); - OS.g_free(localePtr); - if (error[0] != 0 || utf8Ptr == 0) continue; + int /*long*/ utf8Ptr = OS.g_filename_to_utf8(localePtr, -1, null, null, null); + if (utf8Ptr == 0) utf8Ptr = OS.g_filename_display_name (localePtr); + if (localePtr != utf8Ptr) OS.g_free (localePtr); + if (utf8Ptr == 0) continue; int /*long*/[] items_written = new int /*long*/[1]; int /*long*/ utf16Ptr = OS.g_utf8_to_utf16(utf8Ptr, -1, null, items_written, null); OS.g_free(utf8Ptr); + if (utf16Ptr == 0) continue; length = (int)/*64*/items_written[0]; char[] buffer = new char[length]; OS.memmove(buffer, utf16Ptr, length * 2); 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 1c8c5a54fb..1de5000e6d 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 @@ -3165,6 +3165,26 @@ fail: } #endif +#ifndef NO__1g_1filename_1display_1name +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1filename_1display_1name) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1filename_1display_1name_FUNC); +/* + rc = (jintLong)g_filename_display_name(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_filename_display_name) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1filename_1display_1name_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1filename_1from_1uri JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1filename_1from_1uri) (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintLongArray arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index c93d847772..cebd9cb41b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -29,6 +29,7 @@ #define LIB_XRENDER "libXrender.a(libXrender.so)" #define LIB_GTK "libgtk-x11-2.0.a(libgtk-x11-2.0.so.0)" #define LIB_GDK "libgdk-x11-2.0.a(libgdk-x11-2.0.so.0)" +#define LIB_GLIB "libglib-2.0.a(libglib-2.0.so.0)" #define LIB_ATK "libatk-1.0.a(libatk-1.0.so.0)" #define LIB_PANGO "libpango-1.0.a(libpango-1.0.so.0)" #define LIB_PANGOCAIRO "libpangocairo-1.0.a(libpangocairo-1.0.so.0)" @@ -38,6 +39,7 @@ #define LIB_XRENDER "libXrender.so" #define LIB_GTK "libgtk-x11-2.0.so" #define LIB_GDK "libgdk-x11-2.0.so" +#define LIB_GLIB "libglib-2.0.so" #define LIB_ATK "libatk-1.0.so" #define LIB_PANGO "libpango-1.0.so" #define LIB_PANGOCAIRO "libpangocairo-1.0.so" @@ -47,6 +49,7 @@ #define LIB_XRENDER "libXrender.so" #define LIB_GTK "libgtk-x11-2.0.so.0" #define LIB_GDK "libgdk-x11-2.0.so.0" +#define LIB_GLIB "libglib-2.0.so.0" #define LIB_ATK "libatk-1.0.so.0" #define LIB_PANGO "libpango-1.0.so.0" #define LIB_PANGOCAIRO "libpangocairo-1.0.so.0" @@ -64,6 +67,7 @@ #define XRenderFreePicture_LIB LIB_XRENDER #define XRenderSetPictureClipRectangles_LIB LIB_XRENDER #define XRenderSetPictureTransform_LIB LIB_XRENDER +#define g_filename_display_name_LIB LIB_GLIB #define gtk_calendar_display_options_LIB LIB_GTK #define gtk_calendar_get_date_LIB LIB_GTK #define gtk_calendar_new_LIB LIB_GTK 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 f444a423e7..cd4e180974 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 @@ -253,6 +253,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1file_1query_1info", "_1g_1file_1read", "_1g_1file_1test", + "_1g_1filename_1display_1name", "_1g_1filename_1from_1uri", "_1g_1filename_1from_1utf8", "_1g_1filename_1to_1uri", 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 f7321e2d6a..a784fb1763 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 @@ -261,6 +261,7 @@ typedef enum { _1g_1file_1query_1info_FUNC, _1g_1file_1read_FUNC, _1g_1file_1test_FUNC, + _1g_1filename_1display_1name_FUNC, _1g_1filename_1from_1uri_FUNC, _1g_1filename_1from_1utf8_FUNC, _1g_1filename_1to_1uri_FUNC, 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 ea39bc83f2..1f1ee5bdd2 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 @@ -2406,6 +2406,18 @@ public static final int /*long*/ g_filename_to_utf8(int /*long*/ opsysstring, in } } /** + * @method flags=dynamic + */ +public static final native int /*long*/ _g_filename_display_name(int /*long*/ filename); +public static final int /*long*/ g_filename_display_name(int /*long*/ filename) { + lock.lock(); + try { + return _g_filename_display_name(filename); + } finally { + lock.unlock(); + } +} +/** * @param filename cast=(const char *) * @param hostname cast=(const char *) * @param error cast=(GError **) 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 b6979e12a8..cd4060359a 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 @@ -200,7 +200,8 @@ String openChooserDialog () { int /*long*/ path = OS.gtk_file_chooser_get_filename (handle); if (path != 0) { int /*long*/ utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, null, null); - OS.g_free (path); + if (utf8Ptr == 0) utf8Ptr = OS.g_filename_display_name (path); + if (path != utf8Ptr) OS.g_free (path); if (utf8Ptr != 0) { int /*long*/ [] items_written = new int /*long*/ [1]; int /*long*/ utf16Ptr = OS.g_utf8_to_utf16 (utf8Ptr, -1, null, items_written, null); 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 0a0c755a20..b57f25accb 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 @@ -119,8 +119,9 @@ String computeResultChooserDialog () { utf8Ptr = name; } else { utf8Ptr = OS.g_filename_to_utf8 (name, -1, null, null, null); - OS.g_free (name); + if (utf8Ptr == 0) utf8Ptr = OS.g_filename_display_name (name); } + if (name != utf8Ptr) OS.g_free (name); if (utf8Ptr != 0) { int /*long*/ [] items_written = new int /*long*/ [1]; int /*long*/ utf16Ptr = OS.g_utf8_to_utf16 (utf8Ptr, -1, null, items_written, null); @@ -150,7 +151,8 @@ String computeResultChooserDialog () { int /*long*/ path = OS.gtk_file_chooser_get_filename (handle); if (path != 0) { utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, null, null); - OS.g_free (path); + if (utf8Ptr == 0) utf8Ptr = OS.g_filename_display_name (path); + if (path != utf8Ptr) OS.g_free (path); } } if (utf8Ptr != 0) { |