[xiph-commits] r3684 - in liboggz/trunk/src: liboggz tools tools/oggz-chop
conrad at svn.annodex.net
conrad at svn.annodex.net
Tue Aug 5 03:54:43 PDT 2008
Author: conrad
Date: 2008-08-05 03:54:43 -0700 (Tue, 05 Aug 2008)
New Revision: 3684
Modified:
liboggz/trunk/src/liboggz/Makefile.am
liboggz/trunk/src/liboggz/oggz.c
liboggz/trunk/src/tools/oggz-chop/cmd.c
liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
liboggz/trunk/src/tools/oggz-known-codecs.c
Log:
fix some build warnings.
See: http://lists.xiph.org/pipermail/ogg-dev/2008-July/001108.html
for background and discussion.
Modified: liboggz/trunk/src/liboggz/Makefile.am
===================================================================
--- liboggz/trunk/src/liboggz/Makefile.am 2008-08-05 10:54:29 UTC (rev 3683)
+++ liboggz/trunk/src/liboggz/Makefile.am 2008-08-05 10:54:43 UTC (rev 3684)
@@ -3,6 +3,7 @@
INCLUDES = $(INCLTDL) \
-I$(top_builddir) -I$(top_builddir)/include \
-I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/liboggz \
@OGG_CFLAGS@
EXTRA_DIST = Version_script.in
Modified: liboggz/trunk/src/liboggz/oggz.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz.c 2008-08-05 10:54:29 UTC (rev 3683)
+++ liboggz/trunk/src/liboggz/oggz.c 2008-08-05 10:54:43 UTC (rev 3684)
@@ -620,6 +620,23 @@
const char *
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)
return NULL;
Modified: liboggz/trunk/src/tools/oggz-chop/cmd.c
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/cmd.c 2008-08-05 10:54:29 UTC (rev 3683)
+++ liboggz/trunk/src/tools/oggz-chop/cmd.c 2008-08-05 10:54:43 UTC (rev 3684)
@@ -7,6 +7,7 @@
#include <getopt.h>
#include "oggz-chop.h"
+#include "oggz_tools.h"
#include "timespec.h"
static char * progname;
Modified: liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/oggz-chop.c 2008-08-05 10:54:29 UTC (rev 3683)
+++ liboggz/trunk/src/tools/oggz-chop/oggz-chop.c 2008-08-05 10:54:43 UTC (rev 3684)
@@ -168,12 +168,12 @@
}
static void
-_ogg_page_set_eos (ogg_page * og)
+_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
@@ -559,8 +559,8 @@
#endif
if (page_time < state->start) {
- if ((gp = ogg_page_granulepos (og)) != -1)
- ts->fisbone.start_granule = ogg_page_granulepos (og);
+ if ((gp = ogg_page_granulepos (OGG_PAGE_CONST(og))) != -1)
+ ts->fisbone.start_granule = ogg_page_granulepos (OGG_PAGE_CONST(og));
} else if (page_time >= state->start &&
(state->end == -1 || page_time <= state->end)) {
@@ -571,7 +571,7 @@
fwrite_ogg_page (state->outfile, og);
} else if (state->end != -1.0 && page_time > state->end) {
/* 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);
/* Stop handling this track */
@@ -617,7 +617,7 @@
keyframe = granulepos >> granuleshift;
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,
* ie. recover earlier pages from this new GOP */
accum_size = track_state_advance_page_accum (ts);
Modified: liboggz/trunk/src/tools/oggz-known-codecs.c
===================================================================
--- liboggz/trunk/src/tools/oggz-known-codecs.c 2008-08-05 10:54:29 UTC (rev 3683)
+++ liboggz/trunk/src/tools/oggz-known-codecs.c 2008-08-05 10:54:43 UTC (rev 3684)
@@ -40,6 +40,8 @@
/* #define DEBUG */
+typedef int (*qsort_func) (const void * p1, const void * p2);
+
int
usage (char * progname)
{
@@ -57,23 +59,23 @@
}
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
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 (!(*p2)) return 1;
- return strcmp(* (char * const *) p1, * (char * const *) p2);
+ return strcmp (*p1, *p2);
}
int
main (int argc, char ** argv)
{
OggzStreamContent content;
- char * content_types[OGGZ_CONTENT_UNKNOWN];
+ const char * content_types[OGGZ_CONTENT_UNKNOWN];
char * progname = argv[0];
@@ -111,7 +113,8 @@
}
/* Sort them */
- qsort (content_types, OGGZ_CONTENT_UNKNOWN, sizeof (char *), cmpstringp);
+ qsort (content_types, OGGZ_CONTENT_UNKNOWN, sizeof (char *),
+ (qsort_func) cmpstringp);
/* Print them */
for (content = 0; content < OGGZ_CONTENT_UNKNOWN; content++) {
More information about the commits
mailing list