[MPlayer-cvslog] r23727 - trunk/libdvdcss/libdvdcss.c

Diego Biurrun diego at biurrun.de
Sat Jul 14 14:50:00 CEST 2007


On Sat, Jul 14, 2007 at 10:06:31AM +0200, Reimar Döffinger wrote:
> On Fri, Jul 13, 2007 at 06:49:31PM +0200, Diego Biurrun wrote:
> > > 
> > > 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.

I'm asking because libdvdcss does not contain any PRI format specifiers,
so there is a probability that they will not want to add them.

> 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.

I'm asking because I wish to keep our diffs to upstream as small as
possible.  If r23728 is enough to solve the problem then this might as
well be reverted.

Diego



More information about the MPlayer-cvslog mailing list