[MPlayer-cvslog] r30949 - in trunk: libmpcodecs/ad_realaud.c libmpcodecs/vd_realvid.c libmpcodecs/vd_xanim.c loader/elfdll.c loader/module.c loader/win32.c mpcommon.c mpcommon.h path.c path.h

diego subversion at mplayerhq.hu
Tue Mar 23 19:01:00 CET 2010


Author: diego
Date: Tue Mar 23 19:01:00 2010
New Revision: 30949

Log:
Get rid of pointless def_path variable; use codec_path directly instead.

Modified:
   trunk/libmpcodecs/ad_realaud.c
   trunk/libmpcodecs/vd_realvid.c
   trunk/libmpcodecs/vd_xanim.c
   trunk/loader/elfdll.c
   trunk/loader/module.c
   trunk/loader/win32.c
   trunk/mpcommon.c
   trunk/mpcommon.h
   trunk/path.c
   trunk/path.h

Modified: trunk/libmpcodecs/ad_realaud.c
==============================================================================
--- trunk/libmpcodecs/ad_realaud.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/libmpcodecs/ad_realaud.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -252,9 +252,9 @@ static int preinit(sh_audio_t *sh){
   unsigned int result;
   char *path;
 
-  path = malloc(strlen(def_path) + strlen(sh->codec->dll) + 2);
+  path = malloc(strlen(codecs_path) + strlen(sh->codec->dll) + 2);
   if (!path) return 0;
-  sprintf(path, "%s/%s", def_path, sh->codec->dll);
+  sprintf(path, "%s/%s", codecs_path, sh->codec->dll);
 
     /* first try to load linux dlls, if failed and we're supporting win32 dlls,
        then try to load the windows ones */
@@ -278,8 +278,8 @@ static int preinit(sh_audio_t *sh){
   if(raSetDLLAccessPath){
 #endif
       // used by 'SIPR'
-      path = realloc(path, strlen(def_path) + 13);
-      sprintf(path, "DT_Codecs=%s", def_path);
+      path = realloc(path, strlen(codecs_path) + 13);
+      sprintf(path, "DT_Codecs=%s", codecs_path);
       if(path[strlen(path)-1]!='/'){
         path[strlen(path)+1]=0;
         path[strlen(path)]='/';
@@ -301,14 +301,14 @@ static int preinit(sh_audio_t *sh){
 #ifdef CONFIG_WIN32DLL
     if (dll_type == 1){
       if (wraOpenCodec2) {
-        sprintf(path, "%s\\", def_path);
+        sprintf(path, "%s\\", codecs_path);
         result = wraOpenCodec2(&sh->context, path);
       } else
 	result=wraOpenCodec(&sh->context);
     } else
 #endif
     if (raOpenCodec2) {
-      sprintf(path, "%s/", def_path);
+      sprintf(path, "%s/", codecs_path);
       result = raOpenCodec2(&sh->context, path);
     } else
       result=raOpenCodec(&sh->context);

Modified: trunk/libmpcodecs/vd_realvid.c
==============================================================================
--- trunk/libmpcodecs/vd_realvid.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/libmpcodecs/vd_realvid.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -274,9 +274,9 @@ static int init(sh_video_t *sh){
 
 	mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X  sub-id: 0x%08X\n",be2me_32(((unsigned int*)extrahdr)[1]),be2me_32(((unsigned int*)extrahdr)[0]));
 
-	path = malloc(strlen(def_path) + strlen(sh->codec->dll) + 2);
+	path = malloc(strlen(codecs_path) + strlen(sh->codec->dll) + 2);
 	if (!path) return 0;
-	sprintf(path, "%s/%s", def_path, sh->codec->dll);
+	sprintf(path, "%s/%s", codecs_path, sh->codec->dll);
 
 	/* first try to load linux dlls, if failed and we're supporting win32 dlls,
 	   then try to load the windows ones */

Modified: trunk/libmpcodecs/vd_xanim.c
==============================================================================
--- trunk/libmpcodecs/vd_xanim.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/libmpcodecs/vd_xanim.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -682,7 +682,7 @@ static int init(sh_video_t *sh)
     for (i=0; i < XA_CLOSE_FUNCS; i++)
 	xa_close_func[i] = NULL;
 
-    snprintf(dll, 1024, "%s/%s", def_path, sh->codec->dll);
+    snprintf(dll, 1024, "%s/%s", codec_path, sh->codec->dll);
     if (xacodec_load(sh, dll) == 0)
 	return 0;
 

Modified: trunk/loader/elfdll.c
==============================================================================
--- trunk/loader/elfdll.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/loader/elfdll.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -68,7 +68,7 @@ void *ELFDLL_dlopen(const char *libname,
 
 	/* Now try to construct searches through our extra search-path */
 	namelen = strlen(libname);
-	ldpath = def_path;
+	ldpath = codec_path;
 	while(ldpath && *ldpath)
 	{
 		int len;

Modified: trunk/loader/module.c
==============================================================================
--- trunk/loader/module.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/loader/module.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -393,9 +393,9 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR lib
 		    strncpy(path, libname, 511);
                 else
 		    /* check default user path */
-		    strncpy(path, def_path, 300);
+		    strncpy(path, codec_path, 300);
 	    }
-	    else if (strcmp(def_path, listpath[i]))
+	    else if (strcmp(codec_path, listpath[i]))
                 /* path from the list */
 		strncpy(path, listpath[i], 300);
 	    else

Modified: trunk/loader/win32.c
==============================================================================
--- trunk/loader/win32.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/loader/win32.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -2575,7 +2575,8 @@ static int WINAPI expLoadLibraryA(char* 
 	return MODULE_HANDLE_psapi;
 
     result=LoadLibraryA(name);
-    dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
+    dbgprintf("Returned LoadLibraryA(0x%x='%s'), codec_path=%s => 0x%x\n",
+              name, name, codec_path, result);
 
     return result;
 }
@@ -3589,13 +3590,15 @@ static HANDLE WINAPI expFindFirstFileA(L
 #ifdef CONFIG_QTX_CODECS
     if(strstr(s, "quicktime\\*.QTX")){
 	dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTX\n", s, s, lpfd);
-	dbgprintf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",def_path);
-	qtx_dir=opendir(def_path);
+	dbgprintf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",
+	          codec_path);
+	qtx_dir = opendir(codec_path);
 	if(!qtx_dir) return (HANDLE)-1;
 	memset(lpfd,0,sizeof(*lpfd));
 	if(expFindNextFileA(FILE_HANDLE_quicktimeqtx,lpfd))
 	    return FILE_HANDLE_quicktimeqtx;
-	printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",def_path);
+	printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",
+	       codec_path);
 	return (HANDLE)-1;
     }
 #if 0
@@ -3732,8 +3735,8 @@ static HANDLE WINAPI expCreateFileA(LPCS
     if(strstr(cs1, "QuickTime.qts"))
     {
 	int result;
-	char* tmp=malloc(strlen(def_path)+50);
-	strcpy(tmp, def_path);
+	char* tmp = malloc(strlen(codec_path) + 50);
+	strcpy(tmp, codec_path);
 	strcat(tmp, "/");
 	strcat(tmp, "QuickTime.qts");
 	result=open(tmp, O_RDONLY);
@@ -3743,9 +3746,9 @@ static HANDLE WINAPI expCreateFileA(LPCS
     if(strstr(cs1, ".qtx"))
     {
 	int result;
-	char* tmp=malloc(strlen(def_path)+250);
+	char* tmp = malloc(strlen(codec_path) + 250);
 	char* x=strrchr(cs1,'\\');
-	sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1);
+	sprintf(tmp, "%s/%s", codec_path, x ? (x + 1) : cs1);
 //	printf("### Open: %s -> %s\n",cs1,tmp);
 	result=open(tmp, O_RDONLY);
 	free(tmp);
@@ -3756,8 +3759,8 @@ static HANDLE WINAPI expCreateFileA(LPCS
     if(strncmp(cs1, "AP", 2) == 0)
     {
 	int result;
-	char* tmp=malloc(strlen(def_path)+50);
-	strcpy(tmp, def_path);
+	char* tmp = malloc(strlen(codec_path) + 50);
+	strcpy(tmp, codec_path);
 	strcat(tmp, "/");
 	strcat(tmp, "APmpg4v1.apl");
 	result=open(tmp, O_RDONLY);

Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/mpcommon.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -314,5 +314,3 @@ const m_option_t noconfig_opts[] = {
     {NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
-char *codec_path = NULL;
-

Modified: trunk/mpcommon.h
==============================================================================
--- trunk/mpcommon.h	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/mpcommon.h	Tue Mar 23 19:01:00 2010	(r30949)
@@ -37,6 +37,4 @@ void set_osd_subtitle(subtitle *subs);
 extern int disable_system_conf;
 extern int disable_user_conf;
 
-extern char *codec_path;
-
 #endif /* MPLAYER_MPCOMMON_H */

Modified: trunk/path.c
==============================================================================
--- trunk/path.c	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/path.c	Tue Mar 23 19:01:00 2010	(r30949)
@@ -176,20 +176,20 @@ void set_path_env(void)
 }
 #endif /* (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) */
 
-char *def_path = BINARY_CODECS_PATH;
+char *codec_path = BINARY_CODECS_PATH;
 
 static int needs_free = 0;
 
 void set_codec_path(const char *path)
 {
     if (needs_free)
-        free(def_path);
+        free(codec_path);
     if (path == 0) {
-        def_path   = BINARY_CODECS_PATH;
+        codec_path = BINARY_CODECS_PATH;
         needs_free = 0;
         return;
     }
-    def_path = malloc(strlen(path) + 1);
-    strcpy(def_path, path);
+    codec_path = malloc(strlen(path) + 1);
+    strcpy(codec_path, path);
     needs_free = 1;
 }

Modified: trunk/path.h
==============================================================================
--- trunk/path.h	Tue Mar 23 18:52:46 2010	(r30948)
+++ trunk/path.h	Tue Mar 23 19:01:00 2010	(r30949)
@@ -21,7 +21,7 @@
 #ifndef MPLAYER_PATH_H
 #define MPLAYER_PATH_H
 
-extern char *def_path;
+extern char *codec_path;
 
 char *get_path(const char *filename);
 void set_path_env(void);


More information about the MPlayer-cvslog mailing list