mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
* removed vlc_wraptext
This commit is contained in:
parent
49ca49407d
commit
48b748067c
@ -3,7 +3,7 @@
|
||||
* Collection of useful common types and macros definitions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998, 1999, 2000 VideoLAN
|
||||
* $Id: vlc_common.h,v 1.65 2003/05/25 17:27:13 massiot Exp $
|
||||
* $Id: vlc_common.h,v 1.66 2003/05/27 01:48:50 hartman Exp $
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@via.ecp.fr>
|
||||
* Vincent Seguin <seguin@via.ecp.fr>
|
||||
@ -563,8 +563,6 @@ static inline uint64_t U64_AT( void * _p )
|
||||
# define vlc_strncasecmp NULL
|
||||
#endif
|
||||
|
||||
VLC_EXPORT( char *, vlc_wraptext, ( char *psz_text, size_t i_line ) );
|
||||
|
||||
/* Format type specifiers for 64 bits numbers */
|
||||
#if !defined(WIN32) && !defined(UNDER_CE)
|
||||
# define I64Fd "%lld"
|
||||
|
@ -2,7 +2,7 @@
|
||||
* libc.c: Extra libc function for some systems.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2002 VideoLAN
|
||||
* $Id: libc.c,v 1.7 2003/02/08 22:20:28 massiot Exp $
|
||||
* $Id: libc.c,v 1.8 2003/05/27 01:48:50 hartman Exp $
|
||||
*
|
||||
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
|
||||
* Samuel Hocevar <sam@zoy.org>
|
||||
@ -171,55 +171,3 @@ char *vlc_dgettext( const char *package, const char *msgid )
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* wraptext: insert \n at convenient places. CAUTION: modifies its argument
|
||||
*****************************************************************************/
|
||||
char *vlc_wraptext( char *psz_text, size_t i_line )
|
||||
{
|
||||
size_t i_len = strlen(psz_text);
|
||||
char * psz_line = psz_text;
|
||||
|
||||
while ( i_len > i_line )
|
||||
{
|
||||
/* Look if there is a newline somewhere. */
|
||||
char * psz_parser = psz_line;
|
||||
while ( psz_parser <= psz_line + i_line && *psz_parser != '\n' )
|
||||
{
|
||||
psz_parser++;
|
||||
}
|
||||
if ( *psz_parser == '\n' )
|
||||
{
|
||||
i_len -= psz_parser + 1 - psz_line;
|
||||
psz_line = psz_parser + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find the furthest space. */
|
||||
psz_parser = psz_line + i_line;
|
||||
while ( psz_parser > psz_line && *psz_parser != ' ' )
|
||||
{
|
||||
psz_parser--;
|
||||
}
|
||||
if ( *psz_parser == ' ' )
|
||||
{
|
||||
*psz_parser = '\n';
|
||||
i_len -= psz_parser + 1 - psz_line;
|
||||
psz_line = psz_parser + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Wrapping has failed. Find the first space or newline after i_line. */
|
||||
psz_parser = psz_line + i_line + 1;
|
||||
while ( psz_parser < psz_line + i_len
|
||||
&& *psz_parser != ' ' && *psz_parser != '\n' )
|
||||
{
|
||||
psz_parser++;
|
||||
}
|
||||
|
||||
if ( psz_parser < psz_line + i_len ) *psz_parser = '\n';
|
||||
i_len -= psz_parser + 1 - psz_line;
|
||||
psz_line = psz_parser + 1;
|
||||
}
|
||||
|
||||
return psz_text;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user