summaryrefslogtreecommitdiffstats
path: root/core/Fifo.c
diff options
context:
space:
mode:
authorhandbrake <[email protected]>2006-01-14 13:27:00 +0000
committerhandbrake <[email protected]>2006-01-14 13:27:00 +0000
commitb69e82fd960103c41979e00beb9b1c9fac78083b (patch)
tree264c5b637fd261c67d17e1d3649d4526c585e663 /core/Fifo.c
parent951be4e0b69aa652c992124025c862c4f1660937 (diff)
HandBrake 0.6.0-test3
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@12 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'core/Fifo.c')
-rw-r--r--core/Fifo.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/Fifo.c b/core/Fifo.c
index 06aed08cb..7e7433e01 100644
--- a/core/Fifo.c
+++ b/core/Fifo.c
@@ -1,10 +1,13 @@
-/* $Id: Fifo.c,v 1.9 2004/02/24 21:55:53 titer Exp $
+/* $Id: Fifo.c,v 1.12 2004/03/04 17:35:52 titer Exp $
This file is part of the HandBrake source code.
Homepage: <http://handbrake.m0k.org/>.
It may be used under the terms of the GNU General Public License. */
#include "Fifo.h"
+#if defined( HB_BEOS ) || defined( HB_LINUX )
+#include <malloc.h>
+#endif
HBBuffer * HBBufferInit( int size )
{
@@ -45,15 +48,19 @@ HBBuffer * HBBufferInit( int size )
void HBBufferReAlloc( HBBuffer * b, int size )
{
- b->alloc = size;
#if defined( HB_BEOS ) || defined( HB_LINUX )
b->data = realloc( b->data, size );
#elif defined( HB_MACOSX )
- b->dataOrig = realloc( b->dataOrig, size );
- b->data = b->dataOrig;
+ /* Ugly */
+ uint8_t * new = malloc( size );
+ memcpy( new, b->data, b->size );
+ free( b->dataOrig );
+ b->dataOrig = new;
+ b->data = new;
#elif defined( HB_CYGWIN )
/* TODO */
#endif
+ b->alloc = size;
if( !b->data )
{
@@ -106,8 +113,10 @@ HBFifo * HBFifoInit( int capacity )
void HBFifoDie( HBFifo * f )
{
+ HBLockLock( f->lock );
f->die = 1;
HBCondSignal( f->cond );
+ HBLockUnlock( f->lock );
}
void HBFifoClose( HBFifo ** _f )