Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
9826be04
Commit
9826be04
authored
Nov 29, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline path_sanitize()
Also optimize it away where applicable.
parent
c9b04765
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
28 deletions
+31
-28
include/vlc_strings.h
include/vlc_strings.h
+31
-1
src/libvlccore.sym
src/libvlccore.sym
+0
-1
src/text/strings.c
src/text/strings.c
+0
-26
No files found.
include/vlc_strings.h
View file @
9826be04
...
@@ -135,7 +135,37 @@ static inline char *str_format( input_thread_t *input, const char *fmt )
...
@@ -135,7 +135,37 @@ static inline char *str_format( input_thread_t *input, const char *fmt )
}
}
void
filename_sanitize
(
char
*
);
void
filename_sanitize
(
char
*
);
VLC_API
void
path_sanitize
(
char
*
);
/**
* Remove forbidden characters from full paths (leaves slashes)
*/
static
inline
void
path_sanitize
(
char
*
str
)
{
#if defined( _WIN32 ) || defined( __OS2__ )
/* check drive prefix if path is absolute */
if
((((
unsigned
char
)(
str
[
0
]
-
'A'
)
<
26
)
||
((
unsigned
char
)(
str
[
0
]
-
'a'
)
<
26
))
&&
(
str
[
1
]
==
':'
))
str
+=
2
;
while
(
*
str
!=
'\0'
)
{
if
(
strchr
(
"*
\"
?:|<>"
,
*
str
)
!=
NULL
)
*
str
=
'_'
;
if
(
*
str
==
'/'
)
*
str
=
DIR_SEP_CHAR
;
str
++
;
}
#elif defined( __APPLE__ )
while
(
*
str
!=
'\0'
)
{
if
(
*
str
==
':'
)
*
str
=
'_'
;
str
++
;
}
#else
(
void
)
str
;
#endif
}
/**
/**
* @}
* @}
...
...
src/libvlccore.sym
View file @
9826be04
...
@@ -285,7 +285,6 @@ net_SetCSCov
...
@@ -285,7 +285,6 @@ net_SetCSCov
net_vaPrintf
net_vaPrintf
net_Write
net_Write
NTPtime64
NTPtime64
path_sanitize
picture_BlendSubpicture
picture_BlendSubpicture
picture_CopyPixels
picture_CopyPixels
picture_Hold
picture_Hold
...
...
src/text/strings.c
View file @
9826be04
...
@@ -887,29 +887,3 @@ void filename_sanitize( char *str )
...
@@ -887,29 +887,3 @@ void filename_sanitize( char *str )
*
str
=
'_'
;
*
str
=
'_'
;
}
}
}
}
/**
* Remove forbidden characters from full paths (leaves slashes)
*/
void
path_sanitize
(
char
*
str
)
{
#if defined( _WIN32 ) || defined( __OS2__ )
/* check drive prefix if path is absolute */
if
(
(((
unsigned
char
)(
str
[
0
]
-
'A'
)
<
26
)
||
((
unsigned
char
)(
str
[
0
]
-
'a'
)
<
26
))
&&
(
':'
==
str
[
1
])
)
str
+=
2
;
#endif
while
(
*
str
)
{
#if defined( __APPLE__ )
if
(
*
str
==
':'
)
*
str
=
'_'
;
#elif defined( _WIN32 ) || defined( __OS2__ )
if
(
strchr
(
"*
\"
?:|<>"
,
*
str
)
)
*
str
=
'_'
;
if
(
*
str
==
'/'
)
*
str
=
DIR_SEP_CHAR
;
#endif
str
++
;
}
}
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