]> git.sesse.net Git - vlc/commitdiff
Drop wcslen() and back to original DnD. Refix it.
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 22 Oct 2006 14:57:24 +0000 (14:57 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 22 Oct 2006 14:57:24 +0000 (14:57 +0000)
modules/gui/wxwidgets/wxwidgets.hpp

index 01d02285fe6e7d0c7c36358265c4e8660e10ec7a..4e395f6c604b74761042f7237c0d09d623868e68 100644 (file)
@@ -110,8 +110,6 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
        
 /* From Locale functions to use for File Drop targets ... go figure */
 #ifdef wxUSE_UNICODE
-#include <wchar.h>
-
 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
      * non-western encoding, it obviously fails.
      */
-    size_t n = wcslen ((const wchar_t *)stupid);
-    char psz_local[n + 1];
+    size_t i = 0;
+    while (stupid[i])
+        i++;
 
-    for (size_t i = 0; i < n; i++)
-        psz_local[i] = stupid[i];
+    char psz_local[i + 1];
+    if ((i >= 1) && (stupid[i - 1] == '\n'))
+        i--;
 
-    psz_local[n] = '\0';
-    if ((n >= 1) && (stupid[n - 1] == '\n'))
-        psz_local[n - 1] = '\0';
+    do
+        psz_local[i] = stupid[i];
+    while (n--);
 
     return FromLocaleDup( psz_local );
 }