VLC  3.0.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Functions
String helpers


file  vlc_strings.h
 Helper functions for nul-terminated strings.


static int vlc_ascii_toupper (int c)
static int vlc_ascii_tolower (int c)
static int vlc_ascii_strcasecmp (const char *psz1, const char *psz2)
 Compare two ASCII strings ignoring case. More...
static int vlc_ascii_strncasecmp (const char *psz1, const char *psz2, size_t n)
void resolve_xml_special_chars (char *psz_value)
 Converts "&lt;", "&gt;" and "&amp;" to "<", ">" and "&". More...
char * convert_xml_special_chars (const char *psz_content)
 XML-encode an UTF-8 string. More...
char * vlc_b64_encode_binary (const uint8_t *, size_t)
char * vlc_b64_encode (const char *)
size_t vlc_b64_decode_binary_to_buffer (uint8_t *p_dst, size_t i_dst_max, const char *psz_src)
size_t vlc_b64_decode_binary (uint8_t **pp_dst, const char *psz_src)
char * vlc_b64_decode (const char *psz_src)
char * str_format_time (const char *)
 Formats current time into a heap-allocated string. More...
char * str_format_meta (input_thread_t *, const char *)
static char * str_format (input_thread_t *input, const char *fmt)
void filename_sanitize (char *)
 Remove forbidden, potentially forbidden and otherwise evil characters from filenames. More...
void path_sanitize (char *)
 Remove forbidden characters from full paths (leaves slashes) More...
time_t str_duration (const char *)

Detailed Description

Function Documentation

char* convert_xml_special_chars ( const char *  str)

XML-encode an UTF-8 string.

strnull-terminated UTF-8 byte sequence to XML-encode
XML encoded string or NULL on error (errno is set to ENOMEM or EILSEQ as appropriate)

References likely, unlikely, and vlc_towc().

Referenced by encode(), and httpd_HtmlError().

void filename_sanitize ( char *  str)

Remove forbidden, potentially forbidden and otherwise evil characters from filenames.

This includes slashes, and popular characters like colon (on Unix anyway), so this should only be used for automatically generated filenames.

Do not use this on full paths, only single file names without any directory separator!

References EnsureUTF8().

Referenced by ArtCacheGetDirPath(), ArtCacheName(), input_CreateFilename(), and vout_snapshot_SaveImage().

void path_sanitize ( char *  )

Remove forbidden characters from full paths (leaves slashes)

References DIR_SEP_CHAR.

Referenced by input_CreateFilename(), and vout_snapshot_SaveImage().

void resolve_xml_special_chars ( char *  psz_value)

Converts "&lt;", "&gt;" and "&amp;" to "<", ">" and "&".

stringto convert

References cmp_entity(), xml_entity_s::psz_char, xml_entity_s::psz_entity, psz_value, and xml_entities.

Referenced by decode().

time_t str_duration ( const char *  )

References us_strtod().

static char* str_format ( input_thread_t input,
const char *  fmt 
char* str_format_meta ( input_thread_t ,
const char *   
char* str_format_time ( const char *  tformat)

Formats current time into a heap-allocated string.

tformattime format (as with C strftime())
an allocated string (must be free()'d), or NULL on memory error.

References localtime_r(), strdup(), and vlc_assert_unreachable.

Referenced by str_format().

static int vlc_ascii_strcasecmp ( const char *  psz1,
const char *  psz2 

Compare two ASCII strings ignoring case.

The result is independent of the locale. If there are non-ASCII characters in the strings, their cases are NOT ignored in the comparison.

References vlc_ascii_tolower().

Referenced by cookie_domain_matches(), typecmp(), and vlc_http_cookies_append().

static int vlc_ascii_strncasecmp ( const char *  psz1,
const char *  psz2,
size_t  n 
static int vlc_ascii_tolower ( int  c)
static int vlc_ascii_toupper ( int  c)
char* vlc_b64_decode ( const char *  psz_src)
size_t vlc_b64_decode_binary ( uint8_t **  pp_dst,
const char *  psz_src 
size_t vlc_b64_decode_binary_to_buffer ( uint8_t *  p_dst,
size_t  i_dst_max,
const char *  psz_src 

References p.

Referenced by vlc_b64_decode(), and vlc_b64_decode_binary().

char* vlc_b64_encode ( const char *  )
char* vlc_b64_encode_binary ( const uint8_t *  ,

Referenced by vlc_b64_encode().