#include "audstrings.h"
#include <stdio.h>
#include <glib.h>
#include <audacious/i18n.h>
#include <string.h>
#include <ctype.h>
Go to the source code of this file.
Functions | |
gchar * | escape_shell_chars (const gchar *string) |
Escapes characters that are special to the shell inside double quotes. | |
static gchar * | str_replace_drive_letter (gchar *str) |
Performs in place replacement of Windows-style drive letter with '/' (slash). | |
gchar * | str_append (gchar *str, const gchar *add_str) |
gchar * | str_replace (gchar *str, gchar *new_str) |
void | str_replace_in (gchar **str, gchar *new_str) |
gboolean | str_has_prefix_nocase (const gchar *str, const gchar *prefix) |
gboolean | str_has_suffix_nocase (const gchar *str, const gchar *suffix) |
gboolean | str_has_suffixes_nocase (const gchar *str, gchar *const *suffixes) |
gchar * | str_to_utf8_fallback (const gchar *str) |
gchar * | str_assert_utf8 (const gchar *str) |
This function can be used to assert that a given string is valid UTF-8. | |
const gchar * | str_skip_chars (const gchar *str, const gchar *chars) |
const void * | memfind (const void *mem, gint size, const void *token, gint length) |
gchar * | convert_dos_path (gchar *path) |
gchar * | filename_get_subtune (const gchar *filename, gint *track) |
Checks if given URI contains a subtune indicator/number. | |
gchar * | filename_split_subtune (const gchar *filename, gint *track) |
Given file path/URI contains ending indicating subtune number "?<number>", splits the string into filename without subtune value. | |
void | string_replace_char (gchar *string, gchar old_str, gchar new_str) |
static gchar | get_hex_digit (const gchar **get) |
static void | string_decode_percent_2 (const gchar *from, gchar *to) |
void | string_decode_percent (gchar *s) |
static gboolean | is_legal_char (gchar c, gboolean is_filename) |
static gchar | make_hex_digit (gint i) |
gchar * | string_encode_percent (const gchar *string, gboolean is_filename) |
gboolean | uri_is_utf8 (const gchar *uri, gboolean warn) |
gchar * | uri_to_utf8 (const gchar *uri) |
void | uri_check_utf8 (gchar **uri, gboolean warn) |
gchar * | filename_to_uri (const gchar *name) |
gchar * | uri_to_filename (const gchar *uri) |
void | string_cut_extension (gchar *string) |
gint | string_compare (const gchar *ap, const gchar *bp) |
gint | string_compare_encoded (const gchar *ap, const gchar *bp) |
Variables | |
gchar *(* | str_to_utf8 )(const gchar *str) = str_to_utf8_fallback |
Convert given string from nearly any encoding to UTF-8 encoding. | |
gchar *(* | chardet_to_utf8 )(const gchar *str, gssize len, gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error) = NULL |
gchar* convert_dos_path | ( | gchar * | path | ) |
Definition at line 259 of file audstrings.c.
Referenced by construct_uri().
gchar* escape_shell_chars | ( | const gchar * | string | ) |
Escapes characters that are special to the shell inside double quotes.
string | String to be escaped. |
Definition at line 45 of file audstrings.c.
gchar* filename_get_subtune | ( | const gchar * | filename, | |
gint * | track | |||
) |
Checks if given URI contains a subtune indicator/number.
If it does, track is set to to it, and position of subtune separator in the URI string is returned.
filename | Filename/URI to split. | |
track | Pointer to variable where subtune number should be assigned or NULL if it is not needed. |
Definition at line 285 of file audstrings.c.
Referenced by filename_split_subtune().
gchar* filename_split_subtune | ( | const gchar * | filename, | |
gint * | track | |||
) |
Given file path/URI contains ending indicating subtune number "?<number>", splits the string into filename without subtune value.
If given track pointer is non-NULL, subtune number is assigned into it.
filename | Filename/URI to split. | |
track | Pointer to variable where subtune number should be assigned or NULL if it is not needed. |
Definition at line 316 of file audstrings.c.
Referenced by file_find_decoder().
gchar* filename_to_uri | ( | const gchar * | name | ) |
Definition at line 495 of file audstrings.c.
Referenced by add_cb(), handle_cmd_line_filenames(), load_playlists(), save_playlists(), and uri_to_utf8().
static gchar get_hex_digit | ( | const gchar ** | get | ) | [inline, static] |
Definition at line 338 of file audstrings.c.
Referenced by string_compare_encoded(), and string_decode_percent_2().
Definition at line 377 of file audstrings.c.
Referenced by string_encode_percent().
static gchar make_hex_digit | ( | gint | i | ) | [static] |
Definition at line 383 of file audstrings.c.
Referenced by string_encode_percent().
Definition at line 233 of file audstrings.c.
gchar* str_append | ( | gchar * | str, | |
const gchar * | add_str | |||
) |
Definition at line 97 of file audstrings.c.
gchar* str_assert_utf8 | ( | const gchar * | str | ) |
This function can be used to assert that a given string is valid UTF-8.
If it is, a copy of the string is returned. However, if the string is NOT valid UTF-8, a warning and a callstack backtrace is printed in order to see where the problem occured.
This is a temporary measure for removing useless str_to_utf8 etc. calls and will be eventually removed. This function should be used in place of str_to_utf8() calls when it can be reasonably assumed that the input should already be in unicode encoding.
str | String to be tested and converted to UTF-8 encoding. |
Definition at line 194 of file audstrings.c.
gboolean str_has_prefix_nocase | ( | const gchar * | str, | |
const gchar * | prefix | |||
) |
Definition at line 116 of file audstrings.c.
gboolean str_has_suffix_nocase | ( | const gchar * | str, | |
const gchar * | suffix | |||
) |
Definition at line 123 of file audstrings.c.
Referenced by scan_plugin_func(), and str_has_suffixes_nocase().
gboolean str_has_suffixes_nocase | ( | const gchar * | str, | |
gchar *const * | suffixes | |||
) |
Definition at line 129 of file audstrings.c.
gchar* str_replace | ( | gchar * | str, | |
gchar * | new_str | |||
) |
Definition at line 103 of file audstrings.c.
Referenced by str_append(), and str_replace_in().
static gchar* str_replace_drive_letter | ( | gchar * | str | ) | [static] |
Performs in place replacement of Windows-style drive letter with '/' (slash).
str | String to be manipulated. |
Definition at line 78 of file audstrings.c.
Referenced by convert_dos_path().
void str_replace_in | ( | gchar ** | str, | |
gchar * | new_str | |||
) |
Definition at line 110 of file audstrings.c.
const gchar* str_skip_chars | ( | const gchar * | str, | |
const gchar * | chars | |||
) |
Definition at line 226 of file audstrings.c.
gchar* str_to_utf8_fallback | ( | const gchar * | str | ) |
Definition at line 144 of file audstrings.c.
Referenced by cd_str_to_utf8().
gint string_compare | ( | const gchar * | ap, | |
const gchar * | bp | |||
) |
Definition at line 529 of file audstrings.c.
Referenced by plugin_compare(), and tuple_compare_string().
gint string_compare_encoded | ( | const gchar * | ap, | |
const gchar * | bp | |||
) |
Definition at line 573 of file audstrings.c.
Referenced by add_cb(), and filename_compare_basename().
void string_cut_extension | ( | gchar * | string | ) |
Definition at line 517 of file audstrings.c.
Referenced by tuple_formatter_make_title_string().
void string_decode_percent | ( | gchar * | s | ) |
Definition at line 370 of file audstrings.c.
Referenced by tuple_set_filename().
static void string_decode_percent_2 | ( | const gchar * | from, | |
gchar * | to | |||
) | [static] |
Definition at line 358 of file audstrings.c.
Referenced by string_decode_percent(), uri_is_utf8(), uri_to_filename(), and uri_to_utf8().
gchar* string_encode_percent | ( | const gchar * | string, | |
gboolean | is_filename | |||
) |
Definition at line 393 of file audstrings.c.
Referenced by filename_to_uri().
void string_replace_char | ( | gchar * | string, | |
gchar | old_str, | |||
gchar | new_str | |||
) |
Definition at line 332 of file audstrings.c.
Referenced by convert_dos_path().
void uri_check_utf8 | ( | gchar ** | uri, | |
gboolean | warn | |||
) |
Definition at line 482 of file audstrings.c.
Referenced by make_entries().
Definition at line 430 of file audstrings.c.
Referenced by playlist_rescan_file(), and uri_check_utf8().
gchar* uri_to_filename | ( | const gchar * | uri | ) |
Definition at line 508 of file audstrings.c.
Referenced by get_associated_image_file(), playlist_insert_folder(), vfs_file_test(), and vfs_is_writeable().
gchar* uri_to_utf8 | ( | const gchar * | uri | ) |
Definition at line 465 of file audstrings.c.
Referenced by playlist_rescan_file(), and uri_check_utf8().
gchar *(* chardet_to_utf8)(const gchar *str, gssize len, gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error) = NULL |
Definition at line 171 of file audstrings.c.
Referenced by chardet_init().
gchar*(* str_to_utf8)(const gchar *str) = str_to_utf8_fallback |
Convert given string from nearly any encoding to UTF-8 encoding.
str | Local filename/path to convert. |
Definition at line 169 of file audstrings.c.
Referenced by chardet_init(), str_assert_utf8(), tuple_associate_string(), and tuple_set_filename().