changeset 126:73b4c55700ec

Fix in DirectoryDialog string convertion
author Frank Benoit <benoit@tionex.de>
date Mon, 21 Jan 2008 00:22:39 +0100
parents 1feb02b24d1c
children e49a0f04c689
files dwt/widgets/DirectoryDialog.d
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/widgets/DirectoryDialog.d	Mon Jan 21 00:17:23 2008 +0100
+++ b/dwt/widgets/DirectoryDialog.d	Mon Jan 21 00:22:39 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * Copyright (c) 2000, 2007 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -173,10 +173,11 @@
     if (response is OS.GTK_RESPONSE_OK) {
         auto path = OS.gtk_file_chooser_get_filename (handle);
         if (path !is null) {
-            auto utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, null, null);
+            uint items_written;
+            auto utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, &items_written, null);
             OS.g_free (path);
             if (utf8Ptr !is null) {
-                answer = tango.stdc.stringz.fromUtf8z( utf8Ptr ).dup;
+                answer = utf8Ptr[ 0 .. items_written ].dup;
                 filterPath = answer[ tango.text.Util.locatePatternPrior( answer, SEPARATOR ) + 1 .. $ ];
                 OS.g_free (utf8Ptr);
             }
@@ -227,9 +228,10 @@
     int response = OS.gtk_dialog_run (handle);
     if (response is OS.GTK_RESPONSE_OK) {
         char* fileNamePtr = OS.gtk_file_selection_get_filename (handle);
-        char* utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, null, null);
+        uint items_written;
+        char* utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, &items_written, null);
         if (utf8Ptr !is null) {
-            char[] osAnswer = tango.stdc.stringz.fromUtf8z(utf8Ptr);
+            char[] osAnswer = utf8Ptr[ 0 .. items_written ];
             if (osAnswer.length !is 0) {
                 /* remove trailing separator, unless root directory */
                 if ( osAnswer != SEPARATOR && osAnswer[ $-1 .. $ ] == SEPARATOR ) {