/*****************************************************************************
* 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. */
/*****************************************************************************
* 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;
}
#endif
+/*****************************************************************************
+ * lldiv: returns quotient and remainder
+ *****************************************************************************/
+#if defined(SYS_BEOS)
+lldiv_t vlc_lldiv( long long numer, long long denom )
+{
+ lldiv_t d;
+ d.quot = numer / denom;
+ d.rem = numer % denom;
+ return d;
+}
+#endif
+
/*****************************************************************************
* vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\'
}
#endif
+#if defined (WIN32) || !defined (HAVE_SHARED_LIBVLC)
/*****************************************************************************
* dgettext: gettext for plugins.
*****************************************************************************/
return (char *)msgid;
#endif
}
+#endif
/*****************************************************************************
* count_utf8_string: returns the number of characters in the 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 )
{
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++;
}
/* 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--;
}
/* 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++;
}
#endif
}
-size_t vlc_iconv( vlc_iconv_t cd, char **inbuf, size_t *inbytesleft,
+size_t vlc_iconv( vlc_iconv_t cd, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft )
{
#if defined(HAVE_ICONV)
- return iconv( cd, inbuf, inbytesleft, outbuf, outbytesleft );
+ return iconv( cd, (ICONV_CONST char **)inbuf, inbytesleft,
+ outbuf, outbytesleft );
#else
int i_bytes;