[vlc-devel] commit: Add some comments ( Rémi Denis-Courmont )
git version control
git at videolan.org
Mon Mar 24 21:30:32 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Mon Mar 24 22:09:37 2008 +0200| [0649ebcda4d32b629806a4b7b321504f32f8a622]
Add some comments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0649ebcda4d32b629806a4b7b321504f32f8a622
---
src/misc/block.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/misc/block.c b/src/misc/block.c
index b5289c7..e2c0023 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -102,7 +102,7 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
if( p_block->pf_release != BlockRelease )
{
/* Special case when pf_release if overloaded
- * TODO if used one day, them implement it in a smarter way */
+ * TODO if used one day, then implement it in a smarter way */
block_t *p_dup = block_Duplicate( p_block );
block_Release( p_block );
if( !p_dup )
@@ -119,6 +119,7 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
return NULL;
}
+ /* Adjust reserved header if there is enough room */
if( p_block->p_buffer - i_prebody > p_sys->p_allocated_buffer &&
p_block->p_buffer - i_prebody < p_sys->p_allocated_buffer +
p_sys->i_allocated_buffer )
@@ -127,6 +128,8 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
p_block->i_buffer += i_prebody;
i_prebody = 0;
}
+
+ /* Adjust payload size if there is enough room */
if( p_block->p_buffer + i_body < p_sys->p_allocated_buffer +
p_sys->i_allocated_buffer )
{
@@ -134,8 +137,10 @@ block_t *block_Realloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
i_body = 0;
}
+ /* Not enough room, reallocate the buffer */
if( i_body > 0 || i_prebody > 0 )
{
+ /* FIXME: this is really dumb, we should use realloc() */
block_t *p_rea = block_New( NULL, i_buffer_size );
if( p_rea )
More information about the vlc-devel
mailing list