[FFmpeg-devel] [PATCH] Add extra const to FF_PFNGLSHADERSOURCEPROC.

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat Jun 1 03:30:49 EEST 2024


Billy O'Neal (VC AIR) via ffmpeg-devel:
> Resolves the following compiler error on macOS 14.5:
> 
> ```console
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1891:21: note: 'glShaderSource' has been explicitly marked deprecated here
> GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length) OPENGL_DEPRECATED(10.5, 10.14);
>                     ^
> src/libavdevice/opengl_enc.c:482:27: error: incompatible function pointer types assigning to 'FF_PFNGLSHADERSOURCEPROC' (aka 'void (*)(unsigned int, int, const char **, const int *)') from 'void (GLuint, GLsizei, const GLchar *const *, const GLint *)' (aka 'void (unsigned int, int, const char *const *, const int *)') [-Wincompatible-function-pointer-types]
>     procs->glShaderSource = glShaderSource;
>                           ^ ~~~~~~~~~~~~~~
> ```
> 
> Signed-off-by: Billy Robert O'Neal III <bion at microsoft.com>
> ---
>  libavdevice/opengl_enc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
> index 6f7a30ff9e..691bee22ad 100644
> --- a/libavdevice/opengl_enc.c
> +++ b/libavdevice/opengl_enc.c
> @@ -117,7 +117,7 @@ typedef void   (APIENTRY *FF_PFNGLATTACHSHADERPROC) (GLuint program, GLuint shad
>  typedef GLuint (APIENTRY *FF_PFNGLCREATESHADERPROC) (GLenum type);
>  typedef void   (APIENTRY *FF_PFNGLDELETESHADERPROC) (GLuint shader);
>  typedef void   (APIENTRY *FF_PFNGLCOMPILESHADERPROC) (GLuint shader);
> -typedef void   (APIENTRY *FF_PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const char* *string, const GLint *length);
> +typedef void   (APIENTRY *FF_PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const char* const *string, const GLint *length);
>  typedef void   (APIENTRY *FF_PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
>  typedef void   (APIENTRY *FF_PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, char *infoLog);
>  

It seems that the extra const is apple-only, so this patch should be
restricted to it.

- Andreas



More information about the ffmpeg-devel mailing list