Hi,

  The attached patches unbreak compile on FreeBSD and remove warning on 32bit 
systems (both my fault).

 Also attached are a misc patch to ossplay (constify some structs, fix a small 
bug in CAF reader).

Yours,
        Yair K.
diff -r e300d16046f7 cmd/ossplay/ossplay_parser.c
--- a/cmd/ossplay/ossplay_parser.c	Wed Oct 20 04:14:01 2010 +0300
+++ b/cmd/ossplay/ossplay_parser.c	Mon Nov 01 22:56:02 2010 +0200
@@ -1174,7 +1175,7 @@
     ldouble_t COMM_rate = 0;
 
     exp = ((buf[8] & 127) << 8) + buf[9] - 16383;
-#if 1
+#if 0
     /*
      * This part of the mantissa will typically be resolved to
      * sub-Hz rates which we don't support anyway.
@@ -1686,7 +1687,7 @@
     double rate = 0;
 
     exp = ((buf[0] & 127) << 4) + ((buf[1] & 240) >> 4) - 1023;
-#if 1
+#if 0
    /*
     * This part of the mantissa will typically be resolved to
     * sub-Hz rates which we don't support anyway. We can also
diff -r e300d16046f7 os_cmd/FreeBSD/ossdetect/ossdetect.c
--- a/os_cmd/FreeBSD/ossdetect/ossdetect.c	Wed Oct 20 04:14:01 2010 +0300
+++ b/os_cmd/FreeBSD/ossdetect/ossdetect.c	Mon Nov 01 22:58:30 2010 +0200
@@ -148,7 +148,7 @@
 	}
 
       /* Drivers with upper case names are unsupported ones */
-      if ((*line >= 'A' && *line <= 'Z') || (*line == '\0))
+      if ((*line >= 'A' && *line <= 'Z') || (*line == '\0'))
 	continue;
 
       driver = line;
diff -r e300d16046f7 cmd/ossplay/ossplay_console.c
--- a/cmd/ossplay/ossplay_console.c	Wed Oct 20 04:14:01 2010 +0300
+++ b/cmd/ossplay/ossplay_console.c	Mon Nov 01 23:42:39 2010 +0200
@@ -158,7 +158,7 @@
   void *ptr;
 
   if ((sz == 0) || (sz > OSSPLAY_MAX_MALLOC)) {
-    fprintf (stderr, "Unreasonable allocation size" _PRIbig_t ", aborting",
+    fprintf (stderr, "Unreasonable allocation size " _PRIbig_t ", aborting",
              (big_t)sz);
     exit (E_SETUP_ERROR);
   }
diff -r e300d16046f7 cmd/ossplay/ossplay_parser.c
--- a/cmd/ossplay/ossplay_parser.c	Wed Oct 20 04:14:01 2010 +0300
+++ b/cmd/ossplay/ossplay_parser.c	Mon Nov 01 23:42:39 2010 +0200
@@ -65,9 +65,9 @@
 read_flag_t;
 
 typedef struct chunk_functions {
-  uint32 id;
-  uint32 d_chunk_size;
-  read_flag_t read_chunk_f;
+  const uint32 id;
+  const uint32 d_chunk_size;
+  const read_flag_t read_chunk_f;
   chunk_parser_t * f;
 }
 chunk_functions_t;
@@ -76,12 +76,12 @@
   file_init_t * init;
   file_read_t * read;
   file_iterator_t * iterator;
-  chunk_functions_t * perfile;
-  chunk_functions_t * common;
+  const chunk_functions_t * perfile;
+  const chunk_functions_t * common;
 }
 parser_t;
 
-extern int quiet, verbose, force_fmt;
+extern int quiet, verbose, force_fmt, force_speed;
 extern long seek_byte;
 extern flag from_stdin, raw_file;
 extern off_t (*ossplay_lseek) (int, off_t, int);
@@ -115,7 +115,7 @@
 static chunk_parser_t wave_fmt_parse;
 static chunk_parser_t wave_list_parse;
 
-static chunk_functions_t IFF_common[] = {
+static const chunk_functions_t IFF_common[] = {
   { H('A', 'N', 'N', 'O'), 0, READ_ALL, &iff_comment_parse },
   { H('N', 'A', 'M', 'E'), 0, READ_ALL, &iff_comment_parse },
   { H('(', 'c', ')', ' '), 0, READ_ALL, &iff_comment_parse },
@@ -123,20 +123,20 @@
   { 0, 0, READ_NONE, NULL }
 };
 
-static chunk_functions_t AIFF_funcs[] = {
+static const chunk_functions_t AIFF_funcs[] = {
   { H('C', 'O', 'M', 'M'), 18, READ_ALL, &aiff_comm_parse },
   { H('S', 'S', 'N', 'D'), 8, READ_PART, &aiff_ssnd_parse },
   { 0, 0, R_ZERO_FLAG, NULL }
 };
 
-static chunk_functions_t AIFC_funcs[] = {
+static const chunk_functions_t AIFC_funcs[] = {
   { H('C', 'O', 'M', 'M'), 22, READ_ALL, &aifc_comm_parse },
   { H('S', 'S', 'N', 'D'), 8, READ_PART, &aiff_ssnd_parse },
   { H('F', 'V', 'E', 'R'), 4, READ_ALL, &aifc_fver_parse },
   { 0, 0, R_ZERO_FLAG, NULL }
 };
 
-static chunk_functions_t WAVE_funcs[] = {
+static const chunk_functions_t WAVE_funcs[] = {
   { H('f', 'm', 't', ' '), 14, READ_ALL, &wave_fmt_parse },
   { H('d', 'a', 't', 'a'), 0, READ_NONE, &wave_data_parse },
   { H('D', 'I', 'S', 'P'), 5, READ_ALL, &wave_disp_parse },
@@ -144,26 +144,26 @@
   { 0, 0, R_ZERO_FLAG, NULL }
 };
 
-static chunk_functions_t _8SVX_funcs[] = {
+static const chunk_functions_t _8SVX_funcs[] = {
   { H('B', 'O', 'D', 'Y'), 0, READ_NONE, &wave_data_parse },
   { H('V', 'H', 'D', 'R'), 16, READ_ALL, &_8svx_vhdr_parse },
   { 0, 0, R_ZERO_FLAG, NULL }
 };
 
-static chunk_functions_t _16SV_funcs[] = {
+static const chunk_functions_t _16SV_funcs[] = {
   { H('V', 'H', 'D', 'R'), 14, READ_ALL, &_16sv_vhdr_parse },
   { H('B', 'O', 'D', 'Y'), 0, READ_NONE, &wave_data_parse },
   { 0, 0, R_ZERO_FLAG, NULL }
 };
 
-static chunk_functions_t MAUD_funcs[] = {
+static const chunk_functions_t MAUD_funcs[] = {
   { H('M', 'D', 'A', 'T'), 0, READ_NONE, &wave_data_parse },
   { H('C', 'H', 'A', 'N'), 4, READ_ALL, &maud_chan_parse },
   { H('M', 'H', 'D', 'R'), 20, READ_ALL, &maud_mhdr_parse },
   { 0, 0, R_ZERO_FLAG, NULL }
 };
 
-static chunk_functions_t CAF_funcs[] = {
+static const chunk_functions_t CAF_funcs[] = {
   { H('d', 'e', 's', 'c'), 32, READ_ALL, &caf_desc_parse },
   { H('d', 'a', 't', 'a'), 4, READ_NONE, &caf_data_parse },
   { 0, 0, R_ZERO_FLAG, NULL }
@@ -522,8 +522,8 @@
 {
   int ret;
 
-  big_t rbytes;
-  chunk_functions_t * i, * oi;
+  sbig_t rbytes;
+  const chunk_functions_t * i, * oi;
   file_t f = { {
     256, 496, 7, 4, {
       {256, 0},
@@ -952,6 +952,7 @@
   char chn[32];
   const char * fmt = "";
 
+  if (force_speed) speed = force_speed;
   switch (type)
     {
       case WAVE_FILE:
@@ -1033,7 +1034,7 @@
   f->total_size = f->ne_int (buf + 4, 4) + 8;
 
   if (from_stdin) return 0;
-  fstat (f->fd, &st);
+  if (fstat (f->fd, &st) == -1) return 0;
   if (st.st_size < f->total_size) {
     f->total_size = st.st_size;
     print_msg (NOTIFYM, "%s: File size is smaller than the form size!\n",
@@ -1595,12 +1596,11 @@
   struct stat st;
 
   memcpy (buf, buf+8, 4);
-  if (from_stdin) {
+  if (from_stdin || (fstat (f->fd, &st) == -1)) {
     f->total_size = BIG_SPECIAL;
     return 4;
   }
 
-  fstat (f->fd, &st);
   f->total_size = st.st_size;
   return 4;
 }
@@ -1621,7 +1621,7 @@
   f->chunk_id = be_int (buf, 4);
   f->chunk_size = be_int (buf + 4, 8);
   f->cpos = 0;
-  f->fut_size += f->chunk_size + (f->chunk_size & 1) + 12 - l;
+  f->fut_size += f->chunk_size + 12 - l;
 
   if (verbose > 3)
     print_msg (VERBOSEM, "%s: Reading chunk %c%c%c%c, size %d, pos %d\n",
@@ -1773,7 +1773,7 @@
   ossplay_lseek (f->fd, 16, SEEK_CUR);
 
   if (from_stdin) return 0;
-  fstat (f->fd, &st);
+  if (fstat (f->fd, &st) == -1) return 0;
   if (st.st_size < f->total_size) {
     f->total_size = st.st_size;
     print_msg (NOTIFYM, "%s: File size is smaller than the form size!\n",
_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to