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
49c53195
Commit
49c53195
authored
Mar 19, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file access: Remove expand path, spare one dummy duplication
parent
540c7613
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
23 deletions
+14
-23
modules/access/file.c
modules/access/file.c
+14
-23
No files found.
modules/access/file.c
View file @
49c53195
...
...
@@ -49,6 +49,7 @@
#if defined( WIN32 ) && !defined( UNDER_CE )
# include <io.h>
# include <ctype.h>
#else
# include <unistd.h>
# include <poll.h>
...
...
@@ -377,36 +378,27 @@ static int Control( access_t *p_access, int i_query, va_list args )
return
VLC_SUCCESS
;
}
static
char
*
expand_path
(
const
access_t
*
p_access
,
const
char
*
path
)
{
#if defined(WIN32)
if
(
!
strcasecmp
(
p_access
->
psz_access
,
"file"
)
&&
(
'/'
==
path
[
0
])
&&
path
[
1
]
&&
(
':'
==
path
[
2
])
&&
(
'/'
==
path
[
3
]))
// Explorer can open path such as file:/C:/ or file:///C:/
// hence remove leading / if found
return
strdup
(
path
+
1
);
#endif
return
strdup
(
path
);
}
/*****************************************************************************
* open_file: Opens a specific file
*****************************************************************************/
static
int
open_file
(
access_t
*
p_access
,
const
char
*
p
sz_name
)
static
int
open_file
(
access_t
*
p_access
,
const
char
*
p
ath
)
{
char
*
path
=
expand_path
(
p_access
,
psz_name
);
#if defined(WIN32)
if
(
!
strcasecmp
(
p_access
->
psz_access
,
"file"
)
&&
(
'/'
==
path
[
0
])
&&
isalpha
(
path
[
1
])
&&
(
':'
==
path
[
2
])
&&
(
'/'
==
path
[
3
]))
/* Explorer can open path such as file:/C:/ or file:///C:/
* hence remove leading / if found */
path
++
;
#endif
#ifdef UNDER_CE
p_sys
->
fd
=
utf8_fopen
(
path
,
"rb"
);
if
(
!
p_sys
->
fd
)
{
msg_Err
(
p_access
,
"cannot open file %s"
,
p
sz_name
);
msg_Err
(
p_access
,
"cannot open file %s"
,
p
ath
);
intf_UserFatal
(
p_access
,
VLC_FALSE
,
_
(
"File reading failed"
),
_
(
"VLC could not open the file
\"
%s
\"
."
),
psz_name
);
free
(
path
);
_
(
"VLC could not open the file
\"
%s
\"
."
),
path
);
return
VLC_EGENERIC
;
}
...
...
@@ -416,12 +408,11 @@ static int open_file (access_t *p_access, const char *psz_name)
fseek
(
p_sys
->
fd
,
0
,
SEEK_SET
);
#else
int
fd
=
utf8_open
(
path
,
O_RDONLY
|
O_NONBLOCK
/* O_LARGEFILE*/
,
0666
);
free
(
path
);
if
(
fd
==
-
1
)
{
msg_Err
(
p_access
,
"cannot open file %s (%m)"
,
p
sz_name
);
msg_Err
(
p_access
,
"cannot open file %s (%m)"
,
p
ath
);
intf_UserFatal
(
p_access
,
VLC_FALSE
,
_
(
"File reading failed"
),
_
(
"VLC could not open the file
\"
%s
\"
."
),
p
sz_name
);
_
(
"VLC could not open the file
\"
%s
\"
."
),
p
ath
);
return
-
1
;
}
...
...
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