Commit 7f3e25da authored by Rafaël Carré's avatar Rafaël Carré

backports [17293], [17294], [17295], and [17297]

parent e27d7960
...@@ -108,8 +108,6 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 ); ...@@ -108,8 +108,6 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
# define wxLocaleFree(string) LocaleFree(string) # define wxLocaleFree(string) LocaleFree(string)
#endif #endif
#define wxDnDLocaleFree( string ) wxLocaleFree( string )
/* 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
static inline char *wxDnDFromLocale( const wxChar *stupid ) static inline char *wxDnDFromLocale( const wxChar *stupid )
...@@ -124,25 +122,24 @@ static inline char *wxDnDFromLocale( const wxChar *stupid ) ...@@ -124,25 +122,24 @@ 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 = 0;
while (stupid[n])
n++;
wxString str(stupid); char psz_local[n + 1];
int i; for (size_t i = 0; i <= n; i++)
size_t n = str.Len();
char psz_local[n+1];
for(i=0;i<n;i++)
psz_local[i] = stupid[i]; psz_local[i] = stupid[i];
psz_local[n] = '\0';
if( psz_local[n-1] == '\n' ) // Kludge for (broken?) apps that adds a LF at the end of DnD
psz_local[n-1] = '\0'; if ((n >= 1) && (strchr ("\n\r", stupid[n - 1]) != NULL))
psz_local[n - 1] = '\0';
return FromLocaleDup( psz_local ); return FromLocaleDup( psz_local );
} }
# define wxDnDLocaleFree( string ) free( string )
#else #else
# define wxDnDFromLocale( string ) wxFromLocale( string ) # define wxDnDFromLocale( string ) wxFromLocale( string )
# define wxDnDLocaleFree( string ) wxLocaleFree( string )
#endif #endif
#define WRAPCOUNT 80 #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