[vlc-devel] [PATCH] libvlc API: Add equalizer to audio.c

Cyril MATHE cmathe at actech-innovation.com
Tue Jul 7 17:13:42 CEST 2009


Le mardi 07 juillet 2009 à 16:34 +0200, Rémi Duraffort a écrit :
> > > >> The asprintf() error handling looks broken to me.
> > > > it is not. the asprintf line is (comes from equalizer.c):
> > > > asprintf( &psz, "%s %lld.%07llu", psz_newbands ? psz_newbands : "",
> > > > d.quot, d.rem ) == -1 )
> > > > so we need an unsigned long for d.rem but it is said in man :
> > > > EXAMPLE
> > > >        After
> > > >                div_t q = div(-5, 3);
> > > >        the values q.quot and q.rem are -1 and -2, respectively.
> > > > this is why we need it. The sign is changed before and after lldiv to
> > > > have not negative d.rem value and to conserve the number sign
> > > 
> > > Sorry, I do not see the relevance of your rant on the (idiotic indeed)
> > > semantics of the American integer division, to my complaints on the _error_
> > > handling of the asprintf() call. 
> > 
> > I don't understand what is the problem with asprintf().
> +        if( asprintf( &psz, "%s %lld.%07llu",                                                                                                                              
> +                      psz_newbands ? psz_newbands : "",                                                                                                                    
> +                      d.quot, d.rem ) == -1 )                                                                                                                              
> +        {                                                                                                                                                                  
> +            free( psz_newbands );
> +        }
> +        psz_newbands = psz;
> 
> When asprintf fail it return -1. In your code, when asprintf fails you
> save the result (which isn't defined) in psz_newband !
> 
> 
> Best regards
that's right! i took it from equalizer.c but it seems that it has been
fixed in equalizer.c since I did it.
Thanks




More information about the vlc-devel mailing list