Commit 8992f56a authored by conrad's avatar conrad

fix some build warnings.

See: http://lists.xiph.org/pipermail/ogg-dev/2008-July/001108.html
for background and discussion.


git-svn-id: http://svn.annodex.net/liboggz/trunk@3684 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent f4747051
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
INCLUDES = $(INCLTDL) \ INCLUDES = $(INCLTDL) \
-I$(top_builddir) -I$(top_builddir)/include \ -I$(top_builddir) -I$(top_builddir)/include \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_srcdir)/src/liboggz \
@OGG_CFLAGS@ @OGG_CFLAGS@
EXTRA_DIST = Version_script.in EXTRA_DIST = Version_script.in
......
...@@ -620,6 +620,23 @@ oggz_map_return_value_to_error (int cb_ret) ...@@ -620,6 +620,23 @@ oggz_map_return_value_to_error (int cb_ret)
const char * const char *
oggz_content_type (OggzStreamContent content) oggz_content_type (OggzStreamContent content)
{ {
/* 20080805:
* Re: http://lists.xiph.org/pipermail/ogg-dev/2008-July/001108.html
*
* "The ISO C standard, in section 6.7.2.2 "enumeration specifiers",
* paragraph 4, says
*
* Each enumerated type shall be compatible with *char*, a signed
* integer type, or an unsigned integer type. The choice of type is
* implementation-defined, but shall be capable of representing the
* values of all the members of the declaration."
*
* -- http://gcc.gnu.org/ml/gcc-bugs/2000-09/msg00271.html
*
* Hence, we cannot remove the (content < 0) guard, even though current
* GCC gives a warning for it -- other compilers (including earlier GCC
* versions) may use a signed type for enum OggzStreamContent.
*/
if (content < 0 || content >= OGGZ_CONTENT_UNKNOWN) if (content < 0 || content >= OGGZ_CONTENT_UNKNOWN)
return NULL; return NULL;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <getopt.h> #include <getopt.h>
#include "oggz-chop.h" #include "oggz-chop.h"
#include "oggz_tools.h"
#include "timespec.h" #include "timespec.h"
static char * progname; static char * progname;
......
...@@ -168,12 +168,12 @@ _ogg_page_free (const ogg_page * og) ...@@ -168,12 +168,12 @@ _ogg_page_free (const ogg_page * og)
} }
static void static void
_ogg_page_set_eos (ogg_page * og) _ogg_page_set_eos (const ogg_page * og)
{ {
if (og == NULL) return; if (og == NULL) return;
og->header[5] |= 0x04; og->header[5] |= 0x04;
ogg_page_checksum_set (og); ogg_page_checksum_set (OGG_PAGE_CONST(og));
} }
static void static void
...@@ -559,8 +559,8 @@ read_plain (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data) ...@@ -559,8 +559,8 @@ read_plain (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
#endif #endif
if (page_time < state->start) { if (page_time < state->start) {
if ((gp = ogg_page_granulepos (og)) != -1) if ((gp = ogg_page_granulepos (OGG_PAGE_CONST(og))) != -1)
ts->fisbone.start_granule = ogg_page_granulepos (og); ts->fisbone.start_granule = ogg_page_granulepos (OGG_PAGE_CONST(og));
} else if (page_time >= state->start && } else if (page_time >= state->start &&
(state->end == -1 || page_time <= state->end)) { (state->end == -1 || page_time <= state->end)) {
...@@ -571,7 +571,7 @@ read_plain (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data) ...@@ -571,7 +571,7 @@ read_plain (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
fwrite_ogg_page (state->outfile, og); fwrite_ogg_page (state->outfile, og);
} else if (state->end != -1.0 && page_time > state->end) { } else if (state->end != -1.0 && page_time > state->end) {
/* This is the first page past the end time; set EOS */ /* This is the first page past the end time; set EOS */
_ogg_page_set_eos ((ogg_page *)og); _ogg_page_set_eos (og);
fwrite_ogg_page (state->outfile, og); fwrite_ogg_page (state->outfile, og);
/* Stop handling this track */ /* Stop handling this track */
...@@ -617,7 +617,7 @@ read_gs (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data) ...@@ -617,7 +617,7 @@ read_gs (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
keyframe = granulepos >> granuleshift; keyframe = granulepos >> granuleshift;
if (keyframe != ts->prev_keyframe) { if (keyframe != ts->prev_keyframe) {
if (ogg_page_continued(og)) { if (ogg_page_continued(OGG_PAGE_CONST(og))) {
/* If this new-keyframe page is continued, advance the page accumulator, /* If this new-keyframe page is continued, advance the page accumulator,
* ie. recover earlier pages from this new GOP */ * ie. recover earlier pages from this new GOP */
accum_size = track_state_advance_page_accum (ts); accum_size = track_state_advance_page_accum (ts);
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
/* #define DEBUG */ /* #define DEBUG */
typedef int (*qsort_func) (const void * p1, const void * p2);
int int
usage (char * progname) usage (char * progname)
{ {
...@@ -57,23 +59,23 @@ usage (char * progname) ...@@ -57,23 +59,23 @@ usage (char * progname)
} }
static int static int
cmpstringp (const char **p1, const char **p2) cmpstringp (char * const * p1, char * const * p2)
{ {
/* The actual arguments to this function are "pointers to /* The actual arguments to this function are "pointers to
pointers to char", but strcmp(3) arguments are "pointers pointers to char", but strcmp(3) arguments are "pointers
to char", hence the following cast plus dereference */ to char", hence the function cast plus dereference */
if (!(*p1)) return -1; if (!(*p1)) return -1;
if (!(*p2)) return 1; if (!(*p2)) return 1;
return strcmp(* (char * const *) p1, * (char * const *) p2); return strcmp (*p1, *p2);
} }
int int
main (int argc, char ** argv) main (int argc, char ** argv)
{ {
OggzStreamContent content; OggzStreamContent content;
char * content_types[OGGZ_CONTENT_UNKNOWN]; const char * content_types[OGGZ_CONTENT_UNKNOWN];
char * progname = argv[0]; char * progname = argv[0];
...@@ -111,7 +113,8 @@ main (int argc, char ** argv) ...@@ -111,7 +113,8 @@ main (int argc, char ** argv)
} }
/* Sort them */ /* Sort them */
qsort (content_types, OGGZ_CONTENT_UNKNOWN, sizeof (char *), cmpstringp); qsort (content_types, OGGZ_CONTENT_UNKNOWN, sizeof (char *),
(qsort_func) cmpstringp);
/* Print them */ /* Print them */
for (content = 0; content < OGGZ_CONTENT_UNKNOWN; content++) { for (content = 0; content < OGGZ_CONTENT_UNKNOWN; content++) {
......
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