summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-26 17:42:20 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-26 17:42:20 +0300
commit4785c2617ee9ac186464a55c1bfb13a5781ef041 (patch)
tree2424f18b68b2037bd4e290471821e9adae28b876 /loader
parent2732d5efbae3e0ee28bc6b70ceab1eb77e593216 (diff)
parent38abe6ff7a3810f8e01b6296570e92df1b12b09c (diff)
downloadmpv-4785c2617ee9ac186464a55c1bfb13a5781ef041.tar.bz2
mpv-4785c2617ee9ac186464a55c1bfb13a5781ef041.tar.xz
Merge svn changes up to r30967
Diffstat (limited to 'loader')
-rw-r--r--loader/drv.c22
-rw-r--r--loader/drv.h1
-rw-r--r--loader/elfdll.c6
-rw-r--r--loader/module.c8
-rw-r--r--loader/registry.c2
-rw-r--r--loader/win32.c95
-rw-r--r--loader/wine/elfdll.h1
7 files changed, 41 insertions, 94 deletions
diff --git a/loader/drv.c b/loader/drv.c
index 13945538d2..fbc4007734 100644
--- a/loader/drv.c
+++ b/loader/drv.c
@@ -25,12 +25,7 @@
#ifndef __MINGW32__
#include "ext.h"
#endif
-
-#ifndef WIN32_LOADER
-char* def_path = BINARY_CODECS_PATH;
-#else
-extern char* def_path;
-#endif
+#include "path.h"
#if 1
@@ -65,21 +60,6 @@ extern char* def_path;
"pop %%ebx\n\t"::)
#endif
-static int needs_free=0;
-void SetCodecPath(const char* path)
-{
- if(needs_free)free(def_path);
- if(path==0)
- {
- def_path = BINARY_CODECS_PATH;
- needs_free=0;
- return;
- }
- def_path = malloc(strlen(path)+1);
- strcpy(def_path, path);
- needs_free=1;
-}
-
static DWORD dwDrvID = 0;
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
diff --git a/loader/drv.h b/loader/drv.h
index 9ae1f8fbec..6f20b8ce54 100644
--- a/loader/drv.h
+++ b/loader/drv.h
@@ -9,7 +9,6 @@
#include "wine/windef.h"
#include "wine/driver.h"
-void SetCodecPath(const char* path);
void CodecAlloc(void);
void CodecRelease(void);
diff --git a/loader/elfdll.c b/loader/elfdll.c
index e4a0190f89..057fa5b9c8 100644
--- a/loader/elfdll.c
+++ b/loader/elfdll.c
@@ -18,6 +18,7 @@
#include "wine/debugtools.h"
#include "wine/winerror.h"
#include "debug.h"
+#include "path.h"
//DEFAULT_DEBUG_CHANNEL(elfdll)
@@ -37,9 +38,6 @@ DWORD fixup_imports(WINE_MODREF *wm);
void dump_exports(HMODULE hModule);
/*---------------- END HACKS ---------------*/
-//char *extra_ld_library_path = "/usr/lib/win32";
-extern char* def_path;
-
struct elfdll_image
{
HMODULE pe_module_start;
@@ -68,7 +66,7 @@ void *ELFDLL_dlopen(const char *libname, int flags)
/* Now try to construct searches through our extra search-path */
namelen = strlen(libname);
- ldpath = def_path;
+ ldpath = codec_path;
while(ldpath && *ldpath)
{
int len;
diff --git a/loader/module.c b/loader/module.c
index 79c01270d3..b9dcfa5869 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -46,6 +46,7 @@
#endif
#include "win32.h"
#include "drv.h"
+#include "path.h"
#ifdef EMU_QTX_API
#include "wrapper.h"
@@ -365,8 +366,7 @@ static WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm )
HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
{
WINE_MODREF *wm = 0;
- char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 };
- extern char* def_path;
+ char* listpath[] = { "", "", 0 };
char path[512];
char checked[2000];
int i = -1;
@@ -393,9 +393,9 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
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
diff --git a/loader/registry.c b/loader/registry.c
index 9964eeb9ff..cab63ceb72 100644
--- a/loader/registry.c
+++ b/loader/registry.c
@@ -21,7 +21,7 @@
#include "ext.h"
#include "registry.h"
-#include "get_path.h"
+#include "path.h"
//#undef TRACE
//#define TRACE printf
diff --git a/loader/win32.c b/loader/win32.c
index d0cbddca66..0b1999a043 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -49,6 +49,7 @@ for DLL to know too much about its environment.
#include "loader.h"
#include "com.h"
#include "ext.h"
+#include "path.h"
#include <stdlib.h>
#include <assert.h>
@@ -77,8 +78,6 @@ for DLL to know too much about its environment.
#include "osdep/mmap_anon.h"
#include "libavutil/avstring.h"
-char* def_path = BINARY_CODECS_PATH;
-
static void do_cpuid(unsigned int ax, unsigned int *regs)
{
__asm__ volatile
@@ -146,7 +145,7 @@ static void longcount_stub(long long*);
static unsigned int (*localcount)()=localcount_stub;
static void (*longcount)(long long*)=longcount_stub;
-static pthread_mutex_t memmut;
+static pthread_mutex_t memmut = PTHREAD_MUTEX_INITIALIZER;
static unsigned int localcount_stub(void)
{
@@ -366,14 +365,9 @@ void* mreq_private(int size, int to_zero, int type)
if (to_zero)
memset(header, 0, nsize);
#ifdef GARBAGE
- if (!last_alloc)
- {
- pthread_mutex_init(&memmut, NULL);
- pthread_mutex_lock(&memmut);
- }
- else
+ pthread_mutex_lock(&memmut);
+ if (last_alloc)
{
- pthread_mutex_lock(&memmut);
last_alloc->next = header; /* set next */
}
@@ -442,10 +436,7 @@ static int my_release(void* memory)
alccnt--;
- if (last_alloc)
- pthread_mutex_unlock(&memmut);
- else
- pthread_mutex_destroy(&memmut);
+ pthread_mutex_unlock(&memmut);
//if (alccnt < 40000) printf("MY_RELEASE: %p\t%ld (%d)\n", header, header->size, alccnt);
#else
@@ -1182,13 +1173,6 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
}
}
fclose (f);
- /*
- * ad hoc fix for smp machines.
- * some problems on WaitForSingleObject,CreateEvent,SetEvent
- * CreateThread ...etc..
- *
- */
- cachedsi.dwNumberOfProcessors=1;
}
#endif /* __linux__ */
cache = 1;
@@ -1814,47 +1798,31 @@ static long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1
static long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
{
- dbgprintf("GetVersionExA(0x%x) => 1\n");
+ dbgprintf("GetVersionExA(0x%x) => 1\n", c);
c->dwOSVersionInfoSize=sizeof(*c);
- c->dwMajorVersion=4;
- c->dwMinorVersion=0;
- c->dwBuildNumber=0x4000457;
-#if 1
- // leave it here for testing win9x-only codecs
- c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
- strcpy(c->szCSDVersion, " B");
-#else
- c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers
- strcpy(c->szCSDVersion, "Service Pack 3");
-#endif
- dbgprintf(" Major version: 4\n Minor version: 0\n Build number: 0x4000457\n"
- " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n");
+ c->dwMajorVersion=5;
+ c->dwMinorVersion=1;
+ c->dwBuildNumber=0x5010a28;
+ c->dwPlatformId=VER_PLATFORM_WIN32_NT;
+ strcpy(c->szCSDVersion, "Service Pack 2");
+ dbgprintf(" Major version: 5\n Minor version: 1\n Build number: 0x5010a28\n"
+ " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 2'\n");
return 1;
}
static long WINAPI expGetVersionExW(OSVERSIONINFOW* c)
{
char CSDVersion[128];
- dbgprintf("GetVersionExW(0x%x) => 1\n");
+ dbgprintf("GetVersionExW(0x%x) => 1\n", c);
c->dwOSVersionInfoSize=sizeof(*c);
c->dwMajorVersion=5;
- c->dwMinorVersion=0;
- c->dwBuildNumber=0x5000457;
-#if 1
- // leave it here for testing win9x-only codecs
- c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
- strcpy(CSDVersion, " B");
-#else
- c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers
- strcpy(CSDVersion, "Service Pack 3");
-#endif
+ c->dwMinorVersion=1;
+ c->dwBuildNumber=0x5010a28;
+ c->dwPlatformId=VER_PLATFORM_WIN32_NT;
+ strcpy(CSDVersion, "Service Pack 2");
MultiByteToWideChar(65001, 0x0, CSDVersion, -1, c->szCSDVersion, 128);
- dbgprintf(" Major version: %d\n Minor version: %d\n Build number: 0x%08x\n"
- " Platform Id: %s\n Version string: '%s'\n",
- c->dwMajorVersion, c->dwMinorVersion, c->dwBuildNumber,
- (c->dwPlatformId==VER_PLATFORM_WIN32_WINDOWS ? "VER_PLATFORM_WIN32_WINDOWS" :
- (c->dwPlatformId==VER_PLATFORM_WIN32_NT ? "VER_PLATFORM_WIN32_NT" : "Unknown")),
- CSDVersion);
+ dbgprintf(" Major version: 5\n Minor version: 1\n Build number: 0x5010a28\n"
+ " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 2'\n");
return 1;
}
@@ -2604,7 +2572,8 @@ static int WINAPI expLoadLibraryA(char* name)
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;
}
@@ -3618,13 +3587,15 @@ static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd)
#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
@@ -3761,8 +3732,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
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);
@@ -3772,9 +3743,9 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
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);
@@ -3785,8 +3756,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
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);
diff --git a/loader/wine/elfdll.h b/loader/wine/elfdll.h
index 82a6ea1f8d..e93ae10429 100644
--- a/loader/wine/elfdll.h
+++ b/loader/wine/elfdll.h
@@ -9,6 +9,5 @@ HINSTANCE16 ELFDLL_LoadModule16(LPCSTR libname);
void ELFDLL_UnloadLibrary(WINE_MODREF *wm);
void *ELFDLL_dlopen(const char *libname, int flags);
-extern char *extra_ld_library_path;
#endif /* MPLAYER_ELFDLL_H */