You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(56) |
Jul
(101) |
Aug
(14) |
Sep
|
Oct
(1) |
Nov
|
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(66) |
Feb
(106) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(10) |
Oct
(7) |
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ny...@us...> - 2007-02-10 15:23:30
|
Revision: 325 http://svn.sourceforge.net/pmplib/?rev=325&view=rev Author: nyaochi Date: 2007-02-10 07:23:26 -0800 (Sat, 10 Feb 2007) Log Message: ----------- [Win32GUI] - Configurable source location of playlists - Configurable music and playlist location in the player - Disable Unicode JSPL for now Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj trunk/pmplib/frontend/easypmp/win32gui/maindlg.h trunk/pmplib/frontend/easypmp/win32gui/preference.h trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h trunk/pmplib/frontend/easypmp/win32gui/resource.h trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/lib/playlist/contrib/js/jsapi.h trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h trunk/pmplib/lib/playlist/contrib/js/jslong.h trunk/pmplib/lib/playlist/contrib/js/jsosdep.h trunk/pmplib/lib/playlist/contrib/js/jsotypes.h trunk/pmplib/lib/playlist/contrib/js/jspubtd.h trunk/pmplib/lib/playlist/contrib/js/jstypes.h trunk/pmplib/lib/playlist/contrib/js/win32/debug/js32.dll trunk/pmplib/lib/playlist/contrib/js/win32/js32.lib trunk/pmplib/lib/playlist/contrib/js/win32/js32d.lib trunk/pmplib/lib/playlist/contrib/js/win32/release/js32.dll trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 15:23:26 UTC (rev 325) @@ -76,9 +76,9 @@ MODE_DATABASE_REPR = 0x00000004, MODE_PLAYLIST = 0x00000010, MODE_PLAYLIST_RECONVERT = 0x00000100, - MODE_PLAYLIST_FIND = 0x00000200, - MODE_PLAYLIST_SKIP = 0x00000400, - MODE_PLAYLIST_JSPL = 0x00000800, + MODE_PLAYLIST_FIND = 0x00000200, + MODE_PLAYLIST_SKIP = 0x00000400, + MODE_PLAYLIST_JSPL = 0x00000800, MODE_LIST_DEVICES = 0x00001000, MODE_HELP = 0x00010000, MODE_HELP_VARIABLE = 0x00020000, @@ -98,9 +98,10 @@ ucs2char_t** strip_words; int num_strip_words; - char *path_to_pmp_music; - char *path_to_pmp_playlist; - char *path_to_playlist_source; + ucs2char_t* path_to_pmp_music; + ucs2char_t* path_to_pmp_playlist; + ucs2char_t* path_to_playlist_source; + int subdir_playlist_source; } option_t; typedef struct { Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 15:23:26 UTC (rev 325) @@ -189,7 +189,7 @@ // Decode the playlist path prefix for system path separators if (opt->path_to_playlist_source) { - mbstoucs2(path, MAX_PATH, opt->path_to_playlist_source, strlen(opt->path_to_playlist_source)+1); + ucs2cpy(path, opt->path_to_playlist_source); } else { filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); } @@ -197,7 +197,7 @@ filepath_decode(path); ret = find_file( path, - pmp->info.playlist_flag & PMPPF_RECURSIVE ? 1 : 0, + opt->subdir_playlist_source, found_playlist_file, &ed ); Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 15:23:26 UTC (rev 325) @@ -313,10 +313,10 @@ // Modify the default setting. if (opt.path_to_pmp_music) { - mbstoucs2(pmp->info.path_to_music, MAX_PATH, opt.path_to_pmp_music, strlen(opt.path_to_pmp_music)+1); + ucs2cpy(pmp->info.path_to_music, opt.path_to_pmp_music); } if (opt.path_to_pmp_playlist) { - mbstoucs2(pmp->info.path_to_playlist, MAX_PATH, opt.path_to_pmp_playlist, strlen(opt.path_to_pmp_playlist)+1); + ucs2cpy(pmp->info.path_to_playlist, opt.path_to_pmp_playlist); } // Generate open flag. Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 15:23:26 UTC (rev 325) @@ -128,6 +128,9 @@ ucs2free(opt->strip_words[i]); } ucs2free(opt->strip_words); + ucs2free(opt->path_to_pmp_music); + ucs2free(opt->path_to_pmp_playlist); + ucs2free(opt->path_to_playlist_source); free(opt->system_encoding); free(opt->music_encoding); memset(opt, 0, sizeof(*opt)); @@ -217,8 +220,8 @@ opt->verb |= MODE_PLAYLIST; break; case 'P': - free(opt->path_to_playlist_source); - opt->path_to_playlist_source = strdup(optarg); + ucs2free(opt->path_to_playlist_source); + opt->path_to_playlist_source = mbsdupucs2(optarg); break; case 'r': opt->verb |= MODE_PLAYLIST_RECONVERT; @@ -238,11 +241,11 @@ break; case 's': if (strncmp("pmp_music:", optarg, 10) == 0) { - free(opt->path_to_pmp_music); - opt->path_to_pmp_music = strdup(optarg+10); + ucs2free(opt->path_to_pmp_music); + opt->path_to_pmp_music = mbsdupucs2(optarg+10); } else if (strncmp("pmp_playlist:", optarg, 13) == 0) { - free(opt->path_to_pmp_playlist); - opt->path_to_pmp_playlist = strdup(optarg+13); + ucs2free(opt->path_to_pmp_playlist); + opt->path_to_pmp_playlist = mbsdupucs2(optarg+13); } else { fprintf(fpe, "Unrecognized variable: %s\n", optarg); return -1; Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-10 15:23:26 UTC (rev 325) @@ -92,51 +92,60 @@ // Dialog // -IDD_PREFERENCE DIALOGEX 0, 0, 263, 234 +IDD_PREFERENCE DIALOGEX 0, 0, 263, 265 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12 - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,240,48,12 + PUSHBUTTON "Cancel",IDCANCEL,204,240,48,12 GROUPBOX "Media database",IDC_STATIC,12,12,240,48 CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,24,72,8 CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24,72,8 CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24,72,8 - LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108,12 - COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,60 + LTEXT "Source of media information (&z):",IDC_STATIC,24,36,108,12 + COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,36,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,72 CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,78,72,8 CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78,72,8 CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168,78,72,8 - LTEXT "Conversion option:",IDC_STATIC,24,96,72,8 - CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,96,72,8 - CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 - CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,108,144,8 - GROUPBOX "Portable Player Device",IDC_STATIC,12,132,240,72 - LTEXT "&Location:",IDC_STATIC,24,145,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,145,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,145,66,12 - LTEXT "&Identifier:",IDC_STATIC,24,162,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_ID,78,162,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,24,180,42,12,SS_CENTERIMAGE - LTEXT "?X?^?e?B?b?N",IDC_STATIC_PLAYER_DESCRIPTION,78,180,162,12,0,WS_EX_CLIENTEDGE + LTEXT "Conversion option:",IDC_STATIC,24,90,72,8,SS_CENTERIMAGE + CONTROL "Find &missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,90,72,8 + CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,90,72,8 + LTEXT "Source folder(s):",IDC_STATIC,24,102,72,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_PLAYLIST_SOURCE,96,102,144,12,ES_AUTOHSCROLL + PUSHBUTTON "Re&fer",IDC_BUTTON_REFER_PLAYLIST_SOURCE,96,115,30,12 + CONTROL "Include su&b folders",IDC_CHECK_PLAYLIST_SUBFOLDERS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,117,72,8 + GROUPBOX "Portable Player Device",IDC_STATIC,12,144,240,90 + LTEXT "&Location:",IDC_STATIC,24,157,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_LOCATION,72,156,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,156,66,12 + LTEXT "&Identifier:",IDC_STATIC,24,174,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_ID,72,174,168,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Description:",IDC_STATIC,24,192,42,12,SS_CENTERIMAGE + LTEXT "",IDC_STATIC_PLAYER_DESCRIPTION,72,192,168,12,0,WS_EX_CLIENTEDGE + LTEXT "Music folder:",IDC_STATIC,24,210,48,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_DEVICE_MUSIC,72,210,54,12,ES_AUTOHSCROLL + LTEXT "Playlist folder:",IDC_STATIC,138,210,48,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_DEVICE_PLAYLIST,186,210,54,12,ES_AUTOHSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,120,12 + PUSHBUTTON "&Default",IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE,126,115,30,12 END -IDD_PROCESSING DIALOGEX 0, 0, 263, 234 +IDD_PROCESSING DIALOGEX 0, 0, 263, 265 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12,NOT WS_VISIBLE - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,240,48,12,NOT WS_VISIBLE + PUSHBUTTON "Cancel",IDCANCEL,204,240,48,12 CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER,12,12,240,84 - EDITTEXT IDC_EDIT_LOG,12,96,240,102,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + EDITTEXT IDC_EDIT_LOG,12,96,240,138,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 - CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,210,48,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,120,12 + CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,240,48,12 END @@ -153,7 +162,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 258 END IDD_PROCESSING, DIALOG @@ -161,7 +170,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 258 END END #endif // APSTUDIO_INVOKED @@ -197,8 +206,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,13,0,2 - PRODUCTVERSION 0,13,0,2 + FILEVERSION 0,14,0,2 + PRODUCTVERSION 0,14,0,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -214,12 +223,12 @@ BLOCK "040904b0" BEGIN VALUE "FileDescription", "EasyPMP [Win32 GUI] application" - VALUE "FileVersion", "0, 13, 0, 2" + VALUE "FileVersion", "0, 14, 0, 2" VALUE "InternalName", "easypmp_win32gui" VALUE "LegalCopyright", "Copyright 2005-2007 Nyaochi" VALUE "OriginalFilename", "easypmp_win32gui.exe" VALUE "ProductName", "EasyPMP [Win32 GUI]" - VALUE "ProductVersion", "0, 13, 0, 2" + VALUE "ProductVersion", "0, 14, 0, 2" END END BLOCK "VarFileInfo" Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2007-02-10 15:23:26 UTC (rev 325) @@ -4,6 +4,7 @@ Version="8.00" Name="easypmp_win32gui" ProjectGUID="{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" + RootNamespace="easypmp_win32gui" > <Platforms> <Platform @@ -236,6 +237,10 @@ > </File> <File + RelativePath=".\folderdialog.h" + > + </File> + <File RelativePath=".\maindlg.h" > </File> Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -24,10 +24,6 @@ #pragma once -/** - * \addtogroup win32 - * @{ - */ class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>, @@ -72,7 +68,7 @@ DDX_RADIO(IDC_RADIO_PLAYLIST, m_setting.iPlaylistProcess) DDX_CHECK(IDC_CHECK_PL_FIND, m_setting.bSearchMissing) DDX_CHECK(IDC_CHECK_PL_SKIP, m_setting.bSkipMissing) - DDX_CHECK(IDC_CHECK_PL_JSPL, m_setting.bJSPL) + DDX_CHECK(IDC_CHECK_PLAYLIST_SUBFOLDERS, m_setting.bPlaylistSourceSubdirs) DDX_CHECK(IDC_CHECK_SAVE_LOG, m_setting.bSaveLog) DDX_CHECK(IDC_CHECK_SAFEREMOVE, m_setting.bSafelyRemove) END_DDX_MAP() @@ -82,6 +78,8 @@ MESSAGE_HANDLER(WM_APP, OnInitialize) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) + COMMAND_ID_HANDLER(IDC_BUTTON_REFER_PLAYLIST_SOURCE, OnClickReferPlaylistSource) + COMMAND_ID_HANDLER(IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE, OnClickDefaultPlaylistSource) COMMAND_HANDLER(IDC_COMBO_DEVICE_LOCATION, CBN_SELCHANGE, OnLocationSelChange) END_MSG_MAP() @@ -227,6 +225,24 @@ return 0; } + LRESULT OnClickReferPlaylistSource(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + CFolderDialog2 fd(m_hWnd, _T("Choose a folder for source playlists")); + fd.SetFolderPath(m_setting.strPlaylistSourceLocation); + if (fd.DoModal() == IDOK) { + m_setting.strPlaylistSourceLocation = fd.m_szFolderPath; + updateUI(FALSE); + } + return 0; + } + + LRESULT OnClickDefaultPlaylistSource(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + m_setting.strPlaylistSourceLocation = _T(""); + updateUI(FALSE); + return 0; + } + LRESULT OnLocationSelChange(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { CString strPlayerLocation; @@ -275,6 +291,9 @@ m_cmbPlayerLocation.GetLBText(m_cmbPlayerLocation.GetCurSel(), m_setting.strPlayerLocation); m_cmbPlayerIdentifier.GetLBText(m_cmbPlayerIdentifier.GetCurSel(), m_setting.strPlayerIdentifier); m_setting.iMediaInfoSource = m_cmbMediaInfoSource.GetCurSel(); + GetDlgItemText(IDC_EDIT_DEVICE_MUSIC, m_setting.strPlayerMusicLocation); + GetDlgItemText(IDC_EDIT_DEVICE_PLAYLIST, m_setting.strPlayerPlaylistLocation); + GetDlgItemText(IDC_EDIT_PLAYLIST_SOURCE, m_setting.strPlaylistSourceLocation); } else { if (m_cmbPlayerLocation.SelectString(-1, m_setting.strPlayerLocation) == CB_ERR) { m_cmbPlayerLocation.SetCurSel(-1); @@ -284,6 +303,9 @@ } m_cmbMediaInfoSource.SetCurSel(m_setting.iMediaInfoSource); SetDlgItemText(IDC_STATIC_PLAYER_DESCRIPTION, m_setting.strPlayerDescription); + SetDlgItemText(IDC_EDIT_DEVICE_MUSIC, m_setting.strPlayerMusicLocation); + SetDlgItemText(IDC_EDIT_DEVICE_PLAYLIST, m_setting.strPlayerPlaylistLocation); + SetDlgItemText(IDC_EDIT_PLAYLIST_SOURCE, m_setting.strPlaylistSourceLocation); } } @@ -352,5 +374,3 @@ m_strIniFile = strIniFile; } }; -/** @} */ - Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-10 15:23:26 UTC (rev 325) @@ -24,10 +24,6 @@ #pragma once -/** - * \addtogroup win32 - * @{ - */ class CEasyPMPSetting { public: int iDBProces; @@ -36,10 +32,13 @@ int iPlaylistProcess; BOOL bSearchMissing; BOOL bSkipMissing; - BOOL bJSPL; + CString strPlaylistSourceLocation; + BOOL bPlaylistSourceSubdirs; CString strPlayerLocation; CString strPlayerIdentifier; CString strPlayerDescription; + CString strPlayerMusicLocation; + CString strPlayerPlaylistLocation; BOOL bSaveLog; BOOL bSafelyRemove; int iCodePage; @@ -53,10 +52,13 @@ iPlaylistProcess = 2; bSearchMissing = TRUE; bSkipMissing = FALSE; - bJSPL = FALSE; - strPlayerLocation = _T(""); // Initialize empty. - strPlayerIdentifier = _T(""); // Initialize empty. - strPlayerDescription = _T(""); // Initialize empty. + strPlaylistSourceLocation = _T(""); // Initialize empty. + bPlaylistSourceSubdirs = FALSE; + strPlayerLocation = _T(""); // Initialize empty. + strPlayerIdentifier = _T(""); // Initialize empty. + strPlayerDescription = _T(""); // Initialize empty. + strPlayerMusicLocation = _T(""); + strPlayerPlaylistLocation = _T(""); bSaveLog = FALSE; bSafelyRemove = FALSE; iCodePage = CP_ACP; @@ -103,9 +105,12 @@ persistInt(iPlaylistProcess, _T("Playlist"), _T("Process"), szSettingFile, storing); persistBool(bSearchMissing, _T("Playlist"), _T("SearchMissing"), szSettingFile, storing); persistBool(bSkipMissing, _T("Playlist"), _T("SkipMissing"), szSettingFile, storing); - persistBool(bJSPL, _T("Playlist"), _T("JSPL"), szSettingFile, storing); + persistString(strPlaylistSourceLocation, _T("Playlist"), _T("SourceLocation"), szSettingFile, storing); + persistBool(bPlaylistSourceSubdirs, _T("Playlist"), _T("SourceSubdirs"), szSettingFile, storing); persistString(strPlayerLocation, _T("Player"), _T("Location"), szSettingFile, storing); persistString(strPlayerIdentifier, _T("Player"), _T("Identifier"), szSettingFile, storing); + persistString(strPlayerMusicLocation, _T("Player"), _T("MusicLocation"), szSettingFile, storing); + persistString(strPlayerPlaylistLocation, _T("Player"), _T("PlaylistLocation"), szSettingFile, storing); persistBool(bSafelyRemove, _T("General"), _T("SafelyRemove"), szSettingFile, storing); persistInt(iCodePage, _T("General"), _T("CodePage"), szSettingFile, storing); if (!storing) { @@ -206,9 +211,13 @@ strPlayerDescription += _T(" "); strPlayerDescription += A2CT(pmp->info.decl.mode); } + strPlayerMusicLocation = UCS2CT(pmp->info.path_to_music); + strPlayerPlaylistLocation = UCS2CT(pmp->info.path_to_playlist); } else { strPlayerIdentifier = _T(""); strPlayerDescription = _T(""); + strPlayerMusicLocation = _T(""); + strPlayerPlaylistLocation = _T(""); } } @@ -323,4 +332,3 @@ } }; -/** @} */ Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -280,8 +280,17 @@ } if (m_preference.bSearchMissing) opt.verb |= MODE_PLAYLIST_FIND; if (m_preference.bSkipMissing) opt.verb |= MODE_PLAYLIST_SKIP; - if (m_preference.bJSPL) opt.verb |= MODE_PLAYLIST_JSPL; + if (opt.verb & MODE_PLAYLIST) { + opt.verb |= MODE_PLAYLIST_JSPL; + } + if (!m_preference.strPlaylistSourceLocation.IsEmpty()) { + opt.path_to_playlist_source = ucs2dup(T2CUCS(m_preference.strPlaylistSourceLocation)); + } + if (m_preference.bPlaylistSourceSubdirs) { + opt.subdir_playlist_source = 1; + } + // Set path to the root folder. m_preference.GetPathToPlayerRoot(str); ucs2cpy(opt.path_to_root, T2CUCS(str)); @@ -329,6 +338,14 @@ return 1; } + // Modify the default setting. + if (!m_preference.strPlayerMusicLocation.IsEmpty()) { + ucs2cpy(pmp->info.path_to_music, T2CUCS(m_preference.strPlayerMusicLocation)); + } + if (!m_preference.strPlayerPlaylistLocation.IsEmpty()) { + ucs2cpy(pmp->info.path_to_playlist, T2CUCS(m_preference.strPlayerPlaylistLocation)); + } + // Generate open flag. int openflag = 0; if (opt.verb & MODE_DATABASE) { Modified: trunk/pmplib/frontend/easypmp/win32gui/resource.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/resource.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/resource.h 2007-02-10 15:23:26 UTC (rev 325) @@ -31,6 +31,13 @@ #define IDC_STATIC_PLAYER_DESCRIPTION 1021 #define IDC_CHECK_DONT_CLOSE 1021 #define IDC_LIST_PROGRESS 1031 +#define IDC_EDIT_PLAYLIST_SOURCE 1033 +#define IDC_BUTTON_REFER_PLAYLIST_SOURCE 1034 +#define IDC_CHECK_PLAYLIST_SUBFOLDERS 1035 +#define IDC_EDIT_DEVICE_MUSIC 1036 +#define IDC_EDIT_DEVICE_PLAYLIST 1037 +#define IDC_BUTTON1 1038 +#define IDC_BUTTON_DEFAULT_PLAYLIST_SOURCE 1038 // Next default values for new objects // @@ -38,7 +45,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 205 #define _APS_NEXT_COMMAND_VALUE 32772 -#define _APS_NEXT_CONTROL_VALUE 1033 +#define _APS_NEXT_CONTROL_VALUE 1039 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-10 15:23:26 UTC (rev 325) @@ -34,6 +34,7 @@ #include <easypmp.h> #include "ejectdevice.h" +#include "folderdialog.h" #include "progress_with_caption.h" #include "preference.h" #include "processingdlg.h" Modified: trunk/pmplib/lib/playlist/contrib/js/jsapi.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsapi.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsapi.h 2007-02-10 15:23:26 UTC (rev 325) @@ -135,6 +135,19 @@ #define JSFUN_FLAGS_MASK 0xf8 /* overlay JSFUN_* attributes */ /* + * Re-use JSFUN_LAMBDA, which applies only to scripted functions, for use in + * JSFunctionSpec arrays that specify generic native prototype methods, i.e., + * methods of a class prototype that are exposed as static methods taking an + * extra leading argument: the generic |this| parameter. + * + * If you set this flag in a JSFunctionSpec struct's flags initializer, then + * that struct must live at least as long as the native static method object + * created due to this flag by JS_DefineFunctions or JS_InitClass. Typically + * JSFunctionSpec structs are allocated in static arrays. + */ +#define JSFUN_GENERIC_NATIVE JSFUN_LAMBDA + +/* * Well-known JS values. The extern'd variables are initialized when the * first JSContext is created by JS_NewContext (see below). */ @@ -437,10 +450,26 @@ #define JSOPTION_PRIVATE_IS_NSISUPPORTS \ JS_BIT(3) /* context private data points to an nsISupports subclass */ -#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* one-shot compile+execute, - enables compile-time scope - chain resolution of consts - in many cases, e.g. */ +#define JSOPTION_COMPILE_N_GO JS_BIT(4) /* caller of JS_Compile*Script + promises to execute compiled + script once only; enables + compile-time scope chain + resolution of consts. */ +#define JSOPTION_ATLINE JS_BIT(5) /* //@line number ["filename"] + option supported for the + XUL preprocessor and kindred + beasts. */ +#define JSOPTION_XML JS_BIT(6) /* EMCAScript for XML support: + parse <!-- --> as a token, + not backward compatible with + the comment-hiding hack used + in HTML script tags. */ +#define JSOPTION_NATIVE_BRANCH_CALLBACK \ + JS_BIT(7) /* the branch callback set by + JS_SetBranchCallback may be + called with a null script + parameter, by native code + that loops intensively */ extern JS_PUBLIC_API(uint32) JS_GetOptions(JSContext *cx); @@ -490,6 +519,15 @@ extern JS_PUBLIC_API(JSBool) JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj); +/* + * Enumerate any already-resolved standard class ids into ida, or into a new + * JSIdArray if ida is null. Return the augmented array on success, null on + * failure with ida (if it was non-null on entry) destroyed. + */ +extern JS_PUBLIC_API(JSIdArray *) +JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *obj, + JSIdArray *ida); + extern JS_PUBLIC_API(JSObject *) JS_GetScopeChain(JSContext *cx); @@ -562,13 +600,67 @@ * JS_GC entry point clears them for the context on which GC is being forced. * Embeddings may need to do likewise for all contexts. * - * XXXbe See bug 40757 (http://bugzilla.mozilla.org/show_bug.cgi?id=40757), - * which proposes switching (with an #ifdef, alas, if we want to maintain API - * compatibility) to a JNI-like extensible local root frame stack model. + * See the scoped local root API immediately below for a better way to manage + * newborns in cases where native hooks (functions, getters, setters, etc.) + * create many GC-things, potentially without connecting them to predefined + * local roots such as *rval or argv[i] in an active native function. Using + * JS_EnterLocalRootScope disables updating of the context's per-gc-thing-type + * newborn roots, until control flow unwinds and leaves the outermost nesting + * local root scope. */ extern JS_PUBLIC_API(void) JS_ClearNewbornRoots(JSContext *cx); +/* + * Scoped local root management allows native functions, getter/setters, etc. + * to avoid worrying about the newborn root pigeon-holes, overloading local + * roots allocated in argv and *rval, or ending up having to call JS_Add*Root + * and JS_RemoveRoot to manage global roots temporarily. + * + * Instead, calling JS_EnterLocalRootScope and JS_LeaveLocalRootScope around + * the body of the native hook causes the engine to allocate a local root for + * each newborn created in between the two API calls, using a local root stack + * associated with cx. For example: + * + * JSBool + * my_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) + * { + * JSBool ok; + * + * if (!JS_EnterLocalRootScope(cx)) + * return JS_FALSE; + * ok = my_GetPropertyBody(cx, obj, id, vp); + * JS_LeaveLocalRootScope(cx); + * return ok; + * } + * + * NB: JS_LeaveLocalRootScope must be called once for every prior successful + * call to JS_EnterLocalRootScope. If JS_EnterLocalRootScope fails, you must + * not make the matching JS_LeaveLocalRootScope call. + * + * In case a native hook allocates many objects or other GC-things, but the + * native protects some of those GC-things by storing them as property values + * in an object that is itself protected, the hook can call JS_ForgetLocalRoot + * to free the local root automatically pushed for the now-protected GC-thing. + * + * JS_ForgetLocalRoot works on any GC-thing allocated in the current local + * root scope, but it's more time-efficient when called on references to more + * recently created GC-things. Calling it successively on other than the most + * recently allocated GC-thing will tend to average the time inefficiency, and + * may risk O(n^2) growth rate, but in any event, you shouldn't allocate too + * many local roots if you can root as you go (build a tree of objects from + * the top down, forgetting each latest-allocated GC-thing immediately upon + * linking it to its parent). + */ +extern JS_PUBLIC_API(JSBool) +JS_EnterLocalRootScope(JSContext *cx); + +extern JS_PUBLIC_API(void) +JS_LeaveLocalRootScope(JSContext *cx); + +extern JS_PUBLIC_API(void) +JS_ForgetLocalRoot(JSContext *cx, void *thing); + #ifdef DEBUG extern JS_PUBLIC_API(void) JS_DumpNamedRoots(JSRuntime *rt, @@ -647,8 +739,16 @@ extern JS_PUBLIC_API(JSBool) JS_IsAboutToBeFinalized(JSContext *cx, void *thing); +typedef enum JSGCParamKey { + JSGC_MAX_BYTES = 0, /* maximum nominal heap before last ditch GC */ + JSGC_MAX_MALLOC_BYTES = 1 /* # of JS_malloc bytes before last ditch GC */ +} JSGCParamKey; + +extern JS_PUBLIC_API(void) +JS_SetGCParameter(JSRuntime *rt, JSGCParamKey key, uint32 value); + /* - * Add an external string finalizer, one created by JS_NewExternalString (see + * Add a finalizer for external strings created by JS_NewExternalString (see * below) using a type-code returned from this function, and that understands * how to free or release the memory pointed at by JS_GetStringChars(str). * @@ -730,9 +830,21 @@ JSXDRObjectOp xdrObject; JSHasInstanceOp hasInstance; JSMarkOp mark; - jsword spare; + JSReserveSlotsOp reserveSlots; }; +struct JSExtendedClass { + JSClass base; + JSEqualityOp equality; + JSObjectOp outerObject; + JSObjectOp innerObject; + jsword reserved0; + jsword reserved1; + jsword reserved2; + jsword reserved3; + jsword reserved4; +}; + #define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slot */ #define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hook */ #define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */ @@ -742,6 +854,9 @@ object in prototype chain passed in via *objp in/out parameter */ +#define JSCLASS_CONSTRUCT_PROTOTYPE (1<<6) /* call constructor on class + prototype */ +#define JSCLASS_DOCUMENT_OBSERVER (1<<7) /* DOM document observer */ /* * To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or @@ -751,14 +866,21 @@ #define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below */ #define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */ #define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH) -#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ +#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ << JSCLASS_RESERVED_SLOTS_SHIFT) #define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \ - >> JSCLASS_RESERVED_SLOTS_SHIFT) \ + >> JSCLASS_RESERVED_SLOTS_SHIFT) \ & JSCLASS_RESERVED_SLOTS_MASK) +#define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \ + JSCLASS_RESERVED_SLOTS_WIDTH) + +/* True if JSClass is really a JSExtendedClass. */ +#define JSCLASS_IS_EXTENDED (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0)) + /* Initializer for unused members of statically initialized JSClass structs. */ #define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,0 +#define JSCLASS_NO_RESERVED_MEMBERS 0,0,0,0,0 /* For detailed comments on these function pointer types, see jspubtd.h. */ struct JSObjectOps { @@ -791,6 +913,15 @@ JSSetRequiredSlotOp setRequiredSlot; }; +struct JSXMLObjectOps { + JSObjectOps base; + JSGetMethodOp getMethod; + JSSetMethodOp setMethod; + JSEnumerateValuesOp enumerateValues; + JSEqualityOp equality; + JSConcatenateOp concatenate; +}; + /* * Classes that expose JSObjectOps via a non-null getObjectOps class hook may * derive a property structure from this struct, return a pointer to it from @@ -819,8 +950,21 @@ extern JS_PUBLIC_API(JSBool) JS_IdToValue(JSContext *cx, jsid id, jsval *vp); +/* + * The magic XML namespace id is int-tagged, but not a valid integer jsval. + * Global object classes in embeddings that enable JS_HAS_XML_SUPPORT (E4X) + * should handle this id specially before converting id via JSVAL_TO_INT. + */ +#define JS_DEFAULT_XML_NAMESPACE_ID ((jsid) JSVAL_VOID) + +/* + * JSNewResolveOp flag bits. + */ #define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */ #define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */ +#define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:...' */ +#define JSRESOLVE_DECLARING 0x08 /* var, const, or function prolog op */ +#define JSRESOLVE_CLASSNAME 0x10 /* class name used when constructing */ extern JS_PUBLIC_API(JSBool) JS_PropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp); @@ -886,6 +1030,9 @@ extern JS_PUBLIC_API(JSBool) JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv); +extern JS_PUBLIC_API(JSBool) +JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp); + extern JS_PUBLIC_API(void *) JS_GetPrivate(JSContext *cx, JSObject *obj); @@ -958,6 +1105,18 @@ uintN *attrsp, JSBool *foundp); /* + * The same, but if the property is native, return its getter and setter via + * *getterp and *setterp, respectively (and only if the out parameter pointer + * is not null). + */ +extern JS_PUBLIC_API(JSBool) +JS_GetPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, + const char *name, + uintN *attrsp, JSBool *foundp, + JSPropertyOp *getterp, + JSPropertyOp *setterp); + +/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be @@ -978,12 +1137,23 @@ const char *alias); extern JS_PUBLIC_API(JSBool) +JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, JSBool *foundp); + +extern JS_PUBLIC_API(JSBool) JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) +JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name, + uintN flags, jsval *vp); + +extern JS_PUBLIC_API(JSBool) JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) +JS_GetMethod(JSContext *cx, JSObject *obj, const char *name, JSObject **objp, + jsval *vp); + +extern JS_PUBLIC_API(JSBool) JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) @@ -1011,6 +1181,18 @@ uintN *attrsp, JSBool *foundp); /* + * The same, but if the property is native, return its getter and setter via + * *getterp and *setterp, respectively (and only if the out parameter pointer + * is not null). + */ +extern JS_PUBLIC_API(JSBool) +JS_GetUCPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, + uintN *attrsp, JSBool *foundp, + JSPropertyOp *getterp, + JSPropertyOp *setterp); + +/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be @@ -1030,6 +1212,11 @@ uintN attrs); extern JS_PUBLIC_API(JSBool) +JS_HasUCProperty(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, + JSBool *vp); + +extern JS_PUBLIC_API(JSBool) JS_LookupUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, jsval *vp); @@ -1072,6 +1259,9 @@ JS_AliasElement(JSContext *cx, JSObject *obj, const char *name, jsint alias); extern JS_PUBLIC_API(JSBool) +JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp); + +extern JS_PUBLIC_API(JSBool) JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp); extern JS_PUBLIC_API(JSBool) @@ -1092,7 +1282,23 @@ extern JS_PUBLIC_API(JSIdArray *) JS_Enumerate(JSContext *cx, JSObject *obj); +/* + * Create an object to iterate over enumerable properties of obj, in arbitrary + * property definition order. NB: This differs from longstanding for..in loop + * order, which uses order of property definition in obj. + */ +extern JS_PUBLIC_API(JSObject *) +JS_NewPropertyIterator(JSContext *cx, JSObject *obj); + +/* + * Return true on success with *idp containing the id of the next enumerable + * property to visit using iterobj, or JSVAL_VOID if there is no such property + * left to visit. Return false on error. + */ extern JS_PUBLIC_API(JSBool) +JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp); + +extern JS_PUBLIC_API(JSBool) JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode, jsval *vp, uintN *attrsp); @@ -1112,12 +1318,16 @@ */ struct JSPrincipals { char *codebase; + + /* XXX unspecified and unused by Mozilla code -- can we remove these? */ void * (* JS_DLL_CALLBACK getPrincipalArray)(JSContext *cx, JSPrincipals *); JSBool (* JS_DLL_CALLBACK globalPrivilegesEnabled)(JSContext *cx, JSPrincipals *); /* Don't call "destroy"; use reference counting macros below. */ jsrefcount refcount; - void (* JS_DLL_CALLBACK destroy)(JSContext *cx, struct JSPrincipals *); + + void (* JS_DLL_CALLBACK destroy)(JSContext *cx, JSPrincipals *); + JSBool (* JS_DLL_CALLBACK subsume)(JSPrincipals *, JSPrincipals *); }; #ifdef JS_THREADSAFE @@ -1142,7 +1352,7 @@ JS_SetPrincipalsTranscoder(JSRuntime *rt, JSPrincipalsTranscoder px); extern JS_PUBLIC_API(JSObjectPrincipalsFinder) -JS_SetObjectPrincipalsFinder(JSContext *cx, JSObjectPrincipalsFinder fop); +JS_SetObjectPrincipalsFinder(JSRuntime *rt, JSObjectPrincipalsFinder fop); /************************************************************************/ @@ -1183,6 +1393,12 @@ JS_GetFunctionFlags(JSFunction *fun); /* + * Return the arity (length) of fun. + */ +extern JS_PUBLIC_API(uint16) +JS_GetFunctionArity(JSFunction *fun); + +/* * Infallible predicate to test whether obj is a function object (faster than * comparing obj's class name to "Function", but equivalent unless someone has * overwritten the "Function" identifier with a different constructor and then @@ -1198,6 +1414,11 @@ JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call, uintN nargs, uintN attrs); +extern JS_PUBLIC_API(JSFunction *) +JS_DefineUCFunction(JSContext *cx, JSObject *obj, + const jschar *name, size_t namelen, JSNative call, + uintN nargs, uintN attrs); + extern JS_PUBLIC_API(JSObject *) JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent); @@ -1543,6 +1764,44 @@ extern JS_PUBLIC_API(JSBool) JS_MakeStringImmutable(JSContext *cx, JSString *str); +/* + * Return JS_TRUE if C (char []) strings passed via the API and internally + * are UTF-8. The source must be compiled with JS_C_STRINGS_ARE_UTF8 defined + * to get UTF-8 support. + */ +JS_PUBLIC_API(JSBool) +JS_StringsAreUTF8(); + +/* + * Character encoding support. + * + * For both JS_EncodeCharacters and JS_DecodeBytes, set *dstlenp to the size + * of the destination buffer before the call; on return, *dstlenp contains the + * number of bytes (JS_EncodeCharacters) or jschars (JS_DecodeBytes) actually + * stored. To determine the necessary destination buffer size, make a sizing + * call that passes NULL for dst. + * + * On errors, the functions report the error. In that case, *dstlenp contains + * the number of characters or bytes transferred so far. If cx is NULL, no + * error is reported on failure, and the functions simply return JS_FALSE. + * + * NB: Neither function stores an additional zero byte or jschar after the + * transcoded string. + * + * If the source has been compiled with the #define JS_C_STRINGS_ARE_UTF8 to + * enable UTF-8 interpretation of C char[] strings, then JS_EncodeCharacters + * encodes to UTF-8, and JS_DecodeBytes decodes from UTF-8, which may create + * addititional errors if the character sequence is malformed. If UTF-8 + * support is disabled, the functions deflate and inflate, respectively. + */ +JS_PUBLIC_API(JSBool) +JS_EncodeCharacters(JSContext *cx, const jschar *src, size_t srclen, char *dst, + size_t *dstlenp); + +JS_PUBLIC_API(JSBool) +JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, + size_t *dstlenp); + /************************************************************************/ /* @@ -1552,6 +1811,7 @@ JSLocaleToUpperCase localeToUpperCase; JSLocaleToLowerCase localeToLowerCase; JSLocaleCompare localeCompare; + JSLocaleToUnicode localeToUnicode; }; /* @@ -1697,6 +1957,9 @@ extern JS_PUBLIC_API(void) JS_ClearPendingException(JSContext *cx); +extern JS_PUBLIC_API(JSBool) +JS_ReportPendingException(JSContext *cx); + /* * Save the current exception state. This takes a snapshot of cx's current * exception state without making any change to that state. @@ -1727,6 +1990,14 @@ extern JS_PUBLIC_API(JSErrorReport *) JS_ErrorFromException(JSContext *cx, jsval v); +/* + * Given a reported error's message and JSErrorReport struct pointer, throw + * the corresponding exception on cx. + */ +extern JS_PUBLIC_API(JSBool) +JS_ThrowReportedError(JSContext *cx, const char *message, + JSErrorReport *reportp); + #ifdef JS_THREADSAFE /* @@ -1744,7 +2015,7 @@ extern JS_PUBLIC_API(jsword) JS_SetContextThread(JSContext *cx); -extern JS_PUBLIC_API(intN) +extern JS_PUBLIC_API(jsword) JS_ClearContextThread(JSContext *cx); #endif /* JS_THREADSAFE */ Modified: trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jscpucfg.h 2007-02-10 15:23:26 UTC (rev 325) @@ -42,54 +42,13 @@ #include "jsosdep.h" -#ifdef XP_MAC -#undef IS_LITTLE_ENDIAN -#define IS_BIG_ENDIAN 1 +#if defined(XP_WIN) || defined(XP_OS2) || defined(WINCE) -#define JS_BYTES_PER_BYTE 1L -#define JS_BYTES_PER_SHORT 2L -#define JS_BYTES_PER_INT 4L -#define JS_BYTES_PER_INT64 8L -#define JS_BYTES_PER_LONG 4L -#define JS_BYTES_PER_FLOAT 4L -#define JS_BYTES_PER_DOUBLE 8L -#define JS_BYTES_PER_WORD 4L -#define JS_BYTES_PER_DWORD 8L +#ifdef __WATCOMC__ +#define HAVE_VA_LIST_AS_ARRAY +#endif -#define JS_BITS_PER_BYTE 8L -#define JS_BITS_PER_SHORT 16L -#define JS_BITS_PER_INT 32L -#define JS_BITS_PER_INT64 64L -#define JS_BITS_PER_LONG 32L -#define JS_BITS_PER_FLOAT 32L -#define JS_BITS_PER_DOUBLE 64L -#define JS_BITS_PER_WORD 32L - -#define JS_BITS_PER_BYTE_LOG2 3L -#define JS_BITS_PER_SHORT_LOG2 4L -#define JS_BITS_PER_INT_LOG2 5L -#define JS_BITS_PER_INT64_LOG2 6L -#define JS_BITS_PER_LONG_LOG2 5L -#define JS_BITS_PER_FLOAT_LOG2 5L -#define JS_BITS_PER_DOUBLE_LOG2 6L -#define JS_BITS_PER_WORD_LOG2 5L - -#define JS_ALIGN_OF_SHORT 2L -#define JS_ALIGN_OF_INT 4L -#define JS_ALIGN_OF_LONG 4L -#define JS_ALIGN_OF_INT64 2L -#define JS_ALIGN_OF_FLOAT 4L -#define JS_ALIGN_OF_DOUBLE 4L -#define JS_ALIGN_OF_POINTER 4L -#define JS_ALIGN_OF_WORD 4L - -#define JS_BYTES_PER_WORD_LOG2 2L -#define JS_BYTES_PER_DWORD_LOG2 3L -#define PR_WORDS_PER_DWORD_LOG2 1L - -#elif defined(XP_WIN) || defined(XP_OS2) - -#if defined( _WIN32) || defined(XP_OS2) +#if defined(_WIN32) || defined(XP_OS2) || defined(WINCE) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN @@ -133,7 +92,7 @@ #define JS_BYTES_PER_WORD_LOG2 2L #define JS_BYTES_PER_DWORD_LOG2 3L #define PR_WORDS_PER_DWORD_LOG2 1L -#endif /* _WIN32 || XP_OS2 */ +#endif /* _WIN32 || XP_OS2 || WINCE*/ #if defined(_WINDOWS) && !defined(_WIN32) /* WIN16 */ #define IS_LITTLE_ENDIAN 1 @@ -189,7 +148,7 @@ #else -#error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN, or XP_UNIX" +#error "Must define one of XP_BEOS, XP_OS2, XP_WIN, or XP_UNIX" #endif Modified: trunk/pmplib/lib/playlist/contrib/js/jslong.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jslong.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jslong.h 2007-02-10 15:23:26 UTC (rev 325) @@ -185,7 +185,7 @@ /*********************************************************************** ** MACROS: JSLL_UDIVMOD ** DESCRIPTION: -** Produce both a quotient and a remainder given an unsigned +** Produce both a quotient and a remainder given an unsigned ** INPUTS: JSUint64 a: The dividend of the operation ** JSUint64 b: The quotient of the operation ** OUTPUTS: JSUint64 *qp: pointer to quotient Modified: trunk/pmplib/lib/playlist/contrib/js/jsosdep.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsosdep.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsosdep.h 2007-02-10 15:23:26 UTC (rev 325) @@ -52,21 +52,6 @@ #endif #endif /* XP_WIN || XP_OS2 */ -#ifdef XP_MAC -#define JS_HAVE_LONG_LONG - -JS_BEGIN_EXTERN_C - -#include <stddef.h> - -extern void* reallocSmaller(void* block, size_t newSize); - -extern char* strdup(const char* str); - -JS_END_EXTERN_C - -#endif /* XP_MAC */ - #ifdef XP_BEOS #define JS_HAVE_LONG_LONG #endif Modified: trunk/pmplib/lib/playlist/contrib/js/jsotypes.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jsotypes.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jsotypes.h 2007-02-10 15:23:26 UTC (rev 325) @@ -75,7 +75,7 @@ typedef JSUintn uintn; typedef JSUint64 uint64; -#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) +#if !defined(_WIN32) && !defined(XP_OS2) typedef JSUint32 uint32; #else typedef unsigned long uint32; @@ -102,7 +102,7 @@ #ifdef HPUX #include <model.h> #else -#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) +#if !defined(_WIN32) && !defined(XP_OS2) typedef JSInt32 int32; #else typedef long int32; @@ -112,14 +112,14 @@ #endif /* HPUX */ #endif /* AIX && HAVE_SYS_INTTYPES_H */ -#endif /* XP_BEOS */ +#endif /* XP_BEOS */ typedef JSFloat64 float64; /* Re: jsbit.h */ -#define TEST_BIT JS_TEST_BIT -#define SET_BIT JS_SET_BIT -#define CLEAR_BIT JS_CLEAR_BIT +#define TEST_BIT JS_TEST_BIT +#define SET_BIT JS_SET_BIT +#define CLEAR_BIT JS_CLEAR_BIT /* Re: prarena.h->plarena.h */ #define PRArena PLArena @@ -199,13 +199,4 @@ #define PR_CompareStrings PL_CompareStrings #define PR_CompareValues PL_CompareValues -#ifdef XP_MAC -#ifndef TRUE /* Mac standard is lower case true */ - #define TRUE 1 -#endif -#ifndef FALSE /* Mac standard is lower case false */ - #define FALSE 0 -#endif -#endif - #endif /* !defined(PROTYPES_H) */ Modified: trunk/pmplib/lib/playlist/contrib/js/jspubtd.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jspubtd.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jspubtd.h 2007-02-10 15:23:26 UTC (rev 325) @@ -69,6 +69,7 @@ JSVERSION_1_4 = 140, JSVERSION_ECMA_3 = 148, JSVERSION_1_5 = 150, + JSVERSION_1_6 = 160, JSVERSION_DEFAULT = 0, JSVERSION_UNKNOWN = -1 } JSVersion; @@ -84,6 +85,8 @@ JSTYPE_STRING, /* string */ JSTYPE_NUMBER, /* number */ JSTYPE_BOOLEAN, /* boolean */ + JSTYPE_NULL, /* null */ + JSTYPE_XML, /* xml object */ JSTYPE_LIMIT } JSType; @@ -112,6 +115,7 @@ /* Struct typedefs. */ typedef struct JSClass JSClass; +typedef struct JSExtendedClass JSExtendedClass; typedef struct JSConstDoubleSpec JSConstDoubleSpec; typedef struct JSContext JSContext; typedef struct JSErrorReport JSErrorReport; @@ -123,11 +127,12 @@ typedef struct JSObject JSObject; typedef struct JSObjectMap JSObjectMap; typedef struct JSObjectOps JSObjectOps; +typedef struct JSXMLObjectOps JSXMLObjectOps; typedef struct JSRuntime JSRuntime; -typedef struct JSRuntime JSTaskState; /* XXX deprecated name */ +typedef struct JSRuntime JSTaskState; /* XXX deprecated name */ typedef struct JSScript JSScript; typedef struct JSString JSString; -typedef struct JSXDRState JSXDRState; +typedef struct JSXDRState JSXDRState; typedef struct JSExceptionState JSExceptionState; typedef struct JSLocaleCallbacks JSLocaleCallbacks; @@ -203,6 +208,9 @@ * * JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not id * JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment + * JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequence + * JSRESOLVE_DECLARING var, const, or function prolog declaration opcode + * JSRESOLVE_CLASSNAME class name used when constructing * * The *objp out parameter, on success, should be null to indicate that id * was not resolved; and non-null, referring to obj or one of its prototypes, @@ -263,12 +271,17 @@ * Thus JSClass (which pre-dates JSObjectOps in the API) provides a low-level * interface to class-specific code and data, while JSObjectOps allows for a * higher level of operation, which does not use the object's class except to - * find the class's JSObjectOps struct, by calling clasp->getObjectOps. + * find the class's JSObjectOps struct, by calling clasp->getObjectOps, and to + * finalize the object. * * If this seems backwards, that's because it is! API compatibility requires * a JSClass *clasp parameter to JS_NewObject, etc. Most host objects do not * need to implement the larger JSObjectOps, and can share the common JSScope * code and data used by the native (js_ObjectOps, see jsobj.c) ops. + * + * Further extension to preserve API compatibility: if this function returns + * a pointer to JSXMLObjectOps.base, not to JSObjectOps, then the engine calls + * extended hooks needed for E4X. */ typedef JSObjectOps * (* JS_DLL_CALLBACK JSGetObjectOps)(JSContext *cx, JSClass *clasp); @@ -326,6 +339,21 @@ typedef uint32 (* JS_DLL_CALLBACK JSMarkOp)(JSContext *cx, JSObject *obj, void *arg); +/* + * The optional JSClass.reserveSlots hook allows a class to make computed + * per-instance object slots reservations, in addition to or instead of using + * JSCLASS_HAS_RESERVED_SLOTS(n) in the JSClass.flags initializer to reserve + * a constant-per-class number of slots. Implementations of this hook should + * return the number of slots to reserve, not including any reserved by using + * JSCLASS_HAS_RESERVED_SLOTS(n) in JSClass.flags. + * + * NB: called with obj locked by the JSObjectOps-specific mutual exclusion + * mechanism appropriate for obj, so don't nest other operations that might + * also lock obj. + */ +typedef uint32 +(* JS_DLL_CALLBACK JSReserveSlotsOp)(JSContext *cx, JSObject *obj); + /* JSObjectOps function pointer typedefs. */ /* @@ -372,11 +400,7 @@ */ typedef JSBool (* JS_DLL_CALLBACK JSLookupPropOp)(JSContext *cx, JSObject *obj, jsid id, - JSObject **objp, JSProperty **propp -#if defined JS_THREADSAFE && defined DEBUG - , const char *file, uintN line -#endif - ); + JSObject **objp, JSProperty **propp); /* * Define obj[id], a direct property of obj named id, having the given initial @@ -472,10 +496,31 @@ (* JS_DLL_CALLBACK JSGetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot); -typedef void +typedef JSBool (* JS_DLL_CALLBACK JSSetRequiredSlotOp)(JSContext *cx, JSObject *obj, uint32 slot, jsval v); +typedef JSObject * +(* JS_DLL_CALLBACK JSGetMethodOp)(JSContext *cx, JSObject *obj, jsid id, + jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSSetMethodOp)(JSContext *cx, JSObject *obj, jsid id, + jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSEnumerateValuesOp)(JSContext *cx, JSObject *obj, + JSIterateOp enum_op, + jsval *statep, jsid *idp, jsval *vp); + +typedef JSBool +(* JS_DLL_CALLBACK JSEqualityOp)(JSContext *cx, JSObject *obj, jsval v, + JSBool *bp); + +typedef JSBool +(* JS_DLL_CALLBACK JSConcatenateOp)(JSContext *cx, JSObject *obj, jsval v, + jsval *vp); + /* Typedef for native functions called by the JS VM. */ typedef JSBool @@ -502,13 +547,19 @@ JSErrorReport *report); typedef struct JSErrorFormatString { + /* The error format string (UTF-8 if JS_C_STRINGS_ARE_UTF8 is defined). */ const char *format; - uintN argCount; + + /* The number of arguments to expand in the formatted error message. */ + uint16 argCount; + + /* One of the JSExnType constants above. */ + int16 exnType; } JSErrorFormatString; typedef const JSErrorFormatString * (* JS_DLL_CALLBACK JSErrorCallback)(void *userRef, const char *locale, - const uintN errorNumber); + const uintN errorNumber); #ifdef va_start #define JS_ARGUMENT_FORMATTER_DEFINED 1 @@ -532,6 +583,9 @@ JSString *src1, JSString *src2, jsval *rval); +typedef JSBool +(* JS_DLL_CALLBACK JSLocaleToUnicode)(JSContext *cx, char *src, jsval *rval); + /* * Security protocol types. */ Modified: trunk/pmplib/lib/playlist/contrib/js/jstypes.h =================================================================== --- trunk/pmplib/lib/playlist/contrib/js/jstypes.h 2007-02-10 05:41:20 UTC (rev 324) +++ trunk/pmplib/lib/playlist/contrib/js/jstypes.h 2007-02-10 15:23:26 UTC (rev 325) @@ -107,22 +107,19 @@ #define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK #endif /* _WINDLL */ -#elif defined(XP_MAC) -#define JS_EXTERN_API(__type) extern __declspec(export) __type -#define JS_EXPORT_API(__type) __declspec(export) __type -#define JS_EXTERN_DATA(__type) extern __declspec(export) __type -#define JS_EXPORT_DATA(__type) __declspec(export) __type +#else /* Unix */ -#define JS_DLL_CALLBACK -#define JS_STATIC_DLL_CALLBACK(__x) static __x +#ifdef HAVE_VISIBILITY_PRAGMA +#define JS_EXTERNAL_VIS __attribute__((visibility ("default"))) +#else +#define JS_EXTERNAL_VIS +#endif -#else /* Unix */ +#define JS_EXTERN_API(__type) extern JS_EXTERNAL_VIS __type +#define JS_EXPORT_API(__type) JS_EXTERNAL_VIS __type +#define JS_EXTERN_DATA(__type) extern JS_EXTERNAL_VIS __type +#define JS_EXPORT_DATA(__type) JS_EXTERNAL_VIS __type -#define JS_EXTERN_API(__type) extern __type -#define JS_EXPORT_API(__type) __type -#define JS_EXTERN_DATA(__type) extern __type -#define JS_EXPORT_DATA(__type) __type - #define JS_DLL_CALLBACK #define JS_STATIC_DLL_CALLBACK(__x) static __x @@ -141,7 +138,7 @@ #if defined(_WIN32) && !defined(__MWERKS__) # define JS_IMPORT_DATA(__x) __declspec(dllimport) __x #else -# define JS_IMPORT_DATA(__x) __x +# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x) #endif /* @@ -203,6 +200,19 @@ #define JS_BITMASK(n) (JS_BIT(n) - 1) /*********************************************************************** +** MACROS: JS_PTR_TO_INT32 +** JS_PTR_TO_UINT32 +** JS_INT32_TO_PTR +** JS_UINT32_TO_PTR +** DESCRIPTION: +** Integer to pointer and pointer to integer conversion macros. +***********************************************************************/ +#define JS_PTR_TO_INT32(x) ((jsint)((char *)(x) - (char *)0)) +#define JS_PTR_TO_UINT32(x) ((jsuint)((char *)(x) - (char *)0)) +#define JS_INT32_TO_PTR(x) ((void *)((char *)0 + (jsint)(x))) +#define JS_UINT32_TO_PTR(x) ((void *)((char *)0 + (jsuint)(x))) + +/*********************************************************************** ** MACROS: JS_HOWMANY ** JS_ROUNDUP ** JS_MIN @@ -215,13 +225,13 @@ #define JS_MIN(x,y) ((x)<(y)?(x):(y)) #define JS_MAX(x,y) ((x)>(y)?(x):(y)) -#if (defined(XP_MAC) || defined(XP_WIN)) && !defined(CROSS_COMPILE) +#if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE) # include "jscpucfg.h" /* Use standard Mac or Windows configuration */ #elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE) # include "jsautocfg.h" /* Use auto-detected configuration */ # include "jsosdep.h" /* ...and platform-specific flags */ #else -# error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN or XP_UNIX" +# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" #endif JS_BEGIN_EXTERN_C @@ -231,7 +241,7 @@ ** JSInt8 ** DESCRIPTION: ** The int8 types are known to be 8 bits each. There is no type that -** is equivalent to a plain "char". +** is equivalent to a plain "char". ************************************************************************/ #if JS_BYTES_PER_BYTE == 1 typedef unsigned char JSUint8; @@ -244,7 +254,7 @@ ** TYPES: JSUint16 ** JSInt16 ** DESCRIPTION: -** The int16 t... [truncated message content] |
From: <ny...@us...> - 2007-02-10 05:41:19
|
Revision: 324 http://svn.sourceforge.net/pmplib/?rev=324&view=rev Author: nyaochi Date: 2007-02-09 21:41:20 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Configurable paths for CUI version. New options -P (--playlist-source) and -s (--set) were added. We don't have to transfer source playlists to a player; EasyPMP can directly convert playlist file located on the PC. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 05:41:20 UTC (rev 324) @@ -97,6 +97,10 @@ char *mbs_strip_words; ucs2char_t** strip_words; int num_strip_words; + + char *path_to_pmp_music; + char *path_to_pmp_playlist; + char *path_to_playlist_source; } option_t; typedef struct { Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 05:41:20 UTC (rev 324) @@ -188,7 +188,11 @@ ed.instance = instance; // Decode the playlist path prefix for system path separators - filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + if (opt->path_to_playlist_source) { + mbstoucs2(path, MAX_PATH, opt->path_to_playlist_source, strlen(opt->path_to_playlist_source)+1); + } else { + filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + } filepath_addslash(path); filepath_decode(path); ret = find_file( Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 05:41:20 UTC (rev 324) @@ -311,6 +311,14 @@ goto exit_main; } + // Modify the default setting. + if (opt.path_to_pmp_music) { + mbstoucs2(pmp->info.path_to_music, MAX_PATH, opt.path_to_pmp_music, strlen(opt.path_to_pmp_music)+1); + } + if (opt.path_to_pmp_playlist) { + mbstoucs2(pmp->info.path_to_playlist, MAX_PATH, opt.path_to_pmp_playlist, strlen(opt.path_to_pmp_playlist)+1); + } + // Generate open flag. if (opt.verb & MODE_DATABASE) { openflag |= PMPOF_MUSIC_DB_WRITE; Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 05:41:20 UTC (rev 324) @@ -74,6 +74,7 @@ fprintf(fp, "\n"); fprintf(fp, "Playlist options:\n"); fprintf(fp, " -p, --playlist Convert playlist files\n"); + fprintf(fp, " -P, --playlist-source=VALUE Change the path to the source playlists\n"); fprintf(fp, " -r, --reconvert Discard the existing playlist files and reconvert\n"); fprintf(fp, " -f, --find-missing Correct playlists with corrupt references to media files\n"); fprintf(fp, " -i, --ignore-missing Continue a conversion even if a media file is missing\n"); @@ -105,9 +106,8 @@ fprintf(fp, " Note that a pathname ending with \"%c%c\" implies inclusion of its subdirs\n", PATHCHAR, PATHCHAR); fprintf(fp, "\n"); fprintf(fp, "Pathname variables:\n"); - fprintf(fp, " music Relative path to music directory\n"); - fprintf(fp, " playlistsrc Absolute path to the sources for playlist conversion\n"); - fprintf(fp, " playlistdst Relative path to the destinations for playlist conversion\n"); + fprintf(fp, " pmp_music Relative path to music directory\n"); + fprintf(fp, " pmp_playlist Relative path to playlist directory\n"); } void option_init(option_t* opt) @@ -153,6 +153,7 @@ {"repr-level", required_argument, 0, 'L'}, {"strip-words", required_argument, 0, 't'}, {"playlist", no_argument, 0, 'p'}, + {"playlist-source", no_argument, 0, 'P'}, {"reconvert", no_argument, 0, 'r'}, {"find-missing", no_argument, 0, 'f'}, {"ignore-missing", no_argument, 0, 'i'}, @@ -169,9 +170,9 @@ {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "cuz:RL:t:prfild:xs:e:w:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfild:xs:e:w:vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "cuz:RL:t:prfild:xs:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfild:xs:vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -215,6 +216,10 @@ case 'p': opt->verb |= MODE_PLAYLIST; break; + case 'P': + free(opt->path_to_playlist_source); + opt->path_to_playlist_source = strdup(optarg); + break; case 'r': opt->verb |= MODE_PLAYLIST_RECONVERT; break; @@ -232,6 +237,17 @@ strcpy(opt->model, optarg); break; case 's': + if (strncmp("pmp_music:", optarg, 10) == 0) { + free(opt->path_to_pmp_music); + opt->path_to_pmp_music = strdup(optarg+10); + } else if (strncmp("pmp_playlist:", optarg, 13) == 0) { + free(opt->path_to_pmp_playlist); + opt->path_to_pmp_playlist = strdup(optarg+13); + } else { + fprintf(fpe, "Unrecognized variable: %s\n", optarg); + return -1; + break; + } break; #ifndef _WIN32 case 'e': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-10 04:58:08
|
Revision: 323 http://svn.sourceforge.net/pmplib/?rev=323&view=rev Author: nyaochi Date: 2007-02-09 20:58:08 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Notify empty artist or album names as a player might move such entries to "unknown" section. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-10 04:38:49 UTC (rev 322) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-10 04:58:08 UTC (rev 323) @@ -209,7 +209,7 @@ ++num_obtained; } else { // Report the error. - if (progress(instance, EASYPMPP_MUSIC_GMI | EASYPMPSP_WARN_GMI, i, 0, filename) != 0) { + if (progress(instance, EASYPMPP_MUSIC_GMI | EASYPMPSP_WARN_FAILURE, i, 0, filename) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } @@ -217,6 +217,14 @@ record->ts_update = timestamp; record->ts_import = ts_import; } + + // Warn empty artist or album name. + if (!record->artist || !*record->artist || !record->album || !*record->album) { + if (progress(instance, EASYPMPP_MUSIC_GMI | EASYPMPSP_WARN_EMPTY, i, 0, filename) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + } } if (progress(instance, EASYPMPP_MUSIC_GMI | EASYPMPSP_END, num_obtained, 0, NULL) != 0) { result = EASYPMPE_CANCEL; Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 04:38:49 UTC (rev 322) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 04:58:08 UTC (rev 323) @@ -47,15 +47,16 @@ EASYPMPSP_START = 0x00000001, EASYPMPSP_PROGRESS = 0x00000002, EASYPMPSP_SKIPPED = 0x00000003, - EASYPMPSP_WARN_GMI = 0x00000004, - EASYPMPSP_WARN_PLAYLIST = 0x00000005, - EASYPMPSP_SKIP_PLAYLIST = 0x00000006, - EASYPMPSP_MISSING_MEDIA = 0x00000007, - EASYPMPSP_JSPL_ERROR = 0x00000008, - EASYPMPSP_JSPL_ERROR_POS = 0x00000009, - EASYPMPSP_JSPL_ERROR_LINE = 0x0000000A, - EASYPMPSP_JSPL_OUTPUT = 0x0000000B, - EASYPMPSP_END = 0x0000000C, + EASYPMPSP_WARN_FAILURE = 0x00000004, + EASYPMPSP_WARN_EMPTY = 0x00000005, + EASYPMPSP_WARN_PLAYLIST = 0x00000006, + EASYPMPSP_SKIP_PLAYLIST = 0x00000007, + EASYPMPSP_MISSING_MEDIA = 0x00000008, + EASYPMPSP_JSPL_ERROR = 0x00000009, + EASYPMPSP_JSPL_ERROR_POS = 0x0000000A, + EASYPMPSP_JSPL_ERROR_LINE = 0x0000000B, + EASYPMPSP_JSPL_OUTPUT = 0x0000000C, + EASYPMPSP_END = 0x0000000D, }; enum { Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 04:38:49 UTC (rev 322) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 04:58:08 UTC (rev 323) @@ -114,11 +114,16 @@ case EASYPMPP_MUSIC_GMI|EASYPMPSP_PROGRESS: easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; - case EASYPMPP_MUSIC_GMI|EASYPMPSP_WARN_GMI: + case EASYPMPP_MUSIC_GMI|EASYPMPSP_WARN_FAILURE: console_clearln(fpo); fprintf(fpe, " WARNING: Could not obtain the media information\n"); fprints(fpe, " %s\n", param_str); break; + case EASYPMPP_MUSIC_GMI|EASYPMPSP_WARN_EMPTY: + console_clearln(fpo); + fprintf(fpe, " WARNING: Empty artist or album name found\n"); + fprints(fpe, " %s\n", param_str); + break; case EASYPMPP_MUSIC_GMI|EASYPMPSP_END: console_clearln(fpo); fprintf(fpo, " %d files were imported\n", param_int); Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 04:38:49 UTC (rev 322) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-10 04:58:08 UTC (rev 323) @@ -568,6 +568,14 @@ dlg->m_ctrlProgress.SetPos(param_int); dlg->write_log(LL_TRACE, _T("%s"), UCS2CT(param_str)); break; + case EASYPMPP_MUSIC_GMI|EASYPMPSP_WARN_FAILURE: + dlg->m_bFailed = TRUE; + dlg->write_log(LL_WARNING, _T("WARNING: Could not obtain the media information: %s"), UCS2CT(param_str)); + break; + case EASYPMPP_MUSIC_GMI|EASYPMPSP_WARN_EMPTY: + dlg->m_bFailed = TRUE; + dlg->write_log(LL_WARNING, _T("WARNING: Empty artist or album name found: %s"), UCS2CT(param_str)); + break; case EASYPMPP_MUSIC_GMI|EASYPMPSP_END: dlg->m_ctrlProgress.ShowWindow(SW_HIDE); //dlg->m_ctrlProgress.DestroyWindow(); Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-10 04:38:49 UTC (rev 322) +++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-10 04:58:08 UTC (rev 323) @@ -228,7 +228,7 @@ } *p++ = 0; //strcpy(model->name, line); - strcpy(model->name, "iRiver H10"); + strcpy(model->name, "H10"); // Parse and check version number. q = strchr(p, '-'); Modified: trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-10 04:38:49 UTC (rev 322) +++ trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-10 04:58:08 UTC (rev 323) @@ -203,7 +203,7 @@ } // Obtain the model name. - strcpy(model->name, "MSI MEGA PLAYER 540"); + strcpy(model->name, "MEGA PLAYER 540"); memset(model->version, 0, sizeof(model->version)); strncpy(model->version, buff+0x1F, 8); strcpy(model->language, ""); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-10 04:38:49
|
Revision: 322 http://svn.sourceforge.net/pmplib/?rev=322&view=rev Author: nyaochi Date: 2007-02-09 20:38:49 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Enable Ogg Vorbis support for Samsung YH-920. Modified Paths: -------------- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-10 04:29:14 UTC (rev 321) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-10 04:38:49 UTC (rev 322) @@ -192,8 +192,8 @@ 20, "UM", "5.15", "5.15", "SYSTEM\\FW_YH920.mi4", "System\\DATA\\PP5000.HDR", - ".mp3\0.wma\0", - {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, + ".mp3\0.wma\0.ogg\0", + {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_VORBIS, 0, 0, 0}, "System", "System\\MUSIC", "System\\PLAYLIST", ".plp", hdr_init_samsung_yh920, samsung_parse_model This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-10 04:29:17
|
Revision: 321 http://svn.sourceforge.net/pmplib/?rev=321&view=rev Author: nyaochi Date: 2007-02-09 20:29:14 -0800 (Fri, 09 Feb 2007) Log Message: ----------- The completion of initial draft of PMPlib API documentation. Modified Paths: -------------- trunk/pmplib/include/pmplib/filepath.h trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/include/pmplib/ucs2char.h Modified: trunk/pmplib/include/pmplib/filepath.h =================================================================== --- trunk/pmplib/include/pmplib/filepath.h 2007-02-09 16:13:11 UTC (rev 320) +++ trunk/pmplib/include/pmplib/filepath.h 2007-02-10 04:29:14 UTC (rev 321) @@ -42,14 +42,18 @@ * \addtogroup filepath File/Path Manupulation API * @{ * - * The PMPlib File/Path Manupulation API is a utility for file-systems and - * pathnames. + * The PMPlib File/Path Manupulation API is a utility for operations on file + * systems and string manupulation for file/path names. This API encapsulates + * the difference between Win32 and POSIX APIs, UCS-2 string and multi-byte + * characters, and path characters ('\\' or '/'). */ /** - * \addtogroup filepath_string file/path string API + * \addtogroup filepath_string String manupulation for file and path names * @{ * + * String manupulation routines manage strings so that they are grammartical + * for path and file names. */ /** @@ -215,9 +219,12 @@ /** @} */ /** - * \addtogroup filepath_filedir file/directory manupulation API + * \addtogroup filepath_filedir File and directory manupulation * @{ * + * File and directory manupulation routines provide a unified API to + * manupulate a file system, encapsulating the difference between Win32 and + * POSIX APIs. */ /** Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-09 16:13:11 UTC (rev 320) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-10 04:29:14 UTC (rev 321) @@ -48,14 +48,22 @@ /** * \addtogroup pmp PMPlib APIs * @{ + * + * The PMPlib APIs define the programing interface for both applications + * and driver modules. */ /* * Forward structure declarations. */ -struct tag_pmp_t; typedef struct tag_pmp_t pmp_t; -struct tag_pmp_music_t; typedef struct tag_pmp_music_t pmp_music_t; +struct tag_pmp_t; +/** Synonym of struct tag_pmp_t. */ +typedef struct tag_pmp_t pmp_t; +struct tag_pmp_music_t; +/** Synonym of struct tag_pmp_music_t. */ +typedef struct tag_pmp_music_t pmp_music_t; + /** * Status codes. */ @@ -146,8 +154,10 @@ /** - * @defgroup device PMPlib Device API + * @defgroup device PMPlib device API * @{ + * + * PMPlib Device API is the root interface to a driver. */ /** Maximum size, in chars, of a device description. */ @@ -296,8 +306,11 @@ */ /** - * @defgroup music PMPlib Music API + * @defgroup music PMPlib music API * @{ + * + * PMPlib Music API provides the interface to manage music files in a portable + * media device. */ /** @@ -418,6 +431,10 @@ */ uint32_t ts_import; }; + +/** + * Synonym of struct tag_pmp_music_record_t. + */ typedef struct tag_pmp_music_record_t pmp_music_record_t; /** @@ -622,7 +639,7 @@ * This function frees the memory blocks used by each record in the array and * the array. * - * @param record The pointer to pmp_music_record_t array. + * @param records The pointer to pmp_music_record_t array. * @param num_records The number of elements in the array. */ PMPAPI void pmplib_records_finish(pmp_music_record_t* records, int num_records); @@ -683,7 +700,7 @@ * * @param dst The destination array. * @param src The source array. - * @param num_records The number of elements in the source array. + * @param num_playlists The number of elements in the source array. */ PMPAPI void pmplib_playlists_clone(pmp_playlist_t* dst, const pmp_playlist_t* src, int num_playlists); @@ -692,8 +709,10 @@ */ /** - * \addtogroup pmp_export Export functions of a driver module + * \addtogroup pmp_export PMPlib export functions for a driver module * @{ + * + * This API defines the interface that a driver module must implement. */ /** @@ -755,8 +774,10 @@ */ /** - * \addtogroup pmp_driver Driver utility API + * \addtogroup pmp_driver PMPlib miscellaneous routines * @{ + * + * PMPlib miscellaneous routines provide the utility for a driver module. */ /** @@ -794,7 +815,7 @@ /** - * @defgroup pmplib PMPlib Helper API + * @defgroup pmplib PMPlib helper API * @{ * * The PMPlib Helper API provides the utility for choosing a suitable PMPlib @@ -922,14 +943,14 @@ * to the driver will be returned in the \a pmp argument. * * @param pmplib The pointer to the ::pmplib_t instance. + * @param ptr_pmp The pointer to the buffer to receive the pointer + * to the driver interface (::pmp_t instance). * @param path_to_device A UCS-2 string representing the location of the * target device. This parameter cannot be \c NULL. * @param id A C-string representing the device identifier of * the target device. If this argument is \c NULL, * this function tries to recognize the model of the * device based on the location (\a path_to_device). - * @retval ptr_pmp The pointer to the buffer to receive the pointer - * to the driver interface (::pmp_t instance). * @retval result_t The status code. * * @assert Modified: trunk/pmplib/include/pmplib/ucs2char.h =================================================================== --- trunk/pmplib/include/pmplib/ucs2char.h 2007-02-09 16:13:11 UTC (rev 320) +++ trunk/pmplib/include/pmplib/ucs2char.h 2007-02-10 04:29:14 UTC (rev 321) @@ -40,14 +40,23 @@ * \addtogroup ucs2 UCS-2 Character/String API * @{ * - * The PMPlib UCS-2 character/string API provides a manupulation utility - * for characters/strings in UCS-2 encoding. As a number of portable media - * players support Unicode for displaying song information, PMPlib deals - * with Unicode characters/strings encoded in UCS-2. + * The PMPlib UCS-2 Character/String API provides a manupulation utility + * for characters and strings encoded in UCS-2. The PMPlib supports unicode + * characters and strings in UCS-2 encoding since a number of media players + * employ the encoding for displaying song information. An application is + * required to deal with UCS-2 characters/strings for using the PMPlib API. + * The PMPlib UCS-2 Character/String API implements character encoding + * converter, UCS-2 character routine, ANSI C compatible string manupulator, + * miscellaneous string manupulator, stdio/stdlib compatible routine, and + * memory manager. * - * The byte order of UCS-2 character is dependent on the CPU architecture - * on which this code runs: e.g., little-endian on Intel IA-32/IA-64 and + * A UCS-2 character is represented by a unsigned 16-bit value + * (::ucs2char_t). + * The byte order of a UCS-2 character is dependent on the CPU architecture + * on which this code runs, e.g., little-endian on Intel IA-32/IA-64 and * big-endian on IBM PowerPC. + * + * An application must call ucs2init() before using this API. */ /** @@ -56,12 +65,22 @@ typedef uint16_t ucs2char_t; /** - * Initialize the UCS-2 library. + * Initialize the UCS-2 Character/String library. * - * This function initializes internal variables used in the UCS-2 library. - * Call this function before using any other functions in this API. + * This function initializes internal variables used in the UCS-2 + * Character/String library. Call this function before using any other + * functions in this API. * - * @retval int Zero if succeeded, otherwise non-zero value. + * By default, this function detects the character encoding of multi-byte + * characters on the current system based on the value of LANG variable + * (for POSIX) or via GetACP() function (for Win32). If this function + * could not detect the character encoding of the current system, this + * function would assume it as "UTF-8". + * + * @retval int Zero if succeeded, otherwise non-zero value. Non-zero + * value indicates that the library could not initialize + * character conversion routines with the character + * encoding of the current locale. */ UCS2API int ucs2init(); @@ -70,21 +89,20 @@ * @defgroup ucs2_conv Character encoding converter * @{ * - * This API subset converts the character encoding of a string from one to - * another. It supports mutual conversions between: + * Character encoding converter is to convert a string in one character + * encoding to another. The API subset supports mutual conversions between: * UCS-2 and multi-byte character (i.e., \c char); * UCS-2 and UTF-8. - * - * By default, this library detects the character encoding of multi-byte - * characters on the current system based on the value of LANG variable - * (for POSIX) or via GetACP() function (for Win32). + * Character encoding conversion is performed by MultiByteToWideChar() and + * WideCharToMultiByte() function in Win32 API (for Windows environments) + * iconv() function in libc or libiconv (for POSIX environments). */ /** * Set the encoding for multi-byte characters (for iconv/libiconv). * - * This function change the default encoding for multi-byte characters to the - * character encoding specified by the \a encoding argument. + * This function changes the default encoding for multi-byte characters to the + * character encoding specified by the \p encoding argument. * * @param encoding The pointer to the string specifying the character * encoding. @@ -110,8 +128,8 @@ /** * Set the code page for multi-byte characters (for Win32). * - * This function change the default encoding for multi-byte characters to the - * code page specified by the \a cp argument. + * This function changes the default encoding for multi-byte characters to the + * code page specified by the \p cp argument. * * @param cp The code page. * @@ -125,8 +143,6 @@ * * This function returns the default code page for multi-byte characters. * - * @param cp The code page. - * * @note * This function is effective only on Win32 environments. */ @@ -135,17 +151,17 @@ /** * Convert a UCS-2 string to multi-byte characters. * - * @param mbstr The pointer to the buffer for receiving multi-byte + * @param mbstr The pointer to the buffer that receives multi-byte * characters converted from the UCS-2 string. If - * \a mbs_size is zero, this argument is not be used. + * \p mbs_size is zero, this argument is not be used. * @param mbs_size The size, in bytes, of the buffer pointed to by the - * \a mbstr argument. If this value is zero, the function + * \p mbstr argument. If this value is zero, the function * returns the number of bytes required for the buffer. * @param ucs2str The pointer to the UCS-2 string to be converted. * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 - * string, \a ucs2str. - * @retval size_t The number of bytes written to \a mbstr buffer if - * the conversion is successful. If \a mbs_size is zero, + * string, \p ucs2str. + * @retval size_t The number of bytes written to \p mbstr buffer if + * the conversion is successful. If \p mbs_size is zero, * the return value is the required size, in bytes, for a * buffer to receive the converted string. This function * returns zero if an error occurred. @@ -155,19 +171,19 @@ /** * Convert multi-byte characters to a UCS-2 string. * - * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * @param ucs2str The pointer to the buffer that receives UCS-2 string * converted from the multi-byte characters. If - * \a ucs_size is zero, this argument is not be used. + * \p ucs_size is zero, this argument is not be used. * @param ucs_size The size, in number of UCS-2 characters, of the buffer - * pointed to by the \a ucs2str argument. If this value is + * pointed to by the \p ucs2str argument. If this value is * zero, the function returns the number of UCS-2 * characters required for the buffer. * @param mbstr The pointer to the multi-byte characters to be * converted. * @param mbs_size The size, in bytes, of the multi-byte characters, - * \a mbstr. - * @retval size_t The number of UCS-2 characters written to \a ucs2str - * buffer if the conversion is successful. If \a ucs_size + * \p mbstr. + * @retval size_t The number of UCS-2 characters written to \p ucs2str + * buffer if the conversion is successful. If \p ucs_size * is zero, the return value is the required size, in * number of UCS-2 characters, for a buffer to receive the * converted string. This function returns zero if an error @@ -178,44 +194,44 @@ /** * Convert multi-byte characters in a specific encoding to a UCS-2 string. * - * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * @param ucs2str The pointer to the buffer that receives UCS-2 string * converted from the multi-byte characters. If - * \a ucs_size is zero, this argument is not be used. + * \p ucs_size is zero, this argument is not be used. * @param ucs_size The size, in number of UCS-2 characters, of the buffer - * pointed to by the \a ucs2str argument. If this value is + * pointed to by the \p ucs2str argument. If this value is * zero, the function returns the number of UCS-2 * characters required for the buffer. * @param mbstr The pointer to the multi-byte characters to be * converted. * @param mbs_size The size, in bytes, of the multi-byte characters, - * \a mbstr. + * \p mbstr. * @param charset The pointer to the string specifying the encoding of * the multi-byte characters. - * @retval size_t The number of UCS-2 characters written to \a ucs2str - * buffer if the conversion is successful. If \a ucs_size + * @retval size_t The number of UCS-2 characters written to \p ucs2str + * buffer if the conversion is successful. If \p ucs_size * is zero, the return value is the required size, in * number of UCS-2 characters, for a buffer to receive the * converted string. This function returns zero if an error * occurred. * @note - * \a charset is ignored on Win32 environments. + * \p charset is ignored on Win32 environments. */ UCS2API size_t mbstoucs2_charset(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size, const char *charset); /** - * Convert a UCS-2 string to multi-byte characters. + * Convert a UCS-2 string to a UTF-8 string. * - * @param mbstr The pointer to the buffer for receiving UTF-8 string - * converted from the UCS-2 string. If \a mbs_size is + * @param mbstr The pointer to the buffer that receives UTF-8 string + * converted from the UCS-2 string. If \p mbs_size is * zero, this argument is not be used. * @param mbs_size The size, in bytes, of the buffer pointed to by the - * \a mbstr argument. If this value is zero, the function + * \p mbstr argument. If this value is zero, the function * returns the number of bytes required for the buffer. * @param ucs2str The pointer to the UCS-2 string to be converted. * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 - * string, \a ucs2str. - * @retval size_t The number of bytes written to \a mbstr buffer if - * the conversion is successful. If \a mbs_size is zero, + * string, \p ucs2str. + * @retval size_t The number of bytes written to \p mbstr buffer if + * the conversion is successful. If \p mbs_size is zero, * the return value is the required size, in bytes, for a * buffer to receive the converted string. This function * returns zero if an error occurred. @@ -225,17 +241,17 @@ /** * Convert a UTF-8 string to a UCS-2 string. * - * @param ucs2str The pointer to the buffer for receiving UCS-2 string - * converted from the UTF-8 string. If \a ucs_size is + * @param ucs2str The pointer to the buffer that receives UCS-2 string + * converted from the UTF-8 string. If \p ucs_size is * zero, this argument is not be used. * @param ucs_size The size, in number of UCS-2 characters, of the buffer - * pointed to by the \a ucs2str argument. If this value is + * pointed to by the \p ucs2str argument. If this value is * zero, the function returns the number of UCS-2 * characters required for the buffer. * @param mbstr The pointer to the UTF-8 string to be converted. - * @param mbs_size The size, in bytes, of the UTF-8 string, \a mbstr. - * @retval size_t The number of UCS-2 characters written to \a ucs2str - * buffer if the conversion is successful. If \a ucs_size + * @param mbs_size The size, in bytes, of the UTF-8 string, \p mbstr. + * @retval size_t The number of UCS-2 characters written to \p ucs2str + * buffer if the conversion is successful. If \p ucs_size * is zero, the return value is the required size, in * number of UCS-2 characters, for a buffer to receive the * converted string. This function returns zero if an error @@ -285,7 +301,7 @@ /** * Convert and duplicate a UTF-8 string to a UCS-2 string. * - * @param mbstr The pointer to multi-byte characters. + * @param utf8str The pointer to a UTF-8 string. * @retval char* The pointer to the duplicated string. Call ucs2free() * to free the memory block allocated by this function. */ @@ -298,8 +314,11 @@ /** - * @defgroup ucs2_memory Memory manager routines + * @defgroup ucs2_memory Memory manager * @{ + * + * Memory manager provides functions to allocate/expand/free memory blocks. + * Use these functions to manage memory blocks allocated by the PMPlib API. */ /** @@ -330,7 +349,7 @@ /** * Free a memory block. * - * @param ptr The pointer to the memory block to be freed. + * @param ptr The pointer to the memory block to be free. */ UCS2API void ucs2free(void* ptr); @@ -341,6 +360,9 @@ /** * @defgroup ucs2_char UCS-2 character routines * @{ + * + * UCS-2 character routines provide the utility to classify characters and + * convert from upper and lower cases. */ /** @@ -390,9 +412,9 @@ * @defgroup ucs2_string_ansi ANSI C compatible string routines * @{ * - * This is the subset of the UCS-2 Character/String API that corresponds - * to string manupulation routines in the ANSI C standard. The following - * ANSI C functions are not defined in this subset: + * ANSI C compatible string routines correspond to string manupulation + * routines in the ANSI C standard. The following ANSI C functions are not + * defined in this API subset: * strcoll, strerror, strtok, strxfrm. */ @@ -408,10 +430,10 @@ /** * Search for the first occurrence of a character in a string. * - * @param str The pointer to the string in which \a c is searched. + * @param str The pointer to the string in which \p c is searched. * @param c The target character. - * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL - * if \a c does not occur in \a str. + * @retval ucs2char_t* The pointer to the character \p c in \p str, or \c NULL + * if \p c does not occur in \p str. */ UCS2API ucs2char_t* ucs2chr(const ucs2char_t* str, ucs2char_t c); @@ -420,9 +442,9 @@ * * @param x The pointer to a string. * @param y The pointer to another string. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. + * @retval int A positive value if \p x is greater than \p y; + * a negative value if \p x is smaller than \p y; + * zero if \p x is identical to \p y. */ UCS2API int ucs2cmp(const ucs2char_t* x, const ucs2char_t* y); @@ -440,9 +462,9 @@ * * @param str The pointer to a string. * @param charset The pointer to a character set. - * @retval size_t The number of characters from the beginning of \a str - * in which any character in \a charset appear for the - * first time, or the length of \a str if such a character + * @retval size_t The number of characters from the beginning of \p str + * in which any character in \p charset appear for the + * first time, or the length of \p str if such a character * does not exist. */ UCS2API size_t ucs2cspn(const ucs2char_t *str, const ucs2char_t *charset); @@ -451,7 +473,7 @@ * Count the length of a string. * * @param str The pointer to a string. - * @retval size_t The number of characters in \a str. + * @retval size_t The number of characters in \p str. */ UCS2API size_t ucs2len(const ucs2char_t* str); @@ -471,9 +493,9 @@ * @param x The pointer to a string. * @param y The pointer to another string. * @param n The number of characters to be compared. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. + * @retval int A positive value if \p x is greater than \p y; + * a negative value if \p x is smaller than \p y; + * zero if \p x is identical to \p y. */ UCS2API int ucs2ncmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); @@ -490,10 +512,10 @@ /** * Find a character in a string that belongs to a character set. * - * @param str The pointer to the string where \a charset is searched. + * @param str The pointer to the string where \p charset is searched. * @param charset The pointer to a character set. - * @retval ucs2char_t* The pointer to the character in \a str that belongs - * to \a charset, or \c NULL if such a character does not + * @retval ucs2char_t* The pointer to the character in \p str that belongs + * to \p charset, or \c NULL if such a character does not * exist. */ UCS2API ucs2char_t* ucs2pbrk(const ucs2char_t *str, const ucs2char_t *charset); @@ -501,20 +523,20 @@ /** * Search for the last occurrence of a character in a string. * - * @param str The pointer to the string in which \a c is searched. + * @param str The pointer to the string in which \p c is searched. * @param c The target character. - * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL - * if \a c does not occur in \a str. + * @retval ucs2char_t* The pointer to the character \p c in \p str, or \c NULL + * if \p c does not occur in \p str. */ -UCS2API ucs2char_t* ucs2rchr(const ucs2char_t* string, ucs2char_t c); +UCS2API ucs2char_t* ucs2rchr(const ucs2char_t* str, ucs2char_t c); /** * Find a character in a string that does not belong to a character set. * - * @param str The pointer to the string where \a charset is searched. + * @param str The pointer to the string where \p charset is searched. * @param charset The pointer to a character set. - * @retval ucs2char_t* The pointer to the character in \a str that does not - * belong to \a charset, or \c NULL if such a character + * @retval ucs2char_t* The pointer to the character in \p str that does not + * belong to \p charset, or \c NULL if such a character * does not exist. */ UCS2API size_t ucs2spn(const ucs2char_t *str, const ucs2char_t *charset); @@ -522,11 +544,11 @@ /** * Find a substring in a string. * - * @param str The pointer to the string where \a substr is searched. + * @param str The pointer to the string where \p substr is searched. * @param substr The pointer to the substring. - * @retval ucs2char_t* The pointer to the character where \a substr begins - * in \a str for the first time, or \c NULL if \a str - * does not contain \a substr. + * @retval ucs2char_t* The pointer to the character where \p substr begins + * in \p str for the first time, or \c NULL if \p str + * does not contain \p substr. */ UCS2API ucs2char_t* ucs2str(const ucs2char_t* str, const ucs2char_t* substr); @@ -541,6 +563,8 @@ /** * @defgroup ucs2_string_non_ansi Miscellaneous string routines * @{ + * + * Non ANSI C compatible string routines. */ /** @@ -560,31 +584,31 @@ * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() * to free the memory block allocated by this function. */ -UCS2API ucs2char_t* ucs2ndup(const ucs2char_t* src, size_t length); +UCS2API ucs2char_t* ucs2ndup(const ucs2char_t* str, size_t length); /** * Convert a string to lowercase. * - * Given \a str argument, this function converts uppercase letters in the + * Given \p str argument, this function converts uppercase letters in the * string to lowercase and overwrites the resultant string on the same buffer - * pointed by the \a str argument. + * pointed by the \p str argument. * * @param str The pointer to a string. * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. + * \p str. */ UCS2API ucs2char_t* ucs2lwr(ucs2char_t* str); /** * Convert a string to uppercase. * - * Given \a str argument, this function converts lowercase letters in the + * Given \p str argument, this function converts lowercase letters in the * string to uppercase and overwrites the resultant string on the same buffer - * pointed by the \a str argument. + * pointed by the \p str argument. * * @param str The pointer to a string. * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. + * \p str. */ UCS2API ucs2char_t* ucs2upr(ucs2char_t* str); @@ -593,9 +617,9 @@ * * @param x The pointer to a string. * @param y The pointer to another string. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. + * @retval int A positive value if \p x is greater than \p y; + * a negative value if \p x is smaller than \p y; + * zero if \p x is identical to \p y. */ UCS2API int ucs2icmp(const ucs2char_t* x, const ucs2char_t* y); @@ -605,22 +629,22 @@ * @param x The pointer to a string. * @param y The pointer to another string. * @param n The number of characters to be compared. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. + * @retval int A positive value if \p x is greater than \p y; + * a negative value if \p x is smaller than \p y; + * zero if \p x is identical to \p y. */ UCS2API int ucs2incmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); /** * Strip whitespace characters at the head and tail of a string. * - * Given \a str argument, this function trims whilespace characters at the + * Given \p str argument, this function trims whilespace characters at the * head and tail of the string and overwrites the resultant string on the - * same buffer pointed by the \a str argument. + * same buffer pointed by the \p str argument. * * @param str The pointer to a string. * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. + * \p str. */ UCS2API ucs2char_t* ucs2strip(ucs2char_t* str); @@ -631,8 +655,11 @@ /** - * @defgroup ucs2_std Wrapper for stdio/stdlib routines + * @defgroup ucs2_std ANSI C compatible stdio/stdlib routines * @{ + * + * ANSI C compatible stdio/stdlib routines provide utilities for streams and + * string-integer conversions. */ /** @@ -646,9 +673,9 @@ * Convert an integer value to UCS-2 string. * @param value The integer value. * @param string The pointer to the buffer to receive the string. - * @param radix Radix of the \a value. + * @param radix Radix of the \p value. * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. + * \p str. */ UCS2API ucs2char_t* itoucs2(int value, ucs2char_t *string, int radix); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 17:19:10
|
Revision: 320 http://svn.sourceforge.net/pmplib/?rev=320&view=rev Author: nyaochi Date: 2007-02-09 08:13:11 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Documentation of pmp.h Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/include/pmplib/pmp.h trunk/pmplib/lib/filepath/filepath.vcproj trunk/pmplib/lib/pmp/pmp.vcproj trunk/pmplib/lib/pmp/pmp_win32.c trunk/pmplib/lib/pmp_iriverplus2/idx.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.c trunk/pmplib/lib/ucs2/ucs2.vcproj Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-09 16:13:11 UTC (rev 320) @@ -40,13 +40,6 @@ * @{ */ -static void device_show_pathflag(int flag, FILE* fp) -{ - if (flag & PMPPEF_RECURSIVE) { - fprintf(fp, " sub_directory=yes"); - } -} - // Display a path name using the given string format. void device_show_path(FILE *fp, const char* const format, const ucs2char_t* const path) { Modified: trunk/pmplib/include/pmplib/pmp.h =================================================================== --- trunk/pmplib/include/pmplib/pmp.h 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-09 16:13:11 UTC (rev 320) @@ -24,6 +24,8 @@ #ifndef __PMP_H__ #define __PMP_H__ +#include <pmplib/os_types.h> + #ifdef PMP_EXPORTS #define PMPAPI __declspec(dllexport) #else @@ -55,24 +57,31 @@ struct tag_pmp_music_t; typedef struct tag_pmp_music_t pmp_music_t; /** - * Error codes. + * Status codes. */ enum { + /** Success. */ PMP_SUCCESS = 0, - PMP_DEVICENOTFOUND, - PMP_NOTSUPPORTED, - PMP_INSUFFICIENTMEMORY, - PMP_NOTIMPLIMENTED, - PMPDBE_OUTOFMEMORY, - PMPDBE_NOTFOUND, - PMPDBE_INVALIDTYPE, - PMPDBE_DBINCONSIST, - PMPDBE_NOTINITIALIZED, - PMPDBE_INVALIDLEAFID, - PMPDBE_OPENFORREAD, - PMPDBE_OPENFORWRITE, - PMPDBE_INSUFFICIENT, - PMPPLE_WRITE, + /** Undetermined error. */ + PMPERR_ERROR = 0x80000000, + /** Device is not found or unsupported. */ + PMPERR_DEVICENOTFOUND, + /** Insufficient memory. */ + PMPERR_INSUFFICIENTMEMORY, + /** Operation is not implemented. */ + PMPERR_NOTIMPLIMENTED, + /** The entry is not found. */ + PMPERR_ENTRYNOTFOUND, + /** Inconsistent operation/data. */ + PMPERR_INCONSISTENCY, + /** Error while opening a file for reading. */ + PMPERR_OPENFORREAD, + /** Error while opening a file for writing. */ + PMPERR_OPENFORWRITE, + /** Error while reading a file. */ + PMPERR_READ, + /** Error while writing a file. */ + PMPERR_WRITE, }; /** @@ -108,33 +117,34 @@ #define PMPFOURCC(a, b, c, d) \ ((uint32_t)(a) << 24 | (uint32_t)(b) << 16 | (uint32_t)(c) << 8 | (uint32_t)(d)) -#define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') /**< Unknown codec. */ -#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') /**< MPEG Audio Layer III */ -#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') /**< Windows Media Audio */ -#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') /**< Ogg Vorbis */ -#define PMPCODEC_WAV PMPFOURCC('W','A','V','E') /**< Microsoft Riff WAVE */ +/** Unknown codec. */ +#define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') +/** MPEG Audio Layer III. */ +#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') +/** Windows Media Audio. */ +#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') +/** Ogg Vorbis. */ +#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') +/** Microsoft Riff WAVE. */ +#define PMPCODEC_WAV PMPFOURCC('W','A','V','E') +/** + * Flags for device functionality. + */ enum { - PMPPEF_NONE = 0x0000, - PMPPEF_SUPPORT = 0x0001, - PMPPEF_CONSTANT = 0x0002, - PMPPEF_RECURSIVE = 0x0004, -}; - -enum { - PMPMF_NONE = 0x0000, + /** None. */ + PMPF_NONE = 0x0000, + /** The device supports music database. */ PMPMF_SUPPORT = 0x0001, + /** The device supports subdirs under music directory. */ PMPMF_RECURSIVE = 0x0002, + /** The device supports music playlist. */ + PMPPF_SUPPORT = 0x0010, + /** The device supports subdirs under playlist directory. */ + PMPPF_RECURSIVE = 0x0020, }; -enum { - PMPPF_NONE = 0x0000, - PMPPF_SUPPORT = 0x0001, - PMPPF_RECURSIVE = 0x0002, -}; - - /** * @defgroup device PMPlib Device API * @{ @@ -410,9 +420,23 @@ }; typedef struct tag_pmp_music_record_t pmp_music_record_t; +/** + * Structure for a playlist. + */ typedef struct { + /** + * Name of the playlist. + */ ucs2char_t *name; + + /** + * The number of entries in the playlist. + */ int num_entries; + + /** + * Pointer to an array of entries referring to media files. + */ ucs2char_t **entries; } pmp_playlist_t; @@ -615,30 +639,155 @@ */ PMPAPI result_t pmplib_records_clone(pmp_music_record_t* dst, const pmp_music_record_t* src, int num_records); +/** + * Initialize pmp_playlist_t structure. + * + * @param playlist The pointer to pmp_playlist_t instance. + */ PMPAPI void pmplib_playlist_init(pmp_playlist_t* playlist); + +/** + * Uninitialize pmp_playlist_t structure. + * + * This function frees the memory blocks used by the \a playlist. + * + * @param playlist The pointer to pmp_playlist_t instance. + */ PMPAPI void pmplib_playlist_finish(pmp_playlist_t* playlist); + +/** + * Clone a playlist. + * + * This function copies the values in the \a src playlist to \a dst. + * + * @param dst The pointer to the destination. + * @param src The pointer to the source. + */ PMPAPI void pmplib_playlist_clone(pmp_playlist_t* dst, const pmp_playlist_t* src); -PMPAPI void pmplib_playlists_finish(pmp_playlist_t* playlist, int num_playlists); +/** + * Uninitialize an array of pmp_playlist_t playlists. + * + * This function frees the memory blocks used by each playlist in the array and + * the array itself. + * + * @param playlists The pointer to pmp_playlist_t array. + * @param num_playlists The number of elements in the array. + */ +PMPAPI void pmplib_playlists_finish(pmp_playlist_t* playlists, int num_playlists); + +/** + * Clone a pmp_playlist_t array. + * + * This function copies all playlists in the \a src array to \a dst. + * + * @param dst The destination array. + * @param src The source array. + * @param num_records The number of elements in the source array. + */ PMPAPI void pmplib_playlists_clone(pmp_playlist_t* dst, const pmp_playlist_t* src, int num_playlists); /** * @} */ +/** + * \addtogroup pmp_export Export functions of a driver module + * @{ + */ -typedef result_t (*pmplib_create_t)(pmp_t** pmp, const ucs2char_t* path_to_device, const char *devid); +/** + * Prototype of a callback function receiving device IDs from pmplib_create(). + * + * @param instance The user-defined instance value. + * @param devid The device identifier. + */ +typedef void (*pmplib_enumerate_devid_callback_t)(void *instance, const char *devid); /** - * Prototype for the callback function for receiving device identifiers. + * Query a driver and construct a ::pmp_t instance. + * + * This function queries the driver suitable for the portable media device + * specified by the mount location and/or identifier. A driver module must + * return the interface to the driver (::pmp_t instance) if it supports + * the device. Parameter \a path_to_device is expected to be specified. If + * parameter \a id is not \c NULL, the driver module should return the + * interface to the driver with the device identifier specified in \a id + * parameter. If the parameter \a id is \c NULL, the driver module should + * recognize the model of the device based on the content of the files located + * under \a path_to_device. + * + * @param path_to_device A UCS-2 string representing the location of the + * target device. This parameter cannot be \c NULL. + * @param id A C-string representing the device identifier of + * the target device. If this argument is \c NULL, + * this function tries to recognize the model of the + * device based on the location (\a path_to_device). + * @retval ptr_pmp The pointer to the buffer to receive the pointer + * to the driver interface (::pmp_t instance). + * @retval result_t The status code. + * + * @assert + * @code ptr_pmp != NULL @endcode + * @code path_to_device != NULL @endcode + */ +typedef result_t (*pmplib_create_t)(pmp_t** ptr_pmp, const ucs2char_t* path_to_device, const char *id); + +/** + * Enumerate device identifiers supported by the driver module. * + * The driver module should enumerate the device identifiers supported + * by the module and invoke the \a callback function for each identifier. + * + * @param callback The pointer to the callback function to receive + * device identifiers. + * @param instance A user-defined instance value. The callback + * function will receive the same value. + * @retval result_t The status code. + * + * @assert + * @code callback != NULL @endcode */ -typedef void (*pmplib_enumerate_devid_callback_t)(void *instance, const char *devid); typedef result_t (*pmplib_enumerate_devid_t)(pmplib_enumerate_devid_callback_t callback, void *instance); +/** + * @} + */ + +/** + * \addtogroup pmp_driver Driver utility API + * @{ + */ + +/** + * Increment a variable value and check the resultant value. + * + * This function prevents more than one thread from using + * pmplib_interlocked_increment() or pmplib_interlocked_decrement() function + * to access the same variable simultaneously. + * + * @param count The pointer to the variable whose value is to be + * increased. + * @retval uint32_t The value of the variable after this increment. + */ PMPAPI uint32_t pmplib_interlocked_increment(uint32_t* count); + +/** + * Decrement a variable value and check the resultant value. + * + * This function prevents more than one thread from using + * pmplib_interlocked_increment() or pmplib_interlocked_decrement() function + * to access the same variable simultaneously. + * + * @param count The pointer to the variable whose value is to be + * decreased. + * @retval uint32_t The value of the variable after this decrement. + */ PMPAPI uint32_t pmplib_interlocked_decrement(uint32_t* count); +/** + * @} + */ @@ -671,8 +820,8 @@ * the device connected to the mount point (Win32 path "D:\"): * * @code - * #include <ucs2char.h> - * #include <pmp.h> + * #include <pmplib/ucs2char.h> + * #include <pmplib/pmp.h> * * int main(int argc, char *argv[]) * { Modified: trunk/pmplib/lib/filepath/filepath.vcproj =================================================================== --- trunk/pmplib/lib/filepath/filepath.vcproj 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/filepath/filepath.vcproj 2007-02-09 16:13:11 UTC (rev 320) @@ -159,7 +159,7 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File - RelativePath="..\..\include\filepath.h" + RelativePath="..\..\include\pmplib\filepath.h" > </File> </Filter> Modified: trunk/pmplib/lib/pmp/pmp.vcproj =================================================================== --- trunk/pmplib/lib/pmp/pmp.vcproj 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp/pmp.vcproj 2007-02-09 16:13:11 UTC (rev 320) @@ -204,7 +204,7 @@ > </File> <File - RelativePath="..\..\include\pmp.h" + RelativePath="..\..\include\pmplib\pmp.h" > </File> </Filter> Modified: trunk/pmplib/lib/pmp/pmp_win32.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-09 16:13:11 UTC (rev 320) @@ -116,13 +116,13 @@ result_t pmplib_create(pmplib_t* pmplib, pmp_t** pmp, const ucs2char_t* path_to_device, const char *id) { uint32_t i; - result_t ret = PMP_DEVICENOTFOUND; + result_t ret = PMPERR_DEVICENOTFOUND; for (i = 0;i < pmplib->num_plugins;++i) { pmplib_create_t func = (pmplib_create_t)GetProcAddress(pmplib->plugins[i], "pmp_create"); if (func) { ret = func(pmp, path_to_device, id); - if (ret != PMP_DEVICENOTFOUND) { + if (ret != PMPERR_DEVICENOTFOUND) { return ret; } } Modified: trunk/pmplib/lib/pmp_iriverplus2/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-09 16:13:11 UTC (rev 320) @@ -153,7 +153,7 @@ /* Check key type. */ if (idxkey->type < IP2DBIDX_PAGE_NODE_ENTRYNUMBER || IP2DBIDX_PAGE_NODE_FORMAT < idxkey->type) { - return PMPDBE_INVALIDTYPE; + return PMPERR_INCONSISTENCY; } *leafid = 0; @@ -172,14 +172,14 @@ ret = 0; } else { *leafid = 0; - ret = PMPDBE_NOTFOUND; + ret = PMPERR_ENTRYNOTFOUND; } break; } else { node = child; } } else { - ret = PMPDBE_NOTFOUND; + ret = PMPERR_ENTRYNOTFOUND; break; /* Not found. */ } } Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-09 16:13:11 UTC (rev 320) @@ -76,7 +76,7 @@ // Read dat. fp = ucs2fopen(dat_filename, "rb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = ip2dbdat_read(db, fp); if (ret != 0) { @@ -88,7 +88,7 @@ // Read idx. fp = ucs2fopen(idx_filename, "rb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = ip2dbidx_read(db, fp); if (ret != 0) { @@ -110,7 +110,7 @@ filepath_removefile(dat_filename); fp = ucs2fopen(dat_filename, "wb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = ip2dbdat_write(db, fp); if (ret != 0) { @@ -123,7 +123,7 @@ filepath_removefile(idx_filename); fp = ucs2fopen(idx_filename, "wb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = ip2dbidx_write(db, fp); if (ret != 0) { @@ -175,7 +175,7 @@ // Allocate IP2DB records. ip2db_records = (ip2db_record_t*)calloc(n, sizeof(ip2db_record_t)); if (!ip2db_records) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Convert records from pmp_music_record_t to ip2db_record_t. @@ -257,7 +257,7 @@ if (*num_records < n) { *num_records = n; - return PMPDBE_INSUFFICIENT; + return PMPERR_INSUFFICIENTMEMORY; } for (i = 1, j = 0;i <= n;++i) { // recid starts at 1. @@ -355,7 +355,7 @@ /* Check if the leafid is valid. */ if (recid < 1 || ip2db_get_num_record(db) < recid) { - return PMPDBE_INVALIDLEAFID; + return PMPERR_INCONSISTENCY; } /* Fill the record from an element of dat array. */ Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-09 16:13:11 UTC (rev 320) @@ -66,7 +66,7 @@ db->dat_size = num_records; if (!db->dat_array) { db->dat_size = 0; - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Just set records. @@ -116,7 +116,7 @@ uint8_t *p = NULL; uint8_t *dat_buffer = malloc(DAT_SIZE_PER_RECORD * db->dat_size); if (!dat_buffer) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } p = dat_buffer; Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-09 16:13:11 UTC (rev 320) @@ -50,12 +50,12 @@ if (!sortitems) { free(idxkeys); free(sortitems); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } if (!idxkeys) { free(idxkeys); free(sortitems); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } for (type = IP2DBIDX_PAGE_NODE_ENTRYNUMBER;type <= IP2DBIDX_PAGE_NODE_FORMAT;++type) { Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-09 16:13:11 UTC (rev 320) @@ -349,13 +349,13 @@ } } if (!md->id) { - return PMP_DEVICENOTFOUND; + return PMPERR_DEVICENOTFOUND; } // Allocate PMP class instance. pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); if (!pmp) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmp->add_ref = pmp_add_ref; @@ -368,7 +368,7 @@ pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { free(pmp); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpi->decl = md; @@ -444,13 +444,13 @@ music = calloc(1, sizeof(pmp_music_t)); if (!music) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpmi = calloc(1, sizeof(pmp_music_internal_t)); if (!pmpmi) { free(music); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } ip2db_init(&pmpmi->ip2db); @@ -543,7 +543,7 @@ pmp->info.path_to_playlist, plp_ext ) != 0) { - return PMPPLE_WRITE; + return PMPERR_WRITE; } } } @@ -579,7 +579,7 @@ pmplib_records_clone(records, pmpmi->records, pmpmi->num_records); return 0; } else { - return PMPDBE_INSUFFICIENT; + return PMPERR_INSUFFICIENTMEMORY; } } Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-09 16:13:11 UTC (rev 320) @@ -345,13 +345,13 @@ } } if (!md->id) { - return PMP_DEVICENOTFOUND; + return PMPERR_DEVICENOTFOUND; } // Allocate PMP class instance. pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); if (!pmp) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmp->add_ref = pmp_add_ref; @@ -364,7 +364,7 @@ pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { free(pmp); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpi->decl = md; @@ -440,13 +440,13 @@ music = calloc(1, sizeof(pmp_music_t)); if (!music) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpmi = calloc(1, sizeof(pmp_music_internal_t)); if (!pmpmi) { free(music); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } ip3db_init(&pmpmi->ip3db); @@ -656,7 +656,7 @@ pmplib_records_clone(records, pmpmi->records, pmpmi->num_records); return 0; } else { - return PMPDBE_INSUFFICIENT; + return PMPERR_INSUFFICIENTMEMORY; } } @@ -664,7 +664,7 @@ { pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; if (level > 0) { - return PMP_NOTIMPLIMENTED; + return PMPERR_NOTIMPLIMENTED; //return ip2db_repr(&pmpdbi->ip2db, fp); } else { return ip3db_dump(&pmpmi->ip3db, fp); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-09 16:13:11 UTC (rev 320) @@ -176,13 +176,13 @@ // Fail if this library does not support the player. if (model == MODEL_NONE) { - return PMP_DEVICENOTFOUND; + return PMPERR_DEVICENOTFOUND; } // Create a PMP instance. pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); if (!pmp) { - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Set member methods. @@ -196,7 +196,7 @@ pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { pmp_release(pmp); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmp->instance = pmpi; @@ -310,13 +310,13 @@ music = calloc(1, sizeof(pmp_music_t)); if (!music) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpmi = calloc(1, sizeof(pmp_music_internal_t)); if (!pmpmi) { free(music); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } irivnavi_init(&pmpmi->db); @@ -363,24 +363,24 @@ ucs2cat(filename, ucs2cs_irivnavi_idb); fp = ucs2fopen(filename, "rb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } // Obtain the stream size. if (fseek(fp, 0, SEEK_END) != 0) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } if ((size = ftell(fp)) == -1) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } if (fseek(fp, 0, SEEK_SET) != 0) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } // Allocate a buffer that stores the whole data. buffer = (uint8_t*)malloc(size); if (!buffer) { - ret = PMPDBE_OUTOFMEMORY; + ret = PMPERR_INSUFFICIENTMEMORY; goto error_exit; } @@ -389,7 +389,7 @@ // Read the data from the buffer. if (irivnavi_serialize(&pmpmi->db, buffer, 0) == 0) { - ret = PMPDBE_DBINCONSIST; + ret = PMPERR_INCONSISTENCY; goto error_exit; } @@ -464,7 +464,7 @@ // Initialize the record array. if (irivnavi_init_records(&pmpmi->db, pmpmi->num_records) != 0) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Convert records from pmp_music_record_t to ip2db_record_t. @@ -493,7 +493,7 @@ filepath_removefile(filename); fp = ucs2fopen(filename, "wb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } irivnavi_update(&pmpmi->db); @@ -501,13 +501,13 @@ // Allocate a buffer that stores the whole data. buffer = (uint8_t*)malloc(pmpmi->db.size); if (!buffer) { - ret = PMPDBE_OUTOFMEMORY; + ret = PMPERR_INSUFFICIENTMEMORY; goto error_exit; } // Write the data to the buffer. if (irivnavi_serialize(&pmpmi->db, buffer, 1) == 0) { - ret = PMPDBE_DBINCONSIST; + ret = PMPERR_INCONSISTENCY; goto error_exit; } @@ -539,7 +539,7 @@ pl->num_entries, path_to_root ) != 0) { - return PMPPLE_WRITE; + return PMPERR_WRITE; } } } @@ -580,7 +580,7 @@ pmplib_records_clone(records, pmpmi->records, pmpmi->num_records); return 0; } else { - return PMPDBE_INSUFFICIENT; + return PMPERR_INSUFFICIENTMEMORY; } } Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-09 16:13:11 UTC (rev 320) @@ -489,13 +489,13 @@ } } if (!md->id) { - return PMP_DEVICENOTFOUND; + return PMPERR_DEVICENOTFOUND; } // Allocate PMP class instance. pmp = (pmp_t*)calloc(1, sizeof(pmp_t)); if (!pmp) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmp->add_ref = pmp_add_ref; @@ -508,7 +508,7 @@ pmpi = (pmp_internal_t*)calloc(1, sizeof(pmp_internal_t)); if (!pmpi) { free(pmp); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpi->decl = md; @@ -584,13 +584,13 @@ music = calloc(1, sizeof(pmp_music_t)); if (!music) { - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pmpmi = calloc(1, sizeof(pmp_music_internal_t)); if (!pmpmi) { free(music); - return PMPDBE_OUTOFMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } pp1db_init(&pmpmi->pp1db, pmpi->decl->hdr_initproc); @@ -681,7 +681,7 @@ pmp->info.path_to_playlist, plp_ext ) != 0) { - return PMPPLE_WRITE; + return PMPERR_WRITE; } } } @@ -717,7 +717,7 @@ pmplib_records_clone(records, pmpmi->records, pmpmi->num_records); return 0; } else { - return PMPDBE_INSUFFICIENT; + return PMPERR_INSUFFICIENTMEMORY; } } Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-09 16:13:11 UTC (rev 320) @@ -98,13 +98,13 @@ uint32_t i, j; if (!db->hdr) { - return PMPDBE_DBINCONSIST; + return PMPERR_INCONSISTENCY; } // Read hdr. fp = ucs2fopen(hdr_filename, "rb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = fread_all(fp, &buffer, &size); if (ret != 0) { @@ -129,7 +129,7 @@ fp = ucs2fopen(filename, "rb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = fread_all(fp, &buffer, &size); if (ret != 0) { @@ -139,7 +139,7 @@ db->dat = calloc(db->hdr->num_dat_entries, sizeof(dat_t)); if (!db->dat) { fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } for (j = 0;j < db->hdr->num_dat_entries;++j) { uint8_t *p = &buffer[db->hdr->dat_record_offset[j]]; @@ -153,7 +153,7 @@ ) <= 0) { free(buffer); fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } } free(buffer); @@ -163,7 +163,7 @@ db->idx = (idx_t**)calloc(db->hdr->num_dat_fields, sizeof(idx_t*)); if (!db->idx) { fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Read indices. @@ -178,7 +178,7 @@ fp = ucs2fopen(filename, "rb"); if (!fp) { - return PMPDBE_OPENFORREAD; + return PMPERR_OPENFORREAD; } ret = fread_all(fp, &buffer, &size); if (ret != 0) { @@ -189,7 +189,7 @@ db->idx[i] = calloc(db->hdr->num_dat_entries, sizeof(idx_t)); if (!db->idx[i]) { fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } for (j = 0;j < db->hdr->num_dat_entries;++j) { p += idx_serialize(p, &db->idx[i][j], 0); @@ -213,7 +213,7 @@ uint32_t offset = 0; if (!db->hdr) { - return PMPDBE_DBINCONSIST; + return PMPERR_INCONSISTENCY; } // Write indices. @@ -227,13 +227,13 @@ fp = ucs2fopen(filename, "wb"); if (!fp) { - return PMPDBE_OPENFORWRITE; + return PMPERR_OPENFORWRITE; } buffer = calloc(db->hdr->num_dat_entries, sizeof(idx_t)); if (!buffer) { fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } p = buffer; @@ -254,12 +254,12 @@ fp = ucs2fopen(filename, "wb"); if (!fp) { - return PMPDBE_OPENFORWRITE; + return PMPERR_OPENFORWRITE; } p = buffer = calloc(db->hdr->num_dat_entries, field_descriptor_get_max_record_size(db->hdr)); if (!buffer) { fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } offset = 0; db->hdr->dat_record_offset[0] = offset; @@ -285,12 +285,12 @@ // Read hdr. fp = ucs2fopen(hdr_filename, "wb"); if (!fp) { - return PMPDBE_OPENFORWRITE; + return PMPERR_OPENFORWRITE; } buffer = calloc(db->hdr->param.size, 1); if (!buffer) { fclose(fp); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } hdr_serialize(buffer, db->hdr, 1); fwrite(buffer, 1, db->hdr->param.size, fp); @@ -305,7 +305,7 @@ uint32_t i, j; if (!db->hdr) { - return PMPDBE_DBINCONSIST; + return PMPERR_INCONSISTENCY; } hdr_repr(db->hdr, fp); @@ -458,7 +458,7 @@ sort_item_t* si = NULL; if (!db->hdr) { - return PMPDBE_NOTINITIALIZED; + return PMPERR_INCONSISTENCY; } dat_free_array(db->dat, db->hdr); @@ -474,7 +474,7 @@ db->dat = calloc(n, sizeof(dat_t)); if (!db->dat) { pp1db_finish(db); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Convert records from pmp_music_record_t to ip2db_record_t. @@ -498,7 +498,7 @@ si = calloc(n, sizeof(sort_item_t)); if (!si) { pp1db_finish(db); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Generate indices. @@ -509,7 +509,7 @@ db->idx[i] = calloc(n, sizeof(idx_t)); if (!db->idx[i]) { pp1db_finish(db); - return PMP_INSUFFICIENTMEMORY; + return PMPERR_INSUFFICIENTMEMORY; } // Preparation for sorting records. @@ -562,7 +562,7 @@ // Check database consistency. if (db->hdr->num_dat_entries - db->hdr->num_dat_inactive_entries != n) { - return PMPDBE_DBINCONSIST; + return PMPERR_INCONSISTENCY; } if (!records) { @@ -572,7 +572,7 @@ if (*num_records < n) { *num_records = n; - return PMPDBE_INSUFFICIENT; + return PMPERR_INSUFFICIENTMEMORY; } for (i = 0, j = 0;i < db->hdr->num_dat_entries;++i) { Modified: trunk/pmplib/lib/ucs2/ucs2.vcproj =================================================================== --- trunk/pmplib/lib/ucs2/ucs2.vcproj 2007-02-09 05:11:59 UTC (rev 319) +++ trunk/pmplib/lib/ucs2/ucs2.vcproj 2007-02-09 16:13:11 UTC (rev 320) @@ -163,7 +163,7 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File - RelativePath="..\..\include\ucs2char.h" + RelativePath="..\..\include\pmplib\ucs2char.h" > </File> </Filter> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 05:11:58
|
Revision: 319 http://svn.sourceforge.net/pmplib/?rev=319&view=rev Author: nyaochi Date: 2007-02-08 21:11:59 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Initial attempt to build pmplib-*.rpm Modified Paths: -------------- trunk/pmplib/configure.in trunk/pmplib/include/Makefile.am trunk/pmplib/lib/pmp_iriverplus2/Makefile.am trunk/pmplib/lib/pmp_iriverplus3/Makefile.am trunk/pmplib/lib/pmp_irivnavi/Makefile.am trunk/pmplib/lib/pmp_portalplayer1/Makefile.am Added Paths: ----------- trunk/pmplib/pmplib.spec.in Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-09 04:54:37 UTC (rev 318) +++ trunk/pmplib/configure.in 2007-02-09 05:11:59 UTC (rev 319) @@ -228,7 +228,7 @@ dnl ------------------------------------------------------------------ dnl Output the configure results. dnl ------------------------------------------------------------------ -AC_CONFIG_FILES(Makefile m4/Makefile include/Makefile include/pmplib/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) +AC_CONFIG_FILES(Makefile m4/Makefile include/Makefile include/pmplib/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile pmplib.spec) if test -n "$JS_CFLAGS" ; then AC_DEFINE([HAVE_JSAPI_H], 1, [Define if you have the jsapi.h header]) Modified: trunk/pmplib/include/Makefile.am =================================================================== --- trunk/pmplib/include/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) +++ trunk/pmplib/include/Makefile.am 2007-02-09 05:11:59 UTC (rev 319) @@ -1,3 +1,9 @@ # $Id:$ SUBDIRS = pmplib + +EXTRA_DIST = \ + os.h \ + gmi.h \ + playlist.h \ + ucs2string.h Modified: trunk/pmplib/lib/pmp_iriverplus2/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) +++ trunk/pmplib/lib/pmp_iriverplus2/Makefile.am 2007-02-09 05:11:59 UTC (rev 319) @@ -4,7 +4,6 @@ pmp_LTLIBRARIES = iriverplus2.la iriverplus2_la_SOURCES = \ - ../../include/pmp.h \ dat.c \ idx.c \ idx_header.c \ Modified: trunk/pmplib/lib/pmp_iriverplus3/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) +++ trunk/pmplib/lib/pmp_iriverplus3/Makefile.am 2007-02-09 05:11:59 UTC (rev 319) @@ -4,7 +4,6 @@ pmp_LTLIBRARIES = iriverplus3.la iriverplus3_la_SOURCES = \ - ../../include/pmp.h \ dat.h \ dat.c \ dic.h \ Modified: trunk/pmplib/lib/pmp_irivnavi/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) +++ trunk/pmplib/lib/pmp_irivnavi/Makefile.am 2007-02-09 05:11:59 UTC (rev 319) @@ -4,8 +4,6 @@ pmp_LTLIBRARIES = irivnavi.la irivnavi_la_SOURCES = \ - ../../include/pmp.h \ - ../../include/pmphelp.h \ irivnavi.c \ irivnavi.h \ playlist.c \ Modified: trunk/pmplib/lib/pmp_portalplayer1/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) +++ trunk/pmplib/lib/pmp_portalplayer1/Makefile.am 2007-02-09 05:11:59 UTC (rev 319) @@ -4,7 +4,6 @@ pmp_LTLIBRARIES = portalplayer1.la portalplayer1_la_SOURCES = \ - ../../include/pmp.h \ hdr.c \ hdr_template.c \ hdr_template.h \ Added: trunk/pmplib/pmplib.spec.in =================================================================== --- trunk/pmplib/pmplib.spec.in (rev 0) +++ trunk/pmplib/pmplib.spec.in 2007-02-09 05:11:59 UTC (rev 319) @@ -0,0 +1,92 @@ +%define name @PACKAGE@ +%define version @VERSION@ +%define release 1 +%define prefix %{_usr} +%define docdir %{_defaultdocdir} + +# Preamble +Summary: Portable Media Player library (PMPlib) +Name: %{name} +Version: %{version} +Release: %{release} +License: LGPL +Vendor: The PMPlib Project +Packager: Naoaki Okazaki <ny...@us...> +URL: http://pmplib.sourceforge.net/ +Group: Applications/Multimedia +Source: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-root +BuildRequires: gcc => 3.0.1, libid3tag-devel, zlib-devel, libogg-devel, libvorbis-devel + +%description +Portable Media Player library (PMPlib) is a management software/library for various portable media players. + +%package devel +Summary: Shared and static libraries for PMPlib +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +Portable Media Player library (PMPlib) is a management software/library for various portable media players. +This package contains both the shared and the static libraries from the PMPlib project. + +%package tools +Summary: Command-line tools for PMPlib (EasyPMP) +License: GPL +Group: Applications/Multimedia +Requires: %{name} = %{version}, libid3tag, zlib, libogg, libvorbis + +%description tools +Portable Media Player library (PMPlib) is a management software/library for various portable media players. +This package contains a frontend program (EasyPMP) for PMPlib. + +%prep + +%setup + +%build +%configure +%{__make} + +%install +%{__rm} -rf %{buildroot} +%makeinstall + +%post + +%postun + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-,root,root) +%doc AUTHORS COPYING ChangeLog INSTALL NEWS README +%{_libdir}/pmplib/irivnavi.so +%{_libdir}/pmplib/portalplayer1.so +%{_libdir}/pmplib/iriverplus2.so +%{_libdir}/pmplib/iriverplus3.so +%{_libdir}/libpmp.so* + +%files devel +%defattr(-,root,root) +%{_libdir}/pmplib/irivnavi.a +%{_libdir}/pmplib/irivnavi.la +%{_libdir}/pmplib/portalplayer1.a +%{_libdir}/pmplib/portalplayer1.la +%{_libdir}/pmplib/iriverplus2.a +%{_libdir}/pmplib/iriverplus2.la +%{_libdir}/pmplib/iriverplus3.a +%{_libdir}/pmplib/iriverplus3.la +%{_libdir}/libpmp.a +%{_libdir}/libpmp.la +%{_includedir}/* + +%files tools +%defattr(-,root,root) +%{_bindir}/easypmp +%{_mandir}/man1/easypmp.1* + +%changelog +* Fri Feb 9 2007 Naoaki Okazaki <ny...@us...> 0.14 +- Initial build This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 04:54:36
|
Revision: 318 http://svn.sourceforge.net/pmplib/?rev=318&view=rev Author: nyaochi Date: 2007-02-08 20:54:37 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Added new Makefile.am files Added Paths: ----------- trunk/pmplib/include/Makefile.am trunk/pmplib/include/pmplib/Makefile.am Added: trunk/pmplib/include/Makefile.am =================================================================== --- trunk/pmplib/include/Makefile.am (rev 0) +++ trunk/pmplib/include/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) @@ -0,0 +1,3 @@ +# $Id:$ + +SUBDIRS = pmplib Added: trunk/pmplib/include/pmplib/Makefile.am =================================================================== --- trunk/pmplib/include/pmplib/Makefile.am (rev 0) +++ trunk/pmplib/include/pmplib/Makefile.am 2007-02-09 04:54:37 UTC (rev 318) @@ -0,0 +1,9 @@ +# $Id:$ + +pmplibincludedir = $(includedir)/pmplib + +pmplibinclude_HEADERS = \ + os_types.h \ + pmp.h \ + ucs2char.h \ + filepath.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 02:52:19
|
Revision: 317 http://svn.sourceforge.net/pmplib/?rev=317&view=rev Author: nyaochi Date: 2007-02-08 18:52:20 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Fix build on POSIX environments. Modified Paths: -------------- trunk/pmplib/Makefile.am trunk/pmplib/configure.in trunk/pmplib/frontend/easypmp/cui/console_posix.c trunk/pmplib/lib/filepath/Makefile.am trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/filepath/rel2abs.c trunk/pmplib/lib/filepath/rel2abs.h trunk/pmplib/lib/pmp/Makefile.am trunk/pmplib/lib/pmp/pmp_posix.c trunk/pmplib/lib/ucs2/Makefile.am trunk/pmplib/lib/ucs2/ucs2char_iconv.c Modified: trunk/pmplib/Makefile.am =================================================================== --- trunk/pmplib/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -1,6 +1,6 @@ # $Id$ -SUBDIRS = m4 libltdl lib/ucs2 lib/filepath lib/pmp lib/gmi lib/playlist lib/pmp_irivnavi lib/pmp_portalplayer1 lib/pmp_iriverplus2 lib/pmp_iriverplus3 frontend/easypmp/cui +SUBDIRS = m4 libltdl include lib/ucs2 lib/filepath lib/pmp lib/gmi lib/playlist lib/pmp_irivnavi lib/pmp_portalplayer1 lib/pmp_iriverplus2 lib/pmp_iriverplus3 frontend/easypmp/cui docdir = $(prefix)/share/doc/@PACKAGE@ doc_DATA = README INSTALL COPYING AUTHORS ChangeLog Modified: trunk/pmplib/configure.in =================================================================== --- trunk/pmplib/configure.in 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/configure.in 2007-02-09 02:52:20 UTC (rev 317) @@ -228,7 +228,7 @@ dnl ------------------------------------------------------------------ dnl Output the configure results. dnl ------------------------------------------------------------------ -AC_CONFIG_FILES(Makefile m4/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) +AC_CONFIG_FILES(Makefile m4/Makefile include/Makefile include/pmplib/Makefile lib/ucs2/Makefile lib/filepath/Makefile lib/pmp/Makefile lib/gmi/Makefile lib/pmp_irivnavi/Makefile lib/pmp_portalplayer1/Makefile lib/pmp_iriverplus2/Makefile lib/pmp_iriverplus3/Makefile lib/playlist/Makefile frontend/easypmp/cui/Makefile) if test -n "$JS_CFLAGS" ; then AC_DEFINE([HAVE_JSAPI_H], 1, [Define if you have the jsapi.h header]) Modified: trunk/pmplib/frontend/easypmp/cui/console_posix.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/frontend/easypmp/cui/console_posix.c 2007-02-09 02:52:20 UTC (rev 317) @@ -38,7 +38,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #ifdef HAVE_STRING_H #include <string.h> Modified: trunk/pmplib/lib/filepath/Makefile.am =================================================================== --- trunk/pmplib/lib/filepath/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libfilepath.la libfilepath_la_SOURCES = \ - ../../include/filepath.h \ + ../../include/pmplib/filepath.h \ filepath_posix.c \ rel2abs.h \ rel2abs.c Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-09 02:52:20 UTC (rev 317) @@ -34,7 +34,7 @@ #include <string.h> #include <sys/stat.h> -#include "filepath.h" +#include <pmplib/filepath.h> #include "rel2abs.h" int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) @@ -265,14 +265,14 @@ return (*path != PATHCHAR); } -int filepath_file_exists(const ucs2char_t *path) +int filepath_file_exists(const ucs2char_t *filename) { int ret = 0; struct stat st; char *mbs_path = ucs2dupmbs(filename); if (mbs_path) { - path_decode(mbs_path); + filepath_decode(mbs_path); //fprintf(stderr, "is_exist: %s\n", mbs_path); ret = open(mbs_path, 0); free(mbs_path); @@ -364,3 +364,54 @@ } return 0; } + +time_t filepath_mtime(const ucs2char_t *filename) +{ + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + filepath_decode(mbs_path); + ret = stat(mbs_path, &st); + free(mbs_path); + if (ret == 0) { + return st.st_mtime; + } + } + return 0; +} + +uint32_t filepath_size(const ucs2char_t *filename) +{ + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + filepath_decode(mbs_path); + ret = stat(mbs_path, &st); + free(mbs_path); + if (ret == 0) { + return (uint32_t)st.st_size; + } + } + return 0; +} + +int filepath_is_dir(const ucs2char_t *filename) +{ + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + filepath_decode(mbs_path); + ret = stat(mbs_path, &st); + free(mbs_path); + if (ret == 0) { + return ((st.st_mode & S_IFMT) == S_IFDIR); + } + } + return 0; +} Modified: trunk/pmplib/lib/filepath/rel2abs.c =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/rel2abs.c 2007-02-09 02:52:20 UTC (rev 317) @@ -39,7 +39,7 @@ #include <os.h> #include <errno.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "rel2abs.h" Modified: trunk/pmplib/lib/filepath/rel2abs.h =================================================================== --- trunk/pmplib/lib/filepath/rel2abs.h 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/filepath/rel2abs.h 2007-02-09 02:52:20 UTC (rev 317) @@ -25,7 +25,7 @@ #ifndef __REL2ABS_H__ #define __REL2ABS_H__ -#include <ucs2char.h> +#include <pmplib/ucs2char.h> /** * \addtogroup filepath Modified: trunk/pmplib/lib/pmp/Makefile.am =================================================================== --- trunk/pmplib/lib/pmp/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/pmp/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -3,7 +3,8 @@ lib_LTLIBRARIES = libpmp.la libpmp_la_SOURCES = \ - ../../include/pmp.h \ + ../../include/pmplib/pmp.h \ + ../../include/pmplib/os_types.h \ pmp.c \ pmp_posix.c Modified: trunk/pmplib/lib/pmp/pmp_posix.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-09 02:52:20 UTC (rev 317) @@ -32,11 +32,10 @@ #include <ltdl.h> #include <os.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> -#include <filepath.h> -#include <pmp.h> - struct tag_pmplib_t { uint32_t num_plugins; lt_dlhandle *plugins; Modified: trunk/pmplib/lib/ucs2/Makefile.am =================================================================== --- trunk/pmplib/lib/ucs2/Makefile.am 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/ucs2/Makefile.am 2007-02-09 02:52:20 UTC (rev 317) @@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libucs2.la libucs2_la_SOURCES = \ - ../../include/ucs2char.h \ + ../../include/pmplib/ucs2char.h \ ucs2char.c \ ucs2char_iconv.c Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 02:29:45 UTC (rev 316) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 02:52:20 UTC (rev 317) @@ -231,7 +231,7 @@ -static void path_decode(char *p) +static void filepath_decode(char *p) { while (*p) { if (*p == 0x005C) { @@ -248,7 +248,7 @@ char* mbs = (char *)alloca(mbs_size * sizeof(char)); if (mbs) { ucs2tombs(mbs, mbs_size, ucs2str, ucs2len(ucs2str)+1); - return (fputs(mbs, fp) != EOF : 0 ? 1); + return (fputs(mbs, fp) != EOF ? 0 : 1); } else { return 1; } @@ -261,61 +261,10 @@ if (mbs_filename) { /* Convert '\\' to '/'. */ - path_decode(mbs_filename); + filepath_decode(mbs_filename); //fprintf(stderr, "fopen: %s\n", mbs_filename); fp = fopen(mbs_filename, mode); } free(mbs_filename); return fp; } - -time_t filepath_mtime(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - ret = stat(mbs_path, &st); - free(mbs_path); - if (ret == 0) { - return st.st_mtime; - } - } - return 0; -} - -uint32_t filepath_size(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - ret = stat(mbs_path, &st); - free(mbs_path); - if (ret == 0) { - return (uint32_t)st.st_size; - } - } - return 0; -} - -int filepath_is_dir(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - ret = stat(mbs_path, &st); - free(mbs_path); - if (ret == 0) { - return ((st.st_mode & S_IFMT) == S_IFDIR); - } - } - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 02:29:46
|
Revision: 316 http://svn.sourceforge.net/pmplib/?rev=316&view=rev Author: nyaochi Date: 2007-02-08 18:29:45 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Moved exportable include files into /include/pmplib directory: <ucs2char.h> -> <pmplib/ucs2char.h> <filepath.h> -> <pmplib/filepath.h> <pmp.h> -> <pmplib/pmp.h> Added <pmplib/os_types.h> Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/console_win32.c trunk/pmplib/frontend/easypmp/cui/device.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/cui/util.c trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp trunk/pmplib/include/gmi.h trunk/pmplib/include/os.h trunk/pmplib/include/playlist.h trunk/pmplib/include/pmplib/filepath.h trunk/pmplib/lib/filepath/filepath_win32.c trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/gmi/gmi_vorbis.c trunk/pmplib/lib/gmi/gmi_wav.c trunk/pmplib/lib/gmi/gmi_wma.c trunk/pmplib/lib/playlist/jspl.c trunk/pmplib/lib/playlist/playlist.c trunk/pmplib/lib/playlist/rw_m3u.c trunk/pmplib/lib/playlist/rw_pls.c trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp/pmp.vcproj trunk/pmplib/lib/pmp/pmp_win32.c trunk/pmplib/lib/pmp_iriverplus2/dat.c trunk/pmplib/lib/pmp_iriverplus2/idx.c trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c trunk/pmplib/lib/pmp_iriverplus2/idx_header.c trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c trunk/pmplib/lib/pmp_iriverplus2/idx_node.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.h trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c trunk/pmplib/lib/pmp_iriverplus2/playlist.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_iriverplus2/serialize.c trunk/pmplib/lib/pmp_iriverplus2/util.c trunk/pmplib/lib/pmp_iriverplus3/dat.c trunk/pmplib/lib/pmp_iriverplus3/dic.c trunk/pmplib/lib/pmp_iriverplus3/idx.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_iriverplus3/serialize.c trunk/pmplib/lib/pmp_iriverplus3/util.c trunk/pmplib/lib/pmp_irivnavi/irivnavi.c trunk/pmplib/lib/pmp_irivnavi/playlist.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_irivnavi/serialize.c trunk/pmplib/lib/pmp_portalplayer1/dat.c trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c trunk/pmplib/lib/pmp_portalplayer1/hdr.c trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c trunk/pmplib/lib/pmp_portalplayer1/idx.c trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c trunk/pmplib/lib/pmp_portalplayer1/playlist.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.c trunk/pmplib/lib/pmp_portalplayer1/pp1db.h trunk/pmplib/lib/pmp_portalplayer1/serialize.c trunk/pmplib/lib/pmp_portalplayer1/util.c trunk/pmplib/lib/ucs2/ucs2char.c trunk/pmplib/lib/ucs2/ucs2char_iconv.c trunk/pmplib/lib/ucs2/ucs2char_win32.c Added Paths: ----------- trunk/pmplib/include/pmplib/os_types.h Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,9 +33,9 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include <gmi.h> #include <easypmp.h> Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,10 +32,10 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <playlist.h> -#include <pmp.h> +#include <pmplib/pmp.h> #include <easypmp.h> Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,9 +29,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include <playlist.h> #include <easypmp.h> Modified: trunk/pmplib/frontend/easypmp/cui/console_win32.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/console_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -20,7 +20,7 @@ * */ -/* $Id:$ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -30,7 +30,7 @@ #include <io.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <windows.h> Modified: trunk/pmplib/frontend/easypmp/cui/device.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/device.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,9 +29,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "util.h" Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-09 02:29:45 UTC (rev 316) @@ -37,10 +37,10 @@ #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> -#include <pmp.h> +#include <pmplib/pmp.h> #include <easypmp.h> #include "option.h" Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-09 02:29:45 UTC (rev 316) @@ -36,10 +36,10 @@ #include <direct.h> /* getcwd() */ #endif/*_MSC_VER*/ -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> -#include <pmp.h> +#include <pmplib/pmp.h> #ifdef HAVE_GETOPT_H #include <getopt.h> Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -41,7 +41,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "console.h" Modified: trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/frontend/easypmp/win32gui/winmain.cpp 2007-02-09 02:29:45 UTC (rev 316) @@ -27,10 +27,10 @@ #include "resource.h" #include <os.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> -#include <pmp.h> +#include <pmplib/pmp.h> #include <easypmp.h> #include "ejectdevice.h" Modified: trunk/pmplib/include/gmi.h =================================================================== --- trunk/pmplib/include/gmi.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/gmi.h 2007-02-09 02:29:45 UTC (rev 316) @@ -35,7 +35,7 @@ extern "C" { #endif/*__cplusplus*/ -#include <pmp.h> +#include <pmplib/pmp.h> /** * \addtogroup gmi Modified: trunk/pmplib/include/os.h =================================================================== --- trunk/pmplib/include/os.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/os.h 2007-02-09 02:29:45 UTC (rev 316) @@ -33,25 +33,9 @@ #endif/*_MSC_VER*/ #include <stdio.h> +#include <pmplib/os_types.h> -#if defined(WIN32) || defined(OS2) -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; -#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) -#include <sys/types.h> - -#else -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#endif - #if defined(WIN32) #define fileno _fileno #define strnicmp _strnicmp @@ -92,6 +76,4 @@ #endif -typedef int result_t; - #endif/*__OS_H__*/ Modified: trunk/pmplib/include/playlist.h =================================================================== --- trunk/pmplib/include/playlist.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/playlist.h 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #define PLAYLISTAPI #endif -#include <pmp.h> +#include <pmplib/pmp.h> #ifdef __cplusplus extern "C" { Modified: trunk/pmplib/include/pmplib/filepath.h =================================================================== --- trunk/pmplib/include/pmplib/filepath.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/include/pmplib/filepath.h 2007-02-09 02:29:45 UTC (rev 316) @@ -25,7 +25,7 @@ #define __FILEPATHUTIL_H__ #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #ifdef FILEPATH_EXPORTS #define FILEPATHAPI __declspec(dllexport) Added: trunk/pmplib/include/pmplib/os_types.h =================================================================== --- trunk/pmplib/include/pmplib/os_types.h (rev 0) +++ trunk/pmplib/include/pmplib/os_types.h 2007-02-09 02:29:45 UTC (rev 316) @@ -0,0 +1,43 @@ +/* + * Basic type definitions among operating systems and compilers. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id:$ */ + +#ifndef __OS_TYPES_H__ +#define __OS_TYPES_H__ + +#if defined(__GNU_C__) +#include <inttypes.h> + +#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) +#include <sys/types.h> + +#else +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned short uint16_t; + +#endif + +typedef int result_t; + +#endif/*__OS_TYPES_H__*/ Property changes on: trunk/pmplib/include/pmplib/os_types.h ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,7 +33,7 @@ #include <windows.h> #include <shlwapi.h> -#include <filepath.h> +#include <pmplib/filepath.h> #pragma comment(lib, "shlwapi.lib") int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance) Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #endif/*HAVE_CONFIG_H*/ #include <os.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include <gmi.h> /** Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,7 +33,7 @@ #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> #include <id3tag.h> Modified: trunk/pmplib/lib/gmi/gmi_vorbis.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_vorbis.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> #include <vorbis/codec.h> Modified: trunk/pmplib/lib/gmi/gmi_wav.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_wav.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> /** Modified: trunk/pmplib/lib/gmi/gmi_wma.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/gmi/gmi_wma.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <gmi.h> /** Modified: trunk/pmplib/lib/playlist/jspl.c =================================================================== --- trunk/pmplib/lib/playlist/jspl.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/jspl.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,9 +32,9 @@ #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include <playlist.h> #include <jsapi.h> Modified: trunk/pmplib/lib/playlist/playlist.c =================================================================== --- trunk/pmplib/lib/playlist/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,10 +32,10 @@ #include <string.h> #endif/*HAVE_STRING_H*/ #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <playlist.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> static const ucs2char_t ucs2cs_m3u[] = {'.','m','3','u',0}; static const ucs2char_t ucs2cs_m3u8[] = {'.','m','3','u','8',0}; Modified: trunk/pmplib/lib/playlist/rw_m3u.c =================================================================== --- trunk/pmplib/lib/playlist/rw_m3u.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/rw_m3u.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #ifdef HAVE_STRING_H #include <string.h> #endif/*HAVE_STRING_H*/ -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <playlist.h> static char *strip(char *line) Modified: trunk/pmplib/lib/playlist/rw_pls.c =================================================================== --- trunk/pmplib/lib/playlist/rw_pls.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/playlist/rw_pls.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <playlist.h> static char *strip(char *line) Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp/pmp.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <string.h> #endif/*HAVE_STRING_H*/ -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> void pmplib_record_init(pmp_music_record_t* record) { Modified: trunk/pmplib/lib/pmp/pmp.vcproj =================================================================== --- trunk/pmplib/lib/pmp/pmp.vcproj 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp/pmp.vcproj 2007-02-09 02:29:45 UTC (rev 316) @@ -196,6 +196,14 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File + RelativePath="..\..\include\os.h" + > + </File> + <File + RelativePath="..\..\include\pmplib\os_types.h" + > + </File> + <File RelativePath="..\..\include\pmp.h" > </File> Modified: trunk/pmplib/lib/pmp/pmp_win32.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp/pmp_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -27,12 +27,12 @@ #endif/*HAVE_CONFIG_H*/ #include <os.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <windows.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> struct tag_pmplib_t { uint32_t num_plugins; Modified: trunk/pmplib/lib/pmp_iriverplus2/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_descriptor.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_exports.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,7 +28,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_header.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_header.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_header.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_leaf.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/idx_node.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/idx_node.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/idx_node.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "util.h" #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.h 2007-02-09 02:29:45 UTC (rev 316) @@ -24,7 +24,7 @@ #ifndef __IP2DB_IP2DB_H__ #define __IP2DB_IP2DB_H__ -#include <pmp.h> +#include <pmplib/pmp.h> #define PAGESIZE 0x400 Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -27,8 +27,8 @@ #include <os.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "util.h" #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db_idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "ip2db.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #include <os.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus2/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/dat.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -38,7 +38,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/dic.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/dic.c 2007-02-09 02:29:45 UTC (rev 316) @@ -35,7 +35,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -46,7 +46,7 @@ #include <stdio.h> #include <stdlib.h> #include <memory.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "util.h" #include "ip3db.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "ip3db.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,7 +28,7 @@ #include <os.h> #include <memory.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,7 +29,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <malloc.h> #include "util.h" Modified: trunk/pmplib/lib/pmp_irivnavi/irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/irivnavi.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/irivnavi.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "serialize.h" #include "irivnavi.h" Modified: trunk/pmplib/lib/pmp_irivnavi/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -37,8 +37,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "irivnavi.h" Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-09 02:29:45 UTC (rev 316) @@ -33,9 +33,9 @@ #include <stdlib.h> #endif/*HAVE_STDLIB_H*/ #include <stddef.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "irivnavi.h" Modified: trunk/pmplib/lib/pmp_irivnavi/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_irivnavi/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #include <os.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/dat.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/dat.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/dat.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/field_descriptor.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/hdr_template.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,7 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "pp1db.h" #include "hdr_template.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/idx.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/idx.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/idx.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/pmp.h> #include "serialize.h" #include "pp1db.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_iriver_h10.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke220.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_medion_mdjuke440.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_msi_megaplayer.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_philips_hdd6320.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_samsung.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,8 +31,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/model_sirius_s50.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/playlist.c 2007-02-09 02:29:45 UTC (rev 316) @@ -28,8 +28,8 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> #include "serialize.h" #include "pp1db.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #ifdef HAVE_STRING_H #include <string.h> #endif/*HAVE_STRING_H*/ -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "pp1db.h" #include "hdr_template.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.c 2007-02-09 02:29:45 UTC (rev 316) @@ -31,9 +31,9 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> -#include <pmp.h> +#include <pmplib/ucs2char.h> +#include <pmplib/filepath.h> +#include <pmplib/pmp.h> #include "pp1db.h" #include "util.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/pp1db.h =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/pp1db.h 2007-02-09 02:29:45 UTC (rev 316) @@ -24,7 +24,7 @@ #ifndef __PP1DB_H__ #define __PP1DB_H__ -#include <pmp.h> +#include <pmplib/pmp.h> #define PP1DB_PATHLENGTH 0x100 /**< Maximum length of path/file name. */ Modified: trunk/pmplib/lib/pmp_portalplayer1/serialize.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/serialize.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/serialize.c 2007-02-09 02:29:45 UTC (rev 316) @@ -30,7 +30,7 @@ #include <os.h> #include <stddef.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "serialize.h" Modified: trunk/pmplib/lib/pmp_portalplayer1/util.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/util.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/pmp_portalplayer1/util.c 2007-02-09 02:29:45 UTC (rev 316) @@ -32,7 +32,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include "util.h" Modified: trunk/pmplib/lib/ucs2/ucs2char.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/ucs2/ucs2char.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,7 +29,7 @@ #include <ctype.h> #include <stdlib.h> #include <string.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> /** * \addtogroup ucs2 Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-09 02:29:45 UTC (rev 316) @@ -35,7 +35,7 @@ #include <stdlib.h> #include <string.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #include <iconv.h> Modified: trunk/pmplib/lib/ucs2/ucs2char_win32.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-09 01:55:34 UTC (rev 315) +++ trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-09 02:29:45 UTC (rev 316) @@ -29,7 +29,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ucs2char.h> +#include <pmplib/ucs2char.h> #ifdef _WIN32 #include <windows.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 01:55:34
|
Revision: 315 http://svn.sourceforge.net/pmplib/?rev=315&view=rev Author: nyaochi Date: 2007-02-08 17:55:34 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Moved remotely Added Paths: ----------- trunk/pmplib/include/pmplib/ucs2char.h Removed Paths: ------------- trunk/pmplib/include/ucs2char.h Copied: trunk/pmplib/include/pmplib/ucs2char.h (from rev 314, trunk/pmplib/include/ucs2char.h) =================================================================== --- trunk/pmplib/include/pmplib/ucs2char.h (rev 0) +++ trunk/pmplib/include/pmplib/ucs2char.h 2007-02-09 01:55:34 UTC (rev 315) @@ -0,0 +1,682 @@ +/* + * UCS-2 character set library. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifndef __UCS2CHAR_H__ +#define __UCS2CHAR_H__ + +#include <stdio.h> + +#ifdef UCS2_EXPORTS +#define UCS2API __declspec(dllexport) +#else +#define UCS2API +#endif + +#ifdef __cplusplus +extern "C" { +#endif/*__cplusplus*/ + +/** + * \addtogroup ucs2 UCS-2 Character/String API + * @{ + * + * The PMPlib UCS-2 character/string API provides a manupulation utility + * for characters/strings in UCS-2 encoding. As a number of portable media + * players support Unicode for displaying song information, PMPlib deals + * with Unicode characters/strings encoded in UCS-2. + * + * The byte order of UCS-2 character is dependent on the CPU architecture + * on which this code runs: e.g., little-endian on Intel IA-32/IA-64 and + * big-endian on IBM PowerPC. + */ + +/** + * Type definition of a UCS-2 character. + */ +typedef uint16_t ucs2char_t; + +/** + * Initialize the UCS-2 library. + * + * This function initializes internal variables used in the UCS-2 library. + * Call this function before using any other functions in this API. + * + * @retval int Zero if succeeded, otherwise non-zero value. + */ +UCS2API int ucs2init(); + + +/** + * @defgroup ucs2_conv Character encoding converter + * @{ + * + * This API subset converts the character encoding of a string from one to + * another. It supports mutual conversions between: + * UCS-2 and multi-byte character (i.e., \c char); + * UCS-2 and UTF-8. + * + * By default, this library detects the character encoding of multi-byte + * characters on the current system based on the value of LANG variable + * (for POSIX) or via GetACP() function (for Win32). + */ + +/** + * Set the encoding for multi-byte characters (for iconv/libiconv). + * + * This function change the default encoding for multi-byte characters to the + * character encoding specified by the \a encoding argument. + * + * @param encoding The pointer to the string specifying the character + * encoding. + * + * @note + * This function is effective only on environments with iconv (libiconv). + */ +UCS2API int ucs2setenc(const char *encoding); + +/** + * Get the encoding for multi-byte characters (for iconv/libiconv). + * + * This function returns the default encoding for multi-byte characters used + * in the UCS-2 API. + * + * @retval const char* The pointer to the string of the character encoding. + * + * @note + * This function is effective only on environments with iconv (libiconv). + */ +UCS2API const char *ucs2getenc(); + +/** + * Set the code page for multi-byte characters (for Win32). + * + * This function change the default encoding for multi-byte characters to the + * code page specified by the \a cp argument. + * + * @param cp The code page. + * + * @note + * This function is effective only on Win32 environments. + */ +UCS2API void ucs2setcp(int cp); + +/** + * Get the code page for multi-byte characters (for Win32). + * + * This function returns the default code page for multi-byte characters. + * + * @param cp The code page. + * + * @note + * This function is effective only on Win32 environments. + */ +UCS2API int ucs2getcp(); + +/** + * Convert a UCS-2 string to multi-byte characters. + * + * @param mbstr The pointer to the buffer for receiving multi-byte + * characters converted from the UCS-2 string. If + * \a mbs_size is zero, this argument is not be used. + * @param mbs_size The size, in bytes, of the buffer pointed to by the + * \a mbstr argument. If this value is zero, the function + * returns the number of bytes required for the buffer. + * @param ucs2str The pointer to the UCS-2 string to be converted. + * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 + * string, \a ucs2str. + * @retval size_t The number of bytes written to \a mbstr buffer if + * the conversion is successful. If \a mbs_size is zero, + * the return value is the required size, in bytes, for a + * buffer to receive the converted string. This function + * returns zero if an error occurred. + */ +UCS2API size_t ucs2tombs(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size); + +/** + * Convert multi-byte characters to a UCS-2 string. + * + * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * converted from the multi-byte characters. If + * \a ucs_size is zero, this argument is not be used. + * @param ucs_size The size, in number of UCS-2 characters, of the buffer + * pointed to by the \a ucs2str argument. If this value is + * zero, the function returns the number of UCS-2 + * characters required for the buffer. + * @param mbstr The pointer to the multi-byte characters to be + * converted. + * @param mbs_size The size, in bytes, of the multi-byte characters, + * \a mbstr. + * @retval size_t The number of UCS-2 characters written to \a ucs2str + * buffer if the conversion is successful. If \a ucs_size + * is zero, the return value is the required size, in + * number of UCS-2 characters, for a buffer to receive the + * converted string. This function returns zero if an error + * occurred. + */ +UCS2API size_t mbstoucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); + +/** + * Convert multi-byte characters in a specific encoding to a UCS-2 string. + * + * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * converted from the multi-byte characters. If + * \a ucs_size is zero, this argument is not be used. + * @param ucs_size The size, in number of UCS-2 characters, of the buffer + * pointed to by the \a ucs2str argument. If this value is + * zero, the function returns the number of UCS-2 + * characters required for the buffer. + * @param mbstr The pointer to the multi-byte characters to be + * converted. + * @param mbs_size The size, in bytes, of the multi-byte characters, + * \a mbstr. + * @param charset The pointer to the string specifying the encoding of + * the multi-byte characters. + * @retval size_t The number of UCS-2 characters written to \a ucs2str + * buffer if the conversion is successful. If \a ucs_size + * is zero, the return value is the required size, in + * number of UCS-2 characters, for a buffer to receive the + * converted string. This function returns zero if an error + * occurred. + * @note + * \a charset is ignored on Win32 environments. + */ +UCS2API size_t mbstoucs2_charset(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size, const char *charset); + +/** + * Convert a UCS-2 string to multi-byte characters. + * + * @param mbstr The pointer to the buffer for receiving UTF-8 string + * converted from the UCS-2 string. If \a mbs_size is + * zero, this argument is not be used. + * @param mbs_size The size, in bytes, of the buffer pointed to by the + * \a mbstr argument. If this value is zero, the function + * returns the number of bytes required for the buffer. + * @param ucs2str The pointer to the UCS-2 string to be converted. + * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 + * string, \a ucs2str. + * @retval size_t The number of bytes written to \a mbstr buffer if + * the conversion is successful. If \a mbs_size is zero, + * the return value is the required size, in bytes, for a + * buffer to receive the converted string. This function + * returns zero if an error occurred. + */ +UCS2API size_t ucs2toutf8(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size); + +/** + * Convert a UTF-8 string to a UCS-2 string. + * + * @param ucs2str The pointer to the buffer for receiving UCS-2 string + * converted from the UTF-8 string. If \a ucs_size is + * zero, this argument is not be used. + * @param ucs_size The size, in number of UCS-2 characters, of the buffer + * pointed to by the \a ucs2str argument. If this value is + * zero, the function returns the number of UCS-2 + * characters required for the buffer. + * @param mbstr The pointer to the UTF-8 string to be converted. + * @param mbs_size The size, in bytes, of the UTF-8 string, \a mbstr. + * @retval size_t The number of UCS-2 characters written to \a ucs2str + * buffer if the conversion is successful. If \a ucs_size + * is zero, the return value is the required size, in + * number of UCS-2 characters, for a buffer to receive the + * converted string. This function returns zero if an error + * occurred. + */ +UCS2API size_t utf8toucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); + +/** + * Convert and duplicate a UCS-2 string to multi-byte characters. + * + * @param ucs2str The pointer to a UCS-2 string. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API char *ucs2dupmbs(const ucs2char_t *ucs2str); + +/** + * Convert and duplicate multi-byte characters to a UCS-2 string. + * + * @param mbstr The pointer to multi-byte characters. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* mbsdupucs2(const char *mbstr); + +/** + * Convert and duplicate multi-byte characters in a specific encoding + * to a UCS-2 string. + * + * @param mbstr The pointer to multi-byte characters. + * @param charset The pointer to the string specifying the encoding of + * the multi-byte characters. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* mbsdupucs2_charset(const char *mbstr, const char *charset); + +/** + * Convert and duplicate a UCS-2 string to a UTF-8 string. + * + * @param ucs2str The pointer to a UCS-2 string. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API char *ucs2duputf8(const ucs2char_t *ucs2str); + +/** + * Convert and duplicate a UTF-8 string to a UCS-2 string. + * + * @param mbstr The pointer to multi-byte characters. + * @retval char* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* utf8dupucs2(const char *utf8str); + +/** + * @} + */ + + + +/** + * @defgroup ucs2_memory Memory manager routines + * @{ + */ + +/** + * Allocate a memory block. + * + * @param size The size, in bytes, of the memory block. + * @retval void* The pointer to the allocated memory block. + */ +UCS2API void *ucs2malloc(size_t size); + +/** + * Allocate a memory block with values initialized as zero. + * + * @param size The size, in bytes, of the memory block. + * @retval void* The pointer to the allocated memory block. + */ +UCS2API void *ucs2calloc(size_t size); + +/** + * Resize a memory block. + * + * @param ptr The pointer to the memory block to be resized. + * @param size The size, in bytes, of the new memory block. + * @retval void* The pointer to the new memory block. + */ +UCS2API void *ucs2realloc(void *ptr, size_t size); + +/** + * Free a memory block. + * + * @param ptr The pointer to the memory block to be freed. + */ +UCS2API void ucs2free(void* ptr); + +/** + * @} + */ + +/** + * @defgroup ucs2_char UCS-2 character routines + * @{ + */ + +/** + * Test whether a USC-2 character is a surrogate-pair character in UTF-16. + * @param c The UCS-2 character to be tested. + * @retval int Non-zero value if the test is true, zero otherwise. + */ +UCS2API int ucs2issurrogate(ucs2char_t c); + +/** + * Test whether a USC-2 character is a whitespace character. + * @param c The UCS-2 character to be tested. + * @retval int Non-zero value if the test is true, zero otherwise. + */ +UCS2API int ucs2isspace(ucs2char_t c); + +/** + * Test whether a USC-2 character is a numeric character. + * @param c The UCS-2 character to be tested. + * @retval int Non-zero value if the test is true, zero otherwise. + */ +UCS2API int ucs2isdigit(ucs2char_t c); + +/** + * Convert a UCS-2 character to lower case. + * @param c The UCS-2 character to be coverted. + * @retval ucs2char_t The resultant UCS-2 character. + */ +UCS2API ucs2char_t ucs2lower(ucs2char_t c); + +/** + * Convert a UCS-2 character to upper case. + * @param c The UCS-2 character to be coverted. + * @retval ucs2char_t The resultant UCS-2 character. + */ +UCS2API ucs2char_t ucs2upper(ucs2char_t c); + +/** + * @} + */ + + + + + +/** + * @defgroup ucs2_string_ansi ANSI C compatible string routines + * @{ + * + * This is the subset of the UCS-2 Character/String API that corresponds + * to string manupulation routines in the ANSI C standard. The following + * ANSI C functions are not defined in this subset: + * strcoll, strerror, strtok, strxfrm. + */ + +/** + * Concatenate two strings. + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @retval ucs2char_t* The pointer to the destination string. + */ +UCS2API ucs2char_t* ucs2cat(ucs2char_t* dst, const ucs2char_t* src); + +/** + * Search for the first occurrence of a character in a string. + * + * @param str The pointer to the string in which \a c is searched. + * @param c The target character. + * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL + * if \a c does not occur in \a str. + */ +UCS2API ucs2char_t* ucs2chr(const ucs2char_t* str, ucs2char_t c); + +/** + * Compare two strings. + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ +UCS2API int ucs2cmp(const ucs2char_t* x, const ucs2char_t* y); + +/** + * Copy a string. + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @retval ucs2char_t* The pointer to the destination string. + */ +UCS2API ucs2char_t* ucs2cpy(ucs2char_t* dst, const ucs2char_t* src); + +/** + * Count the number of characters not appearing in a character set. + * + * @param str The pointer to a string. + * @param charset The pointer to a character set. + * @retval size_t The number of characters from the beginning of \a str + * in which any character in \a charset appear for the + * first time, or the length of \a str if such a character + * does not exist. + */ +UCS2API size_t ucs2cspn(const ucs2char_t *str, const ucs2char_t *charset); + +/** + * Count the length of a string. + * + * @param str The pointer to a string. + * @retval size_t The number of characters in \a str. + */ +UCS2API size_t ucs2len(const ucs2char_t* str); + +/** + * Concatenate two strings (no more than the maximum length). + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @param n The number of characters to be concatenated. + * @retval ucs2char_t* The pointer to the destination string. + */ +UCS2API ucs2char_t* ucs2ncat(ucs2char_t *dst, const ucs2char_t *src, size_t n); + +/** + * Compare two strings (no longer than the maximum length). + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @param n The number of characters to be compared. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ +UCS2API int ucs2ncmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); + +/** + * Copy a string (no more than the maximum length). + * + * @param dst The pointer to the destination of a string. + * @param src The pointer to the source of a string. + * @param n The number of characters to be copied. + * @retval ucs2char_t* The pointer to the destination string. + */ +UCS2API ucs2char_t* ucs2ncpy(ucs2char_t* dst, const ucs2char_t* src, size_t n); + +/** + * Find a character in a string that belongs to a character set. + * + * @param str The pointer to the string where \a charset is searched. + * @param charset The pointer to a character set. + * @retval ucs2char_t* The pointer to the character in \a str that belongs + * to \a charset, or \c NULL if such a character does not + * exist. + */ +UCS2API ucs2char_t* ucs2pbrk(const ucs2char_t *str, const ucs2char_t *charset); + +/** + * Search for the last occurrence of a character in a string. + * + * @param str The pointer to the string in which \a c is searched. + * @param c The target character. + * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL + * if \a c does not occur in \a str. + */ +UCS2API ucs2char_t* ucs2rchr(const ucs2char_t* string, ucs2char_t c); + +/** + * Find a character in a string that does not belong to a character set. + * + * @param str The pointer to the string where \a charset is searched. + * @param charset The pointer to a character set. + * @retval ucs2char_t* The pointer to the character in \a str that does not + * belong to \a charset, or \c NULL if such a character + * does not exist. + */ +UCS2API size_t ucs2spn(const ucs2char_t *str, const ucs2char_t *charset); + +/** + * Find a substring in a string. + * + * @param str The pointer to the string where \a substr is searched. + * @param substr The pointer to the substring. + * @retval ucs2char_t* The pointer to the character where \a substr begins + * in \a str for the first time, or \c NULL if \a str + * does not contain \a substr. + */ +UCS2API ucs2char_t* ucs2str(const ucs2char_t* str, const ucs2char_t* substr); + +/** + * @} + */ + + + + + +/** + * @defgroup ucs2_string_non_ansi Miscellaneous string routines + * @{ + */ + +/** + * Duplicate a string. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* ucs2dup(const ucs2char_t* str); + +/** + * Duplicate a string no longer than the specified length. + * + * @param str The pointer to a string. + * @param length The maximum length of the duplicated string. + * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() + * to free the memory block allocated by this function. + */ +UCS2API ucs2char_t* ucs2ndup(const ucs2char_t* src, size_t length); + +/** + * Convert a string to lowercase. + * + * Given \a str argument, this function converts uppercase letters in the + * string to lowercase and overwrites the resultant string on the same buffer + * pointed by the \a str argument. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ +UCS2API ucs2char_t* ucs2lwr(ucs2char_t* str); + +/** + * Convert a string to uppercase. + * + * Given \a str argument, this function converts lowercase letters in the + * string to uppercase and overwrites the resultant string on the same buffer + * pointed by the \a str argument. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ +UCS2API ucs2char_t* ucs2upr(ucs2char_t* str); + +/** + * Compare two strings incasesensitively. + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ +UCS2API int ucs2icmp(const ucs2char_t* x, const ucs2char_t* y); + +/** + * Compare two strings incasesensitively (no longer than the maximum length). + * + * @param x The pointer to a string. + * @param y The pointer to another string. + * @param n The number of characters to be compared. + * @retval int A positive value if \a x is greater than \a y; + * a negative value if \a x is smaller than \a y; + * zero if \a x is identical to \a y. + */ +UCS2API int ucs2incmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); + +/** + * Strip whitespace characters at the head and tail of a string. + * + * Given \a str argument, this function trims whilespace characters at the + * head and tail of the string and overwrites the resultant string on the + * same buffer pointed by the \a str argument. + * + * @param str The pointer to a string. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ +UCS2API ucs2char_t* ucs2strip(ucs2char_t* str); + +/** + * @} + */ + + + +/** + * @defgroup ucs2_std Wrapper for stdio/stdlib routines + * @{ + */ + +/** + * Convert a UCS-2 string to integer value. + * @param str The pointer to a string. + * @retval int The corresponding integer value. + */ +UCS2API int ucs2toi(const ucs2char_t* str); + +/** + * Convert an integer value to UCS-2 string. + * @param value The integer value. + * @param string The pointer to the buffer to receive the string. + * @param radix Radix of the \a value. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ +UCS2API ucs2char_t* itoucs2(int value, ucs2char_t *string, int radix); + +/** + * Open a stream from a file. + * @param filename The pointer to the UCS-2 string for the file name. + * @param mode The pointer to the C string for the open mode. + * @retval FILE* The pointer to the opened stream if successful, + * NULL otherwise. + */ +UCS2API FILE *ucs2fopen(const ucs2char_t *filename, const char *mode); + +/** + * Write a UCS-2 character to a stream. + * @param c The character to be written. + * @param fp The pointer to the output stream. + * @retval int Zero if successful, non-zero otherwise. + */ +UCS2API int fputucs2c(ucs2char_t c, FILE *fp); + + + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif/*__cplusplus*/ + +#endif/*__UCS2CHAR_H__*/ Deleted: trunk/pmplib/include/ucs2char.h =================================================================== --- trunk/pmplib/include/ucs2char.h 2007-02-09 01:55:12 UTC (rev 314) +++ trunk/pmplib/include/ucs2char.h 2007-02-09 01:55:34 UTC (rev 315) @@ -1,682 +0,0 @@ -/* - * UCS-2 character set library. - * - * Copyright (c) 2005-2006 Nyaochi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/* $Id$ */ - -#ifndef __UCS2CHAR_H__ -#define __UCS2CHAR_H__ - -#include <stdio.h> - -#ifdef UCS2_EXPORTS -#define UCS2API __declspec(dllexport) -#else -#define UCS2API -#endif - -#ifdef __cplusplus -extern "C" { -#endif/*__cplusplus*/ - -/** - * \addtogroup ucs2 UCS-2 Character/String API - * @{ - * - * The PMPlib UCS-2 character/string API provides a manupulation utility - * for characters/strings in UCS-2 encoding. As a number of portable media - * players support Unicode for displaying song information, PMPlib deals - * with Unicode characters/strings encoded in UCS-2. - * - * The byte order of UCS-2 character is dependent on the CPU architecture - * on which this code runs: e.g., little-endian on Intel IA-32/IA-64 and - * big-endian on IBM PowerPC. - */ - -/** - * Type definition of a UCS-2 character. - */ -typedef uint16_t ucs2char_t; - -/** - * Initialize the UCS-2 library. - * - * This function initializes internal variables used in the UCS-2 library. - * Call this function before using any other functions in this API. - * - * @retval int Zero if succeeded, otherwise non-zero value. - */ -UCS2API int ucs2init(); - - -/** - * @defgroup ucs2_conv Character encoding converter - * @{ - * - * This API subset converts the character encoding of a string from one to - * another. It supports mutual conversions between: - * UCS-2 and multi-byte character (i.e., \c char); - * UCS-2 and UTF-8. - * - * By default, this library detects the character encoding of multi-byte - * characters on the current system based on the value of LANG variable - * (for POSIX) or via GetACP() function (for Win32). - */ - -/** - * Set the encoding for multi-byte characters (for iconv/libiconv). - * - * This function change the default encoding for multi-byte characters to the - * character encoding specified by the \a encoding argument. - * - * @param encoding The pointer to the string specifying the character - * encoding. - * - * @note - * This function is effective only on environments with iconv (libiconv). - */ -UCS2API int ucs2setenc(const char *encoding); - -/** - * Get the encoding for multi-byte characters (for iconv/libiconv). - * - * This function returns the default encoding for multi-byte characters used - * in the UCS-2 API. - * - * @retval const char* The pointer to the string of the character encoding. - * - * @note - * This function is effective only on environments with iconv (libiconv). - */ -UCS2API const char *ucs2getenc(); - -/** - * Set the code page for multi-byte characters (for Win32). - * - * This function change the default encoding for multi-byte characters to the - * code page specified by the \a cp argument. - * - * @param cp The code page. - * - * @note - * This function is effective only on Win32 environments. - */ -UCS2API void ucs2setcp(int cp); - -/** - * Get the code page for multi-byte characters (for Win32). - * - * This function returns the default code page for multi-byte characters. - * - * @param cp The code page. - * - * @note - * This function is effective only on Win32 environments. - */ -UCS2API int ucs2getcp(); - -/** - * Convert a UCS-2 string to multi-byte characters. - * - * @param mbstr The pointer to the buffer for receiving multi-byte - * characters converted from the UCS-2 string. If - * \a mbs_size is zero, this argument is not be used. - * @param mbs_size The size, in bytes, of the buffer pointed to by the - * \a mbstr argument. If this value is zero, the function - * returns the number of bytes required for the buffer. - * @param ucs2str The pointer to the UCS-2 string to be converted. - * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 - * string, \a ucs2str. - * @retval size_t The number of bytes written to \a mbstr buffer if - * the conversion is successful. If \a mbs_size is zero, - * the return value is the required size, in bytes, for a - * buffer to receive the converted string. This function - * returns zero if an error occurred. - */ -UCS2API size_t ucs2tombs(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size); - -/** - * Convert multi-byte characters to a UCS-2 string. - * - * @param ucs2str The pointer to the buffer for receiving UCS-2 string - * converted from the multi-byte characters. If - * \a ucs_size is zero, this argument is not be used. - * @param ucs_size The size, in number of UCS-2 characters, of the buffer - * pointed to by the \a ucs2str argument. If this value is - * zero, the function returns the number of UCS-2 - * characters required for the buffer. - * @param mbstr The pointer to the multi-byte characters to be - * converted. - * @param mbs_size The size, in bytes, of the multi-byte characters, - * \a mbstr. - * @retval size_t The number of UCS-2 characters written to \a ucs2str - * buffer if the conversion is successful. If \a ucs_size - * is zero, the return value is the required size, in - * number of UCS-2 characters, for a buffer to receive the - * converted string. This function returns zero if an error - * occurred. - */ -UCS2API size_t mbstoucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); - -/** - * Convert multi-byte characters in a specific encoding to a UCS-2 string. - * - * @param ucs2str The pointer to the buffer for receiving UCS-2 string - * converted from the multi-byte characters. If - * \a ucs_size is zero, this argument is not be used. - * @param ucs_size The size, in number of UCS-2 characters, of the buffer - * pointed to by the \a ucs2str argument. If this value is - * zero, the function returns the number of UCS-2 - * characters required for the buffer. - * @param mbstr The pointer to the multi-byte characters to be - * converted. - * @param mbs_size The size, in bytes, of the multi-byte characters, - * \a mbstr. - * @param charset The pointer to the string specifying the encoding of - * the multi-byte characters. - * @retval size_t The number of UCS-2 characters written to \a ucs2str - * buffer if the conversion is successful. If \a ucs_size - * is zero, the return value is the required size, in - * number of UCS-2 characters, for a buffer to receive the - * converted string. This function returns zero if an error - * occurred. - * @note - * \a charset is ignored on Win32 environments. - */ -UCS2API size_t mbstoucs2_charset(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size, const char *charset); - -/** - * Convert a UCS-2 string to multi-byte characters. - * - * @param mbstr The pointer to the buffer for receiving UTF-8 string - * converted from the UCS-2 string. If \a mbs_size is - * zero, this argument is not be used. - * @param mbs_size The size, in bytes, of the buffer pointed to by the - * \a mbstr argument. If this value is zero, the function - * returns the number of bytes required for the buffer. - * @param ucs2str The pointer to the UCS-2 string to be converted. - * @param ucs_size The size, in number of UCS-2 characters, of the UCS-2 - * string, \a ucs2str. - * @retval size_t The number of bytes written to \a mbstr buffer if - * the conversion is successful. If \a mbs_size is zero, - * the return value is the required size, in bytes, for a - * buffer to receive the converted string. This function - * returns zero if an error occurred. - */ -UCS2API size_t ucs2toutf8(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size); - -/** - * Convert a UTF-8 string to a UCS-2 string. - * - * @param ucs2str The pointer to the buffer for receiving UCS-2 string - * converted from the UTF-8 string. If \a ucs_size is - * zero, this argument is not be used. - * @param ucs_size The size, in number of UCS-2 characters, of the buffer - * pointed to by the \a ucs2str argument. If this value is - * zero, the function returns the number of UCS-2 - * characters required for the buffer. - * @param mbstr The pointer to the UTF-8 string to be converted. - * @param mbs_size The size, in bytes, of the UTF-8 string, \a mbstr. - * @retval size_t The number of UCS-2 characters written to \a ucs2str - * buffer if the conversion is successful. If \a ucs_size - * is zero, the return value is the required size, in - * number of UCS-2 characters, for a buffer to receive the - * converted string. This function returns zero if an error - * occurred. - */ -UCS2API size_t utf8toucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size); - -/** - * Convert and duplicate a UCS-2 string to multi-byte characters. - * - * @param ucs2str The pointer to a UCS-2 string. - * @retval char* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API char *ucs2dupmbs(const ucs2char_t *ucs2str); - -/** - * Convert and duplicate multi-byte characters to a UCS-2 string. - * - * @param mbstr The pointer to multi-byte characters. - * @retval char* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API ucs2char_t* mbsdupucs2(const char *mbstr); - -/** - * Convert and duplicate multi-byte characters in a specific encoding - * to a UCS-2 string. - * - * @param mbstr The pointer to multi-byte characters. - * @param charset The pointer to the string specifying the encoding of - * the multi-byte characters. - * @retval char* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API ucs2char_t* mbsdupucs2_charset(const char *mbstr, const char *charset); - -/** - * Convert and duplicate a UCS-2 string to a UTF-8 string. - * - * @param ucs2str The pointer to a UCS-2 string. - * @retval char* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API char *ucs2duputf8(const ucs2char_t *ucs2str); - -/** - * Convert and duplicate a UTF-8 string to a UCS-2 string. - * - * @param mbstr The pointer to multi-byte characters. - * @retval char* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API ucs2char_t* utf8dupucs2(const char *utf8str); - -/** - * @} - */ - - - -/** - * @defgroup ucs2_memory Memory manager routines - * @{ - */ - -/** - * Allocate a memory block. - * - * @param size The size, in bytes, of the memory block. - * @retval void* The pointer to the allocated memory block. - */ -UCS2API void *ucs2malloc(size_t size); - -/** - * Allocate a memory block with values initialized as zero. - * - * @param size The size, in bytes, of the memory block. - * @retval void* The pointer to the allocated memory block. - */ -UCS2API void *ucs2calloc(size_t size); - -/** - * Resize a memory block. - * - * @param ptr The pointer to the memory block to be resized. - * @param size The size, in bytes, of the new memory block. - * @retval void* The pointer to the new memory block. - */ -UCS2API void *ucs2realloc(void *ptr, size_t size); - -/** - * Free a memory block. - * - * @param ptr The pointer to the memory block to be freed. - */ -UCS2API void ucs2free(void* ptr); - -/** - * @} - */ - -/** - * @defgroup ucs2_char UCS-2 character routines - * @{ - */ - -/** - * Test whether a USC-2 character is a surrogate-pair character in UTF-16. - * @param c The UCS-2 character to be tested. - * @retval int Non-zero value if the test is true, zero otherwise. - */ -UCS2API int ucs2issurrogate(ucs2char_t c); - -/** - * Test whether a USC-2 character is a whitespace character. - * @param c The UCS-2 character to be tested. - * @retval int Non-zero value if the test is true, zero otherwise. - */ -UCS2API int ucs2isspace(ucs2char_t c); - -/** - * Test whether a USC-2 character is a numeric character. - * @param c The UCS-2 character to be tested. - * @retval int Non-zero value if the test is true, zero otherwise. - */ -UCS2API int ucs2isdigit(ucs2char_t c); - -/** - * Convert a UCS-2 character to lower case. - * @param c The UCS-2 character to be coverted. - * @retval ucs2char_t The resultant UCS-2 character. - */ -UCS2API ucs2char_t ucs2lower(ucs2char_t c); - -/** - * Convert a UCS-2 character to upper case. - * @param c The UCS-2 character to be coverted. - * @retval ucs2char_t The resultant UCS-2 character. - */ -UCS2API ucs2char_t ucs2upper(ucs2char_t c); - -/** - * @} - */ - - - - - -/** - * @defgroup ucs2_string_ansi ANSI C compatible string routines - * @{ - * - * This is the subset of the UCS-2 Character/String API that corresponds - * to string manupulation routines in the ANSI C standard. The following - * ANSI C functions are not defined in this subset: - * strcoll, strerror, strtok, strxfrm. - */ - -/** - * Concatenate two strings. - * - * @param dst The pointer to the destination of a string. - * @param src The pointer to the source of a string. - * @retval ucs2char_t* The pointer to the destination string. - */ -UCS2API ucs2char_t* ucs2cat(ucs2char_t* dst, const ucs2char_t* src); - -/** - * Search for the first occurrence of a character in a string. - * - * @param str The pointer to the string in which \a c is searched. - * @param c The target character. - * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL - * if \a c does not occur in \a str. - */ -UCS2API ucs2char_t* ucs2chr(const ucs2char_t* str, ucs2char_t c); - -/** - * Compare two strings. - * - * @param x The pointer to a string. - * @param y The pointer to another string. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. - */ -UCS2API int ucs2cmp(const ucs2char_t* x, const ucs2char_t* y); - -/** - * Copy a string. - * - * @param dst The pointer to the destination of a string. - * @param src The pointer to the source of a string. - * @retval ucs2char_t* The pointer to the destination string. - */ -UCS2API ucs2char_t* ucs2cpy(ucs2char_t* dst, const ucs2char_t* src); - -/** - * Count the number of characters not appearing in a character set. - * - * @param str The pointer to a string. - * @param charset The pointer to a character set. - * @retval size_t The number of characters from the beginning of \a str - * in which any character in \a charset appear for the - * first time, or the length of \a str if such a character - * does not exist. - */ -UCS2API size_t ucs2cspn(const ucs2char_t *str, const ucs2char_t *charset); - -/** - * Count the length of a string. - * - * @param str The pointer to a string. - * @retval size_t The number of characters in \a str. - */ -UCS2API size_t ucs2len(const ucs2char_t* str); - -/** - * Concatenate two strings (no more than the maximum length). - * - * @param dst The pointer to the destination of a string. - * @param src The pointer to the source of a string. - * @param n The number of characters to be concatenated. - * @retval ucs2char_t* The pointer to the destination string. - */ -UCS2API ucs2char_t* ucs2ncat(ucs2char_t *dst, const ucs2char_t *src, size_t n); - -/** - * Compare two strings (no longer than the maximum length). - * - * @param x The pointer to a string. - * @param y The pointer to another string. - * @param n The number of characters to be compared. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. - */ -UCS2API int ucs2ncmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); - -/** - * Copy a string (no more than the maximum length). - * - * @param dst The pointer to the destination of a string. - * @param src The pointer to the source of a string. - * @param n The number of characters to be copied. - * @retval ucs2char_t* The pointer to the destination string. - */ -UCS2API ucs2char_t* ucs2ncpy(ucs2char_t* dst, const ucs2char_t* src, size_t n); - -/** - * Find a character in a string that belongs to a character set. - * - * @param str The pointer to the string where \a charset is searched. - * @param charset The pointer to a character set. - * @retval ucs2char_t* The pointer to the character in \a str that belongs - * to \a charset, or \c NULL if such a character does not - * exist. - */ -UCS2API ucs2char_t* ucs2pbrk(const ucs2char_t *str, const ucs2char_t *charset); - -/** - * Search for the last occurrence of a character in a string. - * - * @param str The pointer to the string in which \a c is searched. - * @param c The target character. - * @retval ucs2char_t* The pointer to the character \a c in \a str, or \c NULL - * if \a c does not occur in \a str. - */ -UCS2API ucs2char_t* ucs2rchr(const ucs2char_t* string, ucs2char_t c); - -/** - * Find a character in a string that does not belong to a character set. - * - * @param str The pointer to the string where \a charset is searched. - * @param charset The pointer to a character set. - * @retval ucs2char_t* The pointer to the character in \a str that does not - * belong to \a charset, or \c NULL if such a character - * does not exist. - */ -UCS2API size_t ucs2spn(const ucs2char_t *str, const ucs2char_t *charset); - -/** - * Find a substring in a string. - * - * @param str The pointer to the string where \a substr is searched. - * @param substr The pointer to the substring. - * @retval ucs2char_t* The pointer to the character where \a substr begins - * in \a str for the first time, or \c NULL if \a str - * does not contain \a substr. - */ -UCS2API ucs2char_t* ucs2str(const ucs2char_t* str, const ucs2char_t* substr); - -/** - * @} - */ - - - - - -/** - * @defgroup ucs2_string_non_ansi Miscellaneous string routines - * @{ - */ - -/** - * Duplicate a string. - * - * @param str The pointer to a string. - * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API ucs2char_t* ucs2dup(const ucs2char_t* str); - -/** - * Duplicate a string no longer than the specified length. - * - * @param str The pointer to a string. - * @param length The maximum length of the duplicated string. - * @retval ucs2char_t* The pointer to the duplicated string. Call ucs2free() - * to free the memory block allocated by this function. - */ -UCS2API ucs2char_t* ucs2ndup(const ucs2char_t* src, size_t length); - -/** - * Convert a string to lowercase. - * - * Given \a str argument, this function converts uppercase letters in the - * string to lowercase and overwrites the resultant string on the same buffer - * pointed by the \a str argument. - * - * @param str The pointer to a string. - * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. - */ -UCS2API ucs2char_t* ucs2lwr(ucs2char_t* str); - -/** - * Convert a string to uppercase. - * - * Given \a str argument, this function converts lowercase letters in the - * string to uppercase and overwrites the resultant string on the same buffer - * pointed by the \a str argument. - * - * @param str The pointer to a string. - * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. - */ -UCS2API ucs2char_t* ucs2upr(ucs2char_t* str); - -/** - * Compare two strings incasesensitively. - * - * @param x The pointer to a string. - * @param y The pointer to another string. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. - */ -UCS2API int ucs2icmp(const ucs2char_t* x, const ucs2char_t* y); - -/** - * Compare two strings incasesensitively (no longer than the maximum length). - * - * @param x The pointer to a string. - * @param y The pointer to another string. - * @param n The number of characters to be compared. - * @retval int A positive value if \a x is greater than \a y; - * a negative value if \a x is smaller than \a y; - * zero if \a x is identical to \a y. - */ -UCS2API int ucs2incmp(const ucs2char_t* x, const ucs2char_t* y, size_t n); - -/** - * Strip whitespace characters at the head and tail of a string. - * - * Given \a str argument, this function trims whilespace characters at the - * head and tail of the string and overwrites the resultant string on the - * same buffer pointed by the \a str argument. - * - * @param str The pointer to a string. - * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. - */ -UCS2API ucs2char_t* ucs2strip(ucs2char_t* str); - -/** - * @} - */ - - - -/** - * @defgroup ucs2_std Wrapper for stdio/stdlib routines - * @{ - */ - -/** - * Convert a UCS-2 string to integer value. - * @param str The pointer to a string. - * @retval int The corresponding integer value. - */ -UCS2API int ucs2toi(const ucs2char_t* str); - -/** - * Convert an integer value to UCS-2 string. - * @param value The integer value. - * @param string The pointer to the buffer to receive the string. - * @param radix Radix of the \a value. - * @retval ucs2char_t* The pointer to the string, which is the same value as - * \a str. - */ -UCS2API ucs2char_t* itoucs2(int value, ucs2char_t *string, int radix); - -/** - * Open a stream from a file. - * @param filename The pointer to the UCS-2 string for the file name. - * @param mode The pointer to the C string for the open mode. - * @retval FILE* The pointer to the opened stream if successful, - * NULL otherwise. - */ -UCS2API FILE *ucs2fopen(const ucs2char_t *filename, const char *mode); - -/** - * Write a UCS-2 character to a stream. - * @param c The character to be written. - * @param fp The pointer to the output stream. - * @retval int Zero if successful, non-zero otherwise. - */ -UCS2API int fputucs2c(ucs2char_t c, FILE *fp); - - - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif/*__cplusplus*/ - -#endif/*__UCS2CHAR_H__*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 01:55:11
|
Revision: 314 http://svn.sourceforge.net/pmplib/?rev=314&view=rev Author: nyaochi Date: 2007-02-08 17:55:12 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Moved remotely Added Paths: ----------- trunk/pmplib/include/pmplib/pmp.h Removed Paths: ------------- trunk/pmplib/include/pmp.h Deleted: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-02-09 01:54:50 UTC (rev 313) +++ trunk/pmplib/include/pmp.h 2007-02-09 01:55:12 UTC (rev 314) @@ -1,826 +0,0 @@ -/* - * Digital Media Player library. - * - * Copyright (c) 2005-2006 Nyaochi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/* $Id$ */ - -#ifndef __PMP_H__ -#define __PMP_H__ - -#ifdef PMP_EXPORTS -#define PMPAPI __declspec(dllexport) -#else -#define PMPAPI -#endif/*PMP_EXPORTS*/ - -#ifdef __cplusplus -extern "C" { -#endif/*__cplusplus*/ - - -/** - * @mainpage PMPlib API Documentation - * - * @section intro Introduction - * - * This is the documentation for the PMPlib API. - */ - -/** - * \addtogroup pmp PMPlib APIs - * @{ - */ - -/* - * Forward structure declarations. - */ -struct tag_pmp_t; typedef struct tag_pmp_t pmp_t; -struct tag_pmp_music_t; typedef struct tag_pmp_music_t pmp_music_t; - -/** - * Error codes. - */ -enum { - PMP_SUCCESS = 0, - PMP_DEVICENOTFOUND, - PMP_NOTSUPPORTED, - PMP_INSUFFICIENTMEMORY, - PMP_NOTIMPLIMENTED, - PMPDBE_OUTOFMEMORY, - PMPDBE_NOTFOUND, - PMPDBE_INVALIDTYPE, - PMPDBE_DBINCONSIST, - PMPDBE_NOTINITIALIZED, - PMPDBE_INVALIDLEAFID, - PMPDBE_OPENFORREAD, - PMPDBE_OPENFORWRITE, - PMPDBE_INSUFFICIENT, - PMPPLE_WRITE, -}; - -/** - * Open flags for portable media device. - * Specify one or more flags to pmp_t::open() member function. - */ -enum { - /** - * Read access to the music database. - * The member function pmp_t::open() will read the music database. - */ - PMPOF_MUSIC_DB_READ = 0x0001, - /** - * Write access to the music database. - * The member function pmp_t::close() will write the music database. - */ - PMPOF_MUSIC_DB_WRITE = 0x0002, - /** - * Read access to the music playlists. - * The member function pmp_t::open() will read the music playlists. - */ - PMPOF_MUSIC_PL_READ = 0x0004, - /** - * Write access to the music playlists. - * The member function pmp_t::close() will write the music playlists. - */ - PMPOF_MUSIC_PL_WRITE = 0x0008, -}; - -/** - * Macro to define FourCC representations of codecs. - */ -#define PMPFOURCC(a, b, c, d) \ - ((uint32_t)(a) << 24 | (uint32_t)(b) << 16 | (uint32_t)(c) << 8 | (uint32_t)(d)) - -#define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') /**< Unknown codec. */ -#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') /**< MPEG Audio Layer III */ -#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') /**< Windows Media Audio */ -#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') /**< Ogg Vorbis */ -#define PMPCODEC_WAV PMPFOURCC('W','A','V','E') /**< Microsoft Riff WAVE */ - -enum { - PMPPEF_NONE = 0x0000, - PMPPEF_SUPPORT = 0x0001, - PMPPEF_CONSTANT = 0x0002, - PMPPEF_RECURSIVE = 0x0004, -}; - -enum { - PMPMF_NONE = 0x0000, - PMPMF_SUPPORT = 0x0001, - PMPMF_RECURSIVE = 0x0002, -}; - -enum { - PMPPF_NONE = 0x0000, - PMPPF_SUPPORT = 0x0001, - PMPPF_RECURSIVE = 0x0002, -}; - - - -/** - * @defgroup device PMPlib Device API - * @{ - */ - -/** Maximum size, in chars, of a device description. */ -#define PMP_DECLSIZE (128) -/** Unavailable field of a device description. */ -#define PMP_DECLUNAVAIL ("***") - -/** - * PMP device decription. - * This structure stores information about a PMP device. A PMP device driver - * should fill these fields properly so that an application can obtain the - * information about the device. An empty value represents the uncertainity - * of the field value at this stage. The value ::PMP_DECLUNAVAIL (\c "***") - * implies the unavailability of the field value for the device. - */ -typedef struct { - /** Device identifier (e.g., "iriver_e10_ums_1.0-1.4"). */ - char id[PMP_DECLSIZE]; - /** Manufacturer (e.g., "iriver"). */ - char manufacturer[PMP_DECLSIZE]; - /** Model name (e.g., "E10"). */ - char name[PMP_DECLSIZE]; - /** Firmware mode (e.g., "UM"). */ - char mode[PMP_DECLSIZE]; - /** Firmware default language (e.g., "JP"). */ - char language[PMP_DECLSIZE]; - /** Firmware version (e.g., "1.4"). */ - char version[PMP_DECLSIZE]; - /** Minimum firmware version (e.g., "1.0"). */ - char min_version[PMP_DECLSIZE]; - /** Maximum firmware version (e.g., "1.4"). */ - char max_version[PMP_DECLSIZE]; -} pmp_device_description_t; - -/** - * PMP device environment. - * This structure stores information about predefined paths, capability, - */ -typedef struct { - /** Path to the root directory of the player. */ - ucs2char_t path_to_root[MAX_PATH]; - /** Relative path to the system directory from the root. */ - ucs2char_t path_to_system[MAX_PATH]; - /** Relative path to the music directory from the root. */ - ucs2char_t path_to_music[MAX_PATH]; - /** Relative path to the playlist directory from the root. */ - ucs2char_t path_to_playlist[MAX_PATH]; - - /** Music flags. */ - uint32_t music_flag; - /** Playlist flags. */ - uint32_t playlist_flag; - - /** Number of elements in \a audio_codecs array. */ - uint32_t num_audio_codecs; - /** Array of PMPFOURCC values corresponding to the supported audio codecs. */ - uint32_t* audio_codecs; - - /** Number of elements in \a audio_extensions array. */ - uint32_t num_audio_extensions; - /** Array of ucs2char_t string values for audio file extensions. */ - ucs2char_t** audio_extensions; - - /** Description about the device. */ - const pmp_device_description_t decl; -} pmp_device_information_t; - -/** - * The root interface for portable media device. - * - * This structure represents the basic interface that is common to any - * portal media devices. It defines several member variables and pure - * virtual functions to access the implementation for the target device. - * Use pmplib_create() function to obtain the instance suitable for a - * specific device. - * - * @see pmplib_create - */ -struct tag_pmp_t { - /** - * Pointer for the internal use. - * - * This member variable is reserved for the internal use of the library. - * Do not modify the value. - */ - void* instance; - - /** - * Reference counter. - * - * This member variable is reserved for the library to manage the - * reference counter. Do not modify the value directly. Call - * member functions add_ref() and release() to increase and - * decrease the reference counter. - */ - uint32_t ref_count; - - /** - * Open flags. - * - * This member variable is reserved for the library to store the - * flags specified in open() function. Do not modify the value. - */ - uint32_t flag; - - /** - * PMP device decription. - */ - pmp_device_information_t info; - - /** - * The pointer to pmp_music_t interface. - */ - pmp_music_t* music; - - /** - * Increment the reference counter. - * @param pmp The pointer to the pmp_t instance. - */ - uint32_t (*add_ref)(pmp_t* pmp); - - /** - * Decrement the reference counter. - * If the reference counter becomes zero after this decrement, - * this function will destroy the pmp_t instance. - * @param pmp The pointer to the pmp_t instance. - */ - uint32_t (*release)(pmp_t* pmp); - - /** - * Open the PMP device. - * @param pmp The pointer to the pmp_t instance. - * @param flag The open flags. - */ - result_t (*open)(pmp_t* pmp, uint32_t flag); - - /** - * Close the PMP device. - * @param pmp The pointer to the pmp_t instance. - */ - result_t (*close)(pmp_t* pmp); -}; - -/** - * @} - */ - -/** - * @defgroup music PMPlib Music API - * @{ - */ - -/** - * Structure for a music record. - */ -struct tag_pmp_music_record_t { - /** - * Relative path for the music file from the mount location of the device. - * The path character must be '\\' on all platforms (including POSIX). - * e.g., "\\Music\\Beatles\\AbbeyRoad\\01_AbbeyRoad.mp3" - * @assert @code filename != NULL @endcode - */ - ucs2char_t *filename; - - /** - * Title name. - * e.g., "Come Together" - * @assert @code title != NULL @endcode - */ - ucs2char_t *title; - - /** - * Artist name. - * e.g., "The Beatles" - * @assert @code artist != NULL @endcode - */ - ucs2char_t *artist; - - /** - * Composer. - * e.g., "John Lennon" - * @assert @code composer != NULL @endcode - */ - ucs2char_t *composer; - - /** - * Album name. - * e.g., "Abbey Road" - * @assert @code album != NULL @endcode - */ - ucs2char_t *album; - - /** - * Genre name. - * e.g., "Rock" - * @assert @code genre != NULL @endcode - */ - ucs2char_t *genre; - - /** - * Release date. - * e.g., "1969" - * @assert @code date != NULL @endcode - */ - ucs2char_t *date; - - /** - * FourCC representation of the codec. - * e.g., PMPCODEC_MPEGLAYER3 - */ - uint32_t codec; - - /** - * Track number. - * e.g., 1 - */ - uint32_t track_number; - - /** - * Sample rate in [Hz]. - * e.g., 44100 - */ - uint32_t sample_rate; - - /** - * Bitrate in [bps]. - * e.g., 128000 - */ - uint32_t bitrate; - - /** - * Duration in seconds. - * e.g., 260 - */ - uint32_t duration; - - /** - * File size in bytes. - * e.g., 4160000 - */ - uint32_t filesize; - - /** - * Timestamp of the last update of the music file. - * The value is equivalent to \c st.st_mtime after \c stat(&st, filename); - */ - uint32_t ts_update; - - /** - * Rating. - * e.g., 5 - */ - uint32_t rating; - - /** - * Play count on the device. - * e.g., 23 - */ - uint32_t play_count; - - /** - * Timestamp of the recent playback on the device. - */ - uint32_t ts_playback; - - /** - * timestamp when the track was imported. - */ - uint32_t ts_import; -}; -typedef struct tag_pmp_music_record_t pmp_music_record_t; - -typedef struct { - ucs2char_t *name; - int num_entries; - ucs2char_t **entries; -} pmp_playlist_t; - -/** - * Interface for organizing music files. - * - * This interface is responsible for several operations relevant to music - * files in a portable media device. The major operations are: - * - setting a list of music records for building a music database - * - getting a list of music records from the existing music database - * - dumping the existing music database in a text format - * - setting a list of music files for generating - * - getting a list of music playlists used by the device - * - * You cannot create an instance of this structure by yourself. Access - * pmp_t::music member to obtain this interface. - */ -struct tag_pmp_music_t { - /** - * Pointer for the internal use. - * - * This member variable is reserved for the internal use of the library. - * Do not modify the value. - */ - void* instance; - - /** - * The pointer to pmp_t interface. - * - * @assert - * @code this->pmp->music == this @endcode - */ - pmp_t* pmp; - - /** - * Set a list of music records. - * - * This function sets a list of music records that provide a complete - * information about all music files on a device. Based on this list, - * PMPlib will build a music database on the device. - * - * This function does not write out any content on the player immediately - * for the following reason. Some portable devices manage a music database - * and playlists separately, but some integrate playlist information into - * a music database. In the latter case, PMPlib cannot build a music - * database until a definitive list of playlists is obtained. In order to - * support various devices in a unified interface, this function reserves - * a future update of the music database; a database update is prolonged - * until the device is closed by pmp->close() call. - * - * @param music The pointer to the pmp_music_t interface. - * @param records An array of music records. - * @param num_records The number of elements in \a records array. - * @retval result_t The status code after this operation. - * - * @assert - * @code music != NULL @endcode - * @code records != NULL @endcode - */ - result_t (*set_records)(pmp_music_t* music, const pmp_music_record_t* records, uint32_t num_records); - - /** - * Get a list of music records. - * - * This function gets the list of music records in the existing music - * database or set by \a set_records call. - * - * If the argument \a records is NULL, this function returns the number of - * music records to the variable whose address is specified by the - * argument \a num_records. You can use this for determining the size of - * array \a records necessary to obtain all records from this function. - * - * If the argument \a records is not NULL, this function copies the - * current music records to the array whose address is specified by the - * argument \a records and whose size is specified by the variable - * pointed by the argument \a num_records. - * - * @param music The pointer to the pmp_music_t interface. - * @param records An array of music records. - * @param num_records The pointer to the variable presenting the number - * of elements in \a records array. - * @retval result_t The status code after this operation. - * - * @assert - * @code music != NULL @endcode - * @code num_records != NULL @endcode - */ - result_t (*get_records)(pmp_music_t* music, pmp_music_record_t* records, uint32_t* num_records); - - /** - * Set a list of music playlists. - * - * This function sets a list of music playlists. PMPlib will generate the - * playlists on the device based on this list. - * - * This function does not write out any content on the player immediately; - * playlist generation is prolonged until the device is closed by - * pmp->close() call. - * - * @param music The pointer to the pmp_music_t interface. - * @param playlists An array of music playlists. - * @param num_playlists The number of elements in \a playlists array. - * @retval result_t The status code after this operation. - * - * @assert - * @code music != NULL @endcode - * @code playlists != NULL @endcode - */ - result_t (*set_playlists)(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists); - - /** - * Get a list of music playlists. - * - * This function gets the list of music playlists in the device or set by - * \a set_playlists call. - * - * If the argument \a playlists is NULL, this function returns the number - * of music playlists to the variable whose address is specified by the - * argument \a num_playlists. You can use this for determining the size of - * array \a playlists necessary to obtain all playlists. - * - * If the argument \a playlists is not NULL, this function copies the - * current music playlists to the array whose address is specified by the - * argument \a playlists and whose size is specified by the variable - * pointed by the argument \a num_playlists. - * - * @param music The pointer to the pmp_music_t interface. - * @param playlists An array of music playlists. - * @param num_playlists The pointer to the variable presenting the - * number of elements in \a playlists array. - * @retval result_t The status code after this operation. - * - * @assert - * @code music != NULL @endcode - * @code num_playlists != NULL @endcode - */ - result_t (*get_playlists)(pmp_music_t* music, pmp_playlist_t* playlists, uint32_t* num_playlists); - - /** - * Dump the music database. - * - * @param music The pointer to the pmp_music_t interface. - * @param fp The pointer to an output stream. - * @param flag The flags. - * @retval result_t The status code after this operation. - * - * @assert - * @code music != NULL @endcode - */ - result_t (*dump)(pmp_music_t* music, FILE *fp, int flag); -}; - -/** - * Initialize pmp_music_record_t structure. - * - * @param record The pointer to pmp_music_record_t instance. - */ -PMPAPI void pmplib_record_init(pmp_music_record_t* record); - -/** - * Uninitialize pmp_music_record_t structure. - * - * This function frees the memory blocks used by the \a record. - * - * @param record The pointer to pmp_music_record_t instance. - */ -PMPAPI void pmplib_record_finish(pmp_music_record_t* record); - -/** - * Clone a pmp_music_record_t record. - * - * This function copies the values in the \a src record to \a dst. - * - * @param dst The pointer to the destination. - * @param src The pointer to the source. - * @retval result_t The status code after this operation. - */ -PMPAPI result_t pmplib_record_clone(pmp_music_record_t* dst, const pmp_music_record_t* src); - -/** - * Uninitialize an array of pmp_music_record_t records. - * - * This function frees the memory blocks used by each record in the array and - * the array. - * - * @param record The pointer to pmp_music_record_t array. - * @param num_records The number of elements in the array. - */ -PMPAPI void pmplib_records_finish(pmp_music_record_t* records, int num_records); - -/** - * Clone a pmp_music_record_t array. - * - * This function copies all records in the \a src array to \a dst. - * - * @param dst The destination array. - * @param src The source array. - * @param num_records The number of elements in the source array. - * @retval result_t The status code after this operation. - */ -PMPAPI result_t pmplib_records_clone(pmp_music_record_t* dst, const pmp_music_record_t* src, int num_records); - -PMPAPI void pmplib_playlist_init(pmp_playlist_t* playlist); -PMPAPI void pmplib_playlist_finish(pmp_playlist_t* playlist); -PMPAPI void pmplib_playlist_clone(pmp_playlist_t* dst, const pmp_playlist_t* src); - -PMPAPI void pmplib_playlists_finish(pmp_playlist_t* playlist, int num_playlists); -PMPAPI void pmplib_playlists_clone(pmp_playlist_t* dst, const pmp_playlist_t* src, int num_playlists); - -/** - * @} - */ - - -typedef result_t (*pmplib_create_t)(pmp_t** pmp, const ucs2char_t* path_to_device, const char *devid); - -/** - * Prototype for the callback function for receiving device identifiers. - * - */ -typedef void (*pmplib_enumerate_devid_callback_t)(void *instance, const char *devid); -typedef result_t (*pmplib_enumerate_devid_t)(pmplib_enumerate_devid_callback_t callback, void *instance); - -PMPAPI uint32_t pmplib_interlocked_increment(uint32_t* count); -PMPAPI uint32_t pmplib_interlocked_decrement(uint32_t* count); - - - - - - -/** - * @defgroup pmplib PMPlib Helper API - * @{ - * - * The PMPlib Helper API provides the utility for choosing a suitable PMPlib - * driver from a number of installed drivers. Because the PMPlib project - * implements a number of drivers for different portable media devices, an - * application must choose a suitable driver that matches to the target - * device. By using this API, an application can query a driver suitable for - * the portable media device specified by the mount location (root directory - * of the device) and/or the string identifier of a driver. An application can - * also enumerate the string identifiers of the drivers available in the - * system. - * - * An application must call pmplib_init() function to initialize the API - * and obtain the pointer to a ::pmplib_t instance that is used for subsequent - * calls of the API. - * The application can query an interface to a PMPlib driver by using - * pmplib_create() function. A list of installed device identifiers is - * obtained by receiving callback notifications invoked by - * pmplib_enumerate_devid() function. The application must terminate this - * API by calling pmplib_finish() function. - * - * This is an example of querying an interface to the driver that matches to - * the device connected to the mount point (Win32 path "D:\"): - * - * @code - * #include <ucs2char.h> - * #include <pmp.h> - * - * int main(int argc, char *argv[]) - * { - * result_t ret = 0; - * pmp_t* pmp = NULL; - * pmplib_t* pmplib = NULL; - * static const ucs2char_t path[] = {'D',':','\\',0}; - * - * // Initialize the PMPlib Helper API. - * if ((ret = pmplib_init(&pmplib)) != 0) { - * // Failed to initialize the API. - * goto error_exit; - * } - * - * // Query an interface to the PMPlib driver suitable for the path. - * if ((ret = pmplib_create(pmplib, &pmp, path, NULL)) != 0) { - * // Failed to find a suitable driver. - * goto error_exit; - * } - * - * // Processing with the driver. - * ... - * - * // Release the driver. - * pmp->release(pmp); - * - * // Terminate the helper API. - * pmplib_finish(pmplib); - * return 0; - * - * error_exit: - * // Error handling. - * ... - * return 1; - * } - * @endcode - * - * @{ - */ - -struct tag_pmplib_t; - -/** - * The structure for the PMPlib Helper API. - * An application should use a pointer to this structure as a handle value - * for this API. Call pmplib_init() function to obtain a pointer to this - * structure and pmplib_finish() function to terminate this API. Access to - * a member in this structure is prohibited since it is reserved for the - * internal use of the library only. - */ -typedef struct tag_pmplib_t pmplib_t; - -/** - * Initialize the PMPlib helper library. - * - * This function loads the drivers installed in the system to prepare them. - * - * @retval ptr_pmplib The pointer to the buffer to receive the pointer - * to the ::pmplib_t instance initialized by this - * function. - * @retval result_t The status code. - * - * @assert - * @code ptr_pmplib != NULL @endcode - * - * @note - * Call this function before using any other functions in this API. - */ -PMPAPI result_t pmplib_init(pmplib_t** ptr_pmplib); - -/** - * Uninitialize the PMPlib helper library. - * - * This function detatch the drivers loaded by pmplib_init() function. - * - * @param pmplib The pointer to the ::pmplib_t instance. - * @retval result_t The status code. - * - * @assert - * @code ptr_pmplib != NULL @endcode - * - * @note - * Call this function to terminate this API. - */ -PMPAPI result_t pmplib_finish(pmplib_t* pmplib); - -/** - * Query a driver and create a ::pmp_t instance. - * - * This function queries the driver suitable for the portable media device - * specified by the mount location and/or identifier, and returns the - * interface to the driver (::pmp_t instance). An application must specify - * parameter \a path_to_device. If parameter \a id is not \c NULL, this - * function obtains the interface to the driver with the device identifier - * specified in \a id parameter. If the parameter \a id is \c NULL, this - * function tries to recognize the model of the device based on the content - * of the files located under \a path_to_device. If successful, the interface - * to the driver will be returned in the \a pmp argument. - * - * @param pmplib The pointer to the ::pmplib_t instance. - * @param path_to_device A UCS-2 string representing the location of the - * target device. This parameter cannot be \c NULL. - * @param id A C-string representing the device identifier of - * the target device. If this argument is \c NULL, - * this function tries to recognize the model of the - * device based on the location (\a path_to_device). - * @retval ptr_pmp The pointer to the buffer to receive the pointer - * to the driver interface (::pmp_t instance). - * @retval result_t The status code. - * - * @assert - * @code pmplib != NULL @endcode - * @code ptr_pmp != NULL @endcode - * @code path_to_device != NULL @endcode - */ -PMPAPI result_t pmplib_create(pmplib_t* pmplib, pmp_t** ptr_pmp, const ucs2char_t* path_to_device, const char *id); - -/** - * Enumerate device identifiers of the installed drivers. - * - * This function enumerates the device identifiers of the installed drivers, - * and invokes the \a callback function for each identifier. - * - * @param pmplib The pointer to the ::pmplib_t instance. - * @param callback The pointer to the callback function to receive - * device identifiers. - * @param instance A user-defined instance value. The callback - * function will receive the same value. - * @retval result_t The status code. - * - * @assert - * @code pmplib != NULL @endcode - * @code callback != NULL @endcode - */ -PMPAPI result_t pmplib_enumerate_devid(pmplib_t* pmplib, pmplib_enumerate_devid_callback_t callback, void *instance); - -/** - * @} - */ - -/** - * @} - */ - - -#ifdef __cplusplus -} -#endif/*__cplusplus*/ - -#endif/*__PMP_H__*/ - Copied: trunk/pmplib/include/pmplib/pmp.h (from rev 313, trunk/pmplib/include/pmp.h) =================================================================== --- trunk/pmplib/include/pmplib/pmp.h (rev 0) +++ trunk/pmplib/include/pmplib/pmp.h 2007-02-09 01:55:12 UTC (rev 314) @@ -0,0 +1,826 @@ +/* + * Digital Media Player library. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifndef __PMP_H__ +#define __PMP_H__ + +#ifdef PMP_EXPORTS +#define PMPAPI __declspec(dllexport) +#else +#define PMPAPI +#endif/*PMP_EXPORTS*/ + +#ifdef __cplusplus +extern "C" { +#endif/*__cplusplus*/ + + +/** + * @mainpage PMPlib API Documentation + * + * @section intro Introduction + * + * This is the documentation for the PMPlib API. + */ + +/** + * \addtogroup pmp PMPlib APIs + * @{ + */ + +/* + * Forward structure declarations. + */ +struct tag_pmp_t; typedef struct tag_pmp_t pmp_t; +struct tag_pmp_music_t; typedef struct tag_pmp_music_t pmp_music_t; + +/** + * Error codes. + */ +enum { + PMP_SUCCESS = 0, + PMP_DEVICENOTFOUND, + PMP_NOTSUPPORTED, + PMP_INSUFFICIENTMEMORY, + PMP_NOTIMPLIMENTED, + PMPDBE_OUTOFMEMORY, + PMPDBE_NOTFOUND, + PMPDBE_INVALIDTYPE, + PMPDBE_DBINCONSIST, + PMPDBE_NOTINITIALIZED, + PMPDBE_INVALIDLEAFID, + PMPDBE_OPENFORREAD, + PMPDBE_OPENFORWRITE, + PMPDBE_INSUFFICIENT, + PMPPLE_WRITE, +}; + +/** + * Open flags for portable media device. + * Specify one or more flags to pmp_t::open() member function. + */ +enum { + /** + * Read access to the music database. + * The member function pmp_t::open() will read the music database. + */ + PMPOF_MUSIC_DB_READ = 0x0001, + /** + * Write access to the music database. + * The member function pmp_t::close() will write the music database. + */ + PMPOF_MUSIC_DB_WRITE = 0x0002, + /** + * Read access to the music playlists. + * The member function pmp_t::open() will read the music playlists. + */ + PMPOF_MUSIC_PL_READ = 0x0004, + /** + * Write access to the music playlists. + * The member function pmp_t::close() will write the music playlists. + */ + PMPOF_MUSIC_PL_WRITE = 0x0008, +}; + +/** + * Macro to define FourCC representations of codecs. + */ +#define PMPFOURCC(a, b, c, d) \ + ((uint32_t)(a) << 24 | (uint32_t)(b) << 16 | (uint32_t)(c) << 8 | (uint32_t)(d)) + +#define PMPCODEC_NONE PMPFOURCC(' ',' ',' ',' ') /**< Unknown codec. */ +#define PMPCODEC_MPEGLAYER3 PMPFOURCC('M','P','1','3') /**< MPEG Audio Layer III */ +#define PMPCODEC_WMA PMPFOURCC('W','M','A',' ') /**< Windows Media Audio */ +#define PMPCODEC_VORBIS PMPFOURCC('O','V','1',' ') /**< Ogg Vorbis */ +#define PMPCODEC_WAV PMPFOURCC('W','A','V','E') /**< Microsoft Riff WAVE */ + +enum { + PMPPEF_NONE = 0x0000, + PMPPEF_SUPPORT = 0x0001, + PMPPEF_CONSTANT = 0x0002, + PMPPEF_RECURSIVE = 0x0004, +}; + +enum { + PMPMF_NONE = 0x0000, + PMPMF_SUPPORT = 0x0001, + PMPMF_RECURSIVE = 0x0002, +}; + +enum { + PMPPF_NONE = 0x0000, + PMPPF_SUPPORT = 0x0001, + PMPPF_RECURSIVE = 0x0002, +}; + + + +/** + * @defgroup device PMPlib Device API + * @{ + */ + +/** Maximum size, in chars, of a device description. */ +#define PMP_DECLSIZE (128) +/** Unavailable field of a device description. */ +#define PMP_DECLUNAVAIL ("***") + +/** + * PMP device decription. + * This structure stores information about a PMP device. A PMP device driver + * should fill these fields properly so that an application can obtain the + * information about the device. An empty value represents the uncertainity + * of the field value at this stage. The value ::PMP_DECLUNAVAIL (\c "***") + * implies the unavailability of the field value for the device. + */ +typedef struct { + /** Device identifier (e.g., "iriver_e10_ums_1.0-1.4"). */ + char id[PMP_DECLSIZE]; + /** Manufacturer (e.g., "iriver"). */ + char manufacturer[PMP_DECLSIZE]; + /** Model name (e.g., "E10"). */ + char name[PMP_DECLSIZE]; + /** Firmware mode (e.g., "UM"). */ + char mode[PMP_DECLSIZE]; + /** Firmware default language (e.g., "JP"). */ + char language[PMP_DECLSIZE]; + /** Firmware version (e.g., "1.4"). */ + char version[PMP_DECLSIZE]; + /** Minimum firmware version (e.g., "1.0"). */ + char min_version[PMP_DECLSIZE]; + /** Maximum firmware version (e.g., "1.4"). */ + char max_version[PMP_DECLSIZE]; +} pmp_device_description_t; + +/** + * PMP device environment. + * This structure stores information about predefined paths, capability, + */ +typedef struct { + /** Path to the root directory of the player. */ + ucs2char_t path_to_root[MAX_PATH]; + /** Relative path to the system directory from the root. */ + ucs2char_t path_to_system[MAX_PATH]; + /** Relative path to the music directory from the root. */ + ucs2char_t path_to_music[MAX_PATH]; + /** Relative path to the playlist directory from the root. */ + ucs2char_t path_to_playlist[MAX_PATH]; + + /** Music flags. */ + uint32_t music_flag; + /** Playlist flags. */ + uint32_t playlist_flag; + + /** Number of elements in \a audio_codecs array. */ + uint32_t num_audio_codecs; + /** Array of PMPFOURCC values corresponding to the supported audio codecs. */ + uint32_t* audio_codecs; + + /** Number of elements in \a audio_extensions array. */ + uint32_t num_audio_extensions; + /** Array of ucs2char_t string values for audio file extensions. */ + ucs2char_t** audio_extensions; + + /** Description about the device. */ + const pmp_device_description_t decl; +} pmp_device_information_t; + +/** + * The root interface for portable media device. + * + * This structure represents the basic interface that is common to any + * portal media devices. It defines several member variables and pure + * virtual functions to access the implementation for the target device. + * Use pmplib_create() function to obtain the instance suitable for a + * specific device. + * + * @see pmplib_create + */ +struct tag_pmp_t { + /** + * Pointer for the internal use. + * + * This member variable is reserved for the internal use of the library. + * Do not modify the value. + */ + void* instance; + + /** + * Reference counter. + * + * This member variable is reserved for the library to manage the + * reference counter. Do not modify the value directly. Call + * member functions add_ref() and release() to increase and + * decrease the reference counter. + */ + uint32_t ref_count; + + /** + * Open flags. + * + * This member variable is reserved for the library to store the + * flags specified in open() function. Do not modify the value. + */ + uint32_t flag; + + /** + * PMP device decription. + */ + pmp_device_information_t info; + + /** + * The pointer to pmp_music_t interface. + */ + pmp_music_t* music; + + /** + * Increment the reference counter. + * @param pmp The pointer to the pmp_t instance. + */ + uint32_t (*add_ref)(pmp_t* pmp); + + /** + * Decrement the reference counter. + * If the reference counter becomes zero after this decrement, + * this function will destroy the pmp_t instance. + * @param pmp The pointer to the pmp_t instance. + */ + uint32_t (*release)(pmp_t* pmp); + + /** + * Open the PMP device. + * @param pmp The pointer to the pmp_t instance. + * @param flag The open flags. + */ + result_t (*open)(pmp_t* pmp, uint32_t flag); + + /** + * Close the PMP device. + * @param pmp The pointer to the pmp_t instance. + */ + result_t (*close)(pmp_t* pmp); +}; + +/** + * @} + */ + +/** + * @defgroup music PMPlib Music API + * @{ + */ + +/** + * Structure for a music record. + */ +struct tag_pmp_music_record_t { + /** + * Relative path for the music file from the mount location of the device. + * The path character must be '\\' on all platforms (including POSIX). + * e.g., "\\Music\\Beatles\\AbbeyRoad\\01_AbbeyRoad.mp3" + * @assert @code filename != NULL @endcode + */ + ucs2char_t *filename; + + /** + * Title name. + * e.g., "Come Together" + * @assert @code title != NULL @endcode + */ + ucs2char_t *title; + + /** + * Artist name. + * e.g., "The Beatles" + * @assert @code artist != NULL @endcode + */ + ucs2char_t *artist; + + /** + * Composer. + * e.g., "John Lennon" + * @assert @code composer != NULL @endcode + */ + ucs2char_t *composer; + + /** + * Album name. + * e.g., "Abbey Road" + * @assert @code album != NULL @endcode + */ + ucs2char_t *album; + + /** + * Genre name. + * e.g., "Rock" + * @assert @code genre != NULL @endcode + */ + ucs2char_t *genre; + + /** + * Release date. + * e.g., "1969" + * @assert @code date != NULL @endcode + */ + ucs2char_t *date; + + /** + * FourCC representation of the codec. + * e.g., PMPCODEC_MPEGLAYER3 + */ + uint32_t codec; + + /** + * Track number. + * e.g., 1 + */ + uint32_t track_number; + + /** + * Sample rate in [Hz]. + * e.g., 44100 + */ + uint32_t sample_rate; + + /** + * Bitrate in [bps]. + * e.g., 128000 + */ + uint32_t bitrate; + + /** + * Duration in seconds. + * e.g., 260 + */ + uint32_t duration; + + /** + * File size in bytes. + * e.g., 4160000 + */ + uint32_t filesize; + + /** + * Timestamp of the last update of the music file. + * The value is equivalent to \c st.st_mtime after \c stat(&st, filename); + */ + uint32_t ts_update; + + /** + * Rating. + * e.g., 5 + */ + uint32_t rating; + + /** + * Play count on the device. + * e.g., 23 + */ + uint32_t play_count; + + /** + * Timestamp of the recent playback on the device. + */ + uint32_t ts_playback; + + /** + * timestamp when the track was imported. + */ + uint32_t ts_import; +}; +typedef struct tag_pmp_music_record_t pmp_music_record_t; + +typedef struct { + ucs2char_t *name; + int num_entries; + ucs2char_t **entries; +} pmp_playlist_t; + +/** + * Interface for organizing music files. + * + * This interface is responsible for several operations relevant to music + * files in a portable media device. The major operations are: + * - setting a list of music records for building a music database + * - getting a list of music records from the existing music database + * - dumping the existing music database in a text format + * - setting a list of music files for generating + * - getting a list of music playlists used by the device + * + * You cannot create an instance of this structure by yourself. Access + * pmp_t::music member to obtain this interface. + */ +struct tag_pmp_music_t { + /** + * Pointer for the internal use. + * + * This member variable is reserved for the internal use of the library. + * Do not modify the value. + */ + void* instance; + + /** + * The pointer to pmp_t interface. + * + * @assert + * @code this->pmp->music == this @endcode + */ + pmp_t* pmp; + + /** + * Set a list of music records. + * + * This function sets a list of music records that provide a complete + * information about all music files on a device. Based on this list, + * PMPlib will build a music database on the device. + * + * This function does not write out any content on the player immediately + * for the following reason. Some portable devices manage a music database + * and playlists separately, but some integrate playlist information into + * a music database. In the latter case, PMPlib cannot build a music + * database until a definitive list of playlists is obtained. In order to + * support various devices in a unified interface, this function reserves + * a future update of the music database; a database update is prolonged + * until the device is closed by pmp->close() call. + * + * @param music The pointer to the pmp_music_t interface. + * @param records An array of music records. + * @param num_records The number of elements in \a records array. + * @retval result_t The status code after this operation. + * + * @assert + * @code music != NULL @endcode + * @code records != NULL @endcode + */ + result_t (*set_records)(pmp_music_t* music, const pmp_music_record_t* records, uint32_t num_records); + + /** + * Get a list of music records. + * + * This function gets the list of music records in the existing music + * database or set by \a set_records call. + * + * If the argument \a records is NULL, this function returns the number of + * music records to the variable whose address is specified by the + * argument \a num_records. You can use this for determining the size of + * array \a records necessary to obtain all records from this function. + * + * If the argument \a records is not NULL, this function copies the + * current music records to the array whose address is specified by the + * argument \a records and whose size is specified by the variable + * pointed by the argument \a num_records. + * + * @param music The pointer to the pmp_music_t interface. + * @param records An array of music records. + * @param num_records The pointer to the variable presenting the number + * of elements in \a records array. + * @retval result_t The status code after this operation. + * + * @assert + * @code music != NULL @endcode + * @code num_records != NULL @endcode + */ + result_t (*get_records)(pmp_music_t* music, pmp_music_record_t* records, uint32_t* num_records); + + /** + * Set a list of music playlists. + * + * This function sets a list of music playlists. PMPlib will generate the + * playlists on the device based on this list. + * + * This function does not write out any content on the player immediately; + * playlist generation is prolonged until the device is closed by + * pmp->close() call. + * + * @param music The pointer to the pmp_music_t interface. + * @param playlists An array of music playlists. + * @param num_playlists The number of elements in \a playlists array. + * @retval result_t The status code after this operation. + * + * @assert + * @code music != NULL @endcode + * @code playlists != NULL @endcode + */ + result_t (*set_playlists)(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists); + + /** + * Get a list of music playlists. + * + * This function gets the list of music playlists in the device or set by + * \a set_playlists call. + * + * If the argument \a playlists is NULL, this function returns the number + * of music playlists to the variable whose address is specified by the + * argument \a num_playlists. You can use this for determining the size of + * array \a playlists necessary to obtain all playlists. + * + * If the argument \a playlists is not NULL, this function copies the + * current music playlists to the array whose address is specified by the + * argument \a playlists and whose size is specified by the variable + * pointed by the argument \a num_playlists. + * + * @param music The pointer to the pmp_music_t interface. + * @param playlists An array of music playlists. + * @param num_playlists The pointer to the variable presenting the + * number of elements in \a playlists array. + * @retval result_t The status code after this operation. + * + * @assert + * @code music != NULL @endcode + * @code num_playlists != NULL @endcode + */ + result_t (*get_playlists)(pmp_music_t* music, pmp_playlist_t* playlists, uint32_t* num_playlists); + + /** + * Dump the music database. + * + * @param music The pointer to the pmp_music_t interface. + * @param fp The pointer to an output stream. + * @param flag The flags. + * @retval result_t The status code after this operation. + * + * @assert + * @code music != NULL @endcode + */ + result_t (*dump)(pmp_music_t* music, FILE *fp, int flag); +}; + +/** + * Initialize pmp_music_record_t structure. + * + * @param record The pointer to pmp_music_record_t instance. + */ +PMPAPI void pmplib_record_init(pmp_music_record_t* record); + +/** + * Uninitialize pmp_music_record_t structure. + * + * This function frees the memory blocks used by the \a record. + * + * @param record The pointer to pmp_music_record_t instance. + */ +PMPAPI void pmplib_record_finish(pmp_music_record_t* record); + +/** + * Clone a pmp_music_record_t record. + * + * This function copies the values in the \a src record to \a dst. + * + * @param dst The pointer to the destination. + * @param src The pointer to the source. + * @retval result_t The status code after this operation. + */ +PMPAPI result_t pmplib_record_clone(pmp_music_record_t* dst, const pmp_music_record_t* src); + +/** + * Uninitialize an array of pmp_music_record_t records. + * + * This function frees the memory blocks used by each record in the array and + * the array. + * + * @param record The pointer to pmp_music_record_t array. + * @param num_records The number of elements in the array. + */ +PMPAPI void pmplib_records_finish(pmp_music_record_t* records, int num_records); + +/** + * Clone a pmp_music_record_t array. + * + * This function copies all records in the \a src array to \a dst. + * + * @param dst The destination array. + * @param src The source array. + * @param num_records The number of elements in the source array. + * @retval result_t The status code after this operation. + */ +PMPAPI result_t pmplib_records_clone(pmp_music_record_t* dst, const pmp_music_record_t* src, int num_records); + +PMPAPI void pmplib_playlist_init(pmp_playlist_t* playlist); +PMPAPI void pmplib_playlist_finish(pmp_playlist_t* playlist); +PMPAPI void pmplib_playlist_clone(pmp_playlist_t* dst, const pmp_playlist_t* src); + +PMPAPI void pmplib_playlists_finish(pmp_playlist_t* playlist, int num_playlists); +PMPAPI void pmplib_playlists_clone(pmp_playlist_t* dst, const pmp_playlist_t* src, int num_playlists); + +/** + * @} + */ + + +typedef result_t (*pmplib_create_t)(pmp_t** pmp, const ucs2char_t* path_to_device, const char *devid); + +/** + * Prototype for the callback function for receiving device identifiers. + * + */ +typedef void (*pmplib_enumerate_devid_callback_t)(void *instance, const char *devid); +typedef result_t (*pmplib_enumerate_devid_t)(pmplib_enumerate_devid_callback_t callback, void *instance); + +PMPAPI uint32_t pmplib_interlocked_increment(uint32_t* count); +PMPAPI uint32_t pmplib_interlocked_decrement(uint32_t* count); + + + + + + +/** + * @defgroup pmplib PMPlib Helper API + * @{ + * + * The PMPlib Helper API provides the utility for choosing a suitable PMPlib + * driver from a number of installed drivers. Because the PMPlib project + * implements a number of drivers for different portable media devices, an + * application must choose a suitable driver that matches to the target + * device. By using this API, an application can query a driver suitable for + * the portable media device specified by the mount location (root directory + * of the device) and/or the string identifier of a driver. An application can + * also enumerate the string identifiers of the drivers available in the + * system. + * + * An application must call pmplib_init() function to initialize the API + * and obtain the pointer to a ::pmplib_t instance that is used for subsequent + * calls of the API. + * The application can query an interface to a PMPlib driver by using + * pmplib_create() function. A list of installed device identifiers is + * obtained by receiving callback notifications invoked by + * pmplib_enumerate_devid() function. The application must terminate this + * API by calling pmplib_finish() function. + * + * This is an example of querying an interface to the driver that matches to + * the device connected to the mount point (Win32 path "D:\"): + * + * @code + * #include <ucs2char.h> + * #include <pmp.h> + * + * int main(int argc, char *argv[]) + * { + * result_t ret = 0; + * pmp_t* pmp = NULL; + * pmplib_t* pmplib = NULL; + * static const ucs2char_t path[] = {'D',':','\\',0}; + * + * // Initialize the PMPlib Helper API. + * if ((ret = pmplib_init(&pmplib)) != 0) { + * // Failed to initialize the API. + * goto error_exit; + * } + * + * // Query an interface to the PMPlib driver suitable for the path. + * if ((ret = pmplib_create(pmplib, &pmp, path, NULL)) != 0) { + * // Failed to find a suitable driver. + * goto error_exit; + * } + * + * // Processing with the driver. + * ... + * + * // Release the driver. + * pmp->release(pmp); + * + * // Terminate the helper API. + * pmplib_finish(pmplib); + * return 0; + * + * error_exit: + * // Error handling. + * ... + * return 1; + * } + * @endcode + * + * @{ + */ + +struct tag_pmplib_t; + +/** + * The structure for the PMPlib Helper API. + * An application should use a pointer to this structure as a handle value + * for this API. Call pmplib_init() function to obtain a pointer to this + * structure and pmplib_finish() function to terminate this API. Access to + * a member in this structure is prohibited since it is reserved for the + * internal use of the library only. + */ +typedef struct tag_pmplib_t pmplib_t; + +/** + * Initialize the PMPlib helper library. + * + * This function loads the drivers installed in the system to prepare them. + * + * @retval ptr_pmplib The pointer to the buffer to receive the pointer + * to the ::pmplib_t instance initialized by this + * function. + * @retval result_t The status code. + * + * @assert + * @code ptr_pmplib != NULL @endcode + * + * @note + * Call this function before using any other functions in this API. + */ +PMPAPI result_t pmplib_init(pmplib_t** ptr_pmplib); + +/** + * Uninitialize the PMPlib helper library. + * + * This function detatch the drivers loaded by pmplib_init() function. + * + * @param pmplib The pointer to the ::pmplib_t instance. + * @retval result_t The status code. + * + * @assert + * @code ptr_pmplib != NULL @endcode + * + * @note + * Call this function to terminate this API. + */ +PMPAPI result_t pmplib_finish(pmplib_t* pmplib); + +/** + * Query a driver and create a ::pmp_t instance. + * + * This function queries the driver suitable for the portable media device + * specified by the mount location and/or identifier, and returns the + * interface to the driver (::pmp_t instance). An application must specify + * parameter \a path_to_device. If parameter \a id is not \c NULL, this + * function obtains the interface to the driver with the device identifier + * specified in \a id parameter. If the parameter \a id is \c NULL, this + * function tries to recognize the model of the device based on the content + * of the files located under \a path_to_device. If successful, the interface + * to the driver will be returned in the \a pmp argument. + * + * @param pmplib The pointer to the ::pmplib_t instance. + * @param path_to_device A UCS-2 string representing the location of the + * target device. This parameter cannot be \c NULL. + * @param id A C-string representing the device identifier of + * the target device. If this argument is \c NULL, + * this function tries to recognize the model of the + * device based on the location (\a path_to_device). + * @retval ptr_pmp The pointer to the buffer to receive the pointer + * to the driver interface (::pmp_t instance). + * @retval result_t The status code. + * + * @assert + * @code pmplib != NULL @endcode + * @code ptr_pmp != NULL @endcode + * @code path_to_device != NULL @endcode + */ +PMPAPI result_t pmplib_create(pmplib_t* pmplib, pmp_t** ptr_pmp, const ucs2char_t* path_to_device, const char *id); + +/** + * Enumerate device identifiers of the installed drivers. + * + * This function enumerates the device identifiers of the installed drivers, + * and invokes the \a callback function for each identifier. + * + * @param pmplib The pointer to the ::pmplib_t instance. + * @param callback The pointer to the callback function to receive + * device identifiers. + * @param instance A user-defined instance value. The callback + * function will receive the same value. + * @retval result_t The status code. + * + * @assert + * @code pmplib != NULL @endcode + * @code callback != NULL @endcode + */ +PMPAPI result_t pmplib_enumerate_devid(pmplib_t* pmplib, pmplib_enumerate_devid_callback_t callback, void *instance); + +/** + * @} + */ + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif/*__cplusplus*/ + +#endif/*__PMP_H__*/ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 01:54:50
|
Revision: 313 http://svn.sourceforge.net/pmplib/?rev=313&view=rev Author: nyaochi Date: 2007-02-08 17:54:50 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Moved remotely Added Paths: ----------- trunk/pmplib/include/pmplib/filepath.h Removed Paths: ------------- trunk/pmplib/include/filepath.h Deleted: trunk/pmplib/include/filepath.h =================================================================== --- trunk/pmplib/include/filepath.h 2007-02-09 01:53:12 UTC (rev 312) +++ trunk/pmplib/include/filepath.h 2007-02-09 01:54:50 UTC (rev 313) @@ -1,346 +0,0 @@ -/* - * File/path utility implemented with Win32 API. - * - * Copyright (c) 2005-2006 Nyaochi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/* $Id$ */ - -#ifndef __FILEPATHUTIL_H__ -#define __FILEPATHUTIL_H__ - -#include <time.h> -#include <ucs2char.h> - -#ifdef FILEPATH_EXPORTS -#define FILEPATHAPI __declspec(dllexport) -#else -#define FILEPATHAPI -#endif - - -#ifdef __cplusplus -extern "C" { -#endif/*__cplusplus*/ - -/** - * \addtogroup filepath File/Path Manupulation API - * @{ - * - * The PMPlib File/Path Manupulation API is a utility for file-systems and - * pathnames. - */ - -/** - * \addtogroup filepath_string file/path string API - * @{ - * - */ - -/** - * Add a (back)slash character to the end of a string. - * - * This function adds a (back)slash character to the end of the string if - * the resultant string is grammertical. If the string already has a trailing - * (back)slash, this function will not change it. - * - * @param path The pointer to the string. - * @retval ucs2char_t* Identical value to \a path argument. - */ -FILEPATHAPI ucs2char_t* filepath_addslash(ucs2char_t* path); - -/** - * Remove a (back)slash character from the end of a string. - * - * This function removes a (back)slash character from the end of the string if - * the resultant string is grammertical. If the string already has no trailing - * (back)slash, this function will not change it. - * - * @param path The pointer to the string. - * @retval ucs2char_t* The identical value to \a path argument. - */ -FILEPATHAPI ucs2char_t* filepath_removeslash(ucs2char_t* path); - -/** - * Concatenate two strings into one well-formed path. - * - * @param dst The pointer to a buffer to receive the resultant path. - * @param size The size, in number of UCS-2 characters, of \a dst. - * @param path The pointer to a path name. - * @param file The pointer to a file name. - * @retval const ucs2char_t* The identical value to \a dst argument. - */ -FILEPATHAPI const ucs2char_t* filepath_combinepath(ucs2char_t* dst, size_t size, const ucs2char_t* path, const ucs2char_t* file); - -/** - * Remove the path portion of a filepath name. - * - * @param path The pointer to the filepath name from which this - * function removes the path portion. The resultant string - * will contain only the file portion. - */ -FILEPATHAPI void filepath_strippath(ucs2char_t* path); - -/** - * Skip the path portion in a filepath name. - * - * @param path The pointer to the filepath name from which this - * function skips the path portion. The skipped string - * will contain only the file portion. - * @retval const ucs2char_t* The pointer at which the file portion begins. - */ -FILEPATHAPI const ucs2char_t* filepath_skippath(const ucs2char_t* path); - -/** - * Remove the file portion from a string. - * - * @param path The pointer to the string from which the file portion - * is removed. - */ -FILEPATHAPI void filepath_remove_filespec(ucs2char_t* path); - -/** - * Skip a portion in a filepath name. - * - * @param path The pointer to the filepath name from which this - * function skips the portion. - * @param root The pointer to the string representing the portion to - * be skipped. - * @retval const ucs2char_t* The pointer at the next character after the - * portion \a root ends in \a path. - */ -FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root); - -/** - * Skip a portion in filepath name, assuming it as the root directory. - * - * The resultant string will begin with a path character. - * - * @param path The pointer to the filepath name from which this - * function skips the portion. - * @param root The pointer to the string representing the portion to - * be skipped. - * @retval const ucs2char_t* The pointer at the next character after the - * portion \a root ends in \a path. - */ -FILEPATHAPI const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root); - -/** - * Skip a directory name in filepath name. - * - * @param path The pointer to the filepath name from which this - * function skips a directory name. - * @retval const ucs2char_t* The pointer at the next character after the - * directory name ends in \a path. - */ -FILEPATHAPI const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path); - -/** - * Add a file extension to the end of a string. - * - * @param path The pointer to the string. - * @param ext The pointer to the file extension. - */ -FILEPATHAPI void filepath_add_extension(ucs2char_t* path, const ucs2char_t* ext); - -/** - * Remove a file extension from the end of a string. - * - * @param path The pointer to the string from which the extension - * is removed. - */ -FILEPATHAPI void filepath_remove_extension(ucs2char_t* path); - -/** - * Convert a relative path to its corresponding absolute path. - * - * @param absolute The pointer to a buffer to receive the resultant path. - * @param base The name of the base directory where the relative path - * begins. - * @param relative The relative path to be converted. - * @retval int Reserved (0). - */ -FILEPATHAPI int filepath_relative_to_absolute(ucs2char_t* absolute, const ucs2char_t* base, const ucs2char_t* relative); - -/** - * Canonicalize a path. - * - * @param dst The pointer to a buffer to receive the resultant path. - * @param src The path to be canonicalized. - * @retval Non-zero value if successful, zero otherwise. - */ -FILEPATHAPI int filepath_path_canonicalize(ucs2char_t* dst, const ucs2char_t* src); - -/** - * Replaces all path separators with a backslash ('\') separator. - * - * This function replaces all path separators in the given path with - * Windows-style path separators (back-slashes). On POSIX systems, this means - * converting forward slash ('/') path separators into backslashes. On - * Windows, this is a no-op. The \p path is modified in place. - * - * @param path The pointer to the path string to be converted. - * @return int Reserved. - */ -FILEPATHAPI int filepath_encode(ucs2char_t* path); - -/** - * Replaces '\'-slashes in a path name with the native path separator. - * - * This function replaces all Windows-style path separators - * (back-slashes) in the given path with the native path separator. On - * POSIX systems, the replacement character is a forward slash ('/'). On - * Windows, this is a no-op. The \p path is modified in place. - * - * @param path The pointer to the path string to be converted. - * @return int Reserved. - */ -FILEPATHAPI int filepath_decode(ucs2char_t* path); - -/** @} */ - -/** - * \addtogroup filepath_filedir file/directory manupulation API - * @{ - * - */ - -/** - * Prototype for the callback function for receiving found files. - * - * @param instance The instance value. - * @param found_path The path-name portion of the found file. - * @param found_file The file-name portion of the found file. - * @retval int Reserved. - */ -typedef int (*filepath_findfile_callback)(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file); - -/** - * Find files. - * - * @param path The directory in which this function starts the search. - * @param recursive Non-zero value to search files recursively under the - * directory \p path. - * @param callback The pointer to the callback function to receive the - * names of found files. - * @param instance A user-defined instance value that will be sent to the - * callback function. - * @retval int Reserved. - */ -FILEPATHAPI int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance); - -/** - * Test the existence of a file. - * - * @param path The filepath name to be tested. - * @retval int True or false. - */ -FILEPATHAPI int filepath_file_exists(const ucs2char_t* path); - -/** - * Test a file name has an extension. - * - * @param filename The file name to be tested. - * @param ext The extension. - * @retval int True or false. - */ -FILEPATHAPI int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext); - -/** - * Test if a filepath name represents a directory. - * - * @param path The filepath name to be tested. - * @retval int True or false. - */ -FILEPATHAPI int filepath_is_dir(const ucs2char_t *path); - -/** - * Test if a filepath name represents a relative path. - * - * @param path The filepath name to be tested. - * @retval int True or false. - */ -FILEPATHAPI int filepath_is_relative(const ucs2char_t* path); - -/** - * Test if two path names has a common prefix of a directory. - * - * @param path1 A filepath name. - * @param path2 Another filepath name. - * @retval int True or false. - */ -FILEPATHAPI int filepath_is_same_root(const ucs2char_t* path1, const ucs2char_t* path2); - -/** - * Obtain the last-modified time of a file. - * - * @param filename The filepath name. - * @retval time_t The time stamp when the file was updated most recently. - */ -FILEPATHAPI time_t filepath_mtime(const ucs2char_t *filename); - -/** - * Compares the modification times of two files. - * - * This function compares the modification times of @p file1 and @p file2 - * and returns the difference between them is returned. - * - * @param file1 The name of file #1. - * @param file2 The name of file #2. - * @retval int The comparison result: - * - < 0, if file2 was modified more recently than file1; - * - = 0, if the modification times are the same; - * - > 0, if file1 was modified more recently than file2. - */ -FILEPATHAPI int filepath_compare_lastupdate(const ucs2char_t* file1, const ucs2char_t* file2); - -/** - * Obtain the size of a file. - * - * @param filename The filepath name. - * @retval uint32_t The size, in bytes, of the file. - */ -FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename); - -/** - * Remove a file. - * - * @param file The name of a file to be removed. - * @retval int True if succeeded, false otherwise. - */ -FILEPATHAPI int filepath_removefile(const ucs2char_t* file); - -/** - * Copy a file. - * - * @param src The name of a source file to be copied. - * @param dst The name of a destination to be created. - * @retval int True if succeeded, false otherwise. - */ -FILEPATHAPI int filepath_copyfile(const ucs2char_t* src, const ucs2char_t* dst); - -/** @} */ - - -/** @} */ - -#ifdef __cplusplus -} -#endif/*__cplusplus*/ - -#endif/*__FILEPATHUTIL_H__*/ Copied: trunk/pmplib/include/pmplib/filepath.h (from rev 312, trunk/pmplib/include/filepath.h) =================================================================== --- trunk/pmplib/include/pmplib/filepath.h (rev 0) +++ trunk/pmplib/include/pmplib/filepath.h 2007-02-09 01:54:50 UTC (rev 313) @@ -0,0 +1,346 @@ +/* + * File/path utility implemented with Win32 API. + * + * Copyright (c) 2005-2006 Nyaochi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* $Id$ */ + +#ifndef __FILEPATHUTIL_H__ +#define __FILEPATHUTIL_H__ + +#include <time.h> +#include <ucs2char.h> + +#ifdef FILEPATH_EXPORTS +#define FILEPATHAPI __declspec(dllexport) +#else +#define FILEPATHAPI +#endif + + +#ifdef __cplusplus +extern "C" { +#endif/*__cplusplus*/ + +/** + * \addtogroup filepath File/Path Manupulation API + * @{ + * + * The PMPlib File/Path Manupulation API is a utility for file-systems and + * pathnames. + */ + +/** + * \addtogroup filepath_string file/path string API + * @{ + * + */ + +/** + * Add a (back)slash character to the end of a string. + * + * This function adds a (back)slash character to the end of the string if + * the resultant string is grammertical. If the string already has a trailing + * (back)slash, this function will not change it. + * + * @param path The pointer to the string. + * @retval ucs2char_t* Identical value to \a path argument. + */ +FILEPATHAPI ucs2char_t* filepath_addslash(ucs2char_t* path); + +/** + * Remove a (back)slash character from the end of a string. + * + * This function removes a (back)slash character from the end of the string if + * the resultant string is grammertical. If the string already has no trailing + * (back)slash, this function will not change it. + * + * @param path The pointer to the string. + * @retval ucs2char_t* The identical value to \a path argument. + */ +FILEPATHAPI ucs2char_t* filepath_removeslash(ucs2char_t* path); + +/** + * Concatenate two strings into one well-formed path. + * + * @param dst The pointer to a buffer to receive the resultant path. + * @param size The size, in number of UCS-2 characters, of \a dst. + * @param path The pointer to a path name. + * @param file The pointer to a file name. + * @retval const ucs2char_t* The identical value to \a dst argument. + */ +FILEPATHAPI const ucs2char_t* filepath_combinepath(ucs2char_t* dst, size_t size, const ucs2char_t* path, const ucs2char_t* file); + +/** + * Remove the path portion of a filepath name. + * + * @param path The pointer to the filepath name from which this + * function removes the path portion. The resultant string + * will contain only the file portion. + */ +FILEPATHAPI void filepath_strippath(ucs2char_t* path); + +/** + * Skip the path portion in a filepath name. + * + * @param path The pointer to the filepath name from which this + * function skips the path portion. The skipped string + * will contain only the file portion. + * @retval const ucs2char_t* The pointer at which the file portion begins. + */ +FILEPATHAPI const ucs2char_t* filepath_skippath(const ucs2char_t* path); + +/** + * Remove the file portion from a string. + * + * @param path The pointer to the string from which the file portion + * is removed. + */ +FILEPATHAPI void filepath_remove_filespec(ucs2char_t* path); + +/** + * Skip a portion in a filepath name. + * + * @param path The pointer to the filepath name from which this + * function skips the portion. + * @param root The pointer to the string representing the portion to + * be skipped. + * @retval const ucs2char_t* The pointer at the next character after the + * portion \a root ends in \a path. + */ +FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root); + +/** + * Skip a portion in filepath name, assuming it as the root directory. + * + * The resultant string will begin with a path character. + * + * @param path The pointer to the filepath name from which this + * function skips the portion. + * @param root The pointer to the string representing the portion to + * be skipped. + * @retval const ucs2char_t* The pointer at the next character after the + * portion \a root ends in \a path. + */ +FILEPATHAPI const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root); + +/** + * Skip a directory name in filepath name. + * + * @param path The pointer to the filepath name from which this + * function skips a directory name. + * @retval const ucs2char_t* The pointer at the next character after the + * directory name ends in \a path. + */ +FILEPATHAPI const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path); + +/** + * Add a file extension to the end of a string. + * + * @param path The pointer to the string. + * @param ext The pointer to the file extension. + */ +FILEPATHAPI void filepath_add_extension(ucs2char_t* path, const ucs2char_t* ext); + +/** + * Remove a file extension from the end of a string. + * + * @param path The pointer to the string from which the extension + * is removed. + */ +FILEPATHAPI void filepath_remove_extension(ucs2char_t* path); + +/** + * Convert a relative path to its corresponding absolute path. + * + * @param absolute The pointer to a buffer to receive the resultant path. + * @param base The name of the base directory where the relative path + * begins. + * @param relative The relative path to be converted. + * @retval int Reserved (0). + */ +FILEPATHAPI int filepath_relative_to_absolute(ucs2char_t* absolute, const ucs2char_t* base, const ucs2char_t* relative); + +/** + * Canonicalize a path. + * + * @param dst The pointer to a buffer to receive the resultant path. + * @param src The path to be canonicalized. + * @retval Non-zero value if successful, zero otherwise. + */ +FILEPATHAPI int filepath_path_canonicalize(ucs2char_t* dst, const ucs2char_t* src); + +/** + * Replaces all path separators with a backslash ('\') separator. + * + * This function replaces all path separators in the given path with + * Windows-style path separators (back-slashes). On POSIX systems, this means + * converting forward slash ('/') path separators into backslashes. On + * Windows, this is a no-op. The \p path is modified in place. + * + * @param path The pointer to the path string to be converted. + * @return int Reserved. + */ +FILEPATHAPI int filepath_encode(ucs2char_t* path); + +/** + * Replaces '\'-slashes in a path name with the native path separator. + * + * This function replaces all Windows-style path separators + * (back-slashes) in the given path with the native path separator. On + * POSIX systems, the replacement character is a forward slash ('/'). On + * Windows, this is a no-op. The \p path is modified in place. + * + * @param path The pointer to the path string to be converted. + * @return int Reserved. + */ +FILEPATHAPI int filepath_decode(ucs2char_t* path); + +/** @} */ + +/** + * \addtogroup filepath_filedir file/directory manupulation API + * @{ + * + */ + +/** + * Prototype for the callback function for receiving found files. + * + * @param instance The instance value. + * @param found_path The path-name portion of the found file. + * @param found_file The file-name portion of the found file. + * @retval int Reserved. + */ +typedef int (*filepath_findfile_callback)(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file); + +/** + * Find files. + * + * @param path The directory in which this function starts the search. + * @param recursive Non-zero value to search files recursively under the + * directory \p path. + * @param callback The pointer to the callback function to receive the + * names of found files. + * @param instance A user-defined instance value that will be sent to the + * callback function. + * @retval int Reserved. + */ +FILEPATHAPI int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance); + +/** + * Test the existence of a file. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ +FILEPATHAPI int filepath_file_exists(const ucs2char_t* path); + +/** + * Test a file name has an extension. + * + * @param filename The file name to be tested. + * @param ext The extension. + * @retval int True or false. + */ +FILEPATHAPI int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext); + +/** + * Test if a filepath name represents a directory. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ +FILEPATHAPI int filepath_is_dir(const ucs2char_t *path); + +/** + * Test if a filepath name represents a relative path. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ +FILEPATHAPI int filepath_is_relative(const ucs2char_t* path); + +/** + * Test if two path names has a common prefix of a directory. + * + * @param path1 A filepath name. + * @param path2 Another filepath name. + * @retval int True or false. + */ +FILEPATHAPI int filepath_is_same_root(const ucs2char_t* path1, const ucs2char_t* path2); + +/** + * Obtain the last-modified time of a file. + * + * @param filename The filepath name. + * @retval time_t The time stamp when the file was updated most recently. + */ +FILEPATHAPI time_t filepath_mtime(const ucs2char_t *filename); + +/** + * Compares the modification times of two files. + * + * This function compares the modification times of @p file1 and @p file2 + * and returns the difference between them is returned. + * + * @param file1 The name of file #1. + * @param file2 The name of file #2. + * @retval int The comparison result: + * - < 0, if file2 was modified more recently than file1; + * - = 0, if the modification times are the same; + * - > 0, if file1 was modified more recently than file2. + */ +FILEPATHAPI int filepath_compare_lastupdate(const ucs2char_t* file1, const ucs2char_t* file2); + +/** + * Obtain the size of a file. + * + * @param filename The filepath name. + * @retval uint32_t The size, in bytes, of the file. + */ +FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename); + +/** + * Remove a file. + * + * @param file The name of a file to be removed. + * @retval int True if succeeded, false otherwise. + */ +FILEPATHAPI int filepath_removefile(const ucs2char_t* file); + +/** + * Copy a file. + * + * @param src The name of a source file to be copied. + * @param dst The name of a destination to be created. + * @retval int True if succeeded, false otherwise. + */ +FILEPATHAPI int filepath_copyfile(const ucs2char_t* src, const ucs2char_t* dst); + +/** @} */ + + +/** @} */ + +#ifdef __cplusplus +} +#endif/*__cplusplus*/ + +#endif/*__FILEPATHUTIL_H__*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-09 01:53:11
|
Revision: 312 http://svn.sourceforge.net/pmplib/?rev=312&view=rev Author: nyaochi Date: 2007-02-08 17:53:12 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Added /include/pmplib directory. Added Paths: ----------- trunk/pmplib/include/pmplib/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-08 17:31:21
|
Revision: 311 http://svn.sourceforge.net/pmplib/?rev=311&view=rev Author: nyaochi Date: 2007-02-08 09:31:14 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Sync the Win32 GUI with the latest API. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc trunk/pmplib/frontend/easypmp/win32gui/maindlg.h trunk/pmplib/frontend/easypmp/win32gui/preference.h trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h trunk/pmplib/pmp.sln Modified: trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-08 16:41:30 UTC (rev 310) +++ trunk/pmplib/frontend/easypmp/win32gui/easypmp_win32gui.rc 2007-02-08 17:31:14 UTC (rev 311) @@ -29,6 +29,20 @@ // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_DONE ICON "res\\checkmark.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +3 TEXTINCLUDE +BEGIN + "\r\n" +END + +#endif // APSTUDIO_INVOKED + #endif // \x93\xFA\x96{\x8C\xEA resources ///////////////////////////////////////////////////////////////////////////// @@ -78,54 +92,51 @@ // Dialog // -IDD_PREFERENCE DIALOGEX 0, 0, 263, 246 +IDD_PREFERENCE DIALOGEX 0, 0, 263, 234 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,222,48,12 - PUSHBUTTON "Cancel",IDCANCEL,204,222,48,12 + DEFPUSHBUTTON "OK",IDOK,144,210,48,12 + PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 GROUPBOX "Media database",IDC_STATIC,12,12,240,48 CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,24,72,8 CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24,72,8 CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24,72,8 LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108,12 COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,72 + GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,60 CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | WS_GROUP,24,78,72,8 CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78,72,8 CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168,78,72,8 - LTEXT "Playlist folder(s):",IDC_STATIC,24,96,72,8 - CONTROL "&Music",IDC_CHECK_PL_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,96,72,8 - CONTROL "&Playlist",IDC_CHECK_PL_PLAYLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 - LTEXT "Conversion option:",IDC_STATIC,24,108,72,8 - CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,108,72,8 - CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,108,72,8 - CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,120,144,8 - GROUPBOX "Portable Player Device",IDC_STATIC,12,144,240,72 - LTEXT "&Location:",IDC_STATIC,24,156,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,156,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,156,66,12 - LTEXT "&Identifier:",IDC_STATIC,24,174,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_ID,78,174,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,24,192,42,12,SS_CENTERIMAGE - LTEXT "?X?^?e?B?b?N",IDC_STATIC_PLAYER_DESCRIPTION,78,192,162,12,0,WS_EX_CLIENTEDGE + LTEXT "Conversion option:",IDC_STATIC,24,96,72,8 + CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,96,72,8 + CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 + CONTROL "Use &JavaScript playlist",IDC_CHECK_PL_JSPL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,108,144,8 + GROUPBOX "Portable Player Device",IDC_STATIC,12,132,240,72 + LTEXT "&Location:",IDC_STATIC,24,145,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,145,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,145,66,12 + LTEXT "&Identifier:",IDC_STATIC,24,162,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_ID,78,162,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Description:",IDC_STATIC,24,180,42,12,SS_CENTERIMAGE + LTEXT "?X?^?e?B?b?N",IDC_STATIC_PLAYER_DESCRIPTION,78,180,162,12,0,WS_EX_CLIENTEDGE CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,222,120,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 END -IDD_PROCESSING DIALOGEX 0, 0, 263, 246 +IDD_PROCESSING DIALOGEX 0, 0, 263, 234 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,222,48,12,NOT WS_VISIBLE - PUSHBUTTON "Cancel",IDCANCEL,204,222,48,12 + DEFPUSHBUTTON "OK",IDOK,144,210,48,12,NOT WS_VISIBLE + PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER,12,12,240,84 - EDITTEXT IDC_EDIT_LOG,12,96,240,120,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL + EDITTEXT IDC_EDIT_LOG,12,96,240,102,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,222,120,12 - CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,222,48,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 + CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,144,210,48,12 END @@ -142,7 +153,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 239 + BOTTOMMARGIN, 227 END IDD_PROCESSING, DIALOG @@ -150,7 +161,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 239 + BOTTOMMARGIN, 227 END END #endif // APSTUDIO_INVOKED @@ -316,8 +327,8 @@ // // Generated from the TEXTINCLUDE 3 resource. // -//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\easypmp_win32gui.exe.manifest" + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED Modified: trunk/pmplib/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-08 16:41:30 UTC (rev 310) +++ trunk/pmplib/frontend/easypmp/win32gui/maindlg.h 2007-02-08 17:31:14 UTC (rev 311) @@ -70,8 +70,6 @@ BEGIN_DDX_MAP(CMainDlg) DDX_RADIO(IDC_RADIO_DATABASE, m_setting.iDBProces) DDX_RADIO(IDC_RADIO_PLAYLIST, m_setting.iPlaylistProcess) - DDX_CHECK(IDC_CHECK_PL_PLAYLIST, m_setting.bConvertInPlaylist) - DDX_CHECK(IDC_CHECK_PL_MUSIC, m_setting.bConvertInMusic) DDX_CHECK(IDC_CHECK_PL_FIND, m_setting.bSearchMissing) DDX_CHECK(IDC_CHECK_PL_SKIP, m_setting.bSkipMissing) DDX_CHECK(IDC_CHECK_PL_JSPL, m_setting.bJSPL) Modified: trunk/pmplib/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-08 16:41:30 UTC (rev 310) +++ trunk/pmplib/frontend/easypmp/win32gui/preference.h 2007-02-08 17:31:14 UTC (rev 311) @@ -34,8 +34,6 @@ int iMediaInfoSource; CString strStripWords; int iPlaylistProcess; - BOOL bConvertInPlaylist; - BOOL bConvertInMusic; BOOL bSearchMissing; BOOL bSkipMissing; BOOL bJSPL; @@ -53,8 +51,6 @@ iMediaInfoSource = 0; strStripWords = _T("the"); iPlaylistProcess = 2; - bConvertInPlaylist = TRUE; - bConvertInMusic = TRUE; bSearchMissing = TRUE; bSkipMissing = FALSE; bJSPL = FALSE; @@ -105,8 +101,6 @@ persistInt(iMediaInfoSource, _T("Database"), _T("MediaInfoSource"), szSettingFile, storing); persistString(strStripWords, _T("Database"), _T("StripWords"), szSettingFile, storing); persistInt(iPlaylistProcess, _T("Playlist"), _T("Process"), szSettingFile, storing); - persistBool(bConvertInPlaylist, _T("Playlist"), _T("ConvertPlaylist"), szSettingFile, storing); - persistBool(bConvertInMusic, _T("Playlist"), _T("ConvertMusic"), szSettingFile, storing); persistBool(bSearchMissing, _T("Playlist"), _T("SearchMissing"), szSettingFile, storing); persistBool(bSkipMissing, _T("Playlist"), _T("SkipMissing"), szSettingFile, storing); persistBool(bJSPL, _T("Playlist"), _T("JSPL"), szSettingFile, storing); @@ -199,17 +193,18 @@ USES_CONVERSION; if (pmp) { - strPlayerLocation = UCS2CT(pmp->env.path_to_root.path); - strPlayerIdentifier = A2CT(pmp->decl.id); - strPlayerDescription = A2CT(pmp->decl.name); - strPlayerDescription += _T(""); - if (*pmp->decl.version) { + strPlayerLocation = UCS2CT(pmp->info.path_to_root); + strPlayerIdentifier = A2CT(pmp->info.decl.id); + strPlayerDescription = A2CT(pmp->info.decl.manufacturer); + strPlayerDescription += _T(" "); + strPlayerDescription += A2CT(pmp->info.decl.name); + if (*pmp->info.decl.version) { strPlayerDescription += _T(" "); - strPlayerDescription += A2CT(pmp->decl.version); + strPlayerDescription += A2CT(pmp->info.decl.version); } - if (*pmp->decl.mode) { + if (*pmp->info.decl.mode) { strPlayerDescription += _T(" "); - strPlayerDescription += A2CT(pmp->decl.mode); + strPlayerDescription += A2CT(pmp->info.decl.mode); } } else { strPlayerIdentifier = _T(""); Modified: trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-08 16:41:30 UTC (rev 310) +++ trunk/pmplib/frontend/easypmp/win32gui/processingdlg.h 2007-02-08 17:31:14 UTC (rev 311) @@ -47,13 +47,13 @@ } enum { - PHASE_ENUMERATE_MUSIC = 0, + PHASE_OPEN_DEVICE = 0, + PHASE_ENUMERATE_MUSIC, PHASE_ENUMERATE_PLAYLIST, - PHASE_DATABASE_READ, - PHASE_DATABASE_OBTAIN, - PHASE_DATABASE_UPDATE, - PHASE_DATABASE_WRITE, + PHASE_MUSIC_OBTAIN, + PHASE_MUSIC_UPDATE, PHASE_PLAYLIST_CONVERT, + PHASE_CLOSE_DEVICE, }; enum { @@ -278,8 +278,6 @@ case 1: opt.verb |= MODE_PLAYLIST; break; case 2: opt.verb |= (MODE_PLAYLIST | MODE_PLAYLIST_RECONVERT); break; } - if (m_preference.bConvertInMusic) opt.verb |= MODE_PLAYLIST_MUSIC; - if (m_preference.bConvertInPlaylist) opt.verb |= MODE_PLAYLIST_PLAYLIST; if (m_preference.bSearchMissing) opt.verb |= MODE_PLAYLIST_FIND; if (m_preference.bSkipMissing) opt.verb |= MODE_PLAYLIST_SKIP; if (m_preference.bJSPL) opt.verb |= MODE_PLAYLIST_JSPL; @@ -306,13 +304,13 @@ m_ctrlListProgress.InsertColumn(0, _T("Task"), LVCFMT_LEFT, -1, -1); // Insert tasks. + m_ctrlListProgress.InsertItem(PHASE_OPEN_DEVICE, _T("Opening the device"), IDI_QUEUING); m_ctrlListProgress.InsertItem(PHASE_ENUMERATE_MUSIC, _T("Enumerating music files"), IDI_QUEUING); m_ctrlListProgress.InsertItem(PHASE_ENUMERATE_PLAYLIST, _T("Enumerating playlist files"), IDI_QUEUING); - m_ctrlListProgress.InsertItem(PHASE_DATABASE_READ, _T("Reading the database"), IDI_QUEUING); - m_ctrlListProgress.InsertItem(PHASE_DATABASE_OBTAIN, _T("Obtaining media information"), IDI_QUEUING); - m_ctrlListProgress.InsertItem(PHASE_DATABASE_UPDATE, _T("Updating the database"), IDI_QUEUING); - m_ctrlListProgress.InsertItem(PHASE_DATABASE_WRITE, _T("Writing the database"), IDI_QUEUING); + m_ctrlListProgress.InsertItem(PHASE_MUSIC_OBTAIN, _T("Obtaining media information"), IDI_QUEUING); + m_ctrlListProgress.InsertItem(PHASE_MUSIC_UPDATE, _T("Updating the music database"), IDI_QUEUING); m_ctrlListProgress.InsertItem(PHASE_PLAYLIST_CONVERT, _T("Converting playlists"), IDI_QUEUING); + m_ctrlListProgress.InsertItem(PHASE_CLOSE_DEVICE, _T("Closing the device"), IDI_QUEUING); // Expand the size of the task column. m_ctrlListProgress.SetColumnWidth(0, LVSCW_AUTOSIZE); @@ -331,12 +329,35 @@ return 1; } + // Generate open flag. + int openflag = 0; + if (opt.verb & MODE_DATABASE) { + openflag |= PMPOF_MUSIC_DB_WRITE; + if (opt.verb & MODE_DATABASE_UPDATE) { + openflag |= PMPOF_MUSIC_DB_READ; + } + } + if (opt.verb & MODE_DATABASE_REPR) { + openflag |= PMPOF_MUSIC_DB_READ; + } + if (opt.verb & MODE_PLAYLIST) { + openflag |= PMPOF_MUSIC_PL_WRITE; + } + // Show copyright information. showCopyrightInformation(); // Show player information. showPlayerInformation(pmp); + // + this->setState(PHASE_OPEN_DEVICE, STATE_PROCESSING); + result = pmp->open(pmp, openflag); + if (result != 0) { + goto error_exit; + } + this->setState(PHASE_OPEN_DEVICE, STATE_DONE); + // Enumerate target files. easypmp_filelist_t musics, playlists; @@ -374,20 +395,17 @@ write_log(LL_TRACE, _T("")); } - // Execute jobs. - if (opt.verb & MODE_DATABASE) { - result = easypmp_database(&musics, pmp, &opt, &records, &num_records, easypmp_progress, this); + // Update database entries for database mode and JSPL playlists. + if ((opt.verb & MODE_DATABASE) || (opt.verb & MODE_PLAYLIST_JSPL)) { + result = easypmp_database(pmp, &musics, &opt, &records, &num_records, easypmp_progress, this); if (result != 0) { goto error_exit; } } + + // Convert playlists. if (opt.verb & MODE_PLAYLIST) { - if ((opt.verb & MODE_PLAYLIST_JSPL) && (!records)) { - setState(PHASE_DATABASE_READ, STATE_PROCESSING); - easypmp_database_read(pmp, &opt, &records, &num_records, easypmp_progress, this); - setState(PHASE_DATABASE_READ, STATE_DONE); - } - result = easypmp_playlist(&playlists, &musics, pmp, &opt, records, num_records, easypmp_progress, this); + result = easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, this); if (result != 0) { goto error_exit; } @@ -399,12 +417,12 @@ /* Eject the device. */ m_preference.bSafelyRemove = IsDlgButtonChecked(IDC_CHECK_SAFEREMOVE) == BST_CHECKED ? TRUE : FALSE; if (m_preference.bSafelyRemove) { - if (ucs2len(pmp->env.path_to_root.path) > 2 && pmp->env.path_to_root.path[1] == ':') { + if (ucs2len(pmp->info.path_to_root) > 2 && pmp->info.path_to_root[1] == ':') { int i; const int max_tries = 20; CHAR szDrive[3] = {0, 0, 0}; - szDrive[0] = (CHAR)pmp->env.path_to_root.path[0]; - szDrive[1] = (CHAR)pmp->env.path_to_root.path[1]; + szDrive[0] = (CHAR)pmp->info.path_to_root[0]; + szDrive[1] = (CHAR)pmp->info.path_to_root[1]; szDrive[2] = 0; ejectdevice_t* ed = ejectdevice_init(); @@ -434,27 +452,28 @@ } } - if (records) { - /* Free the record array. */ - int i; - for (i = 0;i < num_records;++i) { - pmplib_record_finish(&records[i]); - } - free(records); + // Close the device. + this->setState(PHASE_CLOSE_DEVICE, STATE_PROCESSING); + result = pmp->close(pmp); + if (result != 0) { + goto error_exit; } + this->setState(PHASE_CLOSE_DEVICE, STATE_DONE); + + // Free the music records. + if (records && num_records) { + pmplib_records_finish(records, num_records); + } + easypmp_free_filelist(&playlists); easypmp_free_filelist(&musics); pmp->release(pmp); return 0; error_exit: - if (records) { - /* Free the record array. */ - int i; - for (i = 0;i < num_records;++i) { - pmplib_record_finish(&records[i]); - } - free(records); + // Free the music records. + if (records && num_records) { + pmplib_records_finish(records, num_records); } easypmp_free_filelist(&playlists); easypmp_free_filelist(&musics); @@ -515,9 +534,7 @@ CProcessingDlg* dlg = (CProcessingDlg*)instance; switch (phase) { - case EASYPMPDBP_START: - break; - case EASYPMPDBP_READ|EASYPMPSP_START: +/* case EASYPMPDBP_READ|EASYPMPSP_START: dlg->setState(PHASE_DATABASE_READ, STATE_PROCESSING); dlg->write_log(LL_TRACE, _T("[Reading database]")); break; @@ -536,39 +553,39 @@ dlg->setState(PHASE_DATABASE_READ, STATE_DONE); dlg->write_log(LL_TRACE, str); dlg->write_log(LL_TRACE, _T("")); - break; - case EASYPMPDBP_GMI|EASYPMPSP_START: - dlg->setState(PHASE_DATABASE_OBTAIN, STATE_PROCESSING); - dlg->m_ctrlListProgress.GetSubItemRect(PHASE_DATABASE_OBTAIN, 1, LVIR_BOUNDS, &rt); + break;*/ + case EASYPMPP_MUSIC_GMI|EASYPMPSP_START: + dlg->setState(PHASE_MUSIC_OBTAIN, STATE_PROCESSING); + dlg->m_ctrlListProgress.GetSubItemRect(PHASE_MUSIC_OBTAIN, 1, LVIR_BOUNDS, &rt); dlg->m_ctrlProgress.SetWindowPos(HWND_TOP, rt, SWP_SHOWWINDOW); //dlg->m_ctrlProgress.Create(dlg->m_ctrlListProgress, rt, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); dlg->m_ctrlProgress.SetRange(0, param_int); dlg->write_log(LL_TRACE, _T("[Obtaining media information]")); break; - case EASYPMPDBP_GMI|EASYPMPSP_PROGRESS: + case EASYPMPP_MUSIC_GMI|EASYPMPSP_PROGRESS: str.Format(_T("(%d) %s"), param_int+1, UCS2CT(filepath_skippath(param_str))); dlg->m_ctrlProgress.SetText(str); dlg->m_ctrlProgress.SetPos(param_int); dlg->write_log(LL_TRACE, _T("%s"), UCS2CT(param_str)); break; - case EASYPMPDBP_GMI|EASYPMPSP_END: + case EASYPMPP_MUSIC_GMI|EASYPMPSP_END: dlg->m_ctrlProgress.ShowWindow(SW_HIDE); //dlg->m_ctrlProgress.DestroyWindow(); str.Format(_T("%d files were imported"), param_int); - dlg->setProgress(PHASE_DATABASE_OBTAIN, str); - dlg->setState(PHASE_DATABASE_OBTAIN, STATE_DONE); + dlg->setProgress(PHASE_MUSIC_OBTAIN, str); + dlg->setState(PHASE_MUSIC_OBTAIN, STATE_DONE); dlg->write_log(LL_TRACE, _T("")); break; - case EASYPMPDBP_UPDATE|EASYPMPSP_START: - dlg->setState(PHASE_DATABASE_UPDATE, STATE_PROCESSING); + case EASYPMPP_MUSIC_UPDATE|EASYPMPSP_START: + dlg->setState(PHASE_MUSIC_UPDATE, STATE_PROCESSING); dlg->write_log(LL_TRACE, _T("[Updating database]")); break; - case EASYPMPDBP_UPDATE|EASYPMPSP_END: - dlg->setState(PHASE_DATABASE_UPDATE, STATE_DONE); - dlg->setProgress(PHASE_DATABASE_UPDATE, _T("Done")); + case EASYPMPP_MUSIC_UPDATE|EASYPMPSP_END: + dlg->setState(PHASE_MUSIC_UPDATE, STATE_DONE); + dlg->setProgress(PHASE_MUSIC_UPDATE, _T("Done")); dlg->write_log(LL_TRACE, _T("")); break; - case EASYPMPDBP_WRITE|EASYPMPSP_START: +/* case EASYPMPDBP_WRITE|EASYPMPSP_START: dlg->setState(PHASE_DATABASE_WRITE, STATE_PROCESSING); dlg->write_log(LL_TRACE, _T("[Writing database]")); break; @@ -578,13 +595,9 @@ dlg->setState(PHASE_DATABASE_WRITE, STATE_DONE); dlg->setProgress(PHASE_DATABASE_WRITE, _T("Done")); dlg->write_log(LL_TRACE, _T("")); - break; - case EASYPMPDBP_END: - break; + break;*/ - case EASYPMPPLP_START: - break; - case EASYPMPPLP_CONVERT|EASYPMPSP_START: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_START: dlg->setState(PHASE_PLAYLIST_CONVERT, STATE_PROCESSING); dlg->m_ctrlListProgress.GetSubItemRect(PHASE_PLAYLIST_CONVERT, 1, LVIR_BOUNDS, &rt); dlg->m_ctrlProgress.SetWindowPos(HWND_TOP, rt, SWP_SHOWWINDOW); @@ -592,30 +605,30 @@ dlg->m_ctrlProgress.SetRange(0, param_int); dlg->write_log(LL_TRACE, _T("[Playlist conversion]")); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_PROGRESS: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_PROGRESS: str.Format(_T("(%d) %s"), param_int+1, UCS2CT(filepath_skippath(param_str))); dlg->m_ctrlProgress.SetText(str); dlg->m_ctrlProgress.SetPos(param_int); dlg->write_log(LL_TRACE, _T("%s"), UCS2CT(param_str)); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_WARN_PLAYLIST: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_WARN_PLAYLIST: dlg->m_bFailed = TRUE; dlg->write_log(LL_WARNING, _T("WARNING: %s"), UCS2CT(param_str)); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_SKIP_PLAYLIST: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_SKIP_PLAYLIST: dlg->m_bFailed = TRUE; dlg->write_log(LL_ERROR, _T("ERROR: %s"), UCS2CT(param_str)); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_MISSING_MEDIA: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_MISSING_MEDIA: dlg->write_log(LL_INFO, _T(" %s"), UCS2CT(param_str)); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_JSPL_ERROR: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_JSPL_ERROR: dlg->write_log(LL_ERROR, _T("JSPL(ERROR): %s"), UCS2CT(param_str)); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_JSPL_OUTPUT: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_JSPL_OUTPUT: dlg->write_log(LL_INFO, _T("JSPL: %s"), UCS2CT(param_str)); break; - case EASYPMPPLP_CONVERT|EASYPMPSP_END: + case EASYPMPP_PLAYLIST_CONVERT|EASYPMPSP_END: dlg->m_ctrlProgress.ShowWindow(SW_HIDE); //dlg->m_ctrlProgress.DestroyWindow(); str.Format(_T("%d playlists were succeeded"), param_int); @@ -623,8 +636,6 @@ dlg->setState(PHASE_PLAYLIST_CONVERT, STATE_DONE); dlg->write_log(LL_TRACE, _T("")); break; - case EASYPMPPLP_END: - break; } return (dlg->m_bCancel) ? -1 : 0; @@ -670,15 +681,15 @@ USES_CONVERSION; write_log(LL_INFO, _T("[Player information]")); - write_log(LL_INFO, _T("Device identifier: %s"), A2CT(pmp->decl.id)); - write_log(LL_INFO, _T("Product name: %s"), A2CT(pmp->decl.name)); - write_log(LL_TRACE, _T("Firmware mode: %s"), A2CT(pmp->decl.mode)); - write_log(LL_INFO, _T("Firmware version: %s"), A2CT(pmp->decl.version)); - write_log(LL_TRACE, _T("Default language: %s"), A2CT(pmp->decl.language)); - write_log(LL_TRACE, _T("Root directory: %s"), UCS2CT(pmp->env.path_to_root.path)); - write_log(LL_TRACE, _T("Music directory: %s"), UCS2CT(pmp->env.path_to_music.path)); - write_log(LL_TRACE, _T("Playlist directory: %s"), UCS2CT(pmp->env.path_to_playlist.path)); - write_log(LL_TRACE, _T("Playlist extension: %s"), UCS2CT(pmp->env.playlist_ext)); + write_log(LL_INFO, _T("Device identifier: %s"), A2CT(pmp->info.decl.id)); + write_log(LL_INFO, _T("Product manufacturer: %s"), A2CT(pmp->info.decl.manufacturer)); + write_log(LL_INFO, _T("Product name: %s"), A2CT(pmp->info.decl.name)); + write_log(LL_INFO, _T("Firmware mode: %s"), A2CT(pmp->info.decl.mode)); + write_log(LL_INFO, _T("Firmware version: %s"), A2CT(pmp->info.decl.version)); + write_log(LL_INFO, _T("Default language: %s"), A2CT(pmp->info.decl.language)); + write_log(LL_INFO, _T("Root directory: %s"), UCS2CT(pmp->info.path_to_root)); + write_log(LL_INFO, _T("Music directory: %s"), UCS2CT(pmp->info.path_to_music)); + write_log(LL_INFO, _T("Playlist directory: %s"), UCS2CT(pmp->info.path_to_playlist)); write_log(LL_INFO, _T("")); } Modified: trunk/pmplib/pmp.sln =================================================================== --- trunk/pmplib/pmp.sln 2007-02-08 16:41:30 UTC (rev 310) +++ trunk/pmplib/pmp.sln 2007-02-08 17:31:14 UTC (rev 311) @@ -42,11 +42,13 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_win32gui", "frontend\easypmp\win32gui\easypmp_win32gui.vcproj", "{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" ProjectSection(ProjectDependencies) = postProject + {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} + {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} + {544769C2-6989-452F-B626-E442CAC6553B} = {544769C2-6989-452F-B626-E442CAC6553B} + {C74FE9C9-B5C4-438A-B157-9BCB6C8A7546} = {C74FE9C9-B5C4-438A-B157-9BCB6C8A7546} {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} - {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_portalplayer1", "lib\pmp_portalplayer1\pmp_portalplayer1.vcproj", "{544769C2-6989-452F-B626-E442CAC6553B}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-08 16:41:54
|
Revision: 310 http://svn.sourceforge.net/pmplib/?rev=310&view=rev Author: nyaochi Date: 2007-02-08 08:41:30 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Document filepath API. Modified Paths: -------------- trunk/pmplib/include/filepath.h trunk/pmplib/include/ucs2char.h trunk/pmplib/lib/filepath/filepath_posix.c trunk/pmplib/lib/filepath/filepath_win32.c trunk/pmplib/lib/gmi/gmi.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus2/playlist.c trunk/pmplib/lib/pmp_iriverplus2/util.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_iriverplus3/util.c trunk/pmplib/lib/pmp_irivnavi/playlist.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_portalplayer1/util.c trunk/pmplib/lib/ucs2/ucs2char_iconv.c Modified: trunk/pmplib/include/filepath.h =================================================================== --- trunk/pmplib/include/filepath.h 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/include/filepath.h 2007-02-08 16:41:30 UTC (rev 310) @@ -24,6 +24,7 @@ #ifndef __FILEPATHUTIL_H__ #define __FILEPATHUTIL_H__ +#include <time.h> #include <ucs2char.h> #ifdef FILEPATH_EXPORTS @@ -37,56 +38,306 @@ extern "C" { #endif/*__cplusplus*/ -typedef int (*filepath_findfile_callback)( - void *instance, - const ucs2char_t* found_path, - const ucs2char_t* found_file - ); +/** + * \addtogroup filepath File/Path Manupulation API + * @{ + * + * The PMPlib File/Path Manupulation API is a utility for file-systems and + * pathnames. + */ -FILEPATHAPI int find_file( - const ucs2char_t* path, - int recursive, - filepath_findfile_callback callback, - void *instance - ); +/** + * \addtogroup filepath_string file/path string API + * @{ + * + */ +/** + * Add a (back)slash character to the end of a string. + * + * This function adds a (back)slash character to the end of the string if + * the resultant string is grammertical. If the string already has a trailing + * (back)slash, this function will not change it. + * + * @param path The pointer to the string. + * @retval ucs2char_t* Identical value to \a path argument. + */ FILEPATHAPI ucs2char_t* filepath_addslash(ucs2char_t* path); + +/** + * Remove a (back)slash character from the end of a string. + * + * This function removes a (back)slash character from the end of the string if + * the resultant string is grammertical. If the string already has no trailing + * (back)slash, this function will not change it. + * + * @param path The pointer to the string. + * @retval ucs2char_t* The identical value to \a path argument. + */ FILEPATHAPI ucs2char_t* filepath_removeslash(ucs2char_t* path); -FILEPATHAPI int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext); - +/** + * Concatenate two strings into one well-formed path. + * + * @param dst The pointer to a buffer to receive the resultant path. + * @param size The size, in number of UCS-2 characters, of \a dst. + * @param path The pointer to a path name. + * @param file The pointer to a file name. + * @retval const ucs2char_t* The identical value to \a dst argument. + */ FILEPATHAPI const ucs2char_t* filepath_combinepath(ucs2char_t* dst, size_t size, const ucs2char_t* path, const ucs2char_t* file); +/** + * Remove the path portion of a filepath name. + * + * @param path The pointer to the filepath name from which this + * function removes the path portion. The resultant string + * will contain only the file portion. + */ FILEPATHAPI void filepath_strippath(ucs2char_t* path); -FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root); + +/** + * Skip the path portion in a filepath name. + * + * @param path The pointer to the filepath name from which this + * function skips the path portion. The skipped string + * will contain only the file portion. + * @retval const ucs2char_t* The pointer at which the file portion begins. + */ FILEPATHAPI const ucs2char_t* filepath_skippath(const ucs2char_t* path); -FILEPATHAPI const ucs2char_t* filepath_skipdrive(const ucs2char_t* path, const ucs2char_t* root); -FILEPATHAPI const ucs2char_t* filepath_skip_one_directory(const ucs2char_t* path); +/** + * Remove the file portion from a string. + * + * @param path The pointer to the string from which the file portion + * is removed. + */ +FILEPATHAPI void filepath_remove_filespec(ucs2char_t* path); + +/** + * Skip a portion in a filepath name. + * + * @param path The pointer to the filepath name from which this + * function skips the portion. + * @param root The pointer to the string representing the portion to + * be skipped. + * @retval const ucs2char_t* The pointer at the next character after the + * portion \a root ends in \a path. + */ +FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root); + +/** + * Skip a portion in filepath name, assuming it as the root directory. + * + * The resultant string will begin with a path character. + * + * @param path The pointer to the filepath name from which this + * function skips the portion. + * @param root The pointer to the string representing the portion to + * be skipped. + * @retval const ucs2char_t* The pointer at the next character after the + * portion \a root ends in \a path. + */ +FILEPATHAPI const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root); + +/** + * Skip a directory name in filepath name. + * + * @param path The pointer to the filepath name from which this + * function skips a directory name. + * @retval const ucs2char_t* The pointer at the next character after the + * directory name ends in \a path. + */ +FILEPATHAPI const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path); + +/** + * Add a file extension to the end of a string. + * + * @param path The pointer to the string. + * @param ext The pointer to the file extension. + */ FILEPATHAPI void filepath_add_extension(ucs2char_t* path, const ucs2char_t* ext); + +/** + * Remove a file extension from the end of a string. + * + * @param path The pointer to the string from which the extension + * is removed. + */ FILEPATHAPI void filepath_remove_extension(ucs2char_t* path); -FILEPATHAPI void filepath_remove_filespec(ucs2char_t* path); -FILEPATHAPI void filepath_replace_slash(ucs2char_t* path, ucs2char_t c); -FILEPATHAPI int filepath_is_relative(const ucs2char_t* path); +/** + * Convert a relative path to its corresponding absolute path. + * + * @param absolute The pointer to a buffer to receive the resultant path. + * @param base The name of the base directory where the relative path + * begins. + * @param relative The relative path to be converted. + * @retval int Reserved (0). + */ FILEPATHAPI int filepath_relative_to_absolute(ucs2char_t* absolute, const ucs2char_t* base, const ucs2char_t* relative); + +/** + * Canonicalize a path. + * + * @param dst The pointer to a buffer to receive the resultant path. + * @param src The path to be canonicalized. + * @retval Non-zero value if successful, zero otherwise. + */ FILEPATHAPI int filepath_path_canonicalize(ucs2char_t* dst, const ucs2char_t* src); + +/** + * Replaces all path separators with a backslash ('\') separator. + * + * This function replaces all path separators in the given path with + * Windows-style path separators (back-slashes). On POSIX systems, this means + * converting forward slash ('/') path separators into backslashes. On + * Windows, this is a no-op. The \p path is modified in place. + * + * @param path The pointer to the path string to be converted. + * @return int Reserved. + */ +FILEPATHAPI int filepath_encode(ucs2char_t* path); + +/** + * Replaces '\'-slashes in a path name with the native path separator. + * + * This function replaces all Windows-style path separators + * (back-slashes) in the given path with the native path separator. On + * POSIX systems, the replacement character is a forward slash ('/'). On + * Windows, this is a no-op. The \p path is modified in place. + * + * @param path The pointer to the path string to be converted. + * @return int Reserved. + */ +FILEPATHAPI int filepath_decode(ucs2char_t* path); + +/** @} */ + +/** + * \addtogroup filepath_filedir file/directory manupulation API + * @{ + * + */ + +/** + * Prototype for the callback function for receiving found files. + * + * @param instance The instance value. + * @param found_path The path-name portion of the found file. + * @param found_file The file-name portion of the found file. + * @retval int Reserved. + */ +typedef int (*filepath_findfile_callback)(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file); + +/** + * Find files. + * + * @param path The directory in which this function starts the search. + * @param recursive Non-zero value to search files recursively under the + * directory \p path. + * @param callback The pointer to the callback function to receive the + * names of found files. + * @param instance A user-defined instance value that will be sent to the + * callback function. + * @retval int Reserved. + */ +FILEPATHAPI int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance); + +/** + * Test the existence of a file. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ FILEPATHAPI int filepath_file_exists(const ucs2char_t* path); + +/** + * Test a file name has an extension. + * + * @param filename The file name to be tested. + * @param ext The extension. + * @retval int True or false. + */ +FILEPATHAPI int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext); + +/** + * Test if a filepath name represents a directory. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ +FILEPATHAPI int filepath_is_dir(const ucs2char_t *path); + +/** + * Test if a filepath name represents a relative path. + * + * @param path The filepath name to be tested. + * @retval int True or false. + */ +FILEPATHAPI int filepath_is_relative(const ucs2char_t* path); + +/** + * Test if two path names has a common prefix of a directory. + * + * @param path1 A filepath name. + * @param path2 Another filepath name. + * @retval int True or false. + */ FILEPATHAPI int filepath_is_same_root(const ucs2char_t* path1, const ucs2char_t* path2); +/** + * Obtain the last-modified time of a file. + * + * @param filename The filepath name. + * @retval time_t The time stamp when the file was updated most recently. + */ +FILEPATHAPI time_t filepath_mtime(const ucs2char_t *filename); + +/** + * Compares the modification times of two files. + * + * This function compares the modification times of @p file1 and @p file2 + * and returns the difference between them is returned. + * + * @param file1 The name of file #1. + * @param file2 The name of file #2. + * @retval int The comparison result: + * - < 0, if file2 was modified more recently than file1; + * - = 0, if the modification times are the same; + * - > 0, if file1 was modified more recently than file2. + */ FILEPATHAPI int filepath_compare_lastupdate(const ucs2char_t* file1, const ucs2char_t* file2); +/** + * Obtain the size of a file. + * + * @param filename The filepath name. + * @retval uint32_t The size, in bytes, of the file. + */ +FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename); + +/** + * Remove a file. + * + * @param file The name of a file to be removed. + * @retval int True if succeeded, false otherwise. + */ FILEPATHAPI int filepath_removefile(const ucs2char_t* file); + +/** + * Copy a file. + * + * @param src The name of a source file to be copied. + * @param dst The name of a destination to be created. + * @retval int True if succeeded, false otherwise. + */ FILEPATHAPI int filepath_copyfile(const ucs2char_t* src, const ucs2char_t* dst); -FILEPATHAPI int filepath_encode(ucs2char_t* path); -FILEPATHAPI int filepath_decode(ucs2char_t* path); +/** @} */ -FILEPATHAPI time_t filepath_mtime(const ucs2char_t *filename); -FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename); -FILEPATHAPI int filepath_is_dir(const ucs2char_t *filename); -FILEPATHAPI int filepath_exist(const ucs2char_t *filename); +/** @} */ #ifdef __cplusplus } Modified: trunk/pmplib/include/ucs2char.h =================================================================== --- trunk/pmplib/include/ucs2char.h 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/include/ucs2char.h 2007-02-08 16:41:30 UTC (rev 310) @@ -25,7 +25,6 @@ #define __UCS2CHAR_H__ #include <stdio.h> -#include <time.h> #ifdef UCS2_EXPORTS #define UCS2API __declspec(dllexport) Modified: trunk/pmplib/lib/filepath/filepath_posix.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/filepath/filepath_posix.c 2007-02-08 16:41:30 UTC (rev 310) @@ -23,16 +23,6 @@ /* $Id$ */ -/** - * @file - * - * Functions for working with file and path names with different path - * separators (POSIX implementation). - * - * @addtogroup filepath - * @{ - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif/*HAVE_CONFIG_H*/ @@ -113,22 +103,6 @@ return 0; } -/** - * Finds the file name extension in a native path name. - * - * Checks if the file name in the given @p path has a file name - * extension: that is, whether the part of the path after the last - * path separator contains a period ('.'). If the @p path has an - * extension a pointer to the first character after the last period - * is returned (or a pointer to the null terminator if there are no - * subsequent characters). If the file name has no extension, then - * null itself is returned. - * - * @param path the path name to be searched for an extension. - * - * @return a pointer to the file name extension, or NULL if none was - * found. - */ static ucs2char_t* search_extension(ucs2char_t* path) { ucs2char_t* p = ucs2rchr(path, PATHCHAR); @@ -141,18 +115,6 @@ return NULL; } -/** - * Adds the native path separator to a UCS-2 encoded path name. - * - * If the given @p path does not have a native path separator at the - * end, then one is added. The @p path is modified in place, and is - * assumed to have enough space allocated to it to add the extra - * character. - * - * @param path the path name to be modified. - * - * @return a pointer to the last character in the new path. - */ ucs2char_t* filepath_addslash(ucs2char_t* path) { size_t length = ucs2len(path); @@ -166,16 +128,6 @@ return (path + length); } -/** - * Removes the native path separator from a UCS-2 encoded path name. - * - * If the given @p path has a native path separator at then end, then - * it is removed (or more accurately, it is replaced with the null - * terminator). - * - * @param path the path name to be modified. - * @return a pointer to the last character in the new path. - */ ucs2char_t* filepath_removeslash(ucs2char_t* path) { size_t length = ucs2len(path)-1; @@ -186,15 +138,6 @@ return (path + length); } -/** - * Determines if a filename has a given extension (case-insensitive). - * - * - * @param filename file name to be checked. - * @param ext file name extension to check for. - * @return non-nil if the filename has the given extension, or nil - * otherwise. - */ int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext) { const ucs2char_t* p = search_extension((ucs2char_t*)filename); @@ -250,7 +193,7 @@ return p ? p+1 : path; } -const ucs2char_t* filepath_skipdrive(const ucs2char_t* path, const ucs2char_t* root) +const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root) { const ucs2char_t* p = filepath_skiproot(path, root); if (p == NULL) p = path; @@ -260,7 +203,7 @@ return p; } -const ucs2char_t* filepath_skip_one_directory(const ucs2char_t* path) +const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path) { ucs2char_t* p = ucs2chr(path, PATHCHAR); return p ? p+1 : NULL; @@ -293,25 +236,6 @@ } } -/** - * Replace native path separators in a path with another character. - * - * The native path separators (i.e. '/' on POSIX-like systems) in the - * given @p path are replaced with the given character, @p c. The - * path is modified in place. - * @param path the path in which path separators are to be replaced. - * @param c the replacement character. - */ -void filepath_replace_slash(ucs2char_t* path, ucs2char_t c) -{ - while (*path) { - if (*path == PATHCHAR) { - *path = c; - } - path++; - } -} - void filepath_add_extension(ucs2char_t* path, const ucs2char_t* ext) { ucs2char_t* p = search_extension(path); @@ -336,25 +260,28 @@ } } -/** - * Tests whether a path name is relative. - * - * Checks whether the given @p path begins with a path separator - * character. If the path does begin with a path separator, then it - * is absolute and nil is returned. Otherwise the path is relative, - * and a non-nil value is returned. - * - * @param path the path to be tested for being relative. - * @return non-nil if the path name is relative, nil otherwise. - */ int filepath_is_relative(const ucs2char_t* path) { return (*path != PATHCHAR); } -int filepath_file_exists(const ucs2char_t* path) +int filepath_file_exists(const ucs2char_t *path) { - return filepath_exist(path); + int ret = 0; + struct stat st; + char *mbs_path = ucs2dupmbs(filename); + + if (mbs_path) { + path_decode(mbs_path); + //fprintf(stderr, "is_exist: %s\n", mbs_path); + ret = open(mbs_path, 0); + free(mbs_path); + if (ret != -1) { + close(ret); + } + return (ret != -1); + } + return 0; } int filepath_relative_to_absolute(ucs2char_t* absolute, const ucs2char_t* base, const ucs2char_t* relative) @@ -362,34 +289,11 @@ return (rel2abs(relative, base, absolute, MAX_PATH) != NULL); } -/** - * Tests whether a path name has a given prefix. - * - * Tests whether the @p path name begins with the named @p root. If - * @p root names a directory with a trailing path separator, then this - * function is useful for checking whether a directory (or file) with - * the given @p path would be a sub-directory of (respectively, file - * located below) @p root. - * @param path the path name to be checked for a given prefix. - * @param root the prefix to check for. - * @return non-nil if the path name starts with the given @p root and - * nil otherwise. - */ int filepath_is_same_root(const ucs2char_t* path, const ucs2char_t* root) { return (ucs2ncmp(path, root, ucs2len(root)) == 0); } -/** - * Compares the modification times of two files. - * - * The modification times of @p file1 and @p file2 are compared, and - * the difference between them is returned. The result is: - * - < 0, if file2 was modified more recently than file1; - * - = 0, if the modification times are the same; - * - > 0, if file1 was modified more recently than file2. - * @return the difference in modification times between the two files. - */ int filepath_compare_lastupdate(const ucs2char_t* file1, const ucs2char_t* file2) { int ret = 0; @@ -430,20 +334,6 @@ return ret; } -/** - * Removes the named file. - * - * The given @p file name is converted to a multi-byte character - * string, which is used as an argument to the 'remove' function in - * the C library. Thus, if the @p file name refers to a file, then - * that file is unlinked. If it refers to a directory, and that - * directory is empty, then the directory is deleted. The value - * returned is the result of the calling remove, i.e. 0 on success, - * and -1 on error. The value of errno will be set in the case of an - * error. - * @param file the path name to be unlinked/deleted. - * @return 0 on success, -1 on error. - */ int filepath_removefile(const ucs2char_t* file) { int ret = 0; @@ -453,17 +343,6 @@ return ret; } -/** - * Replaces all path separators with a backslash ('\') separator. - * - * Replaces all path separators in the given path with Windows-style - * path separators (back-slashes). On POSIX systems, this means - * converting forward slash ('/') path separators into backslashes. On - * Windows, this is a no-op. The @p path is modified in place. - * - * @param path the path to be converted. - * @return - */ int filepath_encode(ucs2char_t* path) { while (*path) { @@ -475,17 +354,6 @@ return 0; } -/** - * Replaces '\'-slashes in a path name with the native path separator. - * - * Replaces all Windows-style path separators (back-slashes) in the - * given path with the native path separator. On POSIX systems, the - * replacement character is a forward slash ('/'). On Windows, this - * is a no-op. The @p path is modified in place. - * - * @param path the path to be converted. - * @return - */ int filepath_decode(ucs2char_t* path) { while (*path) { @@ -496,4 +364,3 @@ } return 0; } -/**@}*/ Modified: trunk/pmplib/lib/filepath/filepath_win32.c =================================================================== --- trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/filepath/filepath_win32.c 2007-02-08 16:41:30 UTC (rev 310) @@ -117,7 +117,7 @@ return p ? p+1 : path; } -const ucs2char_t* filepath_skipdrive(const ucs2char_t* path, const ucs2char_t* root) +const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root) { const ucs2char_t* p = filepath_skiproot(path, root); if (p == NULL) p = path; @@ -127,22 +127,12 @@ return p; } -const ucs2char_t* filepath_skip_one_directory(const ucs2char_t* path) +const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path) { ucs2char_t* p = ucs2chr(path, '\\'); return p ? p+1 : NULL; } -void filepath_replace_slash(ucs2char_t* path, ucs2char_t c) -{ - while (*path) { - if (*path == '\\') { - *path = c; - } - path++; - } -} - void filepath_strippath(ucs2char_t* path) { PathStripPathW(path); Modified: trunk/pmplib/lib/gmi/gmi.c =================================================================== --- trunk/pmplib/lib/gmi/gmi.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/gmi/gmi.c 2007-02-08 16:41:30 UTC (rev 310) @@ -63,6 +63,17 @@ }; +static void replace_slash(ucs2char_t* path, ucs2char_t c) +{ + while (*path) { + if (*path == PATHCHAR) { + *path = c; + } + path++; + } +} + + static int gmi_get_from_pathname( media_info_t* info, const ucs2char_t *filename, @@ -102,28 +113,28 @@ /* Obtain genre, artist, and album values from the path if necessary. */ if (flag & GMIF_GENRE) { - q = filepath_skip_one_directory(p); + q = filepath_skipadirectory(p); if (q) { info->genre = ucs2ndup(p, (q-p) - 1); p = q; - q = filepath_skip_one_directory(p); + q = filepath_skipadirectory(p); if (q) { info->artist = ucs2ndup(p, (q-p) - 1); if (flag & GMIF_ALBUM) { info->album = ucs2dup(q); filepath_removeslash(info->album); - filepath_replace_slash(info->album, (ucs2char_t)' '); + replace_slash(info->album, (ucs2char_t)' '); } } } } else { - q = filepath_skip_one_directory(p); + q = filepath_skipadirectory(p); if (q) { info->artist = ucs2ndup(p, (q-p) - 1); if (flag & GMIF_ALBUM) { info->album = ucs2dup(q); filepath_removeslash(info->album); - filepath_replace_slash(info->album, (ucs2char_t)' '); + replace_slash(info->album, (ucs2char_t)' '); } } } Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-08 16:41:30 UTC (rev 310) @@ -196,7 +196,7 @@ } dst->entry_number = j+1; - dst->pathname = ucs2dup(filepath_skipdrive(src->filename, path_to_root)); + dst->pathname = ucs2dup(filepath_changeroot(src->filename, path_to_root)); filepath_remove_filespec(dst->pathname); filepath_encode(dst->pathname); dst->filename = ucs2dup(filepath_skippath(src->filename)); Modified: trunk/pmplib/lib/pmp_iriverplus2/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_iriverplus2/playlist.c 2007-02-08 16:41:30 UTC (rev 310) @@ -58,7 +58,7 @@ filepath_decode(decoded_filename); // 2. As above, with mount point prefix stripped. - ucs2cpy(decoded_filepathname, filepath_skipdrive(decoded_filename, path_to_root)); + ucs2cpy(decoded_filepathname, filepath_changeroot(decoded_filename, path_to_root)); // 3. As above, but with filename stripped. ucs2cpy(decoded_pathname, decoded_filepathname); Modified: trunk/pmplib/lib/pmp_iriverplus2/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_iriverplus2/util.c 2007-02-08 16:41:30 UTC (rev 310) @@ -31,6 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> #include <ucs2char.h> #include "util.h" Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-08 16:41:30 UTC (rev 310) @@ -569,7 +569,7 @@ ip3db_variant_t* dst = records[i]; ip3db_record_init(&pmpmi->ip3db, &records[i]); - ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], filepath_skipdrive(src->filename, pmp->info.path_to_root)); + ip3db_variant_set_str(&dst[IP3DBF_MUSIC_FILEPATH], filepath_changeroot(src->filename, pmp->info.path_to_root)); filepath_remove_filespec(dst[IP3DBF_MUSIC_FILEPATH].value.str); filepath_addslash(dst[IP3DBF_MUSIC_FILEPATH].value.str); filepath_slash(dst[IP3DBF_MUSIC_FILEPATH].value.str); @@ -700,7 +700,7 @@ filepath_combinepath(filepath, MAX_PATH, rootdir, music->pmp->info.path_to_playlist); filepath_addslash(filepath); - dst->filepath = ucs2dup(filepath_skipdrive(filepath, music->pmp->info.path_to_root)); + dst->filepath = ucs2dup(filepath_changeroot(filepath, music->pmp->info.path_to_root)); filepath_slash(dst->filepath); dst->num_entries = src->num_entries; @@ -708,7 +708,7 @@ for (j = 0;j < src->num_entries;++j) { ucs2char_t filename[MAX_PATH]; - ucs2cpy(filename, filepath_skipdrive(src->entries[j], music->pmp->info.path_to_root)); + ucs2cpy(filename, filepath_changeroot(src->entries[j], music->pmp->info.path_to_root)); filepath_slash(filename); dst->entries[j] = ucs2dup(filename); } Modified: trunk/pmplib/lib/pmp_iriverplus3/util.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_iriverplus3/util.c 2007-02-08 16:41:30 UTC (rev 310) @@ -28,6 +28,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> #include <ucs2char.h> #include <malloc.h> Modified: trunk/pmplib/lib/pmp_irivnavi/playlist.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_irivnavi/playlist.c 2007-02-08 16:41:30 UTC (rev 310) @@ -63,7 +63,7 @@ if (mediafiles[i][0]) { char *mbs = NULL; ucs2char_t filename[MAX_PATH]; - ucs2cpy(filename, filepath_skipdrive(mediafiles[i], path_to_root)); + ucs2cpy(filename, filepath_changeroot(mediafiles[i], path_to_root)); filepath_encode(filename); Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-08 16:41:30 UTC (rev 310) @@ -474,7 +474,7 @@ // Set record fields. record_init(dst); - dst->filename = ucs2dupmbs(filepath_skipdrive(src->filename, music->pmp->info.path_to_root)); + dst->filename = ucs2dupmbs(filepath_changeroot(src->filename, music->pmp->info.path_to_root)); dst->title = src->title ? ucs2dupmbs(src->title) : ucs2dupmbs(filepath_skippath(src->filename));; dst->artist = ucs2dupmbs(src->artist ? src->artist : ucs2cs_unknown); dst->album = ucs2dupmbs(src->album ? src->album : ucs2cs_unknown); Modified: trunk/pmplib/lib/pmp_portalplayer1/util.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/util.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/pmp_portalplayer1/util.c 2007-02-08 16:41:30 UTC (rev 310) @@ -31,6 +31,7 @@ #include <os.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> #include <ucs2char.h> #include "util.h" Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-08 14:19:22 UTC (rev 309) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-08 16:41:30 UTC (rev 310) @@ -319,22 +319,3 @@ } return 0; } - -int filepath_exist(const ucs2char_t *filename) -{ - int ret = 0; - struct stat st; - char *mbs_path = ucs2dupmbs(filename); - - if (mbs_path) { - path_decode(mbs_path); - //fprintf(stderr, "is_exist: %s\n", mbs_path); - ret = open(mbs_path, 0); - free(mbs_path); - if (ret != -1) { - close(ret); - } - return (ret != -1); - } - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-08 14:19:28
|
Revision: 309 http://svn.sourceforge.net/pmplib/?rev=309&view=rev Author: nyaochi Date: 2007-02-08 06:19:22 -0800 (Thu, 08 Feb 2007) Log Message: ----------- The completion of the initial documentation of the UCS-2 library. Modified Paths: -------------- trunk/pmplib/include/ucs2char.h trunk/pmplib/lib/ucs2/ucs2char_iconv.c trunk/pmplib/lib/ucs2/ucs2char_win32.c Modified: trunk/pmplib/include/ucs2char.h =================================================================== --- trunk/pmplib/include/ucs2char.h 2007-02-08 04:58:30 UTC (rev 308) +++ trunk/pmplib/include/ucs2char.h 2007-02-08 14:19:22 UTC (rev 309) @@ -344,10 +344,39 @@ * @{ */ +/** + * Test whether a USC-2 character is a surrogate-pair character in UTF-16. + * @param c The UCS-2 character to be tested. + * @retval int Non-zero value if the test is true, zero otherwise. + */ UCS2API int ucs2issurrogate(ucs2char_t c); + +/** + * Test whether a USC-2 character is a whitespace character. + * @param c The UCS-2 character to be tested. + * @retval int Non-zero value if the test is true, zero otherwise. + */ UCS2API int ucs2isspace(ucs2char_t c); + +/** + * Test whether a USC-2 character is a numeric character. + * @param c The UCS-2 character to be tested. + * @retval int Non-zero value if the test is true, zero otherwise. + */ UCS2API int ucs2isdigit(ucs2char_t c); + +/** + * Convert a UCS-2 character to lower case. + * @param c The UCS-2 character to be coverted. + * @retval ucs2char_t The resultant UCS-2 character. + */ UCS2API ucs2char_t ucs2lower(ucs2char_t c); + +/** + * Convert a UCS-2 character to upper case. + * @param c The UCS-2 character to be coverted. + * @retval ucs2char_t The resultant UCS-2 character. + */ UCS2API ucs2char_t ucs2upper(ucs2char_t c); /** @@ -607,11 +636,42 @@ * @{ */ +/** + * Convert a UCS-2 string to integer value. + * @param str The pointer to a string. + * @retval int The corresponding integer value. + */ UCS2API int ucs2toi(const ucs2char_t* str); + +/** + * Convert an integer value to UCS-2 string. + * @param value The integer value. + * @param string The pointer to the buffer to receive the string. + * @param radix Radix of the \a value. + * @retval ucs2char_t* The pointer to the string, which is the same value as + * \a str. + */ UCS2API ucs2char_t* itoucs2(int value, ucs2char_t *string, int radix); -UCS2API ucs2char_t fputucs2c(ucs2char_t c, FILE *fp); + +/** + * Open a stream from a file. + * @param filename The pointer to the UCS-2 string for the file name. + * @param mode The pointer to the C string for the open mode. + * @retval FILE* The pointer to the opened stream if successful, + * NULL otherwise. + */ UCS2API FILE *ucs2fopen(const ucs2char_t *filename, const char *mode); +/** + * Write a UCS-2 character to a stream. + * @param c The character to be written. + * @param fp The pointer to the output stream. + * @retval int Zero if successful, non-zero otherwise. + */ +UCS2API int fputucs2c(ucs2char_t c, FILE *fp); + + + /** @} */ /** @} */ Modified: trunk/pmplib/lib/ucs2/ucs2char_iconv.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-08 04:58:30 UTC (rev 308) +++ trunk/pmplib/lib/ucs2/ucs2char_iconv.c 2007-02-08 14:19:22 UTC (rev 309) @@ -241,14 +241,16 @@ } } -ucs2char_t fputucs2c(ucs2char_t c, FILE *fp) +int fputucs2c(ucs2char_t c, FILE *fp) { ucs2char_t ucs2str[2] = {c, 0}; size_t mbs_size = ucs2tombs(NULL, 0, ucs2str, ucs2len(ucs2str)) + 1; char* mbs = (char *)alloca(mbs_size * sizeof(char)); if (mbs) { ucs2tombs(mbs, mbs_size, ucs2str, ucs2len(ucs2str)+1); - fputs(mbs, fp); + return (fputs(mbs, fp) != EOF : 0 ? 1); + } else { + return 1; } } Modified: trunk/pmplib/lib/ucs2/ucs2char_win32.c =================================================================== --- trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-08 04:58:30 UTC (rev 308) +++ trunk/pmplib/lib/ucs2/ucs2char_win32.c 2007-02-08 14:19:22 UTC (rev 309) @@ -105,9 +105,9 @@ } -ucs2char_t fputucs2c(ucs2char_t c, FILE *fp) +int fputucs2c(ucs2char_t c, FILE *fp) { - return (ucs2char_t)fputwc((wchar_t)c, fp); + return (fputwc((wchar_t)c, fp) != WEOF ? 0 : 1); } FILE *ucs2fopen(const ucs2char_t *filename, const char *mode) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-08 04:58:34
|
Revision: 308 http://svn.sourceforge.net/pmplib/?rev=308&view=rev Author: nyaochi Date: 2007-02-07 20:58:30 -0800 (Wed, 07 Feb 2007) Log Message: ----------- Removed tailing '\\' character in path names. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-07 15:50:54 UTC (rev 307) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-08 04:58:30 UTC (rev 308) @@ -106,6 +106,7 @@ // Decode the music path prefix for system path separators filepath_combinepath(music_path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); + filepath_addslash(music_path); filepath_decode(music_path); fl->num_elements = 0; @@ -188,6 +189,7 @@ // Decode the playlist path prefix for system path separators filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + filepath_addslash(path); filepath_decode(path); ret = find_file( path, Modified: trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-07 15:50:54 UTC (rev 307) +++ trunk/pmplib/lib/pmp_iriverplus2/pmp_iriverplus2.c 2007-02-08 04:58:30 UTC (rev 308) @@ -69,7 +69,7 @@ "System\\H10_Jr.SYS", "System\\H10_Jr.DAT", "System\\H10_Jr.IDX", ".mp3\0.ogg\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_VORBIS, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".plp", }, { @@ -78,7 +78,7 @@ "System\\U10.SYS", "System\\U10.dat", "System\\U10.idx", ".mp3\0.ogg\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_VORBIS, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".plp", }, { Modified: trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c =================================================================== --- trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-07 15:50:54 UTC (rev 307) +++ trunk/pmplib/lib/pmp_irivnavi/pmp_irivnavi.c 2007-02-08 04:58:30 UTC (rev 308) @@ -52,9 +52,9 @@ }; static const ucs2char_t ucs2cs_music_path[] = - {'M','u','s','i','c',PATHCHAR,0}; + {'M','u','s','i','c',0}; static const ucs2char_t ucs2cs_playlist_path[] = - {'P','l','a','y','l','i','s','t','s',PATHCHAR,0}; + {'P','l','a','y','l','i','s','t','s',0}; static const ucs2char_t ucs2cs_playlist_ext[] = {'.','m','3','u',0}; static const ucs2char_t ucs2cs_irivnavi_idb[] = Modified: trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c =================================================================== --- trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-07 15:50:54 UTC (rev 307) +++ trunk/pmplib/lib/pmp_portalplayer1/pmp_portalplayer1.c 2007-02-08 04:58:30 UTC (rev 308) @@ -73,7 +73,7 @@ "System\\H10.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Media\\Music\\", "Media\\Playlist\\", + "System", "Media\\Music", "Media\\Playlist", ".plp", hdr_init_h10_5gb_ums_0205_0253, iriver_h10_parse_model }, @@ -84,7 +84,7 @@ "System\\H10_5GP.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Media\\Music\\", "Media\\Playlist\\", + "System", "Media\\Music", "Media\\Playlist", ".plp", hdr_init_h10_5gb_ums_0205_0253, iriver_h10_parse_model }, @@ -95,7 +95,7 @@ "System\\H10.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".pla", hdr_init_h10_5gb_mtp_0203_0210, iriver_h10_parse_model }, @@ -106,7 +106,7 @@ "System\\H10EMP.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".pla", hdr_init_h10_5gb_mtp_0203_0210, iriver_h10_parse_model }, @@ -117,7 +117,7 @@ "System\\H10.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".pla", hdr_init_h10_5gb_mtp_0251, iriver_h10_parse_model }, @@ -128,7 +128,7 @@ "System\\H10EMP.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".pla", hdr_init_h10_5gb_mtp_0251, iriver_h10_parse_model }, @@ -139,7 +139,7 @@ "System\\H10_20GC.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".pla", hdr_init_h10_20gb_mtp_0100_0102, iriver_h10_parse_model }, @@ -150,7 +150,7 @@ "System\\H10_20GC.mi4", "System\\DATA\\H10DB.hdr", ".mp3\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "Music\\", "Playlists\\", + "System", "Music", "Playlists", ".pla", hdr_init_h10_20gb_mtp_0251, iriver_h10_parse_model }, @@ -161,7 +161,7 @@ "SYSTEM\\JUKEBOX.mi4", "SYSTEM\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "SYSTEM\\", "MyJukeBox\\MUSIC\\", "MyJukeBox\\Playlist\\", + "SYSTEM", "MyJukeBox\\MUSIC", "MyJukeBox\\Playlist", ".pla", hdr_init_medion_mdjuke220, medion_mdjuke220_parse_model }, @@ -172,7 +172,7 @@ "SYSTEM\\JUKEBOX.mi4", "SYSTEM\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "SYSTEM\\", "MyJukeBox\\MUSIC\\", "MyJukeBox\\Playlist\\", + "SYSTEM", "MyJukeBox\\MUSIC", "MyJukeBox\\Playlist", ".pla", hdr_init_medion_mdjuke440, medion_mdjuke220_parse_model }, @@ -183,7 +183,7 @@ "SYSTEM\\FW_YH820.mi4", "System\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "System\\", "System\\MUSIC\\", "System\\PLAYLIST\\", + "System", "System\\MUSIC", "System\\PLAYLIST", ".plp", hdr_init_samsung_yh820, samsung_parse_model }, @@ -194,7 +194,7 @@ "SYSTEM\\FW_YH920.mi4", "System\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "System\\", "System\\MUSIC\\", "System\\PLAYLIST\\", + "System", "System\\MUSIC", "System\\PLAYLIST", ".plp", hdr_init_samsung_yh920, samsung_parse_model }, @@ -205,7 +205,7 @@ "SYSTEM\\FW_YH925.mi4", "System\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "System\\", "System\\MUSIC\\", "System\\PLAYLIST\\", + "System", "System\\MUSIC", "System\\PLAYLIST", ".plp", hdr_init_samsung_yh925, samsung_parse_model }, @@ -216,7 +216,7 @@ "SYSTEM\\FWImage.ebn", "System\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "SYSTEM\\", "Music\\", "Playlists\\", + "SYSTEM", "Music", "Playlists", ".pla", hdr_init_philips_hdd6320, philips_hdd6320_parse_model }, @@ -227,7 +227,7 @@ "SYSTEM\\PP5020.mi4", "System\\DATA\\PP5000.HDR", ".mp3\0.wma\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_WMA, 0, 0, 0, 0}, - "SYSTEM\\", "MUSIC\\", "Playlists\\", + "SYSTEM", "MUSIC", "Playlists", ".pla", hdr_init_msi_megaplayer540, megaplayer_parse_model }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-07 15:50:54
|
Revision: 307 http://svn.sourceforge.net/pmplib/?rev=307&view=rev Author: nyaochi Date: 2007-02-07 07:50:54 -0800 (Wed, 07 Feb 2007) Log Message: ----------- Append a new element at the bottom of the tail (linked list pointed by an AVL tree node), rather than at the beginning of the tail. I'm not sure the specification about the ordering of elements in a tail at this moment, but this can solve the problem where tracks in a playlist are arranged in reversed order. This is not a perfect solution; I need to investigate the ordering later. Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/idx.c Modified: trunk/pmplib/lib/pmp_iriverplus3/idx.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-07 14:11:15 UTC (rev 306) +++ trunk/pmplib/lib/pmp_iriverplus3/idx.c 2007-02-07 15:50:54 UTC (rev 307) @@ -886,12 +886,24 @@ } else { /* The same here. We must obtain the pointer to the node after avltail_new() call. */ - uint32_t offset_tail = avltail_new(idx->avl); + uint32_t offset_newelem = avltail_new(idx->avl); avlnode_t* node = avlnode(idx->avl, offset); - avltail_t* tail = (avltail_t*)avlnode(idx->avl, offset_tail); - tail->data = entry->offset; - tail->next = node->tail; - node->tail = offset_tail; + avltail_t* newelem = (avltail_t*)avlnode(idx->avl, offset_newelem); + if (node->tail) { + /* Append to the end of the linked list. */ + avltail_t* elem = (avltail_t*)avlnode(idx->avl, node->tail); + while (elem->next) { + elem = (avltail_t*)avlnode(idx->avl, elem->next); + } + elem->next = offset_newelem; + newelem->data = entry->offset; + newelem->next = 0; + } else { + /* The first element in the linked list. */ + node->tail = offset_newelem; + newelem->data = entry->offset; + newelem->next = 0; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-07 14:12:59
|
Revision: 306 http://svn.sourceforge.net/pmplib/?rev=306&view=rev Author: nyaochi Date: 2007-02-07 06:11:15 -0800 (Wed, 07 Feb 2007) Log Message: ----------- Do not use id3_file_open_fd() since it leaks file objects in Win32 environment. Use id3_file_open() instead even though this may lose some information in filenames during UCS-2 -> MBS conversion. Modified Paths: -------------- trunk/pmplib/lib/gmi/gmi_mp3.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/pmp.sln Modified: trunk/pmplib/lib/gmi/gmi_mp3.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-07 12:33:41 UTC (rev 305) +++ trunk/pmplib/lib/gmi/gmi_mp3.c 2007-02-07 14:11:15 UTC (rev 306) @@ -333,18 +333,12 @@ ucs2char_t* ucs2 = NULL; struct id3_file *id3file = NULL; struct id3_tag *id3tag = NULL; - FILE *fp = NULL; + char *mbs_filename = ucs2dupmbs(filename); - /* Open the file with UNICODE filename. This is for better compatibility. */ - fp = ucs2fopen(filename, "rb"); - if (!fp) { - return -1; - } - /* Open with libid3tag */ - id3file = id3_file_fdopen(fileno(fp), ID3_FILE_MODE_READONLY); + id3file = id3_file_open(mbs_filename, ID3_FILE_MODE_READONLY); + ucs2free(mbs_filename); if (!id3file) { - fclose(fp); return -1; } Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-07 12:33:41 UTC (rev 305) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-07 14:11:15 UTC (rev 306) @@ -165,7 +165,6 @@ ip2db_record_t* ip2db_records = NULL; static const ucs2char_t ucs2cs_unknown[] = {'u','n','k','n','o','w','n',0}; - fprintf(stdout, "records = %d, num_records = %d\n", records, num_records); // Count valid entries. for (i = 0;i < num_records;++i) { if (ip2db_is_supported_codec(records[i].codec)) { Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-07 12:33:41 UTC (rev 305) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-02-07 14:11:15 UTC (rev 306) @@ -71,7 +71,7 @@ "System\\E10.SYS", "System\\db.dat", "System\\db.dic", "System\\db.idx", ".mp3\0.ogg\0.wma\0.wav\0", {PMPCODEC_MPEGLAYER3, PMPCODEC_VORBIS, PMPCODEC_WMA, PMPCODEC_WAV, 0, 0, 0, 0}, - "System\\", "", "Playlists\\", + "System", "", "Playlists", ".plp", }, { Modified: trunk/pmplib/pmp.sln =================================================================== --- trunk/pmplib/pmp.sln 2007-02-07 12:33:41 UTC (rev 305) +++ trunk/pmplib/pmp.sln 2007-02-07 14:11:15 UTC (rev 306) @@ -14,8 +14,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp", "lib\pmp\pmp.vcproj", "{8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A}" ProjectSection(ProjectDependencies) = postProject + {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} {AA8DA82B-C209-4ABE-ABA1-22352962426D} = {AA8DA82B-C209-4ABE-ABA1-22352962426D} - {FA6E7B73-7CF8-47DD-A016-77382A1FD904} = {FA6E7B73-7CF8-47DD-A016-77382A1FD904} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_irivnavi", "lib\pmp_irivnavi\pmp_irivnavi.vcproj", "{2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1}" @@ -35,18 +35,18 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_cui", "frontend\easypmp\cui\easypmp_cui.vcproj", "{FA1F30D4-6100-4379-8506-6CFE023B0AE7}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "easypmp_win32gui", "frontend\easypmp\win32gui\easypmp_win32gui.vcproj", "{45CCFC7B-42B4-4FF9-AF43-FC3626B1672F}" ProjectSection(ProjectDependencies) = postProject + {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} + {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} + {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} + {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} {E393575C-6B10-43BD-B2C0-63C5040A49F7} = {E393575C-6B10-43BD-B2C0-63C5040A49F7} - {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} = {2548F270-FFCF-43B4-BB9D-D5AAD5B5FEF1} - {3419FA86-F518-4D3B-94C6-B05436439102} = {3419FA86-F518-4D3B-94C6-B05436439102} - {3575EFC2-9051-467A-BEB4-E71E2F8664D7} = {3575EFC2-9051-467A-BEB4-E71E2F8664D7} - {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} = {8BFE7DD6-F825-42BA-A7D7-EFCDCC9D686A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pmp_portalplayer1", "lib\pmp_portalplayer1\pmp_portalplayer1.vcproj", "{544769C2-6989-452F-B626-E442CAC6553B}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-07 12:33:43
|
Revision: 305 http://svn.sourceforge.net/pmplib/?rev=305&view=rev Author: nyaochi Date: 2007-02-07 04:33:41 -0800 (Wed, 07 Feb 2007) Log Message: ----------- Updated cmmand-line options Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/frontend/easypmp/cui/option.h Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-06 18:12:00 UTC (rev 304) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-07 12:33:41 UTC (rev 305) @@ -69,18 +69,19 @@ #define MAKE_PMP_ERROR(code) (((code) << 16) | EASYPMPE_PMPERROR) enum { - MODE_NONE = 0, - MODE_DATABASE = 0x00000001, + MODE_NONE = 0, + MODE_DATABASE = 0x00000001, MODE_DATABASE_UPDATE = 0x00000002, MODE_DATABASE_REPR = 0x00000004, - MODE_PLAYLIST = 0x00000010, + MODE_PLAYLIST = 0x00000010, MODE_PLAYLIST_RECONVERT = 0x00000100, MODE_PLAYLIST_FIND = 0x00000200, MODE_PLAYLIST_SKIP = 0x00000400, MODE_PLAYLIST_JSPL = 0x00000800, - MODE_LIST_DEVICES = 0x00001000, - MODE_HELP = 0x00010000, - MODE_VERSION = 0x00020000, + MODE_LIST_DEVICES = 0x00001000, + MODE_HELP = 0x00010000, + MODE_HELP_VARIABLE = 0x00020000, + MODE_VERSION = 0x00040000, }; typedef struct { Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-06 18:12:00 UTC (rev 304) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-07 12:33:41 UTC (rev 305) @@ -251,6 +251,13 @@ goto exit_main; } + // Show help message for variables and exit. + if (opt.verb & MODE_HELP_VARIABLE) { + option_usage_variable(fpo); + ret = 0; + goto exit_main; + } + // Initialize PMPlib library. if (res = pmplib_init(&pmplib)) { fprintf(fpe, "ERROR: Failed to initialize PMPlib library (%d)\n", res); Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-06 18:12:00 UTC (rev 304) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-07 12:33:41 UTC (rev 305) @@ -50,18 +50,13 @@ #include <easypmp.h> #include "option.h" -/** - * \addtogroup cui - * @{ - */ - void option_usage(FILE *fp, const char *argv0) { fprintf(fp, "USAGE: %s [OPTIONS] [LOCATION]\n", argv0); #ifdef _WIN32 fprintf(fp, " LOCATION Absolute path to the root directory of a player (e.g., D:\\).\n"); #else - fprintf(fp, " LOCATION Absolute path to the root directory of a player (e.g., /mnt/usbdisk/).\n"); + fprintf(fp, " LOCATION Mount location of a player (e.g., /mnt/usbdisk/).\n"); #endif fprintf(fp, " If LOCATION is omitted, assume the current directory.\n"); #ifdef _WIN32 @@ -74,11 +69,11 @@ fprintf(fp, " -u, --update Update the existing media database incrementally\n"); /*fprintf(fp, " -z, --source=SOURCE Specify a source for obtaining media information\n");*/ fprintf(fp, " -R, --repr Output a database structure in plain text\n"); - fprintf(fp, " -L, --repr-level=VAL Specify representation level\n"); + fprintf(fp, " -L, --repr-level=VAL Specify representation level for -R option\n"); fprintf(fp, " -t, --strip-words=VAL Specify a list (CSV) of words to strip from artist names\n"); fprintf(fp, "\n"); fprintf(fp, "Playlist options:\n"); - fprintf(fp, " -p, --playlist Convert playlist files in PLAYLIST directory\n"); + fprintf(fp, " -p, --playlist Convert playlist files\n"); fprintf(fp, " -r, --reconvert Discard the existing playlist files and reconvert\n"); fprintf(fp, " -f, --find-missing Correct playlists with corrupt references to media files\n"); fprintf(fp, " -i, --ignore-missing Continue a conversion even if a media file is missing\n"); @@ -89,7 +84,7 @@ fprintf(fp, "Player options:\n"); fprintf(fp, " -l, --list-device Show the list of supported devices and exit\n"); fprintf(fp, " -d, --device Specify a device identifier for the player\n"); - fprintf(fp, " -s, --set=NAME=VALUE Set a variable NAME to VALUE\n"); + fprintf(fp, " -s, --set=NAME:VALUE Set a variable NAME to VALUE\n"); fprintf(fp, "\n"); #ifndef _WIN32 fprintf(fp, "Language-specific options:\n"); @@ -100,8 +95,21 @@ fprintf(fp, "Miscellaneous options:\n"); fprintf(fp, " -v, --version Show version number and exit\n"); fprintf(fp, " -h, --help Show this help message and exit\n"); + fprintf(fp, " -x, --help-variable Show the list of variables and exit\n"); } +void option_usage_variable(FILE* fp) +{ + fprintf(fp, "VARIABLE USAGE:\n"); + fprintf(fp, " Specify the VALUE of a variable NAME with -s option, i.e., -s NAME:VALUE\n"); + fprintf(fp, " Note that a pathname ending with \"%c%c\" implies inclusion of its subdirs\n", PATHCHAR, PATHCHAR); + fprintf(fp, "\n"); + fprintf(fp, "Pathname variables:\n"); + fprintf(fp, " music Relative path to music directory\n"); + fprintf(fp, " playlistsrc Absolute path to the sources for playlist conversion\n"); + fprintf(fp, " playlistdst Relative path to the destinations for playlist conversion\n"); +} + void option_init(option_t* opt) { memset(opt, 0, sizeof(*opt)); @@ -138,32 +146,32 @@ int this_option_optind = optind ? optind : 1; int option_index = 0; static const struct option long_options[] = { - {"create", no_argument, 0, 'c'}, - {"update", no_argument, 0, 'u'}, - {"source", required_argument, 0, 'z'}, - {"repr", no_argument, 0, 'R'}, + {"create", no_argument, 0, 'c'}, + {"update", no_argument, 0, 'u'}, + {"source", required_argument, 0, 'z'}, + {"repr", no_argument, 0, 'R'}, {"repr-level", required_argument, 0, 'L'}, {"strip-words", required_argument, 0, 't'}, {"playlist", no_argument, 0, 'p'}, {"reconvert", no_argument, 0, 'r'}, {"find-missing", no_argument, 0, 'f'}, - {"ignore-missing", no_argument, 0, 's'}, - {"jspl", no_argument, 0, 'j'}, + {"ignore-missing", no_argument, 0, 'i'}, {"list-device", no_argument, 0, 'l'}, - {"device", required_argument, 0, 'd'}, - {"set", required_argument, 0, 's'}, + {"device", required_argument, 0, 'd'}, + {"set", required_argument, 0, 's'}, #ifndef _WIN32 {"encoding", required_argument, 0, 'e'}, {"tagencoding", required_argument, 0, 'w'}, #endif/*_WIN32*/ - {"version", no_argument, 0, 'v'}, - {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + {"help-variable", no_argument, 0, 'x'}, {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "cuz:RL:t:pmrfsjld:e:w:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:prfild:xs:e:w:vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "cuz:RL:t:pmrfsjld:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:prfild:xs:vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -203,6 +211,7 @@ free(opt->mbs_strip_words); opt->mbs_strip_words = strdup(optarg); break; + case 'p': opt->verb |= MODE_PLAYLIST; break; @@ -215,9 +224,7 @@ case 'i': opt->verb |= MODE_PLAYLIST_SKIP; break; - case 'j': - opt->verb |= MODE_PLAYLIST_JSPL; - break; + case 'l': opt->verb |= MODE_LIST_DEVICES; break; @@ -242,6 +249,9 @@ case 'h': opt->verb |= MODE_HELP; break; + case 'x': + opt->verb |= MODE_HELP_VARIABLE; + break; case '?': return -1; break; @@ -250,4 +260,3 @@ return optind; } -/** @} */ Modified: trunk/pmplib/frontend/easypmp/cui/option.h =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.h 2007-02-06 18:12:00 UTC (rev 304) +++ trunk/pmplib/frontend/easypmp/cui/option.h 2007-02-07 12:33:41 UTC (rev 305) @@ -29,5 +29,6 @@ void option_finish(option_t* opt); int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe); void option_usage(FILE *fp, const char *argv0); +void option_usage_variable(FILE *fp); #endif/*__OPTION_H__*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-06 18:12:05
|
Revision: 304 http://svn.sourceforge.net/pmplib/?rev=304&view=rev Author: nyaochi Date: 2007-02-06 10:12:00 -0800 (Tue, 06 Feb 2007) Log Message: ----------- Show file names from which EasyPMP failed to obtain the media information. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/cui/main.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-06 17:55:20 UTC (rev 303) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-06 18:12:00 UTC (rev 304) @@ -207,6 +207,12 @@ opt->num_strip_words ) == 0) { ++num_obtained; + } else { + // Report the error. + if (progress(instance, EASYPMPP_MUSIC_GMI | EASYPMPSP_WARN_GMI, i, 0, filename) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } } record->ts_update = timestamp; record->ts_import = ts_import; Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-06 17:55:20 UTC (rev 303) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-06 18:12:00 UTC (rev 304) @@ -47,14 +47,15 @@ EASYPMPSP_START = 0x00000001, EASYPMPSP_PROGRESS = 0x00000002, EASYPMPSP_SKIPPED = 0x00000003, - EASYPMPSP_WARN_PLAYLIST = 0x00000004, - EASYPMPSP_SKIP_PLAYLIST = 0x00000005, - EASYPMPSP_MISSING_MEDIA = 0x00000006, - EASYPMPSP_JSPL_ERROR = 0x00000007, - EASYPMPSP_JSPL_ERROR_POS = 0x00000008, - EASYPMPSP_JSPL_ERROR_LINE = 0x00000009, - EASYPMPSP_JSPL_OUTPUT = 0x0000000A, - EASYPMPSP_END = 0x0000000B, + EASYPMPSP_WARN_GMI = 0x00000004, + EASYPMPSP_WARN_PLAYLIST = 0x00000005, + EASYPMPSP_SKIP_PLAYLIST = 0x00000006, + EASYPMPSP_MISSING_MEDIA = 0x00000007, + EASYPMPSP_JSPL_ERROR = 0x00000008, + EASYPMPSP_JSPL_ERROR_POS = 0x00000009, + EASYPMPSP_JSPL_ERROR_LINE = 0x0000000A, + EASYPMPSP_JSPL_OUTPUT = 0x0000000B, + EASYPMPSP_END = 0x0000000C, }; enum { Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-06 17:55:20 UTC (rev 303) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-06 18:12:00 UTC (rev 304) @@ -114,6 +114,11 @@ case EASYPMPP_MUSIC_GMI|EASYPMPSP_PROGRESS: easypmp_progress_num_str(fpo, param_int+1, filepath_skippath(param_str)); break; + case EASYPMPP_MUSIC_GMI|EASYPMPSP_WARN_GMI: + console_clearln(fpo); + fprintf(fpe, " WARNING: Could not obtain the media information\n"); + fprints(fpe, " %s\n", param_str); + break; case EASYPMPP_MUSIC_GMI|EASYPMPSP_END: console_clearln(fpo); fprintf(fpo, " %d files were imported\n", param_int); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-06 17:55:28
|
Revision: 303 http://svn.sourceforge.net/pmplib/?rev=303&view=rev Author: nyaochi Date: 2007-02-06 09:55:20 -0800 (Tue, 06 Feb 2007) Log Message: ----------- Fixed a crash bug in pmp_iriverplus2 Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-06 17:41:05 UTC (rev 302) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-06 17:55:20 UTC (rev 303) @@ -233,12 +233,12 @@ } // Set unknown2 value in idx_header as (n+1). - ++n; - idxheader_setget_unknown2(db->idx_buffer, &n, 1); + i = n + 1; + idxheader_setget_unknown2(db->idx_buffer, &i, 1); // Free the allocated memory block. if (ip2db_records) { - for (i = 0;i < num_records;++i) { + for (i = 0;i < n;++i) { ip2db_free_record(&ip2db_records[i]); } free(ip2db_records); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-06 17:41:39
|
Revision: 302 http://svn.sourceforge.net/pmplib/?rev=302&view=rev Author: nyaochi Date: 2007-02-06 09:41:05 -0800 (Tue, 06 Feb 2007) Log Message: ----------- Improved the status displaying in CUI. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-06 12:09:59 UTC (rev 301) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-06 17:41:05 UTC (rev 302) @@ -80,6 +80,7 @@ console_clearln(fp); console_println(fp, str, 0); + fflush(fp); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-06 12:09:59
|
Revision: 301 http://svn.sourceforge.net/pmplib/?rev=301&view=rev Author: nyaochi Date: 2007-02-06 04:09:59 -0800 (Tue, 06 Feb 2007) Log Message: ----------- Incremental commit for POSIX build. There're still some bugs in pmp_iriverplus2. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/database.c trunk/pmplib/lib/pmp/pmp_posix.c trunk/pmplib/lib/pmp_iriverplus2/ip2db.c Modified: trunk/pmplib/frontend/easypmp/common/database.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/database.c 2007-02-06 05:40:09 UTC (rev 300) +++ trunk/pmplib/frontend/easypmp/common/database.c 2007-02-06 12:09:59 UTC (rev 301) @@ -207,7 +207,6 @@ opt->num_strip_words ) == 0) { ++num_obtained; - } else { } record->ts_update = timestamp; record->ts_import = ts_import; Modified: trunk/pmplib/lib/pmp/pmp_posix.c =================================================================== --- trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-06 05:40:09 UTC (rev 300) +++ trunk/pmplib/lib/pmp/pmp_posix.c 2007-02-06 12:09:59 UTC (rev 301) @@ -42,12 +42,12 @@ lt_dlhandle *plugins; }; -uint32_t interlocked_increment(uint32_t* count) +uint32_t pmplib_interlocked_increment(uint32_t* count) { return ++(*count); } -uint32_t interlocked_decrement(uint32_t* count) +uint32_t pmplib_interlocked_decrement(uint32_t* count) { return --(*count); } @@ -120,7 +120,7 @@ { uint32_t i; for (i = 0;i < pmplib->num_plugins;++i) { - pmplib_enumerate_devid_t func = (pmplib_enumerate_devid_t)lt_dlsym(pmplib->plugins[i], "pmplib_enumerate_devid"); + pmplib_enumerate_devid_t func = (pmplib_enumerate_devid_t)lt_dlsym(pmplib->plugins[i], "pmp_enumerate_devid"); if (func) { func(callback, instance); } @@ -134,7 +134,7 @@ uint32_t i; for (i = 0;i < pmplib->num_plugins;++i) { - pmplib_create_t func = (pmplib_create_t)lt_dlsym(pmplib->plugins[i], "pmplib_create"); + pmplib_create_t func = (pmplib_create_t)lt_dlsym(pmplib->plugins[i], "pmp_create"); if (func) { ret = func(pmp, path_to_device, id); if (ret != PMP_DEVICENOTFOUND) { Modified: trunk/pmplib/lib/pmp_iriverplus2/ip2db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-06 05:40:09 UTC (rev 300) +++ trunk/pmplib/lib/pmp_iriverplus2/ip2db.c 2007-02-06 12:09:59 UTC (rev 301) @@ -165,6 +165,7 @@ ip2db_record_t* ip2db_records = NULL; static const ucs2char_t ucs2cs_unknown[] = {'u','n','k','n','o','w','n',0}; + fprintf(stdout, "records = %d, num_records = %d\n", records, num_records); // Count valid entries. for (i = 0;i < num_records;++i) { if (ip2db_is_supported_codec(records[i].codec)) { @@ -236,10 +237,12 @@ idxheader_setget_unknown2(db->idx_buffer, &n, 1); // Free the allocated memory block. - for (i = 0;i < num_records;++i) { - ip2db_free_record(&ip2db_records[i]); + if (ip2db_records) { + for (i = 0;i < num_records;++i) { + ip2db_free_record(&ip2db_records[i]); + } + free(ip2db_records); } - free(ip2db_records); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |