Mercurial > dwindows
changeset 1704:873304f581be
Fix Unicode issues with the directory browser on Windows.
Fix a hang with the directory browser on Mac when passing an empty string.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 05 May 2012 06:48:40 +0000 |
parents | 043db6b221c2 |
children | 3fa0448d3a7e |
files | mac/dw.m win/dw.c |
diffstat | 2 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Thu May 03 18:44:08 2012 +0000 +++ b/mac/dw.m Sat May 05 06:48:40 2012 +0000 @@ -3208,7 +3208,7 @@ /* Figure out path information... * These functions are only support in Snow Leopard and later... */ - if(defpath && DWOSMinor > 5) + if(defpath && *defpath && DWOSMinor > 5) { struct stat buf; @@ -3273,7 +3273,7 @@ } /* Handle file types */ - if(ext) + if(ext && *ext) { NSArray* fileTypes = [[[NSArray alloc] initWithObjects:[NSString stringWithUTF8String:ext], nil] autorelease]; [openDlg setAllowedFileTypes:fileTypes]; @@ -3314,7 +3314,7 @@ [saveDlg setCanCreateDirectories:YES]; /* Handle file types */ - if(ext) + if(ext && *ext) { NSArray* fileTypes = [[[NSArray alloc] initWithObjects:[NSString stringWithUTF8String:ext], nil] autorelease]; [saveDlg setAllowedFileTypes:fileTypes];
--- a/win/dw.c Thu May 03 18:44:08 2012 +0000 +++ b/win/dw.c Sat May 05 06:48:40 2012 +0000 @@ -11490,7 +11490,7 @@ bi.hwndOwner = NULL; bi.pszDisplayName = 0; bi.pidlRoot = 0; - bi.lpszTitle = title; + bi.lpszTitle = UTF8toWide(title); bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = NULL; /*BrowseCallbackProc*/ @@ -11499,20 +11499,20 @@ { if (SHGetPathFromIDList(pidl,szDir)) { - strncpy(filenamebuf,szDir,1000); + _tcsncpy(filenamebuf,szDir,1000); } /* In C++: pMalloc->Free(pidl); pMalloc->Release(); */ pMalloc->lpVtbl->Free(pMalloc,pidl); pMalloc->lpVtbl->Release(pMalloc); - return _strdup(filenamebuf); + return _strdup(WideToUTF8(filenamebuf)); } } #else if ( XBrowseForFolder( NULL, - (LPCTSTR)defpath, + (LPCTSTR)dpath, -1, - (LPCTSTR)title, + (LPCTSTR)UTF8toWide(title), (LPTSTR)filenamebuf, 1000, FALSE ) )