Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 9 Dec 2012 13:08:01 +0000 (14:08 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 9 Dec 2012 13:08:01 +0000 (14:08 +0100)
* qatar/master:
  avio: K&R cosmetic formatting

Conflicts:
libavformat/aviobuf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/aviobuf.c

@@@ -77,24 -76,26 +77,27 @@@ int ffio_init_context(AVIOContext *s
                    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
                    int64_t (*seek)(void *opaque, int64_t offset, int whence))
  {
-     s->buffer = buffer;
+     s->buffer      = buffer;
      s->buffer_size = buffer_size;
-     s->buf_ptr = buffer;
-     s->opaque = opaque;
-     s->direct = 0;
+     s->buf_ptr     = buffer;
+     s->opaque      = opaque;
++    s->direct      = 0;
      url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
-     s->write_packet = write_packet;
-     s->read_packet = read_packet;
-     s->seek = seek;
-     s->pos = 0;
-     s->must_flush = 0;
-     s->eof_reached = 0;
-     s->error = 0;
-     s->seekable = AVIO_SEEKABLE_NORMAL;
+     s->write_packet    = write_packet;
+     s->read_packet     = read_packet;
+     s->seek            = seek;
+     s->pos             = 0;
+     s->must_flush      = 0;
+     s->eof_reached     = 0;
+     s->error           = 0;
+     s->seekable        = AVIO_SEEKABLE_NORMAL;
      s->max_packet_size = 0;
-     s->update_checksum= NULL;
-     if(!read_packet && !write_flag){
-         s->pos = buffer_size;
+     s->update_checksum = NULL;
+     if (!read_packet && !write_flag) {
+         s->pos     = buffer_size;
          s->buf_end = s->buffer + buffer_size;
      }
      s->read_pause = NULL;
@@@ -119,25 -121,22 +123,26 @@@ AVIOContext *avio_alloc_context
      return s;
  }
  
-     if (s->write_packet && !s->error){
-         int ret= s->write_packet(s->opaque, (uint8_t *)data, len);
-         if(ret < 0){
 +static void writeout(AVIOContext *s, const uint8_t *data, int len)
 +{
++    if (s->write_packet && !s->error) {
++        int ret = s->write_packet(s->opaque, (uint8_t *)data, len);
++        if (ret < 0) {
 +            s->error = ret;
 +        }
 +    }
 +    s->pos += len;
 +}
 +
  static void flush_buffer(AVIOContext *s)
  {
      if (s->buf_ptr > s->buffer) {
 -        if (s->write_packet && !s->error) {
 -            int ret = s->write_packet(s->opaque, s->buffer,
 -                                      s->buf_ptr - s->buffer);
 -            if (ret < 0) {
 -                s->error = ret;
 -            }
 -        }
 +        writeout(s, s->buffer, s->buf_ptr - s->buffer);
-         if(s->update_checksum){
-             s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
-             s->checksum_ptr= s->buffer;
+         if (s->update_checksum) {
+             s->checksum     = s->update_checksum(s->checksum, s->checksum_ptr,
+                                                  s->buf_ptr - s->checksum_ptr);
+             s->checksum_ptr = s->buffer;
          }
 -        s->pos += s->buf_ptr - s->buffer;
      }
      s->buf_ptr = s->buffer;
  }
@@@ -335,13 -311,14 +341,14 @@@ int ff_get_v_length(uint64_t val
      return i;
  }
  
- void ff_put_v(AVIOContext *bc, uint64_t val){
-     int i= ff_get_v_length(val);
+ void ff_put_v(AVIOContext *bc, uint64_t val)
+ {
+     int i = ff_get_v_length(val);
  
-     while(--i>0)
-         avio_w8(bc, 128 | (uint8_t)(val>>(7*i)));
+     while (--i > 0)
 -        avio_w8(bc, 128 | (val >> (7 * i)));
++        avio_w8(bc, 128 | (uint8_t)(val >> (7*i)));
  
-     avio_w8(bc, val&127);
+     avio_w8(bc, val & 127);
  }
  
  void avio_wl64(AVIOContext *s, uint64_t val)
@@@ -384,11 -361,14 +391,14 @@@ void avio_wb24(AVIOContext *s, unsigne
  
  static void fill_buffer(AVIOContext *s)
  {
-     uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_end : s->buffer;
-     int len= s->buffer_size - (dst - s->buffer);
-     int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE;
+     uint8_t *dst        = !s->max_packet_size &&
+                           s->buf_end - s->buffer < s->buffer_size ?
+                           s->buf_end : s->buffer;
+     int len             = s->buffer_size - (dst - s->buffer);
+     int max_buffer_size = s->max_packet_size ?
+                           s->max_packet_size : IO_BUFFER_SIZE;
  
 -    /* can't fill the buffer without read_packet, just set EOF if appropiate */
 +    /* can't fill the buffer without read_packet, just set EOF if appropriate */
      if (!s->read_packet && s->buf_ptr >= s->buf_end)
          s->eof_reached = 1;