[vlc-devel] commit: Remove buggy and unused vlc_wraptext() ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri Apr 10 21:53:05 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 10 22:49:43 2009 +0300| [0f749c6376fbe31bced81360d6dc1c38891b3332] | committer: Rémi Denis-Courmont 

Remove buggy and unused vlc_wraptext()

It did not count non-ASCII characters at all (wrapping asian text must
have been fun...). Then again, to wrap even fixed-width font text, you
need to use wcwidth()/wcswidth().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0f749c6376fbe31bced81360d6dc1c38891b3332
---

 include/vlc_common.h |    4 --
 src/extras/libc.c    |   75 --------------------------------------------------
 src/libvlccore.sym   |    1 -
 3 files changed, 0 insertions(+), 80 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 2ca1450..2907ec6 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -786,10 +786,6 @@ static inline uint64_t ntoh64 (uint64_t ll)
 
 VLC_EXPORT( bool, vlc_ureduce, ( unsigned *, unsigned *, uint64_t, uint64_t, uint64_t ) );
 
-/* vlc_wraptext (defined in src/extras/libc.c) */
-#define wraptext vlc_wraptext
-VLC_EXPORT( char *, vlc_wraptext, ( const char *, int ) LIBVLC_USED );
-
 /* iconv wrappers (defined in src/extras/libc.c) */
 typedef void *vlc_iconv_t;
 VLC_EXPORT( vlc_iconv_t, vlc_iconv_open, ( const char *, const char * ) LIBVLC_USED );
diff --git a/src/extras/libc.c b/src/extras/libc.c
index 3bb0b56..28ed517 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -204,81 +204,6 @@ char *vlc_gettext( const char *msgid )
 }
 
 /*****************************************************************************
- * 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
  *****************************************************************************/
 vlc_iconv_t vlc_iconv_open( const char *tocode, const char *fromcode )
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index b14b8d4..cb6c85b 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -494,7 +494,6 @@ vlc_threadvar_delete
 vlc_ureduce
 VLC_Version
 vlc_wclosedir
-vlc_wraptext
 vlm_Control
 vlm_Delete
 vlm_ExecuteCommand




More information about the vlc-devel mailing list