[xiph-commits] r3533 - in liboggz/trunk: . src/tools src/tools/oggz-chop

conrad at svn.annodex.net conrad at svn.annodex.net
Mon Mar 31 05:34:31 PDT 2008


Author: conrad
Date: 2008-03-31 05:34:30 -0700 (Mon, 31 Mar 2008)
New Revision: 3533

Modified:
   liboggz/trunk/configure.ac
   liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
   liboggz/trunk/src/tools/oggz-sort.c
Log:
Move <ogg/ogg.h> const-correctness check to before largefile tests, as they
create duplicate #defines (which force failure on AC_TRY_COMPILE with -Werror).
Remove compile warnings in oggz-chop.c, builds with -Werror. Tested with
both libogg before and after https://trac.xiph.org/changeset/14463


Modified: liboggz/trunk/configure.ac
===================================================================
--- liboggz/trunk/configure.ac	2008-03-30 13:39:27 UTC (rev 3532)
+++ liboggz/trunk/configure.ac	2008-03-31 12:34:30 UTC (rev 3533)
@@ -163,6 +163,48 @@
 ])
 fi
 
+dnl
+dnl Detect Ogg
+dnl
+
+HAVE_OGG=no
+if test "x$HAVE_PKG_CONFIG" = "xyes" ; then
+  PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
+fi
+
+if test "x$HAVE_OGG" = "xno" ; then
+  XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
+  if test "x$HAVE_OGG" = xno ; then
+    oggz_config_ok="no"
+    AC_CHECK_LIB(ogg, ogg_stream_init, HAVE_OGG="maybe")
+  fi
+fi
+
+AM_CONDITIONAL(HAVE_OGG, [test "x$HAVE_OGG" = "xyes"])
+
+dnl Check for const-correct version of <ogg/ogg.h>
+dnl In libogg changeset:14463, function prototypes like:
+dnl      ogg_page_bos (ogg_page * og);
+dnl were changed to:
+dnl     ogg_page_bos (const ogg_page * og);
+dnl If we are compiling with -Werror, we need to know this.
+if test "x$HAVE_OGG" = "xyes" ; then
+    AC_MSG_CHECKING([if ogg_page_bos() takes a const argument])
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS -Wall -Werror $OGG_CFLAGS"
+    LIBS="$LIBS $OGG_LIBS"
+
+    AC_TRY_COMPILE([#include <ogg/ogg.h>],
+                   [int f(const ogg_page * cog){return ogg_page_bos(cog);}],
+                   [ AC_DEFINE([OGG_H_CONST_CORRECT], [], [Define if <ogg/ogg.h> is const-correct])
+                     AC_MSG_RESULT(yes) ],
+                   [ AC_MSG_RESULT(no) ])
+
+    CFLAGS="$ac_save_CFLAGS"
+    LIBS="$ac_save_LIBS"
+fi
+
 dnl Large file support
 dnl Adapted from: libsndfile by Erik de Castro Lopo
 dnl
@@ -266,48 +308,6 @@
 AC_CHECK_SIZEOF(ssize_t,4)
 
 
-dnl
-dnl Detect Ogg
-dnl
-
-HAVE_OGG=no
-if test "x$HAVE_PKG_CONFIG" = "xyes" ; then
-  PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
-fi
-
-if test "x$HAVE_OGG" = "xno" ; then
-  XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
-  if test "x$HAVE_OGG" = xno ; then
-    oggz_config_ok="no"
-    AC_CHECK_LIB(ogg, ogg_stream_init, HAVE_OGG="maybe")
-  fi
-fi
-
-AM_CONDITIONAL(HAVE_OGG, [test "x$HAVE_OGG" = "xyes"])
-
-dnl Check for type signature of ogg_page_bos(); In earlier libogg releases,
-dnl this was:
-dnl      ogg_page_bos (ogg_page * og);
-dnl but in more recent versions:
-dnl     ogg_page_bos (const ogg_page * og);
-dnl As we are compiling with -Werror, we need to know this
-if test "x$HAVE_OGG" = "xyes" ; then
-    AC_MSG_CHECKING([if ogg_page_bos() takes a const argument])
-    ac_save_CFLAGS="$CFLAGS"
-    ac_save_LIBS="$LIBS"
-    CFLAGS="$CFLAGS -Wall -Werror $OGG_CFLAGS"
-    LIBS="$LIBS $OGG_LIBS"
-
-    AC_TRY_COMPILE([#include <ogg/ogg.h>],
-                   [int f(const ogg_page * cog){return ogg_page_bos(cog);}],
-                   [ AC_DEFINE([OGG_PAGE_BOS_CONST], [], [Define if ogg_page_bos() takes a const argument.])
-                     AC_MSG_RESULT(yes) ],
-                   [ AC_MSG_RESULT(no) ])
-
-    CFLAGS="$ac_save_CFLAGS"
-    LIBS="$ac_save_LIBS"
-fi
-
 # Checks for header files.
 
 # Checks for typedefs, structures, and compiler characteristics.

Modified: liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-03-30 13:39:27 UTC (rev 3532)
+++ liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-03-31 12:34:30 UTC (rev 3533)
@@ -41,6 +41,12 @@
 
 #include "oggz-chop.h"
 
+#ifdef OGG_H_CONST_CORRECT
+#define OGG_PAGE_CONST(x) (x)
+#else
+#define OGG_PAGE_CONST(x) ((ogg_page *)x)
+#endif
+
 /************************************************************
  * OCTrackState
  */
@@ -152,7 +158,7 @@
   if (og == NULL) return;
 
   og->header[5] |= 0x04;
-  ogg_page_checksum_set (og);
+  ogg_page_checksum_set (OGG_PAGE_CONST(og));
 }
 
 static void
@@ -174,7 +180,7 @@
 } OCPageAccum;
 
 static OCPageAccum *
-page_accum_new (ogg_page * og, double time)
+page_accum_new (const ogg_page * og, double time)
 {
   OCPageAccum * pa;
 
@@ -365,7 +371,7 @@
     return read_plain (oggz, og, serialno, user_data);
   } /* else { ... */
 
-  granulepos = ogg_page_granulepos (og);
+  granulepos = ogg_page_granulepos (OGG_PAGE_CONST(og));
   if (granulepos != -1) {
     granuleshift = oggz_get_granuleshift (oggz, serialno);
     keyframe = granulepos >> granuleshift;
@@ -407,7 +413,7 @@
   fwrite_ogg_page (state->outfile, og);
 
   ts = oggz_table_lookup (state->tracks, serialno);
-  ts->headers_remaining -= ogg_page_packets (og);
+  ts->headers_remaining -= ogg_page_packets (OGG_PAGE_CONST(og));
 
   if (ts->headers_remaining <= 0) {
     if (state->start == 0.0 || oggz_get_granuleshift (oggz, serialno) == 0) {
@@ -428,7 +434,7 @@
   OCTrackState * ts;
   double page_time;
 
-  if (ogg_page_bos (og)) {
+  if (ogg_page_bos (OGG_PAGE_CONST(og))) {
     ts = track_state_add (state->tracks, serialno);
     ts->headers_remaining = oggz_stream_get_numheaders (oggz, serialno);
 

Modified: liboggz/trunk/src/tools/oggz-sort.c
===================================================================
--- liboggz/trunk/src/tools/oggz-sort.c	2008-03-30 13:39:27 UTC (rev 3532)
+++ liboggz/trunk/src/tools/oggz-sort.c	2008-03-31 12:34:30 UTC (rev 3533)
@@ -173,7 +173,7 @@
   OSInput * input;
   int is_bos, nfiles;
 
-#ifdef OGG_PAGE_BOS_CONST
+#ifdef OGG_H_CONST_CORRECT
   is_bos = ogg_page_bos (og);
 #else
   is_bos = ogg_page_bos ((ogg_page *)og);



More information about the commits mailing list