[MPlayer-cvslog] r23727 - trunk/libdvdcss/libdvdcss.c
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jul 14 10:06:31 CEST 2007
Hello,
On Fri, Jul 13, 2007 at 06:49:31PM +0200, Diego Biurrun wrote:
> > New Revision: 23727
> >
> > Log:
> > Fix CSS format strings, they could print more than two digits for
> >
> > Modified:
> > trunk/libdvdcss/libdvdcss.c
> >
> > --- trunk/libdvdcss/libdvdcss.c (original)
> > +++ trunk/libdvdcss/libdvdcss.c Sat Jul 7 00:07:35 2007
> > @@ -472,7 +472,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open (
> > {
> > char psz_tmp[16 + 1];
> > sprintf( psz_tmp,
> > - "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
> > + "%.2"PRIx8"%.2"PRIx8"%.2"PRIx8"%.2"PRIx8"%.2"PRIx8"%.2"PRIx8"%.2"PRIx8"%.2"PRIx8"",
> > psz_serial[0], psz_serial[1], psz_serial[2],
> > psz_serial[3], psz_serial[4], psz_serial[5],
> > psz_serial[6], psz_serial[7] );
> > @@ -488,7 +488,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open (
> > psz_key[0] = '-';
> > for( i = 0; i < KEY_SIZE; i++ )
> > {
> > - sprintf( &psz_key[1+i*2], "%.2x", dvdcss->css.p_disc_key[i] );
> > + sprintf( &psz_key[1+i*2], "%.2"PRIx8, dvdcss->css.p_disc_key[i] );
> > }
> > psz_key[1 + KEY_SIZE * 2] = '\0';
> > }
>
> Is this fit for upstream?
>
> PRIx format specifiers are not used elsewhere in libdvdcss. Are they
> available everywhere?
They are available everywhere where a proper inttypes.h is available.
It is not a very relevant change though (esp. compared to r23728).
You could also cast all parameters to unsigned instead.
IMO using sprintf (and even snprintf) here is a stupid idea anyway.
Greetings,
Reimar Döffinger
More information about the MPlayer-cvslog
mailing list