]> git.sesse.net Git - vlc/blobdiff - src/extras/libc.c
Thread-safe and more compact hotkeys initialization
[vlc] / src / extras / libc.c
index 6dc1dd137e9576097bbe41616d39f64000686e39..28ed517d5e2c122b4bc7b4138c86408fff324de0 100644 (file)
 #   include <windows.h>
 #endif
 
-/******************************************************************************
- * strcasestr: find a substring (little) in another substring (big)
- * Case sensitive. Return NULL if not found, return big if little == null
- *****************************************************************************/
-char * vlc_strcasestr( const char *psz_big, const char *psz_little )
-{
-#if defined (HAVE_STRCASESTR) || defined (HAVE_STRISTR)
-    return strcasestr (psz_big, psz_little);
-#else
-    char *p_pos = (char *)psz_big;
-
-    if( !psz_big || !psz_little || !*psz_little ) return p_pos;
-    while( *p_pos )
-    {
-        if( toupper( *p_pos ) == toupper( *psz_little ) )
-        {
-            char * psz_cur1 = p_pos + 1;
-            char * psz_cur2 = (char *)psz_little + 1;
-            while( *psz_cur1 && *psz_cur2 &&
-                   toupper( *psz_cur1 ) == toupper( *psz_cur2 ) )
-            {
-                psz_cur1++;
-                psz_cur2++;
-            }
-            if( !*psz_cur2 ) return p_pos;
-        }
-        p_pos++;
-    }
-    return NULL;
-#endif
-}
-
 /*****************************************************************************
  * vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
  * when called with an empty argument or just '\'
@@ -236,81 +203,6 @@ char *vlc_gettext( const char *msgid )
 #endif
 }
 
-/*****************************************************************************
- * count_utf8_string: returns the number of characters in the string.
- *****************************************************************************/
-static int count_utf8_string( const char *psz_string )
-{
-    int i = 0, i_count = 0;
-    while( psz_string[ i ] != 0 )
-    {
-        if( ((unsigned char *)psz_string)[ i ] <  0x80UL ) i_count++;
-        i++;
-    }
-    return i_count;
-}
-
-/*****************************************************************************
- * 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 )
-{
-    int i_len;
-    char *psz_line, *psz_new_text;
-
-    psz_line = psz_new_text = strdup( psz_text );
-
-    i_len = count_utf8_string( psz_text );
-
-    while( i_len > i_line )
-    {
-        /* Look if there is a newline somewhere. */
-        char *psz_parser = psz_line;
-        int i_count = 0;
-        while( i_count <= i_line && *psz_parser != '\n' )
-        {
-            while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
-            psz_parser++;
-            i_count++;
-        }
-        if( *psz_parser == '\n' )
-        {
-            i_len -= (i_count + 1);
-            psz_line = psz_parser + 1;
-            continue;
-        }
-
-        /* Find the furthest space. */
-        while( psz_parser > psz_line && *psz_parser != ' ' )
-        {
-            while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser--;
-            psz_parser--;
-            i_count--;
-        }
-        if( *psz_parser == ' ' )
-        {
-            *psz_parser = '\n';
-            i_len -= (i_count + 1);
-            psz_line = psz_parser + 1;
-            continue;
-        }
-
-        /* Wrapping has failed. Find the first space or newline */
-        while( i_count < i_len && *psz_parser != ' ' && *psz_parser != '\n' )
-        {
-            while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
-            psz_parser++;
-            i_count++;
-        }
-        if( i_count < i_len ) *psz_parser = '\n';
-        i_len -= (i_count + 1);
-        psz_line = psz_parser + 1;
-    }
-
-    return psz_new_text;
-}
-
 /*****************************************************************************
  * iconv wrapper
  *****************************************************************************/