[MPlayer-dev-eng] [PATCH] loader compiler warnings

Dominik 'Rathann' Mierzejewski dominik at rangers.eu.org
Thu Apr 8 18:06:55 CEST 2004


Hi.
Another round of issues signalled by compiler warnings and proposed fixes:
Some of them are probably wrong, but this is only to signal the problems.

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:
change const void** objects to void **objects in definition (like it is
in expWaitForSingleObject()

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)NULL;

Alex said it's wrong to return NULL, 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;

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-20040403/loader/win32.c.loader	Thu Apr  1 20:47:26 2004
+++ MPlayer-20040403/loader/win32.c	Mon Apr  5 01:46:19 2004
@@ -851,7 +851,7 @@
 }
 
 #ifdef QTX
-static void* WINAPI expWaitForMultipleObjects(int count, const void** objects,
+static void* WINAPI expWaitForMultipleObjects(int count, void** objects,
                    int WaitAll, int duration)
 {
     int i;
@@ -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)NULL;
 #endif
 }
 
@@ -1943,7 +1945,7 @@
                                          LPDWORD values, LPDWORD max_value, LPDWORD max_data,
                                          LPDWORD security, FILETIME *modif )
 {
-    return;
+    return ERROR_SUCCESS;
 }
 
 /*
@@ -3637,7 +3639,7 @@
     if (strrchr(lpFileName, '\\'))
        lpFilePart = strrchr(lpFileName, '\\');
     else
-       lpFilePart = lpFileName;
+       lpFilePart = (LPTSTR)lpFileName;
 #endif
     strcpy(lpBuffer, lpFileName);
 //    strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName);
--- MPlayer-20040403/loader/module.c.loader	Thu Apr  1 20:47:26 2004
+++ MPlayer-20040403/loader/module.c	Mon Apr  5 01:46:19 2004
@@ -997,7 +997,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