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
09775b17
Commit
09775b17
authored
Jan 16, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file: initialize access_t after the open operation is succesful
parent
30057956
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
28 deletions
+19
-28
modules/access/file.c
modules/access/file.c
+19
-28
No files found.
modules/access/file.c
View file @
09775b17
...
...
@@ -132,24 +132,11 @@ static bool IsRemote (int fd)
int
Open
(
vlc_object_t
*
p_this
)
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
const
char
*
path
=
p_access
->
psz_path
;
#ifdef WIN32
bool
is_remote
=
false
;
#endif
if
(
unlikely
(
p_sys
==
NULL
))
return
VLC_ENOMEM
;
access_InitFields
(
p_access
);
p_access
->
pf_read
=
FileRead
;
p_access
->
pf_block
=
NULL
;
p_access
->
pf_control
=
FileControl
;
p_access
->
pf_seek
=
FileSeek
;
p_access
->
p_sys
=
p_sys
;
p_sys
->
i_nb_reads
=
0
;
p_sys
->
b_pace_control
=
true
;
/* Open file */
int
fd
=
-
1
;
...
...
@@ -178,11 +165,9 @@ int Open( vlc_object_t *p_this )
#endif
}
if
(
fd
==
-
1
)
goto
error
;
return
VLC_EGENERIC
;
#ifdef HAVE_SYS_STAT_H
struct
stat
st
;
if
(
fstat
(
fd
,
&
st
))
{
msg_Err
(
p_access
,
"failed to read (%m)"
);
...
...
@@ -195,6 +180,23 @@ int Open( vlc_object_t *p_this )
msg_Dbg
(
p_access
,
"ignoring directory"
);
goto
error
;
}
access_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
if
(
unlikely
(
p_sys
==
NULL
))
goto
error
;
access_InitFields
(
p_access
);
p_access
->
pf_read
=
FileRead
;
p_access
->
pf_block
=
NULL
;
p_access
->
pf_control
=
FileControl
;
p_access
->
pf_seek
=
FileSeek
;
p_access
->
p_sys
=
p_sys
;
p_sys
->
i_nb_reads
=
0
;
p_sys
->
fd
=
fd
;
p_sys
->
caching
=
var_CreateGetInteger
(
p_access
,
"file-caching"
);
if
(
IsRemote
(
fd
))
p_sys
->
caching
+=
var_CreateGetInteger
(
p_access
,
"network-caching"
);
p_sys
->
b_pace_control
=
true
;
if
(
S_ISREG
(
st
.
st_mode
))
p_access
->
info
.
i_size
=
st
.
st_size
;
else
if
(
!
S_ISBLK
(
st
.
st_mode
))
...
...
@@ -202,15 +204,6 @@ int Open( vlc_object_t *p_this )
p_access
->
pf_seek
=
NoSeek
;
p_sys
->
b_pace_control
=
strcasecmp
(
p_access
->
psz_access
,
"stream"
);
}
#else
# warning File size not known!
#endif
p_sys
->
caching
=
var_CreateGetInteger
(
p_access
,
"file-caching"
);
if
(
IsRemote
(
fd
))
p_sys
->
caching
+=
var_CreateGetInteger
(
p_access
,
"network-caching"
);
p_sys
->
fd
=
fd
;
if
(
p_access
->
pf_seek
!=
NoSeek
)
{
...
...
@@ -232,9 +225,7 @@ int Open( vlc_object_t *p_this )
return
VLC_SUCCESS
;
error:
if
(
fd
!=
-
1
)
close
(
fd
);
free
(
p_sys
);
close
(
fd
);
return
VLC_EGENERIC
;
}
...
...
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