strings.c File Reference

Include dependency graph for strings.c:


Data Structures

struct  xml_entity_s

Defines

#define INSERT_STRING(string)
#define INSERT_STRING_NO_FREE(string)
#define SMB_SCHEME   "smb"

Functions

char * decode_URI_duplicate (const char *psz)
 Decode encoded URI component.
char * decode_URI (char *psz)
 Decode an encoded URI component in place.
static bool isurisafe (int c)
static char * encode_URI_bytes (const char *psz_uri, size_t len)
char * encode_URI_component (const char *psz_uri)
 Encodes an URI component (RFC3986 §2).
static int cmp_entity (const void *key, const void *elem)
void resolve_xml_special_chars (char *psz_value)
 Converts "&lt;", "&gt;" and "&amp;" to "<", ">" and "&".
char * convert_xml_special_chars (const char *psz_content)
 Converts '<', '>', '\"', '\'' and '&' to their html entities.
char * vlc_b64_encode_binary (const uint8_t *src, size_t i_src)
char * vlc_b64_encode (const char *src)
size_t vlc_b64_decode_binary_to_buffer (uint8_t *p_dst, size_t i_dst, const char *p_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 *tformat)
 Formats current time into a heap-allocated string.
char * str_format_meta (vlc_object_t *p_object, const char *string)
char * str_format (vlc_object_t *p_this, const char *psz_src)
 Apply str format time and str format meta.
void filename_sanitize (char *str)
 Remove forbidden characters from filenames (including slashes).
void path_sanitize (char *str)
 Remove forbidden characters from full paths (leaves slashes).
char * make_URI (const char *path)
 Convert a file path to an URI.
char * make_path (const char *url)
 Tries to convert an URI to a local (UTF-8-encoded) file path.

Variables

static struct xml_entity_s xml_entities []

Define Documentation

#define INSERT_STRING ( string   ) 

Value:

if( string != NULL )                            \
                    {                                               \
                        int len = strlen( string );                 \
                        dst = xrealloc( dst, i_size = i_size + len );\
                        memcpy( (dst+d), string, len );             \
                        d += len;                                   \
                        free( string );                             \
                    }                                               \
                    else if( !b_empty_if_na )                       \
                    {                                               \
                        *(dst+d) = '-';                             \
                        d++;                                        \
                    }                                               \

Referenced by str_format_meta().

#define INSERT_STRING_NO_FREE ( string   ) 

Value:

{                                               \
                        int len = strlen( string );                 \
                        dst = xrealloc( dst, i_size = i_size + len );\
                        memcpy( dst+d, string, len );               \
                        d += len;                                   \
                    }

Referenced by str_format_meta().

#define SMB_SCHEME   "smb"

Referenced by make_URI().


Function Documentation

static int cmp_entity ( const void *  key,
const void *  elem 
) [static]

char* decode_URI ( char *  psz  ) 

Decode an encoded URI component in place.

This function does NOT decode entire URIs. It decodes components (e.g. host name, directory, file name). Decoded URIs do not exist in the real world (see RFC3986 §2.4). Complete URIs are always "encoded" (or they are syntaxically invalid).

Note that URI encoding is different from Javascript escaping. Especially, white spaces and Unicode non-ASCII code points are encoded differently.

Returns:
psz on success, NULL if it was not properly encoded

References c, and hex().

Referenced by decode_URI_duplicate(), EvaluateRPN(), input_item_SetURI(), MacroDo(), make_path(), Open(), parseURL(), vlc_UrlParse(), and vlclua_decode_uri().

char* decode_URI_duplicate ( const char *  psz  ) 

Decode encoded URI component.

See also decode_URI().

Returns:
decoded duplicated string

References decode_URI(), and strdup().

Referenced by Demux(), Open(), ParseClipInfo(), Port_finder(), ReadMeta(), and test_decode().

static char* encode_URI_bytes ( const char *  psz_uri,
size_t  len 
) [static]

References c, hex(), i, and isurisafe().

Referenced by encode_URI_component(), and make_URI().

char* encode_URI_component ( const char *  psz_uri  ) 

Encodes an URI component (RFC3986 §2).

Parameters:
psz_uri nul-terminated UTF-8 representation of the component. Obviously, you can't pass an URI containing a nul character, but you don't want to do that, do you?
Returns:
encoded string (must be free()'d), or NULL for ENOMEM.

References encode_URI_bytes().

Referenced by DirBlock(), EvaluateRPN(), ProcessMRL(), and vlclua_encode_uri_component().

static bool isurisafe ( int  c  )  [inline, static]

Referenced by encode_URI_bytes().

char* make_path ( const char *  url  ) 

Tries to convert an URI to a local (UTF-8-encoded) file path.

Parameters:
url URI to convert
Returns:
NULL on error, a nul-terminated string otherwise (use free() to release it)

References asprintf(), decode_URI(), DIR_SEP, DIR_SEP_CHAR, strdup(), strncasecmp(), strndup(), and unlikely.

Referenced by ArtCallback(), InputManager::decodeArtURL(), FindMeta(), get_path(), input_item_WriteMeta(), ItemChange(), SDPHandleUrl(), subtitles_Detect(), and MetaPanel::update().

char* make_URI ( const char *  path  ) 


Variable Documentation

struct xml_entity_s xml_entities[] [static]


Generated on Tue May 25 08:05:37 2010 for VLC by  doxygen 1.5.6