]> git.sesse.net Git - vlc/blobdiff - src/extras/libc.c
WxWidgets: use wraptext in UTF-8 mode as that is the codeset for gettext
[vlc] / src / extras / libc.c
index e5c3e68c59a032207289472c0d610a9d0b66a274..d358bfd1bf873a4428b2349d7180618cfbaaa419 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 #include <string.h>                                              /* strdup() */
 #include <stdlib.h>
 #include <ctype.h>
 
 #include <vlc/vlc.h>
-#include <vlc_common.h>
 
 #undef iconv_t
 #undef iconv_open
 #   include <windows.h>
 #endif
 
+#ifdef UNDER_CE
+#   define strcoll strcmp
+#endif
+
 /*****************************************************************************
  * getenv: just in case, but it should never be called
  *****************************************************************************/
@@ -179,7 +182,7 @@ char * vlc_strcasestr( const char *psz_big, const char *psz_little )
 /*****************************************************************************
  * vasprintf:
  *****************************************************************************/
-#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+#if !defined(HAVE_VASPRINTF) || defined(__APPLE__) || defined(SYS_BEOS)
 int vlc_vasprintf(char **strp, const char *fmt, va_list ap)
 {
     /* Guess we need no more than 100 bytes. */
@@ -225,7 +228,7 @@ int vlc_vasprintf(char **strp, const char *fmt, va_list ap)
 /*****************************************************************************
  * asprintf:
  *****************************************************************************/
-#if !defined(HAVE_ASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
+#if !defined(HAVE_ASPRINTF) || defined(__APPLE__) || defined(SYS_BEOS)
 int vlc_asprintf( char **strp, const char *fmt, ... )
 {
     va_list args;
@@ -344,7 +347,7 @@ int64_t vlc_atoll( const char *nptr )
  * vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
  * when called with an empty argument or just '\'
  *****************************************************************************/
-#if defined(WIN32) || defined(UNDER_CE)
+#if defined(WIN32) && !defined(UNDER_CE)
 typedef struct vlc_DIR
 {
     DIR *p_real_dir;
@@ -495,6 +498,7 @@ int vlc_scandir( const char *name, struct dirent ***namelist,
 }
 #endif
 
+#ifndef HAVE_SHARED_LIBVLC
 /*****************************************************************************
  * dgettext: gettext for plugins.
  *****************************************************************************/
@@ -507,6 +511,7 @@ char *vlc_dgettext( const char *package, const char *msgid )
     return (char *)msgid;
 #endif
 }
+#endif
 
 /*****************************************************************************
  * count_utf8_string: returns the number of characters in the string.
@@ -526,17 +531,14 @@ static int count_utf8_string( const char *psz_string )
  * wraptext: inserts \n at convenient places to wrap the text.
  *           Returns the modified string in a new buffer.
  *****************************************************************************/
-char *vlc_wraptext( const char *psz_text, int i_line, vlc_bool_t b_utf8 )
+char *vlc_wraptext( const char *psz_text, int i_line )
 {
     int i_len;
     char *psz_line, *psz_new_text;
 
     psz_line = psz_new_text = strdup( psz_text );
 
-    if( b_utf8 )
-        i_len = count_utf8_string( psz_text );
-    else
-        i_len = strlen( psz_text );
+    i_len = count_utf8_string( psz_text );
 
     while( i_len > i_line )
     {
@@ -545,10 +547,7 @@ char *vlc_wraptext( const char *psz_text, int i_line, vlc_bool_t b_utf8 )
         int i_count = 0;
         while( i_count <= i_line && *psz_parser != '\n' )
         {
-            if( b_utf8 )
-            {
-                while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
-            }
+            while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
             psz_parser++;
             i_count++;
         }
@@ -562,10 +561,7 @@ char *vlc_wraptext( const char *psz_text, int i_line, vlc_bool_t b_utf8 )
         /* Find the furthest space. */
         while( psz_parser > psz_line && *psz_parser != ' ' )
         {
-            if( b_utf8 )
-            {
-                while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser--;
-            }
+            while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser--;
             psz_parser--;
             i_count--;
         }
@@ -580,10 +576,7 @@ char *vlc_wraptext( const char *psz_text, int i_line, vlc_bool_t b_utf8 )
         /* Wrapping has failed. Find the first space or newline */
         while( i_count < i_len && *psz_parser != ' ' && *psz_parser != '\n' )
         {
-            if( b_utf8 )
-            {
-                while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
-            }
+            while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
             psz_parser++;
             i_count++;
         }
@@ -950,7 +943,7 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
         }
     }
 
-#elif defined( WIN32 )
+#elif defined( WIN32 ) && !defined( UNDER_CE )
     SECURITY_ATTRIBUTES saAttr; 
     PROCESS_INFORMATION piProcInfo; 
     STARTUPINFO siStartInfo;