[vlc-devel] [PATCH] libvlc API: Add equalizer to audio.c
ivoire at videolan.org
Tue Jul 7 16:34:12 CEST 2009
> > >> 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 !
Rémi Duraffort | ivoire
More information about the vlc-devel