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
7e6968ae
Commit
7e6968ae
authored
Feb 10, 2010
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change filename_sanitize() to work on original string like path_sanitize().
parent
96824f0c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
17 deletions
+15
-17
include/vlc_strings.h
include/vlc_strings.h
+1
-1
src/input/input.c
src/input/input.c
+4
-6
src/playlist/art.c
src/playlist/art.c
+8
-4
src/text/strings.c
src/text/strings.c
+2
-6
No files found.
include/vlc_strings.h
View file @
7e6968ae
...
...
@@ -50,7 +50,7 @@ VLC_EXPORT( char *, str_format_meta, ( vlc_object_t *, const char * ) );
VLC_EXPORT
(
char
*
,
str_format
,
(
vlc_object_t
*
,
const
char
*
)
);
#define str_format( a, b ) str_format( VLC_OBJECT( a ), b )
VLC_EXPORT
(
char
*
,
filename_sanitize
,
(
const
char
*
)
)
LIBVLC_USED
;
VLC_EXPORT
(
void
,
filename_sanitize
,
(
char
*
)
)
;
VLC_EXPORT
(
void
,
path_sanitize
,
(
char
*
)
);
/**
...
...
src/input/input.c
View file @
7e6968ae
...
...
@@ -3339,16 +3339,14 @@ char *input_CreateFilename( vlc_object_t *p_obj, const char *psz_path, const cha
if
(
!
psz_tmp
)
return
NULL
;
char
*
psz_tmp2
=
filename_sanitize
(
psz_tmp
);
free
(
psz_tmp
);
filename_sanitize
(
psz_tmp
);
if
(
!
psz_tmp2
||
asprintf
(
&
psz_file
,
"%s"
DIR_SEP
"%s%s%s"
,
psz_path
,
psz_tmp2
,
if
(
asprintf
(
&
psz_file
,
"%s"
DIR_SEP
"%s%s%s"
,
psz_path
,
psz_tmp
,
psz_extension
?
"."
:
""
,
psz_extension
?
psz_extension
:
""
)
<
0
)
psz_file
=
NULL
;
free
(
psz_tmp
2
);
free
(
psz_tmp
);
return
psz_file
;
}
else
...
...
src/playlist/art.c
View file @
7e6968ae
...
...
@@ -71,8 +71,10 @@ static char* ArtCacheGetDirPath( const char *psz_title, const char *psz_artist,
if
(
!
EMPTY_STR
(
psz_artist
)
&&
!
EMPTY_STR
(
psz_album
)
)
{
char
*
psz_album_sanitized
=
filename_sanitize
(
psz_album
);
char
*
psz_artist_sanitized
=
filename_sanitize
(
psz_artist
);
char
*
psz_album_sanitized
=
strdup
(
psz_album
);
filename_sanitize
(
psz_album_sanitized
);
char
*
psz_artist_sanitized
=
strdup
(
psz_artist
);
filename_sanitize
(
psz_artist_sanitized
);
if
(
asprintf
(
&
psz_dir
,
"%s"
DIR_SEP
"art"
DIR_SEP
"artistalbum"
DIR_SEP
"%s"
DIR_SEP
"%s"
,
psz_cachedir
,
psz_artist_sanitized
,
psz_album_sanitized
)
==
-
1
)
...
...
@@ -82,7 +84,8 @@ static char* ArtCacheGetDirPath( const char *psz_title, const char *psz_artist,
}
else
{
char
*
psz_title_sanitized
=
filename_sanitize
(
psz_title
);
char
*
psz_title_sanitized
=
strdup
(
psz_title
);
filename_sanitize
(
psz_title_sanitized
);
if
(
asprintf
(
&
psz_dir
,
"%s"
DIR_SEP
"art"
DIR_SEP
"title"
DIR_SEP
"%s"
,
psz_cachedir
,
psz_title_sanitized
)
==
-
1
)
psz_dir
=
NULL
;
...
...
@@ -131,7 +134,8 @@ static char *ArtCacheName( input_item_t *p_item, const char *psz_type )
ArtCacheCreateDir
(
psz_path
);
char
*
psz_ext
=
filename_sanitize
(
psz_type
?
psz_type
:
""
);
char
*
psz_ext
=
strdup
(
psz_type
?
psz_type
:
""
);
filename_sanitize
(
psz_ext
);
char
*
psz_filename
;
if
(
asprintf
(
&
psz_filename
,
"%s"
DIR_SEP
"art%s"
,
psz_path
,
psz_ext
)
<
0
)
psz_filename
=
NULL
;
...
...
src/text/strings.c
View file @
7e6968ae
...
...
@@ -962,10 +962,8 @@ char *str_format( vlc_object_t *p_this, const char *psz_src )
/**
* Remove forbidden characters from filenames (including slashes)
*/
char
*
filename_sanitize
(
const
char
*
str_origin
)
void
filename_sanitize
(
char
*
str
)
{
char
*
str
=
strdup
(
str_origin
);
char
*
str_base
=
str
;
if
(
*
str
==
'.'
&&
(
str
[
1
]
==
'\0'
||
(
str
[
1
]
==
'.'
&&
str
[
2
]
==
'\0'
)
)
)
{
while
(
*
str
)
...
...
@@ -973,7 +971,7 @@ char* filename_sanitize( const char *str_origin )
*
str
=
'_'
;
str
++
;
}
return
str_base
;
return
;
}
#if defined( WIN32 )
...
...
@@ -1014,8 +1012,6 @@ char* filename_sanitize( const char *str_origin )
*
str
--
=
'_'
;
}
#endif
return
str_base
;
}
/**
...
...
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