[MPlayer-dev-eng] [PATCH] Fix "initialization discards qualifiers" warnings in cfg-*.h

Diego Biurrun diego at biurrun.de
Mon Sep 27 13:53:33 CEST 2010


On Mon, Sep 27, 2010 at 11:37:28AM +0200, Diego Biurrun wrote:
> On Sat, Sep 11, 2010 at 03:49:51PM +0200, Clément Bœsch wrote:
> > > The previous patch fixes the cfg-*.h warnings, but creates a few other in
> > > the config parser. So here is a new patch adding fixing the related
> > > constness issues in parser.
> > > 
> > > I also attached a diff of the warnings between the two versions (with and
> > > without the patch).
> > > 
> > 
> > Diff f*cked up in previous mail, sorry. Fixed in this mail.
> > 
> > --- m_config.c	(revision 32153)
> > +++ m_config.c	(working copy)
> > @@ -279,7 +279,7 @@
> >  }
> >  
> >  static m_config_option_t*
> > -m_config_get_co(m_config_t *config, char* arg) {
> > +m_config_get_co(const m_config_t *config, char* arg) {
> >    m_config_option_t *co;
> >  
> >    for(co = config->opts ; co ; co = co->next ) {
> > @@ -295,7 +295,7 @@
> >  }
> >  
> >  static int
> > -m_config_parse_option(m_config_t *config, char* arg, char* param,int set) {
> > +m_config_parse_option(const m_config_t *config, char* arg, char* param,int set) {
> >    m_config_option_t *co;
> >    int r = 0;
> >  
> > @@ -386,7 +386,7 @@
> >  }
> >  
> >  int
> > -m_config_check_option(m_config_t *config, char* arg, char* param) {
> > +m_config_check_option(const m_config_t *config, char* arg, char* param) {
> >    int r;
> >    mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Checking %s=%s\n",arg,param);
> >    r=m_config_parse_option(config,arg,param,0);
> > @@ -399,7 +399,7 @@
> >  
> >  
> >  const m_option_t*
> > -m_config_get_option(m_config_t *config, char* arg) {
> > +m_config_get_option(const m_config_t *config, char* arg) {
> >    m_config_option_t *co;
> >  
> >  #ifdef MP_DEBUG
> > @@ -417,7 +417,7 @@
> >  
> >  
> >  void
> > -m_config_print_option_list(m_config_t *config) {
> > +m_config_print_option_list(const m_config_t *config) {
> >    char min[50],max[50];
> >    m_config_option_t* co;
> >    int count = 0;
> > @@ -450,7 +450,7 @@
> >  }
> >  
> >  m_profile_t*
> > -m_config_get_profile(m_config_t* config, char* name) {
> > +m_config_get_profile(const m_config_t* config, char* name) {
> >    m_profile_t* p;
> >    for(p = config->profiles ; p ; p = p->next)
> >      if(!strcmp(p->name,name)) return p;
> 
> This looks correct.  Have you checked whether it adds warnings when
> applied without the other part?

It adds no warnings, applied.

Diego


More information about the MPlayer-dev-eng mailing list