Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
4903ec72
Commit
4903ec72
authored
Apr 15, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/misc/block.c: fixed BlockRealloc()
parent
9ab25caf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
30 deletions
+15
-30
src/misc/block.c
src/misc/block.c
+15
-30
No files found.
src/misc/block.c
View file @
4903ec72
...
@@ -130,30 +130,30 @@ static block_t *BlockDuplicate( block_t *p_block )
...
@@ -130,30 +130,30 @@ static block_t *BlockDuplicate( block_t *p_block )
static
block_t
*
BlockRealloc
(
block_t
*
p_block
,
int
i_prebody
,
int
i_body
)
static
block_t
*
BlockRealloc
(
block_t
*
p_block
,
int
i_prebody
,
int
i_body
)
{
{
int
i_buffer_size
=
i_prebody
+
i_body
;
if
(
i_body
<
0
||
i_buffer_size
<=
0
)
return
NULL
;
vlc_mutex_lock
(
&
p_block
->
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_block
->
p_sys
->
lock
);
if
(
i_prebody
<
0
||
p_block
->
p_buffer
-
i_prebody
>
p_block
->
p_sys
->
p_allocated_buffer
)
if
(
i_prebody
<
(
p_block
->
p_buffer
-
p_block
->
p_sys
->
p_allocated_buffer
+
p_block
->
p_sys
->
i_allocated_buffer
)
||
p_block
->
p_buffer
-
i_prebody
>
p_block
->
p_sys
->
p_allocated_buffer
)
{
{
p_block
->
p_buffer
-=
i_prebody
;
p_block
->
p_buffer
-=
i_prebody
;
p_block
->
i_buffer
+=
i_prebody
;
p_block
->
i_buffer
+=
i_prebody
;
i_prebody
=
0
;
i_prebody
=
0
;
}
}
if
(
i_body
<
0
||
if
(
p_block
->
p_buffer
+
i_body
<
p_block
->
p_sys
->
p_allocated_buffer
+
p_block
->
p_buffer
+
i_body
<
p_block
->
p_sys
->
p_allocated_buffer
+
p_block
->
p_sys
->
i_allocated_buffer
)
p_block
->
p_sys
->
i_allocated_buffer
)
{
{
p_block
->
i_buffer
=
i_b
ody
;
p_block
->
i_buffer
=
i_b
uffer_size
;
i_body
=
0
;
i_body
=
0
;
}
}
vlc_mutex_unlock
(
&
p_block
->
p_sys
->
lock
);
if
(
i_prebody
>
0
)
if
(
!
i_body
||
!
i_prebody
)
{
{
block_t
*
p_rea
=
block_New
(
p_block
->
p_manager
,
i_prebody
+
i_body
);
block_t
*
p_rea
=
block_New
(
p_block
->
p_manager
,
i_buffer_size
);
fprintf
(
stderr
,
"arg i_prebody=%d max is %d
\n
"
,
i_prebody
,
p_block
->
p_buffer
-
p_block
->
p_sys
->
p_allocated_buffer
);
p_rea
->
i_dts
=
p_block
->
i_dts
;
p_rea
->
i_dts
=
p_block
->
i_dts
;
p_rea
->
i_pts
=
p_block
->
i_pts
;
p_rea
->
i_pts
=
p_block
->
i_pts
;
...
@@ -161,31 +161,16 @@ static block_t *BlockRealloc( block_t *p_block, int i_prebody, int i_body )
...
@@ -161,31 +161,16 @@ static block_t *BlockRealloc( block_t *p_block, int i_prebody, int i_body )
p_rea
->
i_length
=
p_block
->
i_length
;
p_rea
->
i_length
=
p_block
->
i_length
;
p_rea
->
i_rate
=
p_block
->
i_rate
;
p_rea
->
i_rate
=
p_block
->
i_rate
;
memcpy
(
&
p_rea
->
p_buffer
[
i_prebody
]
,
p_block
->
p_buffer
,
memcpy
(
p_rea
->
p_buffer
+
i_prebody
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
__MIN
(
p_block
->
i_buffer
,
p_rea
->
i_buffer
-
i_prebody
)
);
vlc_mutex_unlock
(
&
p_block
->
p_sys
->
lock
);
block_Release
(
p_block
);
block_Release
(
p_block
);
return
p_rea
;
return
p_rea
;
}
}
if
(
i_body
>
0
)
vlc_mutex_unlock
(
&
p_block
->
p_sys
->
lock
);
{
int
i_start
;
block_t
*
p_rea
=
BlockModify
(
p_block
,
VLC_TRUE
);
i_start
=
p_rea
->
p_buffer
-
p_rea
->
p_sys
->
p_allocated_buffer
;
p_rea
->
p_sys
->
i_allocated_buffer
+=
i_body
-
p_rea
->
i_buffer
;
p_rea
->
p_sys
->
p_allocated_buffer
=
realloc
(
p_rea
->
p_sys
->
p_allocated_buffer
,
p_rea
->
p_sys
->
i_allocated_buffer
);
p_rea
->
p_buffer
=
&
p_rea
->
p_sys
->
p_allocated_buffer
[
i_start
];
p_rea
->
i_buffer
=
i_body
;
return
p_rea
;
}
return
p_block
;
return
p_block
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment