fifo: K&R formatting cosmetics

This commit is contained in:
Luca Barbato 2013-07-06 12:05:27 +02:00
parent 4e7f0b082d
commit 73142e7533
1 changed files with 28 additions and 24 deletions

View File

@ -59,7 +59,8 @@ int av_fifo_space(AVFifoBuffer *f)
return f->end - f->buffer - av_fifo_size(f);
}
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
{
unsigned int old_size = f->end - f->buffer;
if (old_size < new_size) {
@ -78,8 +79,10 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
return 0;
}
// src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter)
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int))
/* src must NOT be const as it can be a context for func that may need
* updating (like a pointer or byte counter) */
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
int (*func)(void *, void *, int))
{
int total = size;
do {
@ -101,13 +104,14 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
return total - size;
}
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int))
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size,
void (*func)(void *, void *, int))
{
// Read memory barrier needed for SMP here in theory
do {
int len = FFMIN(f->end - f->rptr, buf_size);
if(func) func(dest, f->rptr, len);
if (func)
func(dest, f->rptr, len);
else {
memcpy(dest, f->rptr, len);
dest = (uint8_t *)dest + len;