shithub: libdvdcss

Download patch

ref: ba862c3860586c3d7248b6bd665440fe791d6c1a
parent: 0463d939434af887912396dcbaa8e45010c66a3a
author: Sam Hocevar <[email protected]>
date: Thu Dec 19 10:44:30 EST 2002

* ./configure.ac: added warning flags whenever possible.


--- a/configure.ac
+++ b/configure.ac
@@ -149,7 +149,32 @@
   fi
 ])
 
-CFLAGS="-Wall ${CFLAGS}"
+dnl
+dnl  Check for available warning flags
+dnl
+CFLAGS_save="${CFLAGS}"
+
+AC_CACHE_CHECK([if \$CC accepts -Wall],
+    [ac_cv_c_Wall],
+    [CFLAGS="-Wall ${CFLAGS_save}"
+     AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
+if test "x${ac_cv_c_Wall}" != "xno"; then
+    CFLAGS_save="-Wall ${CFLAGS_save}"
+fi
+
+AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
+    [ac_cv_c_Wsign_compare],
+    [CFLAGS="-Wsign-compare ${CFLAGS_save}"
+     AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
+if test "x${ac_cv_c_Wsign_compare}" != "xno"; then
+    CFLAGS_save="-Wsign-compare ${CFLAGS_save}"
+fi
+
+CFLAGS="${CFLAGS_save}"
+
+dnl
+dnl  Use 64 bits offsets
+dnl
 CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DDVDCSS_DIST ${CFLAGS}"
 
 AM_CONDITIONAL(SYS_BSDI, test "x$SYS_BSDI" = "x1")
--- a/src/css.c
+++ b/src/css.c
@@ -2,7 +2,7 @@
  * css.c: Functions for DVD authentication and descrambling
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: css.c,v 1.22 2002/12/06 00:16:57 babal Exp $
+ * $Id: css.c,v 1.23 2002/12/19 15:44:30 sam Exp $
  *
  * Author: St�phane Borel <[email protected]>
  *         H�kan Hjort <[email protected]>
@@ -43,6 +43,9 @@
 #ifdef HAVE_SYS_PARAM_H
 #   include <sys/param.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
 #include <fcntl.h>
 
 #ifdef __MINGW_H
@@ -287,7 +290,6 @@
  *****************************************************************************/
 int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
 {
-    char *       psz_cachefile = NULL;
     dvd_title_t *p_title;
     dvd_title_t *p_newtitle;
     dvd_key_t    p_title_key;
@@ -319,7 +321,7 @@
     if( dvdcss->psz_cachefile[0] )
     {
         /* XXX: be careful, we use sprintf and not snprintf */
-        sprintf( dvdcss->psz_block, "%0.10x", i_block );
+        sprintf( dvdcss->psz_block, "%.10x", i_block );
         i_fd = open( dvdcss->psz_cachefile, O_RDONLY );
         b_cache = 1;
 
@@ -959,7 +961,7 @@
                            dvd_key_t p_disc_key )
 {
     uint8_t p_verify[KEY_SIZE];
-    int i, n = 0;
+    unsigned int i, n = 0;
 
     static const dvd_key_t player_keys[] =
     {
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -5,7 +5,7 @@
  *          H�kan Hjort <[email protected]>
  *
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libdvdcss.c,v 1.25 2002/12/19 12:37:30 sam Exp $
+ * $Id: libdvdcss.c,v 1.26 2002/12/19 15:44:30 sam Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -350,7 +350,7 @@
                 if( psz_data[i] < '0' || psz_data[i] > '9' )
                 {
                     sprintf( psz_data,
-                             "%0.2X%0.2X%0.2X%0.2X%0.2X%0.2X%0.2X%0.2X",
+                             "%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X",
                              psz_data[0], psz_data[1], psz_data[2],
                              psz_data[3], psz_data[4], psz_data[5],
                              psz_data[6], psz_data[7] );