[vlc-devel] commit: mp4: Factorize (Geoffroy Couprie )

git version control git at videolan.org
Mon Dec 28 19:12:28 CET 2009


vlc | branch: master | Geoffroy Couprie <geal at videolan.org> | Mon Dec 28 17:07:59 2009 +0100| [cccd5463141e1ab89871f3f725c2908f962b65ab] | committer: Geoffroy Couprie 

mp4: Factorize

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cccd5463141e1ab89871f3f725c2908f962b65ab
---

 modules/demux/mp4/drms.c |   44 ++++++++------------------------------------
 1 files changed, 8 insertions(+), 36 deletions(-)

diff --git a/modules/demux/mp4/drms.c b/modules/demux/mp4/drms.c
index 48e7068..4f78415 100644
--- a/modules/demux/mp4/drms.c
+++ b/modules/demux/mp4/drms.c
@@ -1563,42 +1563,14 @@ static int GetSCIData( char *psz_ipod, uint32_t **pp_sci,
     if( psz_ipod == NULL )
     {
 #ifdef WIN32
-        const wchar_t *wfile =
-                L"\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb";
-        typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
-                                                   LPWSTR );
-        HINSTANCE shfolder_dll = NULL;
-        SHGETFOLDERPATH dSHGetFolderPath = NULL;
-        wchar_t wpath[PATH_MAX];
-
-        if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
-        {
-            dSHGetFolderPath =
-                (SHGETFOLDERPATH)GetProcAddress( shfolder_dll,
-                                                 _T("SHGetFolderPathW") );
-        }
-
-        if( dSHGetFolderPath != NULL &&
-            SUCCEEDED( dSHGetFolderPath( NULL, CSIDL_COMMON_APPDATA,
-                                         NULL, 0, wpath ) ) )
-        {
-            if (wcslen( wpath ) + wcslen( wfile ) >= PATH_MAX )
-            {
-                return -1;
-            }
-            wcscat( wpath, wfile );
-
-            psz_path = FromWide( wpath );
-            strncpy( p_tmp, psz_path, sizeof( p_tmp ) - 1 );
-            p_tmp[sizeof( p_tmp ) - 1] = '\0';
-            free( psz_path );
-            psz_path = p_tmp;
-        }
-
-        if( shfolder_dll != NULL )
-        {
-            FreeLibrary( shfolder_dll );
-        }
+        const char *SCIfile =
+        "\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb";
+        strncpy(p_tmp, config_GetConfDir(), sizeof(p_tmp -1));
+        if( strlen( p_tmp ) + strlen( SCIfile ) >= PATH_MAX )
+            return -1;
+        strcat(p_tmp, SCIfile);
+        p_tmp[sizeof( p_tmp ) - 1] = '\0';
+        psz_path = p_tmp;
 #endif
     }
     else




More information about the vlc-devel mailing list