changeset 30907:b32527b30d17

Get rid of pointless def_path variable; use codec_path directly instead.
author diego
date Tue, 23 Mar 2010 18:01:00 +0000
parents a34f16fb8823
children fbb65a2153c6
files 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
diffstat 10 files changed, 31 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_realaud.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/libmpcodecs/ad_realaud.c	Tue Mar 23 18:01:00 2010 +0000
@@ -252,9 +252,9 @@
   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 @@
   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 @@
 #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);
--- a/libmpcodecs/vd_realvid.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/libmpcodecs/vd_realvid.c	Tue Mar 23 18:01:00 2010 +0000
@@ -274,9 +274,9 @@
 
 	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 */
--- a/libmpcodecs/vd_xanim.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/libmpcodecs/vd_xanim.c	Tue Mar 23 18:01:00 2010 +0000
@@ -682,7 +682,7 @@
     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;
 
--- a/loader/elfdll.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/loader/elfdll.c	Tue Mar 23 18:01:00 2010 +0000
@@ -68,7 +68,7 @@
 
 	/* Now try to construct searches through our extra search-path */
 	namelen = strlen(libname);
-	ldpath = def_path;
+	ldpath = codec_path;
 	while(ldpath && *ldpath)
 	{
 		int len;
--- a/loader/module.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/loader/module.c	Tue Mar 23 18:01:00 2010 +0000
@@ -393,9 +393,9 @@
 		    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
--- a/loader/win32.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/loader/win32.c	Tue Mar 23 18:01:00 2010 +0000
@@ -2575,7 +2575,8 @@
 	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 @@
 #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 @@
     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 @@
     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 @@
     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);
--- a/mpcommon.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/mpcommon.c	Tue Mar 23 18:01:00 2010 +0000
@@ -314,5 +314,3 @@
     {NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
-char *codec_path = NULL;
-
--- a/mpcommon.h	Tue Mar 23 17:52:46 2010 +0000
+++ b/mpcommon.h	Tue Mar 23 18:01:00 2010 +0000
@@ -37,6 +37,4 @@
 extern int disable_system_conf;
 extern int disable_user_conf;
 
-extern char *codec_path;
-
 #endif /* MPLAYER_MPCOMMON_H */
--- a/path.c	Tue Mar 23 17:52:46 2010 +0000
+++ b/path.c	Tue Mar 23 18:01:00 2010 +0000
@@ -176,20 +176,20 @@
 }
 #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;
 }
--- a/path.h	Tue Mar 23 17:52:46 2010 +0000
+++ b/path.h	Tue Mar 23 18:01:00 2010 +0000
@@ -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);