Commit 4c445365 authored by conrad's avatar conrad

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


git-svn-id: http://svn.annodex.net/liboggz/trunk@3533 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 4d1c8181
......@@ -163,6 +163,48 @@ if test "x${ac_enable_read}" = xno && test "x${ac_enable_write}" = xno ; then
])
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_TYPES(ssize_t)
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.
......
......@@ -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 @@ _ogg_page_set_eos (const ogg_page * og)
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 @@ typedef struct _OCPageAccum {
} 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 @@ read_gs (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
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 @@ read_headers (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
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 @@ read_bos (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
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);
......
......@@ -173,7 +173,7 @@ read_page_add_input (OGGZ * oggz, const ogg_page * og, long serialno,
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment