Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
59997c35
Commit
59997c35
authored
Oct 06, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Use array_reserve() to reallocate read buffers.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8e9d7b03
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
8 deletions
+37
-8
gst_private.h
dlls/winegstreamer/gst_private.h
+2
-0
main.c
dlls/winegstreamer/main.c
+27
-0
media_source.c
dlls/winegstreamer/media_source.c
+4
-4
quartz_parser.c
dlls/winegstreamer/quartz_parser.c
+4
-4
No files found.
dlls/winegstreamer/gst_private.h
View file @
59997c35
...
...
@@ -38,6 +38,8 @@
#include "unixlib.h"
bool
array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
DECLSPEC_HIDDEN
;
static
inline
const
char
*
debugstr_time
(
REFERENCE_TIME
time
)
{
ULONGLONG
abstime
=
time
>=
0
?
time
:
-
time
;
...
...
dlls/winegstreamer/main.c
View file @
59997c35
...
...
@@ -31,6 +31,33 @@ static unixlib_handle_t unix_handle;
WINE_DEFAULT_DEBUG_CHANNEL
(
quartz
);
bool
array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
{
unsigned
int
new_capacity
,
max_capacity
;
void
*
new_elements
;
if
(
count
<=
*
capacity
)
return
TRUE
;
max_capacity
=
~
(
SIZE_T
)
0
/
size
;
if
(
count
>
max_capacity
)
return
FALSE
;
new_capacity
=
max
(
4
,
*
capacity
);
while
(
new_capacity
<
count
&&
new_capacity
<=
max_capacity
/
2
)
new_capacity
*=
2
;
if
(
new_capacity
<
count
)
new_capacity
=
max_capacity
;
if
(
!
(
new_elements
=
realloc
(
*
elements
,
new_capacity
*
size
)))
return
FALSE
;
*
elements
=
new_elements
;
*
capacity
=
new_capacity
;
return
TRUE
;
}
struct
wg_parser
*
wg_parser_create
(
enum
wg_parser_type
type
,
bool
unlimited_buffering
)
{
struct
wg_parser_create_params
params
=
...
...
dlls/winegstreamer/media_source.c
View file @
59997c35
...
...
@@ -613,7 +613,7 @@ static DWORD CALLBACK read_thread(void *arg)
{
struct
media_source
*
source
=
arg
;
IMFByteStream
*
byte_stream
=
source
->
byte_stream
;
uint32
_t
buffer_size
=
0
;
size
_t
buffer_size
=
0
;
uint64_t
file_size
;
void
*
data
=
NULL
;
...
...
@@ -636,10 +636,10 @@ static DWORD CALLBACK read_thread(void *arg)
else
if
(
offset
+
size
>=
file_size
)
size
=
file_size
-
offset
;
if
(
size
>
buffer_size
)
if
(
!
array_reserve
(
&
data
,
&
buffer_size
,
size
,
1
)
)
{
buffer_size
=
size
;
data
=
realloc
(
data
,
size
)
;
free
(
data
)
;
return
0
;
}
ret_size
=
0
;
...
...
dlls/winegstreamer/quartz_parser.c
View file @
59997c35
...
...
@@ -786,7 +786,7 @@ static DWORD CALLBACK read_thread(void *arg)
{
struct
parser
*
filter
=
arg
;
LONGLONG
file_size
,
unused
;
uint32
_t
buffer_size
=
0
;
size
_t
buffer_size
=
0
;
void
*
data
=
NULL
;
IAsyncReader_Length
(
filter
->
reader
,
&
file_size
,
&
unused
);
...
...
@@ -807,10 +807,10 @@ static DWORD CALLBACK read_thread(void *arg)
else
if
(
offset
+
size
>=
file_size
)
size
=
file_size
-
offset
;
if
(
size
>
buffer_size
)
if
(
!
array_reserve
(
&
data
,
&
buffer_size
,
size
,
1
)
)
{
buffer_size
=
size
;
data
=
realloc
(
data
,
size
)
;
free
(
data
)
;
return
0
;
}
hr
=
IAsyncReader_SyncRead
(
filter
->
reader
,
offset
,
size
,
data
);
...
...
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