Fix -Wimplicit-function-declaration and -Wincompatible-pointer-types errors with gcc 14. Examples of errors: ``` daphne/daphne-1.0-src/vldp2/vldp/vldp_internal.c: In function 'idle_handler_precache': daphne/daphne-1.0-src/vldp2/vldp/vldp_internal.c:852:31: error: implicit declaration of function 'fileno' [-Wimplicit-function-declaration] 852 | fstat(fileno(F), &filestats); // get stats for file to get file length | ^~~~~~ ``` ``` daphne/src/thread/pthread/SDL_systhread.c:104:24: error: passing argument 1 of 'pthread_create' from incompatible pointer type [-Wincompatible-pointer-types] 104 | if (pthread_create(&thread->handle, &type, RunThread, args) != 0) { | ^~~~~~~~~~~~~~~ | | | SYS_ThreadHandle * {aka int *} In file included from daphne/src/thread/pthread/SDL_systhread.c:24: /usr/include/pthread.h:80:20: note: expected 'struct __pthread ** restrict' but argument is of type 'SYS_ThreadHandle *' {aka 'int *'} 80 | int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict); | ^ ``` --- a/daphne/daphne-1.0-src/vldp2/vldp/vldp_internal.c +++ b/daphne/daphne-1.0-src/vldp2/vldp/vldp_internal.c @@ -29,6 +29,7 @@ #include +#define _DEFAULT_SOURCE #include #include // for malloc/free #include --- a/daphne/src/audio/SDL_audiocvt.c +++ b/daphne/src/audio/SDL_audiocvt.c @@ -18,6 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include #include #include "../SDL_internal.h" --- a/daphne/src/thread/pthread/SDL_systhread.c +++ b/daphne/src/thread/pthread/SDL_systhread.c @@ -29,10 +29,12 @@ #include +#define _BSD_SOURCE +#include + #ifdef __LINUX__ #include #include -#include #include #endif /* __LINUX__ */ @@ -98,7 +100,8 @@ } /* Create the thread and go! */ - if (pthread_create(&thread->handle, &type, RunThread, args) != 0) { + if (pthread_create((struct __pthread ** restrict) &thread->handle, &type, + RunThread, args) != 0) { // 2017.02.07 - RJS ADD - Logging. return SDL_SetError("Not enough resources to create thread"); } @@ -207,13 +210,13 @@ void SDL_SYS_WaitThread(SDL_Thread * thread) { - pthread_join(thread->handle, 0); + pthread_join((struct __pthread *) thread->handle, 0); } void SDL_SYS_DetachThread(SDL_Thread * thread) { - pthread_detach(thread->handle); + pthread_detach((struct __pthread *) thread->handle); } /* vi: set ts=4 sw=4 expandtab: */