Mercurial > audlegacy
diff src/audacious/strings.c @ 4070:040243a50bd3
- modified playlist_load_ins_file() and playlist_load_ins_file_tuple(). path builder and ext_hash checker
have been extracted from playlist_load_ins_file_tuple() and are provided as individual functions.
- path builder is available to plugins as aud_construct_uri() and it allows container plugins to construct valid uri.
- replaced __playlist_ins_with_info_tuple() with the superset __playlist_ins_file(). it can accept both tuple and title/length pair.
- changed call dependency among playlist_load_ins_file(), playlist_load_ins_file_tuple() and __playlist_ins_file(). playlist_load_ins_file() no longer calls playlist_load_ins_file_tuple() nor builds any tuple.
- made some cleanups.
| author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
|---|---|
| date | Fri, 07 Dec 2007 01:11:25 +0900 |
| parents | 41a91ed36bfa |
| children | 9e24c8746d99 |
line wrap: on
line diff
--- a/src/audacious/strings.c Thu Dec 06 16:55:32 2007 +0100 +++ b/src/audacious/strings.c Fri Dec 07 01:11:25 2007 +0900 @@ -73,6 +73,7 @@ return escaped; } +/* replace %20 with ' ' in place */ static gchar * str_twenty_to_space(gchar * str) { @@ -91,6 +92,26 @@ return str; } +/* replace drive letter with '/' in place */ +static gchar * +str_replace_drive_letter(gchar * str) +{ + gchar *match, *match_end; + + g_return_val_if_fail(str != NULL, NULL); + + while ((match = strstr(str, ":\\"))) { + match--; + match_end = match + 3; + *match++ = '/'; + while (*match_end) + *match++ = *match_end++; + *match = 0; /* the end of line */ + } + + return str; +} + static gchar * str_replace_char(gchar * str, gchar old, gchar new) { @@ -263,7 +284,22 @@ return title; } -gchar *chardet_to_utf8(const gchar *str, gssize len, +gchar * +convert_dos_path(gchar * path) +{ + g_return_val_if_fail(path != NULL, NULL); + + /* replace drive letter with '/' */ + str_replace_drive_letter(path); + + /* replace '\' with '/' */ + str_replace_char(path, '\\', '/'); + + return path; +} + +gchar * +chardet_to_utf8(const gchar *str, gssize len, gsize *arg_bytes_read, gsize *arg_bytes_write, GError **arg_error) {
