From: <ny...@us...> - 2006-12-27 14:50:16
|
Revision: 205 http://svn.sourceforge.net/pmplib/?rev=205&view=rev Author: nyaochi Date: 2006-12-27 06:50:16 -0800 (Wed, 27 Dec 2006) Log Message: ----------- Convert back-slash characters to slash characters in path names in the database. Hooray! I did it. The player worked fine with the database now. Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-27 14:23:47 UTC (rev 204) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2006-12-27 14:50:16 UTC (rev 205) @@ -39,7 +39,6 @@ #include <stdlib.h> #include <memory.h> #include <ucs2char.h> -#include <filepath.h> #include "serialize.h" #include "util.h" @@ -346,7 +345,13 @@ return &dc->elems[i]; } +static const ucs2char_t* skip_one_directory(const ucs2char_t* path) +{ + ucs2char_t* p = ucs2chr(path, '/'); + return p ? p+1 : NULL; +} + void dat_construct(dat_t* dat, dic_t* dic, const ip3db_music_record_t* records, int num_records) { int i, j; @@ -354,7 +359,7 @@ uint32_t uid = 0; static const uint32_t uid_root = 0xFFFFFFFF; static const ucs2char_t ucs2cs_object_root[] = {'/','a','/',0}; - static const ucs2char_t ucs2cs_root[] = {PATHCHAR, 0}; + static const ucs2char_t ucs2cs_root[] = {'/', 0}; dat_list_t* dato = &dat->objects; dat_list_t* datm = &dat->musics; dircache_t dc; @@ -394,7 +399,7 @@ while (p && *p) { ucs2char_t tmp[MAX_PATH]; - const ucs2char_t* q = filepath_skip_one_directory(p); + const ucs2char_t* q = skip_one_directory(p); uid = dato->num_entries; ucs2ncpy(tmp, p, q-p); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-27 14:23:47 UTC (rev 204) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2006-12-27 14:50:16 UTC (rev 205) @@ -515,6 +515,17 @@ return (path + length); } +static int _filepath_slash(ucs2char_t* path) +{ + while (*path) { + if (*path == 0x005C) { + *path = 0x002F; + } + path++; + } + return 0; +} + static result_t pmpdb_set(pmpdb_t* pmpdb, const pmp_record_t* records, uint32_t num_records) { int i; @@ -535,7 +546,7 @@ ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], src->filename + ucs2len(path_to_root)); filepath_remove_filespec(dst[IP3DBF_MUSIC_FILEPATH].value.str); filepath_addslash(dst[IP3DBF_MUSIC_FILEPATH].value.str); - filepath_encode(dst[IP3DBF_MUSIC_FILEPATH].value.str); + _filepath_slash(dst[IP3DBF_MUSIC_FILEPATH].value.str); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILENAME], filepath_skippath(src->filename)); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ARTIST], src->artist); ip3db_variant_set_str(&dst[IP3DBF_MUSIC_ALBUM], src->album); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |