[MPlayer-dev-eng] [PATCH 2/2] sub/subreader: Use matching pointer type for enca_sub_cp

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Dec 27 20:33:14 EET 2024


Hi!
Both look fine to me.

> On 26 Dec 2024, at 22:12, Alexander Strasser <eclipse7 at gmx.net> wrote:
> 
> The guess_cp function returns `const char *`, so we should
> use the same type for enca_sub_cp as well.
> 
> Avoids this warning:
> 
> ```
> sub/subreader.c: In function 'subcp_open':
> sub/subreader.c:1287:33: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 1287 |                     enca_sub_cp = guess_cp(st, enca_lang, enca_fallback);
>      |
> ```
> ---
> sub/subreader.c | 2 +-
> sub/subreader.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sub/subreader.c b/sub/subreader.c
> index 3386e1995..35bc9eef5 100644
> --- a/sub/subreader.c
> +++ b/sub/subreader.c
> @@ -55,7 +55,7 @@
> #include <iconv.h>
> #endif
> char *sub_cp=NULL;
> -char *enca_sub_cp=NULL;
> +const char *enca_sub_cp=NULL;
> #ifdef CONFIG_FRIBIDI
> #include <fribidi/fribidi.h>
> char *fribidi_charset = NULL;   ///character set that will be passed to FriBiDi
> diff --git a/sub/subreader.h b/sub/subreader.h
> index d499ad830..a4608cc4d 100644
> --- a/sub/subreader.h
> +++ b/sub/subreader.h
> @@ -33,7 +33,7 @@ extern int sub_no_text_pp;  // disable text post-processing
> extern int sub_match_fuzziness;
> extern int sub_format;
> extern char *sub_cp;
> -extern char *enca_sub_cp;
> +extern const char *enca_sub_cp;
> 
> // subtitle formats
> #define SUB_INVALID   -1
> --
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng



More information about the MPlayer-dev-eng mailing list