Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
95024e06
Commit
95024e06
authored
Sep 18, 2005
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't access unallocated memory
parent
e616477b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
modules/access/gnomevfs.c
modules/access/gnomevfs.c
+17
-15
No files found.
modules/access/gnomevfs.c
View file @
95024e06
...
...
@@ -82,22 +82,25 @@ struct access_sys_t
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
;
char
*
psz_name
;
char
*
psz
,
*
psz_uri
;
GnomeVFSURI
*
p_uri
;
GnomeVFSResult
i_ret
;
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
=
NULL
;
char
*
psz_name
=
NULL
;
char
*
psz
=
NULL
;
char
*
psz_uri
=
NULL
;
GnomeVFSURI
*
p_uri
=
NULL
;
GnomeVFSResult
i_ret
;
GnomeVFSHandle
*
p_handle
=
NULL
;
if
(
!
(
gnome_vfs_init
())
)
{
msg_Warn
(
p_access
,
"couldn't initilize GnomeVFS"
);
return
VLC_EGENERIC
;
}
/* FIXME
Since GnomeVFS segfaults on exit if we initialize it without trying to
open a file with a valid protocol, try to
p
open at least file:// */
gnome_vfs_open
(
&
(
p_sys
->
p_handle
)
,
"file://"
,
5
);
open a file with a valid protocol, try to open at least file:// */
gnome_vfs_open
(
&
p_handle
,
"file://"
,
5
);
p_access
->
pf_read
=
Read
;
p_access
->
pf_block
=
NULL
;
...
...
@@ -109,11 +112,15 @@ static int Open( vlc_object_t *p_this )
p_access
->
info
.
b_eof
=
VLC_FALSE
;
p_access
->
info
.
i_title
=
0
;
p_access
->
info
.
i_seekpoint
=
0
;
p_access
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
access_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
p_sys
->
p_handle
=
p_handle
;
p_sys
->
i_nb_reads
=
0
;
p_sys
->
b_pace_control
=
VLC_TRUE
;
if
(
strcmp
(
"gnomevfs"
,
p_access
->
psz_access
)
&&
*
(
p_access
->
psz_access
)
!=
'\0'
)
{
...
...
@@ -142,7 +149,6 @@ static int Open( vlc_object_t *p_this )
}
p_uri
=
gnome_vfs_uri_new
(
psz_uri
);
if
(
p_uri
)
{
p_sys
->
p_file_info
=
gnome_vfs_file_info_new
();
...
...
@@ -230,7 +236,6 @@ static int Open( vlc_object_t *p_this )
p_sys
->
psz_name
=
psz_name
;
gnome_vfs_uri_unref
(
p_uri
);
return
VLC_SUCCESS
;
}
/*****************************************************************************
...
...
@@ -261,12 +266,11 @@ static void Close( vlc_object_t * p_this )
static
int
Read
(
access_t
*
p_access
,
uint8_t
*
p_buffer
,
int
i_len
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
int
i_ret
;
GnomeVFSFileSize
i_read_len
;
int
i_ret
;
i_ret
=
gnome_vfs_read
(
p_sys
->
p_handle
,
p_buffer
,
(
GnomeVFSFileSize
)
i_len
,
&
i_read_len
);
if
(
i_ret
)
{
p_access
->
info
.
b_eof
=
VLC_TRUE
;
...
...
@@ -319,7 +323,6 @@ static int Seek( access_t *p_access, int64_t i_pos )
i_ret
=
gnome_vfs_seek
(
p_sys
->
p_handle
,
GNOME_VFS_SEEK_START
,
(
GnomeVFSFileOffset
)
i_pos
);
if
(
!
i_ret
)
{
p_access
->
info
.
i_pos
=
i_pos
;
...
...
@@ -400,4 +403,3 @@ static int Control( access_t *p_access, int i_query, va_list args )
}
return
VLC_SUCCESS
;
}
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