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
a774b535
Commit
a774b535
authored
Jan 16, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file: expand a (now) trivial and used only once function
parent
6bd7922e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
25 deletions
+14
-25
modules/access/file.c
modules/access/file.c
+14
-25
No files found.
modules/access/file.c
View file @
a774b535
...
...
@@ -121,8 +121,6 @@ static int NoSeek( access_t *, int64_t );
static
ssize_t
Read
(
access_t
*
,
uint8_t
*
,
size_t
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
static
int
open_file
(
access_t
*
,
const
char
*
);
struct
access_sys_t
{
unsigned
int
i_nb_reads
;
...
...
@@ -180,8 +178,8 @@ static int Open( vlc_object_t *p_this )
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
;
const
char
*
path
=
p_access
->
psz_path
;
#ifdef WIN32
wchar_t
wpath
[
MAX_PATH
+
1
];
bool
is_remote
=
false
;
#endif
...
...
@@ -193,15 +191,23 @@ static int Open( vlc_object_t *p_this )
int
fd
=
-
1
;
if
(
!
strcasecmp
(
p_access
->
psz_access
,
"fd"
))
fd
=
dup
(
atoi
(
p
_access
->
psz_p
ath
));
else
if
(
!
strcmp
(
p
_access
->
psz_p
ath
,
"-"
))
fd
=
dup
(
atoi
(
path
));
else
if
(
!
strcmp
(
path
,
"-"
))
fd
=
dup
(
0
);
else
{
msg_Dbg
(
p_access
,
"opening file `%s'"
,
p_access
->
psz_path
);
fd
=
open_file
(
p_access
,
p_access
->
psz_path
);
msg_Dbg
(
p_access
,
"opening file `%s'"
,
path
);
fd
=
utf8_open
(
path
,
O_RDONLY
|
O_NONBLOCK
);
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot open file %s (%m)"
,
path
);
dialog_Fatal
(
p_access
,
_
(
"File reading failed"
),
_
(
"VLC could not open the file
\"
%s
\"
."
),
path
);
}
#ifdef WIN32
if
(
MultiByteToWideChar
(
CP_UTF8
,
0
,
p_access
->
psz_path
,
-
1
,
wchar_t
wpath
[
MAX_PATH
+
1
];
if
(
MultiByteToWideChar
(
CP_UTF8
,
0
,
path
,
-
1
,
wpath
,
MAX_PATH
)
&&
PathIsNetworkPathW
(
wpath
))
is_remote
=
true
;
...
...
@@ -411,20 +417,3 @@ static int Control( access_t *p_access, int i_query, va_list args )
}
return
VLC_SUCCESS
;
}
/*****************************************************************************
* open_file: Opens a specific file
*****************************************************************************/
static
int
open_file
(
access_t
*
p_access
,
const
char
*
path
)
{
int
fd
=
utf8_open
(
path
,
O_RDONLY
|
O_NONBLOCK
);
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot open file %s (%m)"
,
path
);
dialog_Fatal
(
p_access
,
_
(
"File reading failed"
),
_
(
"VLC could not open the file
\"
%s
\"
."
),
path
);
return
-
1
;
}
return
fd
;
}
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