[MPlayer-dev-eng] [PATCH] Try to adapt to recent compilers such as GCC 14
KO Myung-Hun
komh78 at gmail.com
Sat Sep 28 16:41:35 EEST 2024
Recent compilers such as GCC 14 generate errors for implicit casts.
---
libmpcodecs/vd_qtvideo.c | 2 +-
libvo/vo_kva.c | 4 ++--
loader/afl.c | 2 +-
loader/dshow/DS_Filter.c | 4 ++--
loader/dshow/DS_VideoDecoder.c | 4 ++--
loader/dshow/graph.c | 16 ++++++++--------
loader/ext.c | 2 +-
loader/module.c | 4 ++--
loader/win32.c | 21 +++++++++++----------
mp_msg.c | 4 ++--
stream/asf_mmst_streaming.c | 2 +-
sub/font_load_ft.c | 2 +-
sub/subreader.c | 2 +-
13 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c
index d3dbeacc4..5e37ca456 100644
--- a/libmpcodecs/vd_qtvideo.c
+++ b/libmpcodecs/vd_qtvideo.c
@@ -129,7 +129,7 @@ static int init(sh_video_t *sh){
DecompressSequenceFrameS = (OSErr (*)(ImageSequence,Ptr,long,CodecFlags,CodecFlags*,ICMCompletionProcRecordPtr))GetProcAddress(handler, "DecompressSequenceFrameS");
GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap");
QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr");
- NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear");
+ NewHandleClear = (Handle(*)(Size))GetProcAddress(handler, "NewHandleClear");
DisposeHandle = (void (*)(Handle))GetProcAddress(handler, "DisposeHandle");
DisposeGWorld = (void (*)(GWorldPtr))GetProcAddress(handler, "DisposeGWorld");
CDSequenceEnd = (OSErr (*)(ImageSequence))GetProcAddress(handler, "CDSequenceEnd");
diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c
index 8d327fd88..340ddf69e 100644
--- a/libvo/vo_kva.c
+++ b/libvo/vo_kva.c
@@ -322,8 +322,8 @@ static void imgDisplay(void)
dstStride[2], m_int.stride[2]);
}
} else {
- sws_scale(m_int.sws, m_int.planes, m_int.stride, 0, SRC_HEIGHT,
- dst, dstStride);
+ sws_scale(m_int.sws, (const uint8_t * const *)m_int.planes,
+ m_int.stride, 0, SRC_HEIGHT, dst, dstStride);
}
kvaUnlockBuffer();
diff --git a/loader/afl.c b/loader/afl.c
index 337cbcd55..b29471cdc 100644
--- a/loader/afl.c
+++ b/loader/afl.c
@@ -227,7 +227,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
return MMSYSERR_ERROR;
}
- pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc");
+ pad->pfnDriverProc = (DRIVERPROC)GetProcAddress(pad->hDrvr, "DriverProc");
/* insert new pad at beg of list */
pad->pNextACMDriver = padid->pACMDriverList;
diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c
index 693d59c25..170b49537 100644
--- a/loader/dshow/DS_Filter.c
+++ b/loader/dshow/DS_Filter.c
@@ -216,7 +216,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
enum_pins->vt->Reset(enum_pins);
result = enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched);
- enum_pins->vt->Release(enum_pins);
+ enum_pins->vt->Release((IUnknown *)enum_pins);
Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result);
for (i = 0; i < fetched; i++)
@@ -306,7 +306,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
init++;
break;
}
- tempAll->vt->Release(tempAll);
+ tempAll->vt->Release((IUnknown *)tempAll);
if (!init)
{
diff --git a/loader/dshow/DS_VideoDecoder.c b/loader/dshow/DS_VideoDecoder.c
index dd0396f4f..46dfde426 100644
--- a/loader/dshow/DS_VideoDecoder.c
+++ b/loader/dshow/DS_VideoDecoder.c
@@ -601,8 +601,8 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp
}
if(this->m_pDS_Filter->m_pAll)
- this->m_pDS_Filter->m_pAll->vt->Release(this->m_pDS_Filter->m_pAll);
- this->m_pDS_Filter->m_pAll=MemAllocatorCreate();
+ this->m_pDS_Filter->m_pAll->vt->Release((IUnknown *)this->m_pDS_Filter->m_pAll);
+ this->m_pDS_Filter->m_pAll=(IMemAllocator *)MemAllocatorCreate();
if (!this->m_pDS_Filter->m_pAll)
{
printf("Call to MemAllocatorCreate failed\n");
diff --git a/loader/dshow/graph.c b/loader/dshow/graph.c
index 01bf6c725..dc82dc93c 100644
--- a/loader/dshow/graph.c
+++ b/loader/dshow/graph.c
@@ -141,14 +141,14 @@ FilterGraph* FilterGraphCreate()
This->vt->AddRef = FilterGraph_AddRef;
This->vt->Release = FilterGraph_Release;
- This->vt->AddFilter = FilterGraph_AddFilter;
- This->vt->RemoveFilter = FilterGraph_RemoveFilter;
- This->vt->EnumFilters = FilterGraph_EnumFilters;
- This->vt->FindFilterByName = FilterGraph_FindFilterByName;
- This->vt->ConnectDirect = FilterGraph_ConnectDirect;
- This->vt->Reconnect = FilterGraph_Reconnect;
- This->vt->Disconnect = FilterGraph_Disconnect;
- This->vt->SetDefaultSyncSource = FilterGraph_SetDefaultSyncSource;
+ This->vt->AddFilter = (void *)FilterGraph_AddFilter;
+ This->vt->RemoveFilter = (void *)FilterGraph_RemoveFilter;
+ This->vt->EnumFilters = (void *)FilterGraph_EnumFilters;
+ This->vt->FindFilterByName = (void *)FilterGraph_FindFilterByName;
+ This->vt->ConnectDirect = (void *)FilterGraph_ConnectDirect;
+ This->vt->Reconnect = (void *)FilterGraph_Reconnect;
+ This->vt->Disconnect = (void *)FilterGraph_Disconnect;
+ This->vt->SetDefaultSyncSource = (void *)FilterGraph_SetDefaultSyncSource;
This->interfaces[0] = IID_IUnknown;
This->interfaces[1] = IID_IFilterGraph;
diff --git a/loader/ext.c b/loader/ext.c
index 5483a0b7e..cfdce1258 100644
--- a/loader/ext.c
+++ b/loader/ext.c
@@ -444,7 +444,7 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec
if (type&MEM_RESERVE && (unsigned)address&0xffff) {
size += (unsigned)address&0xffff;
- address = (unsigned)address&~0xffff;
+ address = (LPVOID)((unsigned)address&~0xffff);
}
pgsz = sysconf(_SC_PAGESIZE);
if (type&MEM_COMMIT && (unsigned)address%pgsz) {
diff --git a/loader/module.c b/loader/module.c
index 1a45efce6..df679beaa 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -844,7 +844,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t
// memory management:
case 0x150011: //NewPtrClear
case 0x150012: //NewPtrSysClear
- reg->eax = malloc(((uint32_t *)stack_base)[1]);
+ reg->eax = (uintptr_t)malloc(((uint32_t *)stack_base)[1]);
memset((void *)reg->eax,0,((uint32_t *)stack_base)[1]);
#ifdef DEBUG_QTX_API
printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax);
@@ -852,7 +852,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t
return 1;
case 0x15000F: //NewPtr
case 0x150010: //NewPtrSys
- reg->eax = malloc(((uint32_t *)stack_base)[1]);
+ reg->eax = (uintptr_t)malloc(((uint32_t *)stack_base)[1]);
#ifdef DEBUG_QTX_API
printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax);
#endif
diff --git a/loader/win32.c b/loader/win32.c
index 6d559a7e7..0c5bcca93 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -603,7 +603,7 @@ static HMODULE WINAPI expGetModuleHandleW(const uint16_t* name)
int pos = 0;
while (*name) {
if (*name > 256 || pos >= sizeof(aname) - 1)
- return NULL;
+ return (HMODULE)NULL;
aname[pos++] = *name++;
}
aname[pos] = 0;
@@ -1504,7 +1504,7 @@ static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c)
static int WINAPI expGetCurrentThreadId(void)
{
dbgprintf("GetCurrentThreadId() => %d\n", pthread_self());
- return pthread_self();
+ return (int)pthread_self();
}
static int WINAPI expGetCurrentProcess(void)
{
@@ -2019,15 +2019,16 @@ static DWORD WINAPI expSignalObjectAndWait(HANDLE hObjectToSignal,
expSetEvent(mlist);
break;
case 1: // Semaphore
- expReleaseSemaphore(mlist, 1, NULL);
+ expReleaseSemaphore((intptr_t)mlist, 1, NULL);
break;
case 2: // Mutex
- expReleaseMutex(mlist);
+ expReleaseMutex((HANDLE)mlist);
break;
default:
dbgprintf("Signalling unknown object type %d!\n", hObjectToSignal);
}
- return expWaitForSingleObject(hObjectToWaitOn, dwMilliseconds);
+ return (DWORD)expWaitForSingleObject((void *)hObjectToWaitOn,
+ dwMilliseconds);
}
static long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
@@ -2751,7 +2752,7 @@ static int WINAPI expEnumDisplayMonitors(void *dc, RECT *r,
{
dbgprintf("EnumDisplayMonitors(0x%x, 0x%x, 0x%x, 0x%x) => ?\n",
dc, r, callback_proc, callback_param);
- return callback_proc(0, dc, r, callback_param);
+ return callback_proc(0, (HDC)dc, r, (LPARAM)callback_param);
}
#if 0
@@ -2851,14 +2852,14 @@ static int WINAPI expEnumWindows(int (*callback_func)(HWND, LPARAM), void *callb
{
int i, i2;
dbgprintf("EnumWindows(0x%x, 0x%x) => 1\n", callback_func, callback_param);
- i = callback_func(0, callback_param);
- i2 = callback_func(1, callback_param);
+ i = callback_func(0, (LPARAM)callback_param);
+ i2 = callback_func(1, (LPARAM)callback_param);
return i && i2;
}
static int WINAPI expGetWindowThreadProcessId(HWND win, int *pid_data)
{
- int tid = pthread_self();
+ int tid = (int)pthread_self();
dbgprintf("GetWindowThreadProcessId(0x%x, 0x%x) => %d\n",
win, pid_data, tid);
if (pid_data)
@@ -4940,7 +4941,7 @@ static HPALETTE WINAPI expCreatePalette(CONST LOGPALETTE *lpgpl)
dbgprintf("CreatePalette(%x) => NULL\n", lpgpl);
i = sizeof(LOGPALETTE)+((lpgpl->palNumEntries-1)*sizeof(PALETTEENTRY));
- test = malloc(i);
+ test = (HPALETTE)malloc(i);
memcpy((void *)test, lpgpl, i);
return test;
diff --git a/mp_msg.c b/mp_msg.c
index 3b059801a..4408aed73 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -70,7 +70,7 @@ const char* filename_recode(const char* filename)
filename_len = strlen(filename);
max_path = MSGSIZE_MAX - 4;
precoded = recoded_filename;
- if (iconv(inv_msgiconv, (char **)&filename, &filename_len,
+ if (iconv(inv_msgiconv, (const char **)&filename, &filename_len,
&precoded, &max_path) == (size_t)(-1) && errno == E2BIG) {
precoded[0] = precoded[1] = precoded[2] = '.';
precoded += 3;
@@ -233,7 +233,7 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va){
,MSG_CHARSET,mp_msg_charset);
}else{
memset(tmp2, 0, MSGSIZE_MAX);
- while (iconv(msgiconv, &in, &inlen, &out, &outlen) == -1) {
+ while (iconv(msgiconv, (const char **)&in, &inlen, &out, &outlen) == -1) {
if (!inlen || !outlen)
break;
*out++ = *in++;
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c
index 6b7b6efc0..8853647a2 100644
--- a/stream/asf_mmst_streaming.c
+++ b/stream/asf_mmst_streaming.c
@@ -150,7 +150,7 @@ static void string_utf16(char *dest, char *src, int len) {
len1 = len; len2 = 1000;
ip = src; op = dest;
- iconv(url_conv, &ip, &len1, &op, &len2);
+ iconv(url_conv, (const char **)&ip, &len1, &op, &len2);
}
else
{
diff --git a/sub/font_load_ft.c b/sub/font_load_ft.c
index bd3e1c1de..eb2f77fb5 100644
--- a/sub/font_load_ft.c
+++ b/sub/font_load_ft.c
@@ -743,7 +743,7 @@ static FT_ULong decode_char(iconv_t *cd, char c) {
size_t inbytesleft = 1;
size_t outbytesleft = sizeof(FT_ULong);
- iconv(*cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+ iconv(*cd, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft);
/* convert unicode BigEndian -> MachineEndian */
o = be2me_32(o);
diff --git a/sub/subreader.c b/sub/subreader.c
index 3c815d132..a079af65c 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -1271,7 +1271,7 @@ void subcp_recode (subtitle *sub)
continue;
}
op = ot;
- if (iconv(icdsc, &ip, &ileft,
+ if (iconv(icdsc, (const char **)&ip, &ileft,
&op, &oleft) == (size_t)(-1)) {
mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line.\n");
free(ot);
--
2.42.0
More information about the MPlayer-dev-eng
mailing list