Commit e27d7960 authored by Rafaël Carré's avatar Rafaël Carré

Fix [17230] using wxString.Len() instead of wcslen() which is broken on windows

parent 6e41d8ba
......@@ -107,7 +107,9 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
# define wxFromLocale(wxstring) FromLocale(wxstring.mb_str())
# define wxLocaleFree(string) LocaleFree(string)
#endif
#define wxDnDLocaleFree( string ) wxLocaleFree( string )
/* From Locale functions to use for File Drop targets ... go figure */
#ifdef wxUSE_UNICODE
static inline char *wxDnDFromLocale( const wxChar *stupid )
......@@ -122,24 +124,25 @@ static inline char *wxDnDFromLocale( const wxChar *stupid )
* UTF-8 but also Windows-1252(!) and ISO-8859-15(!) or any
* non-western encoding, it obviously fails.
*/
size_t i = 0;
while (stupid[i])
i++;
char psz_local[i + 1];
if ((i >= 1) && (stupid[i - 1] == '\n'))
i--;
wxString str(stupid);
int i;
size_t n = str.Len();
do
char psz_local[n+1];
for(i=0;i<n;i++)
psz_local[i] = stupid[i];
while (i--);
psz_local[n] = '\0';
if( psz_local[n-1] == '\n' )
psz_local[n-1] = '\0';
return FromLocaleDup( psz_local );
}
# define wxDnDLocaleFree( string ) free( string )
#else
# define wxDnDFromLocale( string ) wxFromLocale( string )
# define wxDnDLocaleFree( string ) wxLocaleFree( string )
#endif
#define WRAPCOUNT 80
......
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