ext/mplex/gstmplexibitstream.cc: gcc madness.
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Wed, 9 Feb 2005 14:27:08 +0000 (14:27 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Wed, 9 Feb 2005 14:27:08 +0000 (14:27 +0000)
Original commit message from CVS:
* ext/mplex/gstmplexibitstream.cc:
gcc madness.

ChangeLog
ext/mplex/gstmplexibitstream.cc

index 4d83730ca71fb3eab0b8c54083cad2849cd2a1d5..d0e88d2dbfb833d046585892089a8a33e70842bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-09  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * ext/mplex/gstmplexibitstream.cc:
+         gcc madness.
+
 2005-02-09  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * ext/ogg/gstogmparse.c:
index 28c0ff0b58d44a5a9278521222ffbdcbf9407b03..0f517703aa114a07fe40e15ebcf2c266dfedaa21 100644 (file)
@@ -66,21 +66,20 @@ GstMplexIBitStream::~GstMplexIBitStream (void)
  * Read data.
  */
 
-size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
+size_t
+GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
 {
-  guint8 *
-      data;
-  guint
-      read;
+  guint8 *data;
+
+  guint read = 0;
 
   if (eos)
     return 0;
 
   while (!eos && (read = gst_bytestream_peek_bytes (bs, &data, size)) != size) {
-    GstEvent *
-        event;
-    guint
-        pending;
+    GstEvent *event;
+
+    guint pending;
 
     gst_bytestream_get_status (bs, &pending, &event);
     if (event) {
@@ -95,8 +94,10 @@ size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
     }
   }
 
-  memcpy (buf, data, read);
-  gst_bytestream_flush_fast (bs, read);
+  if (read > 0) {
+    memcpy (buf, data, read);
+    gst_bytestream_flush_fast (bs, read);
+  }
 
   return read;
 }
@@ -105,7 +106,8 @@ size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
  * Are we at EOS?
  */
 
-bool GstMplexIBitStream::EndOfStream (void)
+bool
+GstMplexIBitStream::EndOfStream (void)
 {
   return eos;
 }