Commit 5e0f332e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Drop wcslen() and back to original DnD. Refix it.

parent 0328a8a9
...@@ -110,8 +110,6 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 ); ...@@ -110,8 +110,6 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
/* From Locale functions to use for File Drop targets ... go figure */ /* From Locale functions to use for File Drop targets ... go figure */
#ifdef wxUSE_UNICODE #ifdef wxUSE_UNICODE
#include <wchar.h>
static inline char *wxDnDFromLocale( const wxChar *stupid ) static inline char *wxDnDFromLocale( const wxChar *stupid )
{ {
/* /*
...@@ -124,15 +122,17 @@ static inline char *wxDnDFromLocale( const wxChar *stupid ) ...@@ -124,15 +122,17 @@ static inline char *wxDnDFromLocale( const wxChar *stupid )
* UTF-8 but also Windows-1252(!) and ISO-8859-15(!) or any * UTF-8 but also Windows-1252(!) and ISO-8859-15(!) or any
* non-western encoding, it obviously fails. * non-western encoding, it obviously fails.
*/ */
size_t n = wcslen ((const wchar_t *)stupid); size_t i = 0;
char psz_local[n + 1]; while (stupid[i])
i++;
for (size_t i = 0; i < n; i++) char psz_local[i + 1];
psz_local[i] = stupid[i]; if ((i >= 1) && (stupid[i - 1] == '\n'))
i--;
psz_local[n] = '\0'; do
if ((n >= 1) && (stupid[n - 1] == '\n')) psz_local[i] = stupid[i];
psz_local[n - 1] = '\0'; while (n--);
return FromLocaleDup( psz_local ); return FromLocaleDup( psz_local );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment