[MPlayer-dev-eng] [PATCH] loader fixes
Dominik 'Rathann' Mierzejewski
dominik at rangers.eu.org
Sat Jul 31 20:41:39 CEST 2004
Hi.
A round of issues and proposed fixes. This is a follow-up for
http://mplayerhq.hu/pipermail/mplayer-dev-eng/2004-April/thread.html#25088
and
http://mplayerhq.hu/pipermail/mplayer-dev-eng/2004-April/thread.html#25156
and
http://mplayerhq.hu/pipermail/mplayer-dev-eng/2004-April/thread.html#25167
You're welcome to yell.
Problem:
leftover inclusions of wine headers
libmpdemux/muxer_rawvideo.c:14
//#include "stream.h"
//#include "demuxer.h"
//#include "stheader.h"
#include "wine/mmreg.h"
#include "wine/avifmt.h"
#include "wine/vfw.h"
#include "bswap.h"
#include "muxer.h"
Solution:
replace all #include "wine/*" with our new wine-independent headers
avi_header.h and ms_hdr.h.
Problem:
MPEGLAYER3WAVEFORMAT struct defined twice (in loader/wine/mmreg.h
and our libmpdemux/ms_hdr.h). It's part of Alex's somewhat failed attempt
to implement my solution for platform-independent avi format definitions.
Solution:
Surround both with:
#ifndef _MPEGLAYER3WAVEFORMAT_
#define _MPEGLAYER3WAVEFORMAT_
[...]
#endif /* _MPEGLAYER3WAVEFORMAT_ */
Problem:
wine typedefs not in sync with avifile's
loader/wine/windef.h:158
typedef int INT;
typedef unsigned int UINT;
typedef unsigned short WORD;
typedef unsigned int DWORD;
typedef unsigned int ULONG;
typedef unsigned char BYTE;
typedef long LONG;
typedef short SHORT;
Solution:
typedef unsigned long DWORD;
typedef unsigned long ULONG;
We can do that safely now, because we have out own platform independent
format definitions.
Problem:
BITMAPINFOHEADER definition not in sync with avifile's
loader/wine/vfw.h:22
#define _BITMAPINFOHEADER_
typedef struct __attribute__((__packed__))
{
int biSize;
int biWidth;
int biHeight;
short biPlanes;
short biBitCount;
int biCompression;
int biSizeImage;
int biXPelsPerMeter;
int biYPelsPerMeter;
int biClrUsed;
int biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
typedef struct {
BITMAPINFOHEADER bmiHeader;
Solution:
replace all ints with longs.
Problem:
dbg_printf defined twice (in loader/config.h and loader/wine/debugtools.h)
Solution:
surround them with #ifndef dbg_printf
Problem:
win32.c:866: warning: assignment discards qualifiers from pointer
target type
[...]
static void* WINAPI expWaitForMultipleObjects(int count, const void**
objects,
int WaitAll, int duration)
{
int i;
void *object;
[...]
for (i = 0; i < count; i++)
{
-> object = objects[i];
[...]
Solution:
object = (void *)objects[i];
This is our code (not in avifile's loader), so we may mess with it. ;)
Problem:
if we enable Quicktime codecs, then
win32.c:898: warning: no return statement in function returning non-void
static HANDLE WINAPI expCreateMutexA(void *pSecAttr,
char bInitialOwner, const char *name)
{
HANDLE mlist = (HANDLE)expCreateEventA(pSecAttr, 0, 0, name);
[...]
#ifndef QTX
/* 10l to QTX, if CreateMutex returns a real mutex, WaitForSingleObject
waits for ever, else it works ;) */
return mlist;
#endif
}
Solution:
#else
return (HANDLE)0;
Alex said it's wrong to return null handle, and suggested returning some
arbitrary value that would be recognized on the other end. However, I
don't know the code well enough, so I'm just saying it could be fixed.
Problem:
win32.c:1948: warning: `return' with no value, in function returning
non-void
static DWORD WINAPI expRegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD
class_len, LPDWORD reserved
LPDWORD subkeys, LPDWORD
max_subkey, LPDWORD max_class,
LPDWORD values, LPDWORD max_value,
LPDWORD max_data,
LPDWORD security, FILETIME
*modif )
{
return;
}
Solution:
return ERROR_SUCCESS;
see http://msdn.microsoft.com/library/en-us/sysinfo/base/regqueryinfokey.asp
Problem:
win32.c:3642: warning: assignment discards qualifiers from pointer
target type
static DWORD WINAPI expGetFullPathNameA
(
-> LPCTSTR lpFileName,
DWORD nBufferLength,
LPTSTR lpBuffer,
LPTSTR lpFilePart
){
[...]
#else
if (strrchr(lpFileName, '\\'))
lpFilePart = strrchr(lpFileName, '\\');
else
-> lpFilePart = lpFileName;
#endif
strcpy(lpBuffer, lpFileName);
// strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName);
return strlen(lpBuffer);
}
Solution:
cast to LPTSTR
Again, the problem was introduced in our code (original is earlier in
#if 0).
Problem:
module.c: In function `MODULE_GetProcAddress':
module.c:1000: warning: assignment from incompatible pointer type
report_entry = report_func;
report_ret = report_func_ret;
-> wrapper_target=retproc;
retproc=(FARPROC)wrapper;
Solution:
cast to void (*)(void)
And again, this is in our added code (QT related).
So don't tell me to send this to avifile maintainer. ;)
--
MPlayer RPMs maintainer: http://greysector.rangers.eu.org/mplayer.html
"I am Grey. I stand between the candle and the star. We are Grey.
We stand between the darkness ... and the light."
-- Delenn in Grey Council in Babylon 5:"Babylon Squared"
-------------- next part --------------
--- MPlayer-20040731/libmpdemux/aviheader.h.loader Fri Jul 16 20:31:47 2004
+++ MPlayer-20040731/libmpdemux/aviheader.h Sat Jul 31 18:55:28 2004
@@ -27,9 +27,6 @@
#define aviTWOCC(ch0, ch1) ((uint16_t)(uint8_t)(ch0) | ((uint16_t)(uint8_t)(ch1) << 8))
#endif
-//typedef uint16_t TWOCC;
-//typedef uint32_t FOURCC;
-
/* form types, list types, and chunk types */
#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
--- MPlayer-20040731/libmpdemux/muxer_rawvideo.c.loader Tue Mar 9 15:46:34 2004
+++ MPlayer-20040731/libmpdemux/muxer_rawvideo.c Sat Jul 31 18:55:28 2004
@@ -11,10 +11,9 @@
//#include "stream.h"
//#include "demuxer.h"
//#include "stheader.h"
+#include "aviheader.h"
+#include "ms_hdr.h"
-#include "wine/mmreg.h"
-#include "wine/avifmt.h"
-#include "wine/vfw.h"
#include "bswap.h"
#include "muxer.h"
--- MPlayer-20040731/libmpdemux/ms_hdr.h.loader Wed Apr 28 12:18:33 2004
+++ MPlayer-20040731/libmpdemux/ms_hdr.h Sat Jul 31 18:55:28 2004
@@ -14,6 +14,8 @@
} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
#endif /* _WAVEFORMATEX_ */
+#ifndef _MPEGLAYER3WAVEFORMAT_
+#define _MPEGLAYER3WAVEFORMAT_
typedef struct __attribute__((__packed__)) mpeglayer3waveformat_tag {
WAVEFORMATEX wf;
unsigned short wID;
@@ -22,6 +24,7 @@
unsigned short nFramesPerBlock;
unsigned short nCodecDelay;
} MPEGLAYER3WAVEFORMAT;
+#endif /* _MPEGLAYER3WAVEFORMAT_ */
#if !defined(_BITMAPINFOHEADER_) && !defined(_WINGDI_H)
#define _BITMAPINFOHEADER_
--- MPlayer-20040731/loader/wine/windef.h.loader Thu Apr 24 20:48:30 2003
+++ MPlayer-20040731/loader/wine/windef.h Sat Jul 31 18:55:28 2004
@@ -156,8 +156,8 @@
typedef int INT;
typedef unsigned int UINT;
typedef unsigned short WORD;
-typedef unsigned int DWORD;
-typedef unsigned int ULONG;
+typedef unsigned long DWORD;
+typedef unsigned long ULONG;
typedef unsigned char BYTE;
typedef long LONG;
typedef short SHORT;
--- MPlayer-20040731/loader/wine/debugtools.h.loader Sat Feb 24 21:30:28 2001
+++ MPlayer-20040731/loader/wine/debugtools.h Sat Jul 31 18:55:28 2004
@@ -63,11 +63,13 @@
static inline LPCSTR debugstr_a( LPCSTR s ) { return debugstr_an( s, 80 ); }
static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); }
+#ifndef dbg_printf
#ifdef __GNUC__
extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2)));
#else
extern int dbg_printf(const char *format, ...);
#endif
+#endif
#define TRACE_(X) TRACE
#define WARN_(X) TRACE
--- MPlayer-20040731/loader/wine/vfw.h.loader Wed Oct 9 15:16:27 2002
+++ MPlayer-20040731/loader/wine/vfw.h Sat Jul 31 18:55:28 2004
@@ -19,17 +19,17 @@
#define _BITMAPINFOHEADER_
typedef struct __attribute__((__packed__))
{
- int biSize;
- int biWidth;
- int biHeight;
+ long biSize;
+ long biWidth;
+ long biHeight;
short biPlanes;
short biBitCount;
- int biCompression;
- int biSizeImage;
- int biXPelsPerMeter;
- int biYPelsPerMeter;
- int biClrUsed;
- int biClrImportant;
+ long biCompression;
+ long biSizeImage;
+ long biXPelsPerMeter;
+ long biYPelsPerMeter;
+ long biClrUsed;
+ long biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
typedef struct {
BITMAPINFOHEADER bmiHeader;
--- MPlayer-20040731/loader/wine/mmreg.h.loader Fri Jul 9 21:22:38 2004
+++ MPlayer-20040731/loader/wine/mmreg.h Sat Jul 31 18:55:28 2004
@@ -83,7 +83,8 @@
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
#endif // !_WAVEFORMATEXTENSIBLE_
-/*
+#ifndef _MPEGLAYER3WAVEFORMAT_
+#define _MPEGLAYER3WAVEFORMAT_
typedef struct mpeglayer3waveformat_tag {
WORD wFormatTag WINE_PACKED;
WORD nChannels WINE_PACKED;
@@ -98,7 +99,7 @@
WORD nFramesPerBlock WINE_PACKED;
WORD nCodecDelay WINE_PACKED;
} MPEGLAYER3WAVEFORMAT;
-*/
+#endif /* _MPEGLAYER3WAVEFORMAT_ */
/* WAVE form wFormatTag IDs */
--- MPlayer-20040731/loader/win32.c.loader Fri Jul 9 21:22:38 2004
+++ MPlayer-20040731/loader/win32.c Sat Jul 31 20:23:11 2004
@@ -863,7 +863,7 @@
for (i = 0; i < count; i++)
{
- object = objects[i];
+ object = (void *)objects[i];
ret = expWaitForSingleObject(object, duration);
if (WaitAll)
dbgprintf("WaitAll flag not yet supported...\n");
@@ -894,6 +894,8 @@
/* 10l to QTX, if CreateMutex returns a real mutex, WaitForSingleObject
waits for ever, else it works ;) */
return mlist;
+#else
+ return (HANDLE)0;
#endif
}
@@ -1943,7 +1945,7 @@
LPDWORD values, LPDWORD max_value, LPDWORD max_data,
LPDWORD security, FILETIME *modif )
{
- return;
+ return ERROR_SUCCESS;
}
/*
@@ -3645,7 +3647,7 @@
if (strrchr(lpFileName, '\\'))
lpFilePart = strrchr(lpFileName, '\\');
else
- lpFilePart = lpFileName;
+ lpFilePart = (LPTSTR)lpFileName;
#endif
strcpy(lpBuffer, lpFileName);
// strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName);
--- MPlayer-20040731/loader/module.c.loader Fri Jul 9 21:22:38 2004
+++ MPlayer-20040731/loader/module.c Sat Jul 31 18:55:28 2004
@@ -1002,7 +1002,7 @@
fprintf(stderr,"theQuickTimeDispatcher catched -> %p\n",retproc);
report_entry = report_func;
report_ret = report_func_ret;
- wrapper_target=retproc;
+ wrapper_target=(void(*)(void))retproc;
retproc=(FARPROC)wrapper;
}
More information about the MPlayer-dev-eng
mailing list