From: <ny...@us...> - 2006-06-25 05:27:20
|
Revision: 66 Author: nyaochi Date: 2006-06-24 22:26:58 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=66&view=rev Log Message: ----------- Boring job for libpmp_portalplayer1 Modified Paths: -------------- branches/branch_0.12/lib/pmp_portalplayer1/model_iriver_h10.c branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke220.c branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke440.c branches/branch_0.12/lib/pmp_portalplayer1/model_samsung.c branches/branch_0.12/lib/pmp_portalplayer1/model_sirius_s50.c branches/branch_0.12/lib/pmp_portalplayer1/playlist.c branches/branch_0.12/lib/pmp_portalplayer1/pmp_portalplayer1.c branches/branch_0.12/lib/pmp_portalplayer1/pp1db.c branches/branch_0.12/lib/pmp_portalplayer1/pp1db.h Modified: branches/branch_0.12/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/model_iriver_h10.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/model_iriver_h10.c 2006-06-25 05:26:58 UTC (rev 66) @@ -91,29 +91,29 @@ int iriver_h10_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_unknown[] = {0}; + static const wchar_t* wcscs_unknown = L""; static const ucs2char_t ucs2cs_empty[] = {0}; // Set fields. dst->status = 0; dst->unknown1 = 0; - dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root)); + dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = wcsdupucs2(filepath_skiproot(src->filename, path_to_root)); filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); - dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dup(filepath_skippath(src->filename)); + dst->fields[PP1DB_DATFIELD_FILENAME].value.str = wcsdupucs2(filepath_skippath(src->filename)); dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; - dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dup(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); - dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); + dst->fields[PP1DB_DATFIELD_TITLE].value.str = wcsdupucs2(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); + dst->fields[PP1DB_DATFIELD_ARTIST].value.str = wcsdupucs2(src->artist ? src->artist : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_ALBUM].value.str = wcsdupucs2(src->album ? src->album : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_GENRE].value.str = wcsdupucs2(src->genre ? src->genre : wcscs_unknown); dst->fields[PP1DB_DATFIELD_RATING].value.dword = src->rating; dst->fields[PP1DB_DATFIELD_PLAYCOUNT].value.dword = src->play_count; dst->fields[PP1DB_DATFIELD_RECENTPLAY].value.dword = src->ts_playback; dst->fields[PP1DB_DATFIELD_UNKNOWN3].value.dword = 0; dst->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword = src->track_number; if (src->date) { - dst->fields[PP1DB_DATFIELD_YEAR].value.dword = ucs2toi(src->date); + dst->fields[PP1DB_DATFIELD_YEAR].value.dword = wtoi(src->date); } dst->fields[PP1DB_DATFIELD_FILESIZE].value.dword = src->filesize; dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration; @@ -128,9 +128,9 @@ int iriver_h10_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; - static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; - static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; + static const wchar_t* wcscs_mp3 = L".mp3"; + static const wchar_t* wcscs_wma = L".wma"; + static const wchar_t* wcscs_wav = L".wav"; ucs2char_t tmp[128]; size_t length = 0; @@ -154,11 +154,11 @@ dst->date = ucs2dup(tmp); // Set codec information according to the file extensions. - if (filepath_hasext(dst->filename, ucs2cs_mp3)) { + if (filepath_hasext(dst->filename, wcscs_mp3)) { dst->codec = PMPCODEC_MPEGLAYER3; - } else if (filepath_hasext(dst->filename, ucs2cs_wma)) { + } else if (filepath_hasext(dst->filename, wcscs_wma)) { dst->codec = PMPCODEC_WMA; - } else if (filepath_hasext(dst->filename, ucs2cs_wav)) { + } else if (filepath_hasext(dst->filename, wcscs_wav)) { dst->codec = PMPCODEC_WAV; } Modified: branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke220.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2006-06-25 05:26:58 UTC (rev 66) @@ -78,16 +78,16 @@ int medion_mdjuke220_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) { ucs2char_t duration[128]; - static const ucs2char_t ucs2cs_unknown[] = {'0',0}; + static const wchar_t* wcscs_unknown = L"0"; // Set fields. dst->status = 0; dst->unknown1 = 0; - dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root)); + dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dupwcs(filepath_skiproot(src->filename, path_to_root)); filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); - dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dup(filepath_skippath(src->filename)); + dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dupwcs(filepath_skippath(src->filename)); dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; @@ -96,24 +96,24 @@ itoucs2(src->duration, duration, 10); dst->fields[PP1DB_DATFIELD_DURATION].value.str = ucs2dup(duration); - dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dup(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); + dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dupwcs(src->artist ? src->artist : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dupwcs(src->album ? src->album : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dupwcs(src->genre ? src->genre : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dupwcs(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); dst->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword = src->track_number; if (src->date) { dst->fields[PP1DB_DATFIELD_YEAR].value.dword = ucs2toi(src->date); } dst->fields[PP1DB_DATFIELD_FILESIZE].value.dword = src->filesize; - dst->fields[PP1DB_DATFIELD_COMPOSER].value.str = ucs2dup(src->composer ? src->composer : ucs2cs_unknown); + dst->fields[PP1DB_DATFIELD_COMPOSER].value.str = ucs2dupwcs(src->composer ? src->composer : wcscs_unknown); return 0; } int medion_mdjuke220_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; - static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; - static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; + static const wchar_t* wcscs_mp3 = L".mp3"; + static const wchar_t* wcscs_wma = L".wma"; + static const wchar_t* wcscs_wav = L".wav"; ucs2char_t tmp[128]; size_t length = 0; @@ -133,17 +133,17 @@ dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; dst->duration = ucs2toi(src->fields[PP1DB_DATFIELD_DURATION].value.str); - dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); - dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); - dst->genre = ucs2dup(src->fields[PP1DB_DATFIELD_GENRE].value.str); - dst->title = ucs2dup(src->fields[PP1DB_DATFIELD_TITLE].value.str); + dst->artist = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ARTIST].value.str); + dst->album = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ALBUM].value.str); + dst->genre = ucs2dupwcs(src->fields[PP1DB_DATFIELD_GENRE].value.str); + dst->title = ucs2dupwcs(src->fields[PP1DB_DATFIELD_TITLE].value.str); // Set codec information according to the file extensions. - if (filepath_hasext(dst->filename, ucs2cs_mp3)) { + if (filepath_hasext(dst->filename, wcscs_mp3)) { dst->codec = PMPCODEC_MPEGLAYER3; - } else if (filepath_hasext(dst->filename, ucs2cs_wma)) { + } else if (filepath_hasext(dst->filename, wcscs_wma)) { dst->codec = PMPCODEC_WMA; - } else if (filepath_hasext(dst->filename, ucs2cs_wav)) { + } else if (filepath_hasext(dst->filename, wcscs_wav)) { dst->codec = PMPCODEC_WAV; } Modified: branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke440.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2006-06-25 05:26:58 UTC (rev 66) @@ -69,33 +69,33 @@ int medion_mdjuke440_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_unknown[] = {'0',0}; + static const wchar_t* wcscs_unknown = L"0"; // Set fields. dst->status = 0; dst->unknown1 = 0; - dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root)); + dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = wcsdupucs2(filepath_skiproot(src->filename, path_to_root)); filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); - dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dup(filepath_skippath(src->filename)); + dst->fields[PP1DB_DATFIELD_FILENAME].value.str = wcsdupucs2(filepath_skippath(src->filename)); dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; - dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dup(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); + dst->fields[PP1DB_DATFIELD_ARTIST].value.str = wcsdupucs2(src->artist ? src->artist : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_ALBUM].value.str = wcsdupucs2(src->album ? src->album : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_GENRE].value.str = wcsdupucs2(src->genre ? src->genre : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_TITLE].value.str = wcsdupucs2(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); dst->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword = src->track_number; - dst->fields[PP1DB_DATFIELD_COMPOSER].value.str = ucs2dup(src->composer ? src->composer : ucs2cs_unknown); + dst->fields[PP1DB_DATFIELD_COMPOSER].value.str = wcsdupucs2(src->composer ? src->composer : wcscs_unknown); return 0; } int medion_mdjuke440_dat_get(pmp_record_t* dst, const dat_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; - static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; - static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; + static const wchar_t* wcscs_mp3 = L".mp3"; + static const wchar_t* wcscs_wma = L".wma"; + static const wchar_t* wcscs_wav = L".wav"; size_t length = 0; length = ucs2len(path_to_root); @@ -112,17 +112,17 @@ dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; - dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); - dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); - dst->genre = ucs2dup(src->fields[PP1DB_DATFIELD_GENRE].value.str); - dst->title = ucs2dup(src->fields[PP1DB_DATFIELD_TITLE].value.str); + dst->artist = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ARTIST].value.str); + dst->album = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ALBUM].value.str); + dst->genre = ucs2dupwcs(src->fields[PP1DB_DATFIELD_GENRE].value.str); + dst->title = ucs2dupwcs(src->fields[PP1DB_DATFIELD_TITLE].value.str); // Set codec information according to the file extensions. - if (filepath_hasext(dst->filename, ucs2cs_mp3)) { + if (filepath_hasext(dst->filename, wcscs_mp3)) { dst->codec = PMPCODEC_MPEGLAYER3; - } else if (filepath_hasext(dst->filename, ucs2cs_wma)) { + } else if (filepath_hasext(dst->filename, wcscs_wma)) { dst->codec = PMPCODEC_WMA; - } else if (filepath_hasext(dst->filename, ucs2cs_wav)) { + } else if (filepath_hasext(dst->filename, wcscs_wav)) { dst->codec = PMPCODEC_WAV; } Modified: branches/branch_0.12/lib/pmp_portalplayer1/model_samsung.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/model_samsung.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/model_samsung.c 2006-06-25 05:26:58 UTC (rev 66) @@ -83,25 +83,25 @@ static int samsung_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_unknown[] = {0}; + static const wchar_t* wcscs_unknown = L""; static const ucs2char_t ucs2cs_empty[] = {0}; // Set fields. dst->status = 0; dst->unknown1 = 0; - dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root)); + dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = wcsdupucs2(filepath_skiproot(src->filename, path_to_root)); filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); - dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dup(filepath_skippath(src->filename)); + dst->fields[PP1DB_DATFIELD_FILENAME].value.str = wcsdupucs2(filepath_skippath(src->filename)); dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration; - dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dup(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); + dst->fields[PP1DB_DATFIELD_ARTIST].value.str = wcsdupucs2(src->artist ? src->artist : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_ALBUM].value.str = wcsdupucs2(src->album ? src->album : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_GENRE].value.str = wcsdupucs2(src->genre ? src->genre : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_TITLE].value.str = wcsdupucs2(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); dst->fields[PP1DB_DATFIELD_TRACKNUMBER].value.dword = src->track_number; if (src->date) { dst->fields[PP1DB_DATFIELD_YEAR].value.dword = ucs2toi(src->date); @@ -138,10 +138,10 @@ dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; dst->duration = ucs2toi(src->fields[PP1DB_DATFIELD_DURATION].value.str); - dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); - dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); - dst->genre = ucs2dup(src->fields[PP1DB_DATFIELD_GENRE].value.str); - dst->title = ucs2dup(src->fields[PP1DB_DATFIELD_TITLE].value.str); + dst->artist = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ARTIST].value.str); + dst->album = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ALBUM].value.str); + dst->genre = ucs2dupwcs(src->fields[PP1DB_DATFIELD_GENRE].value.str); + dst->title = ucs2dupwcs(src->fields[PP1DB_DATFIELD_TITLE].value.str); // Set codec information according to the file extensions. if (filepath_hasext(dst->filename, ucs2cs_mp3)) { Modified: branches/branch_0.12/lib/pmp_portalplayer1/model_sirius_s50.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/model_sirius_s50.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/model_sirius_s50.c 2006-06-25 05:26:58 UTC (rev 66) @@ -99,25 +99,25 @@ int sirius_s50_dat_set(dat_t* dst, const pmp_record_t* src, const ucs2char_t* path_to_root) { - static const ucs2char_t ucs2cs_unknown[] = {0}; + static const wchar_t* wcscs_unknown = L""; static const ucs2char_t ucs2cs_empty[] = {0}; // Set fields. dst->status = 0; dst->unknown1 = 0; - dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = ucs2dup(filepath_skiproot(src->filename, path_to_root)); + dst->fields[PP1DB_DATFIELD_PATHNAME].value.str = wcsdupucs2(filepath_skiproot(src->filename, path_to_root)); filepath_remove_filespec(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_addslash(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); filepath_encode(dst->fields[PP1DB_DATFIELD_PATHNAME].value.str); - dst->fields[PP1DB_DATFIELD_FILENAME].value.str = ucs2dup(filepath_skippath(src->filename)); + dst->fields[PP1DB_DATFIELD_FILENAME].value.str = wcsdupucs2(filepath_skippath(src->filename)); dst->fields[PP1DB_DATFIELD_FORMAT].value.dword = 0; dst->fields[PP1DB_DATFIELD_BITRATE].value.dword = src->bitrate; dst->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword = src->sample_rate; dst->fields[PP1DB_DATFIELD_DURATION].value.dword = src->duration; - dst->fields[PP1DB_DATFIELD_ARTIST].value.str = ucs2dup(src->artist ? src->artist : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_ALBUM].value.str = ucs2dup(src->album ? src->album : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_GENRE].value.str = ucs2dup(src->genre ? src->genre : ucs2cs_unknown); - dst->fields[PP1DB_DATFIELD_TITLE].value.str = ucs2dup(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); + dst->fields[PP1DB_DATFIELD_ARTIST].value.str = wcsdupucs2(src->artist ? src->artist : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_ALBUM].value.str = wcsdupucs2(src->album ? src->album : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_GENRE].value.str = wcsdupucs2(src->genre ? src->genre : wcscs_unknown); + dst->fields[PP1DB_DATFIELD_TITLE].value.str = wcsdupucs2(src->title ? src->title : dst->fields[PP1DB_DATFIELD_FILENAME].value.str); dst->fields[PP1DB_DATFIELD_FILESIZE].value.dword = src->filesize; dst->fields[PP1DB_DATFIELD_UNKNOWN3].value.dword = 0; dst->fields[PP1DB_DATFIELD_DATETIME].value.str = ucs2dup(ucs2cs_empty); @@ -148,21 +148,26 @@ length += ucs2len(src->fields[PP1DB_DATFIELD_FILENAME].value.str); length += 3; - dst->filename = (ucs2char_t*)ucs2malloc(sizeof(ucs2char_t) * length); + dst->filename = (ucs2char_t*)malloc(sizeof(ucs2char_t) * length); if (dst->filename) { - filepath_combinepath(dst->filename, length, path_to_root, src->fields[PP1DB_DATFIELD_PATHNAME].value.str); + wchar_t* tmp = NULL; + tmp = ucs2dupwcs(src->fields[PP1DB_DATFIELD_PATHNAME].value.str); + filepath_combinepath(dst->filename, length, path_to_root, tmp); + free(tmp); filepath_addslash(dst->filename); - ucs2cat(dst->filename, src->fields[PP1DB_DATFIELD_FILENAME].value.str); + tmp = ucs2dupwcs(src->fields[PP1DB_DATFIELD_FILENAME].value.str); + ucs2cat(dst->filename, tmp); + free(tmp); } dst->bitrate = src->fields[PP1DB_DATFIELD_BITRATE].value.dword; dst->sample_rate = src->fields[PP1DB_DATFIELD_SAMPLERATE].value.dword; dst->duration = src->fields[PP1DB_DATFIELD_DURATION].value.dword; - dst->artist = ucs2dup(src->fields[PP1DB_DATFIELD_ARTIST].value.str); - dst->album = ucs2dup(src->fields[PP1DB_DATFIELD_ALBUM].value.str); - dst->genre = ucs2dup(src->fields[PP1DB_DATFIELD_GENRE].value.str); - dst->title = ucs2dup(src->fields[PP1DB_DATFIELD_TITLE].value.str); + dst->artist = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ARTIST].value.str); + dst->album = ucs2dupwcs(src->fields[PP1DB_DATFIELD_ALBUM].value.str); + dst->genre = ucs2dupwcs(src->fields[PP1DB_DATFIELD_GENRE].value.str); + dst->title = ucs2dupwcs(src->fields[PP1DB_DATFIELD_TITLE].value.str); // Set codec information according to the file extensions. if (filepath_hasext(dst->filename, ucs2cs_mp3)) { Modified: branches/branch_0.12/lib/pmp_portalplayer1/playlist.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/playlist.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/playlist.c 2006-06-25 05:26:58 UTC (rev 66) @@ -51,10 +51,10 @@ } int playlist_write( - const ucs2char_t *filename, - const ucs2char_t *mediafiles[], + const wchar_t *filename, + const wchar_t *mediafiles[], int num_mediafiles, - const ucs2char_t *path_to_root + const wchar_t *path_to_root ) { static const ucs2char_t header1_str[] = {'P','L','P',' ','P','L','A','Y','L','I','S','T','\r','\n', 0}; @@ -62,7 +62,7 @@ static const ucs2char_t entry_str[] = {'H','D','D',',',' ', 0}; static const ucs2char_t crlf_str[] = {'\r','\n', 0}; - FILE *fp = ucs2fopen(filename, "wb"); + FILE *fp = filepath_fopen(filename, L"wb"); if (!fp) { return -1; } else { @@ -75,7 +75,8 @@ for (i = 0;i < num_mediafiles;i++) { if (mediafiles[i][0]) { ucs2char_t filename[MAX_PATH]; - ucs2cpy(filename, filepath_skiproot(mediafiles[i], path_to_root)); + const wchar_t* wcs_filename = filepath_skiproot(mediafiles[i], path_to_root); + wcstoucs2(filename, MAX_PATH, wcs_filename, wcslen(wcs_filename)); filepath_encode(filename); Modified: branches/branch_0.12/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/pmp_portalplayer1.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/pmp_portalplayer1.c 2006-06-25 05:26:58 UTC (rev 66) @@ -202,7 +202,7 @@ static result_t pmp_create_instance_db(pmp_t* pmp, pmpdb_t** ptr_pmpdb); static result_t pmp_create_instance_pl(pmp_t* pmp, pmppl_t** ptr_pmppl); static result_t pmp_is_supported_codec(pmp_t* pmp, uint32_t codec); -static result_t pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename); +static result_t pmp_is_supported_ext(pmp_t* pmp, const wchar_t* filename); static uint32_t pmpdb_add_ref(pmpdb_t* pmpdb); static uint32_t pmpdb_release(pmpdb_t* pmpdb); @@ -214,7 +214,7 @@ static uint32_t pmppl_add_ref(pmppl_t* pmppl); static uint32_t pmppl_release(pmppl_t* pmppl); -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, const ucs2char_t* files[], uint32_t num_files); +static result_t pmppl_write(pmppl_t* pmppl, const wchar_t* filename, const wchar_t* files[], uint32_t num_files); @@ -482,7 +482,7 @@ return pp1db_is_supported_codec(codec); } -static int pmp_is_supported_ext(pmp_t* pmp, const ucs2char_t* filename) +static int pmp_is_supported_ext(pmp_t* pmp, const wchar_t* filename) { return pp1db_is_supported_ext(filename); } @@ -559,7 +559,7 @@ return count; } -static result_t pmppl_write(pmppl_t* pmppl, const ucs2char_t* filename, const ucs2char_t* files[], uint32_t num_files) +static result_t pmppl_write(pmppl_t* pmppl, const wchar_t* filename, const wchar_t* files[], uint32_t num_files) { pmp_internal_t* pmpi = (pmp_internal_t*)pmppl->pmp->instance; if (playlist_write(filename, files, num_files, pmpi->env.path_to_root) != 0) { Modified: branches/branch_0.12/lib/pmp_portalplayer1/pp1db.c =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/pp1db.c 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/pp1db.c 2006-06-25 05:26:58 UTC (rev 66) @@ -354,16 +354,16 @@ return 0; } -int pp1db_is_supported_ext(const ucs2char_t* filename) +int pp1db_is_supported_ext(const wchar_t* filename) { - static const ucs2char_t ucs2cs_mp3[] = {'.','m','p','3',0}; - static const ucs2char_t ucs2cs_wma[] = {'.','w','m','a',0}; - static const ucs2char_t ucs2cs_wav[] = {'.','w','a','v',0}; + static const wchar_t* wcscs_mp3 = L".mp3"; + static const wchar_t* wcscs_wma = L".wma"; + static const wchar_t* wcscs_wav = L".wav"; return ( - filepath_hasext(filename, ucs2cs_mp3) || - filepath_hasext(filename, ucs2cs_wma) || - filepath_hasext(filename, ucs2cs_wav) + filepath_hasext(filename, wcscs_mp3) || + filepath_hasext(filename, wcscs_wma) || + filepath_hasext(filename, wcscs_wav) ) ? 1 : 0; } Modified: branches/branch_0.12/lib/pmp_portalplayer1/pp1db.h =================================================================== --- branches/branch_0.12/lib/pmp_portalplayer1/pp1db.h 2006-06-25 03:05:48 UTC (rev 65) +++ branches/branch_0.12/lib/pmp_portalplayer1/pp1db.h 2006-06-25 05:26:58 UTC (rev 66) @@ -150,10 +150,10 @@ // playlist.c int playlist_write( - const ucs2char_t *filename, - const ucs2char_t *mediafiles[], + const wchar_t *filename, + const wchar_t *mediafiles[], int num_mediafiles, - const ucs2char_t *path_to_root + const wchar_t *path_to_root ); // pp1db.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |