summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-08-02 17:18:18 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:15:01 +0200
commit1605194717abdbbe481b322e220484f1e59aa5f1 (patch)
treea16cfce618926faddd5b52ace87a4f19a2cb2160
parent5c76f24b0958f78e45379514a42786450e27b2c1 (diff)
downloadmpv-1605194717abdbbe481b322e220484f1e59aa5f1.tar.bz2
mpv-1605194717abdbbe481b322e220484f1e59aa5f1.tar.xz
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
-rw-r--r--loader/win32.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/loader/win32.c b/loader/win32.c
index 71c46e70fb..becfd51e85 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -141,7 +141,7 @@ static void c_longcount_notsc(long long* z)
}
static unsigned int localcount_stub(void);
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 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)
{
+ mutex_list *pp;
pthread_mutex_lock(&mlist_lock);
- mutex_list* pp=mlist;
+ pp=mlist;
// printf("garbage collector: destroy_event(%x)\n", event);
while(pp)
{
@@ -2757,7 +2758,7 @@ static int WINAPI expMonitorFromPoint(void *p, int flags)
}
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",
dc, r, callback_proc, callback_param);
@@ -2857,7 +2858,7 @@ static int WINAPI expCreateRectRgn(int x, int y, int width, int height)
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;
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)
{
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?
switch(whence)
{
@@ -4747,7 +4748,7 @@ static void WINAPI expGlobalMemoryStatus(
lpmem->dwAvailPageFile = 16*1024*1024;
}
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 */
lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024;
memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS));
@@ -4994,8 +4995,8 @@ static WIN_BOOL WINAPI expGetOpenFileNameA(/*LPOPENFILENAMEA*/ void* lpfn)
return 1;
}
-static char * WINAPI expPathFindExtensionA(const char *path) {
- char *ext;
+static const char * WINAPI expPathFindExtensionA(const char *path) {
+ const char *ext;
if (!path)
ext = NULL;
else {
@@ -5007,8 +5008,8 @@ static char * WINAPI expPathFindExtensionA(const char *path) {
return ext;
}
-static char * WINAPI expPathFindFileNameA(const char *path) {
- char *name;
+static const char * WINAPI expPathFindFileNameA(const char *path) {
+ const char *name;
if (!path || strlen(path) < 2)
name = path;
else {
@@ -5142,7 +5143,7 @@ struct libs
{
char name[64];
int length;
- struct exports* exps;
+ const struct exports* exps;
};
#define FF(X,Y) \
@@ -5151,7 +5152,7 @@ struct libs
#define UNDEFF(X, Y) \
{#X, Y, (void*)-1},
-struct exports exp_kernel32[]=
+static const struct exports exp_kernel32[]=
{
FF(GetVolumeInformationA,-1)
FF(GetDriveTypeA,-1)
@@ -5327,7 +5328,7 @@ struct exports exp_kernel32[]=
UNDEFF(FlsFree, -1)
};
-struct exports exp_msvcrt[]={
+static const struct exports exp_msvcrt[]={
FF(malloc, -1)
FF(_initterm, -1)
FF(__dllonexit, -1)
@@ -5391,7 +5392,7 @@ struct exports exp_msvcrt[]={
FF(realloc,-1)
{"puts",-1,(void*)&puts}
};
-struct exports exp_winmm[]={
+static const struct exports exp_winmm[]={
FF(GetDriverModuleHandle, -1)
FF(timeGetTime, -1)
FF(DefDriverProc, -1)
@@ -5404,10 +5405,10 @@ struct exports exp_winmm[]={
FF(waveOutGetNumDevs, -1)
#endif
};
-struct exports exp_psapi[]={
+static const struct exports exp_psapi[]={
FF(GetModuleBaseNameA, -1)
};
-struct exports exp_user32[]={
+static const struct exports exp_user32[]={
FF(LoadIconA,-1)
FF(LoadStringA, -1)
FF(wsprintfA, -1)
@@ -5455,7 +5456,7 @@ struct exports exp_user32[]={
FF(CharNextA, -1)
FF(EnumDisplaySettingsA, -1)
};
-struct exports exp_advapi32[]={
+static const struct exports exp_advapi32[]={
FF(RegCloseKey, -1)
FF(RegCreateKeyA, -1)
FF(RegCreateKeyExA, -1)
@@ -5467,7 +5468,7 @@ struct exports exp_advapi32[]={
FF(RegSetValueExA, -1)
FF(RegQueryInfoKeyA, -1)
};
-struct exports exp_gdi32[]={
+static const struct exports exp_gdi32[]={
FF(CreateCompatibleDC, -1)
FF(CreateFontA, -1)
FF(DeleteDC, -1)
@@ -5480,10 +5481,10 @@ struct exports exp_gdi32[]={
FF(CreateRectRgn, -1)
#endif
};
-struct exports exp_version[]={
+static const struct exports exp_version[]={
FF(GetFileVersionInfoSizeA, -1)
};
-struct exports exp_ole32[]={
+static const struct exports exp_ole32[]={
FF(CoCreateFreeThreadedMarshaler,-1)
FF(CoCreateInstance, -1)
FF(CoInitialize, -1)
@@ -5496,22 +5497,22 @@ struct exports exp_ole32[]={
};
// do we really need crtdll ???
// msvcrt is the correct place probably...
-struct exports exp_crtdll[]={
+static const struct exports exp_crtdll[]={
FF(memcpy, -1)
FF(wcscpy, -1)
};
-struct exports exp_comctl32[]={
+static const struct exports exp_comctl32[]={
FF(StringFromGUID2, -1)
FF(InitCommonControls, 17)
#ifdef CONFIG_QTX_CODECS
FF(CreateUpDownControl, 16)
#endif
};
-struct exports exp_wsock32[]={
+static const struct exports exp_wsock32[]={
FF(htonl,8)
FF(ntohl,14)
};
-struct exports exp_msdmo[]={
+static const struct exports exp_msdmo[]={
FF(memcpy, -1) // just test
FF(MoCopyMediaType, -1)
FF(MoCreateMediaType, -1)
@@ -5520,7 +5521,7 @@ struct exports exp_msdmo[]={
FF(MoFreeMediaType, -1)
FF(MoInitMediaType, -1)
};
-struct exports exp_oleaut32[]={
+static const struct exports exp_oleaut32[]={
FF(SysAllocStringLen, 4)
FF(SysFreeString, 6)
FF(VariantInit, 8)
@@ -5545,7 +5546,7 @@ struct exports exp_oleaut32[]={
23022 411 _purecall
*/
#ifdef REALPLAYER
-struct exports exp_pncrt[]={
+static const struct exports exp_pncrt[]={
FF(malloc, -1) // just test
FF(free, -1) // just test
FF(fprintf, -1) // just test
@@ -5565,21 +5566,21 @@ struct exports exp_pncrt[]={
#endif
#ifdef CONFIG_QTX_CODECS
-struct exports exp_ddraw[]={
+static const struct exports exp_ddraw[]={
FF(DirectDrawCreate, -1)
};
#endif
-struct exports exp_comdlg32[]={
+static const struct exports exp_comdlg32[]={
FF(GetOpenFileNameA, -1)
};
-struct exports exp_shlwapi[]={
+static const struct exports exp_shlwapi[]={
FF(PathFindExtensionA, -1)
FF(PathFindFileNameA, -1)
};
-struct exports exp_msvcr80[]={
+static const struct exports exp_msvcr80[]={
FF(_CIpow,-1)
FF(_CIsin,-1)
FF(_CIcos,-1)
@@ -5593,7 +5594,7 @@ struct exports exp_msvcr80[]={
{"??3@YAXPAX@Z", -1, expdelete}
};
-struct exports exp_msvcp60[]={
+static const struct exports exp_msvcp60[]={
{"??0_Lockit@std@@QAE@XZ", -1, exp_0Lockit_dummy},
{"??1_Lockit@std@@QAE@XZ", -1, exp_1Lockit_dummy}
};
@@ -5601,7 +5602,7 @@ struct exports exp_msvcp60[]={
#define LL(X) \
{#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
-struct libs libraries[]={
+static const struct libs libraries[]={
LL(kernel32)
LL(msvcrt)
LL(winmm)