diff mbox series

[FFmpeg-devel] avutil/wchar_filename: Make the header C++ compatible

Message ID DB6PR0101MB2214F0D6740B0603C8D39E3D8FB89@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit 4454142782bd3db769939e63ea0f2e5e917dc29d
Headers show
Series [FFmpeg-devel] avutil/wchar_filename: Make the header C++ compatible | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Andreas Rheinhardt June 28, 2022, 4:31 a.m. UTC
When compiling decklink, this header is included from
a C++ file (albeit inside 'extern "C"') and this
causes compilation failures because of an implicit
void* -> char* conversion. So add an explicit cast.
Should fix ticket #9819.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
If we didn't include os_support.h in lots of places via lavf/internal.h,
this issue wouldn't exist.

 libavutil/wchar_filename.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Storsjö June 28, 2022, 8:52 a.m. UTC | #1
On Tue, 28 Jun 2022, Andreas Rheinhardt wrote:

> When compiling decklink, this header is included from
> a C++ file (albeit inside 'extern "C"') and this
> causes compilation failures because of an implicit
> void* -> char* conversion. So add an explicit cast.
> Should fix ticket #9819.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> If we didn't include os_support.h in lots of places via lavf/internal.h,
> this issue wouldn't exist.
>
> libavutil/wchar_filename.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
> index 08de073ed7..9a04a069f1 100644
> --- a/libavutil/wchar_filename.h
> +++ b/libavutil/wchar_filename.h
> @@ -54,7 +54,7 @@ static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w,
>         *filename = NULL;
>         return 0;
>     }
> -    *filename = av_malloc_array(num_chars, sizeof *filename);
> +    *filename = (char*)av_malloc_array(num_chars, sizeof *filename);
>     if (!*filename) {
>         errno = ENOMEM;
>         return -1;
> -- 
> 2.34.1

LGTM, thanks!

// Martin
diff mbox series

Patch

diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index 08de073ed7..9a04a069f1 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -54,7 +54,7 @@  static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w,
         *filename = NULL;
         return 0;
     }
-    *filename = av_malloc_array(num_chars, sizeof *filename);
+    *filename = (char*)av_malloc_array(num_chars, sizeof *filename);
     if (!*filename) {
         errno = ENOMEM;
         return -1;