[MPlayer-dev-eng] [PATCH 3/3] Fix a few warnings

Diego Biurrun diego at biurrun.de
Tue Jul 16 17:18:02 CEST 2013


On 2013-07-14 14:38, Jiang Jiang wrote:
> ---
>   bstr.c                 |  2 +-
>   cfg-common.h           | 24 ++++++++++++------------
>   cfg-mplayer.h          |  8 ++++----
>   codec-cfg.c            |  4 ++--
>   m_config.h             |  2 +-
>   m_option.c             |  2 +-
>   mpcommon.c             |  8 ++++----
>   mplayer.c              |  6 +++---
>   stream/asf_streaming.c |  2 +-
>   stream/stream_dvd.c    |  4 ++--
>   stream/stream_dvd.h    |  4 ++--
>   stream/stream_dvdnav.c |  4 ++--
>   stream/stream_dvdnav.h |  4 ++--
>   sub/vobsub.c           |  2 +-
>   sub/vobsub.h           |  2 +-
>   15 files changed, 39 insertions(+), 39 deletions(-)

I think all of the casts are wrong.

> --- a/m_config.h
> +++ b/m_config.h
> @@ -50,7 +50,7 @@ struct m_config_save_slot {
>   struct m_config_option {
>     m_config_option_t* next;
>     /// Full name (ie option:subopt).
> -  char* name;
> +  const char* name;
>     /// Option description.
>     const struct m_option* opt;
>     /// Save slot stack.

possibly OK, didn't check

> --- a/m_option.c
> +++ b/m_option.c
> @@ -334,7 +334,7 @@ static int parse_position(const m_option_t* opt,const char *name, const char *pa
>     if (param == NULL)
>       return M_OPT_MISSING_PARAM;
>     if (sscanf(param, sizeof(off_t) == sizeof(int) ?
> -	     "%d%c" : "%"PRId64"%c", &tmp_off, &dummy) != 1) {
> +	     "%lld%c" : "%"PRId64"%c", &tmp_off, &dummy) != 1) {
>       mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be an integer: %s\n",opt->name,param);
>       return M_OPT_INVALID;
>     }

The length modifier for sizeof expressions is 'z'.

The "char" --> "unsigned char" and vice versa changes might or might not 
be OK.  Probably uint8_t is a better solution.

Diego


More information about the MPlayer-dev-eng mailing list