mirror of https://github.com/mpv-player/mpv
loader/win32.c: misc cleanup
Make library/export function tables static const. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31898 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid mixing code and declarations. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31899 b3059339-0415-0410-9bf9-f77b7e298cf2 Make function declarations proper prototypes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31900 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix type in conditional. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31901 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid arithmetic on void * pointers. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31902 b3059339-0415-0410-9bf9-f77b7e298cf2 Add const to avoid warnings. The const on the return type is not correct compared to the real win32 API functions, but that really does not matter for us, avoiding the warning is more useful. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31903 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
5c76f24b09
commit
1605194717
|
@ -141,7 +141,7 @@ static void c_longcount_notsc(long long* z)
|
||||||
}
|
}
|
||||||
static unsigned int localcount_stub(void);
|
static unsigned int localcount_stub(void);
|
||||||
static void longcount_stub(long long*);
|
static void longcount_stub(long long*);
|
||||||
static unsigned int (*localcount)()=localcount_stub;
|
static unsigned int (*localcount)(void)=localcount_stub;
|
||||||
static void (*longcount)(long long*)=longcount_stub;
|
static void (*longcount)(long long*)=longcount_stub;
|
||||||
|
|
||||||
static pthread_mutex_t memmut = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t memmut = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
@ -678,8 +678,9 @@ static pthread_mutex_t mlist_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
void destroy_event(void* event)
|
void destroy_event(void* event)
|
||||||
{
|
{
|
||||||
|
mutex_list *pp;
|
||||||
pthread_mutex_lock(&mlist_lock);
|
pthread_mutex_lock(&mlist_lock);
|
||||||
mutex_list* pp=mlist;
|
pp=mlist;
|
||||||
// printf("garbage collector: destroy_event(%x)\n", event);
|
// printf("garbage collector: destroy_event(%x)\n", event);
|
||||||
while(pp)
|
while(pp)
|
||||||
{
|
{
|
||||||
|
@ -2757,7 +2758,7 @@ static int WINAPI expMonitorFromPoint(void *p, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WINAPI expEnumDisplayMonitors(void *dc, RECT *r,
|
static int WINAPI expEnumDisplayMonitors(void *dc, RECT *r,
|
||||||
int WINAPI (*callback_proc)(), void *callback_param)
|
int WINAPI (*callback_proc)(HMONITOR, HDC, LPRECT, LPARAM), void *callback_param)
|
||||||
{
|
{
|
||||||
dbgprintf("EnumDisplayMonitors(0x%x, 0x%x, 0x%x, 0x%x) => ?\n",
|
dbgprintf("EnumDisplayMonitors(0x%x, 0x%x, 0x%x, 0x%x) => ?\n",
|
||||||
dc, r, callback_proc, callback_param);
|
dc, r, callback_proc, callback_param);
|
||||||
|
@ -2857,7 +2858,7 @@ static int WINAPI expCreateRectRgn(int x, int y, int width, int height)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WINAPI expEnumWindows(int (*callback_func)(), void *callback_param)
|
static int WINAPI expEnumWindows(int (*callback_func)(HWND, LPARAM), void *callback_param)
|
||||||
{
|
{
|
||||||
int i, i2;
|
int i, i2;
|
||||||
dbgprintf("EnumWindows(0x%x, 0x%x) => 1\n", callback_func, callback_param);
|
dbgprintf("EnumWindows(0x%x, 0x%x) => 1\n", callback_func, callback_param);
|
||||||
|
@ -3894,7 +3895,7 @@ static WIN_BOOL WINAPI expWriteFile(HANDLE h,LPCVOID pv,DWORD size,LPDWORD wr,LP
|
||||||
static DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence)
|
static DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence)
|
||||||
{
|
{
|
||||||
int wh;
|
int wh;
|
||||||
dbgprintf("SetFilePointer(%d, 0x%x, 0x%x = %d, %d)\n", h, val, ext, ext ? *ext : NULL, whence);
|
dbgprintf("SetFilePointer(%d, 0x%x, 0x%x = %d, %d)\n", h, val, ext, ext ? *ext : 0, whence);
|
||||||
//why would DLL want temporary file with >2Gb size?
|
//why would DLL want temporary file with >2Gb size?
|
||||||
switch(whence)
|
switch(whence)
|
||||||
{
|
{
|
||||||
|
@ -4747,7 +4748,7 @@ static void WINAPI expGlobalMemoryStatus(
|
||||||
lpmem->dwAvailPageFile = 16*1024*1024;
|
lpmem->dwAvailPageFile = 16*1024*1024;
|
||||||
}
|
}
|
||||||
expGetSystemInfo(&si);
|
expGetSystemInfo(&si);
|
||||||
lpmem->dwTotalVirtual = si.lpMaximumApplicationAddress-si.lpMinimumApplicationAddress;
|
lpmem->dwTotalVirtual = (uint8_t *)si.lpMaximumApplicationAddress-(uint8_t *)si.lpMinimumApplicationAddress;
|
||||||
/* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */
|
/* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */
|
||||||
lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024;
|
lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024;
|
||||||
memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS));
|
memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS));
|
||||||
|
@ -4994,8 +4995,8 @@ static WIN_BOOL WINAPI expGetOpenFileNameA(/*LPOPENFILENAMEA*/ void* lpfn)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char * WINAPI expPathFindExtensionA(const char *path) {
|
static const char * WINAPI expPathFindExtensionA(const char *path) {
|
||||||
char *ext;
|
const char *ext;
|
||||||
if (!path)
|
if (!path)
|
||||||
ext = NULL;
|
ext = NULL;
|
||||||
else {
|
else {
|
||||||
|
@ -5007,8 +5008,8 @@ static char * WINAPI expPathFindExtensionA(const char *path) {
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char * WINAPI expPathFindFileNameA(const char *path) {
|
static const char * WINAPI expPathFindFileNameA(const char *path) {
|
||||||
char *name;
|
const char *name;
|
||||||
if (!path || strlen(path) < 2)
|
if (!path || strlen(path) < 2)
|
||||||
name = path;
|
name = path;
|
||||||
else {
|
else {
|
||||||
|
@ -5142,7 +5143,7 @@ struct libs
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[64];
|
||||||
int length;
|
int length;
|
||||||
struct exports* exps;
|
const struct exports* exps;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FF(X,Y) \
|
#define FF(X,Y) \
|
||||||
|
@ -5151,7 +5152,7 @@ struct libs
|
||||||
#define UNDEFF(X, Y) \
|
#define UNDEFF(X, Y) \
|
||||||
{#X, Y, (void*)-1},
|
{#X, Y, (void*)-1},
|
||||||
|
|
||||||
struct exports exp_kernel32[]=
|
static const struct exports exp_kernel32[]=
|
||||||
{
|
{
|
||||||
FF(GetVolumeInformationA,-1)
|
FF(GetVolumeInformationA,-1)
|
||||||
FF(GetDriveTypeA,-1)
|
FF(GetDriveTypeA,-1)
|
||||||
|
@ -5327,7 +5328,7 @@ struct exports exp_kernel32[]=
|
||||||
UNDEFF(FlsFree, -1)
|
UNDEFF(FlsFree, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct exports exp_msvcrt[]={
|
static const struct exports exp_msvcrt[]={
|
||||||
FF(malloc, -1)
|
FF(malloc, -1)
|
||||||
FF(_initterm, -1)
|
FF(_initterm, -1)
|
||||||
FF(__dllonexit, -1)
|
FF(__dllonexit, -1)
|
||||||
|
@ -5391,7 +5392,7 @@ struct exports exp_msvcrt[]={
|
||||||
FF(realloc,-1)
|
FF(realloc,-1)
|
||||||
{"puts",-1,(void*)&puts}
|
{"puts",-1,(void*)&puts}
|
||||||
};
|
};
|
||||||
struct exports exp_winmm[]={
|
static const struct exports exp_winmm[]={
|
||||||
FF(GetDriverModuleHandle, -1)
|
FF(GetDriverModuleHandle, -1)
|
||||||
FF(timeGetTime, -1)
|
FF(timeGetTime, -1)
|
||||||
FF(DefDriverProc, -1)
|
FF(DefDriverProc, -1)
|
||||||
|
@ -5404,10 +5405,10 @@ struct exports exp_winmm[]={
|
||||||
FF(waveOutGetNumDevs, -1)
|
FF(waveOutGetNumDevs, -1)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
struct exports exp_psapi[]={
|
static const struct exports exp_psapi[]={
|
||||||
FF(GetModuleBaseNameA, -1)
|
FF(GetModuleBaseNameA, -1)
|
||||||
};
|
};
|
||||||
struct exports exp_user32[]={
|
static const struct exports exp_user32[]={
|
||||||
FF(LoadIconA,-1)
|
FF(LoadIconA,-1)
|
||||||
FF(LoadStringA, -1)
|
FF(LoadStringA, -1)
|
||||||
FF(wsprintfA, -1)
|
FF(wsprintfA, -1)
|
||||||
|
@ -5455,7 +5456,7 @@ struct exports exp_user32[]={
|
||||||
FF(CharNextA, -1)
|
FF(CharNextA, -1)
|
||||||
FF(EnumDisplaySettingsA, -1)
|
FF(EnumDisplaySettingsA, -1)
|
||||||
};
|
};
|
||||||
struct exports exp_advapi32[]={
|
static const struct exports exp_advapi32[]={
|
||||||
FF(RegCloseKey, -1)
|
FF(RegCloseKey, -1)
|
||||||
FF(RegCreateKeyA, -1)
|
FF(RegCreateKeyA, -1)
|
||||||
FF(RegCreateKeyExA, -1)
|
FF(RegCreateKeyExA, -1)
|
||||||
|
@ -5467,7 +5468,7 @@ struct exports exp_advapi32[]={
|
||||||
FF(RegSetValueExA, -1)
|
FF(RegSetValueExA, -1)
|
||||||
FF(RegQueryInfoKeyA, -1)
|
FF(RegQueryInfoKeyA, -1)
|
||||||
};
|
};
|
||||||
struct exports exp_gdi32[]={
|
static const struct exports exp_gdi32[]={
|
||||||
FF(CreateCompatibleDC, -1)
|
FF(CreateCompatibleDC, -1)
|
||||||
FF(CreateFontA, -1)
|
FF(CreateFontA, -1)
|
||||||
FF(DeleteDC, -1)
|
FF(DeleteDC, -1)
|
||||||
|
@ -5480,10 +5481,10 @@ struct exports exp_gdi32[]={
|
||||||
FF(CreateRectRgn, -1)
|
FF(CreateRectRgn, -1)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
struct exports exp_version[]={
|
static const struct exports exp_version[]={
|
||||||
FF(GetFileVersionInfoSizeA, -1)
|
FF(GetFileVersionInfoSizeA, -1)
|
||||||
};
|
};
|
||||||
struct exports exp_ole32[]={
|
static const struct exports exp_ole32[]={
|
||||||
FF(CoCreateFreeThreadedMarshaler,-1)
|
FF(CoCreateFreeThreadedMarshaler,-1)
|
||||||
FF(CoCreateInstance, -1)
|
FF(CoCreateInstance, -1)
|
||||||
FF(CoInitialize, -1)
|
FF(CoInitialize, -1)
|
||||||
|
@ -5496,22 +5497,22 @@ struct exports exp_ole32[]={
|
||||||
};
|
};
|
||||||
// do we really need crtdll ???
|
// do we really need crtdll ???
|
||||||
// msvcrt is the correct place probably...
|
// msvcrt is the correct place probably...
|
||||||
struct exports exp_crtdll[]={
|
static const struct exports exp_crtdll[]={
|
||||||
FF(memcpy, -1)
|
FF(memcpy, -1)
|
||||||
FF(wcscpy, -1)
|
FF(wcscpy, -1)
|
||||||
};
|
};
|
||||||
struct exports exp_comctl32[]={
|
static const struct exports exp_comctl32[]={
|
||||||
FF(StringFromGUID2, -1)
|
FF(StringFromGUID2, -1)
|
||||||
FF(InitCommonControls, 17)
|
FF(InitCommonControls, 17)
|
||||||
#ifdef CONFIG_QTX_CODECS
|
#ifdef CONFIG_QTX_CODECS
|
||||||
FF(CreateUpDownControl, 16)
|
FF(CreateUpDownControl, 16)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
struct exports exp_wsock32[]={
|
static const struct exports exp_wsock32[]={
|
||||||
FF(htonl,8)
|
FF(htonl,8)
|
||||||
FF(ntohl,14)
|
FF(ntohl,14)
|
||||||
};
|
};
|
||||||
struct exports exp_msdmo[]={
|
static const struct exports exp_msdmo[]={
|
||||||
FF(memcpy, -1) // just test
|
FF(memcpy, -1) // just test
|
||||||
FF(MoCopyMediaType, -1)
|
FF(MoCopyMediaType, -1)
|
||||||
FF(MoCreateMediaType, -1)
|
FF(MoCreateMediaType, -1)
|
||||||
|
@ -5520,7 +5521,7 @@ struct exports exp_msdmo[]={
|
||||||
FF(MoFreeMediaType, -1)
|
FF(MoFreeMediaType, -1)
|
||||||
FF(MoInitMediaType, -1)
|
FF(MoInitMediaType, -1)
|
||||||
};
|
};
|
||||||
struct exports exp_oleaut32[]={
|
static const struct exports exp_oleaut32[]={
|
||||||
FF(SysAllocStringLen, 4)
|
FF(SysAllocStringLen, 4)
|
||||||
FF(SysFreeString, 6)
|
FF(SysFreeString, 6)
|
||||||
FF(VariantInit, 8)
|
FF(VariantInit, 8)
|
||||||
|
@ -5545,7 +5546,7 @@ struct exports exp_oleaut32[]={
|
||||||
23022 411 _purecall
|
23022 411 _purecall
|
||||||
*/
|
*/
|
||||||
#ifdef REALPLAYER
|
#ifdef REALPLAYER
|
||||||
struct exports exp_pncrt[]={
|
static const struct exports exp_pncrt[]={
|
||||||
FF(malloc, -1) // just test
|
FF(malloc, -1) // just test
|
||||||
FF(free, -1) // just test
|
FF(free, -1) // just test
|
||||||
FF(fprintf, -1) // just test
|
FF(fprintf, -1) // just test
|
||||||
|
@ -5565,21 +5566,21 @@ struct exports exp_pncrt[]={
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_QTX_CODECS
|
#ifdef CONFIG_QTX_CODECS
|
||||||
struct exports exp_ddraw[]={
|
static const struct exports exp_ddraw[]={
|
||||||
FF(DirectDrawCreate, -1)
|
FF(DirectDrawCreate, -1)
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct exports exp_comdlg32[]={
|
static const struct exports exp_comdlg32[]={
|
||||||
FF(GetOpenFileNameA, -1)
|
FF(GetOpenFileNameA, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct exports exp_shlwapi[]={
|
static const struct exports exp_shlwapi[]={
|
||||||
FF(PathFindExtensionA, -1)
|
FF(PathFindExtensionA, -1)
|
||||||
FF(PathFindFileNameA, -1)
|
FF(PathFindFileNameA, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct exports exp_msvcr80[]={
|
static const struct exports exp_msvcr80[]={
|
||||||
FF(_CIpow,-1)
|
FF(_CIpow,-1)
|
||||||
FF(_CIsin,-1)
|
FF(_CIsin,-1)
|
||||||
FF(_CIcos,-1)
|
FF(_CIcos,-1)
|
||||||
|
@ -5593,7 +5594,7 @@ struct exports exp_msvcr80[]={
|
||||||
{"??3@YAXPAX@Z", -1, expdelete}
|
{"??3@YAXPAX@Z", -1, expdelete}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct exports exp_msvcp60[]={
|
static const struct exports exp_msvcp60[]={
|
||||||
{"??0_Lockit@std@@QAE@XZ", -1, exp_0Lockit_dummy},
|
{"??0_Lockit@std@@QAE@XZ", -1, exp_0Lockit_dummy},
|
||||||
{"??1_Lockit@std@@QAE@XZ", -1, exp_1Lockit_dummy}
|
{"??1_Lockit@std@@QAE@XZ", -1, exp_1Lockit_dummy}
|
||||||
};
|
};
|
||||||
|
@ -5601,7 +5602,7 @@ struct exports exp_msvcp60[]={
|
||||||
#define LL(X) \
|
#define LL(X) \
|
||||||
{#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
|
{#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
|
||||||
|
|
||||||
struct libs libraries[]={
|
static const struct libs libraries[]={
|
||||||
LL(kernel32)
|
LL(kernel32)
|
||||||
LL(msvcrt)
|
LL(msvcrt)
|
||||||
LL(winmm)
|
LL(winmm)
|
||||||
|
|
Loading…
Reference in New Issue