[vlc-commits] Remove path_sanitize()
Rémi Denis-Courmont
git at videolan.org
Tue May 17 19:58:30 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue May 17 20:36:37 2016 +0300| [cc19824746e463228a3a4b9c997c060d0e720da0] | committer: Rémi Denis-Courmont
Remove path_sanitize()
That function was a failed attempt at protection against special path
characters within formatted meta-data. It is no longer used for that
purpose, but only for formatting time. It is not difficult to avoid
special characters when formatting time, rendering the function
essentially a useless no-op.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc19824746e463228a3a4b9c997c060d0e720da0
---
include/vlc_strings.h | 31 -------------------------------
modules/access_output/file.c | 1 -
modules/access_output/livehttp.c | 10 +++-------
modules/video_filter/scene.c | 2 --
4 files changed, 3 insertions(+), 41 deletions(-)
diff --git a/include/vlc_strings.h b/include/vlc_strings.h
index 1705e4d..0c1c6b7 100644
--- a/include/vlc_strings.h
+++ b/include/vlc_strings.h
@@ -137,37 +137,6 @@ static inline char *str_format( input_thread_t *input, const char *fmt )
void filename_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
-}
-
-/**
* @}
*/
diff --git a/modules/access_output/file.c b/modules/access_output/file.c
index 1b6ea52..d797a1a 100644
--- a/modules/access_output/file.c
+++ b/modules/access_output/file.c
@@ -293,7 +293,6 @@ static int Open( vlc_object_t *p_this )
if (var_InheritBool (p_access, SOUT_CFG_PREFIX"format"))
{
buf = str_format_time (path);
- path_sanitize (buf);
path = buf;
}
diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c
index d0f2ea7..86d1604 100644
--- a/modules/access_output/livehttp.c
+++ b/modules/access_output/livehttp.c
@@ -264,7 +264,6 @@ static int Open( vlc_object_t *p_this )
free( p_sys );
return VLC_ENOMEM;
}
- path_sanitize( psz_tmp );
p_sys->psz_indexPath = psz_tmp;
if( p_sys->i_initial_segment != 1 )
vlc_unlink( p_sys->psz_indexPath );
@@ -475,7 +474,7 @@ static int CryptKey( sout_access_out_t *p_access, uint32_t i_segment )
/*****************************************************************************
* formatSegmentPath: create segment path name based on seg #
*****************************************************************************/
-static char *formatSegmentPath( char *psz_path, uint32_t i_seg, bool b_sanitize )
+static char *formatSegmentPath( char *psz_path, uint32_t i_seg )
{
char *psz_result;
char *psz_firstNumSign;
@@ -498,9 +497,6 @@ static char *formatSegmentPath( char *psz_path, uint32_t i_seg, bool b_sanitize
psz_result = psz_newResult;
}
- if ( b_sanitize )
- path_sanitize( psz_result );
-
return psz_result;
}
@@ -865,9 +861,9 @@ static ssize_t openNextFile( sout_access_out_t *p_access, sout_access_out_sys_t
return -1;
segment->i_segment_number = i_newseg;
- segment->psz_filename = formatSegmentPath( p_access->psz_path, i_newseg, true );
+ segment->psz_filename = formatSegmentPath( p_access->psz_path, i_newseg );
char *psz_idxFormat = p_sys->psz_indexUrl ? p_sys->psz_indexUrl : p_access->psz_path;
- segment->psz_uri = formatSegmentPath( psz_idxFormat , i_newseg, false );
+ segment->psz_uri = formatSegmentPath( psz_idxFormat , i_newseg );
if ( unlikely( !segment->psz_filename ) )
{
diff --git a/modules/video_filter/scene.c b/modules/video_filter/scene.c
index 3b8ad6f..10b650b 100644
--- a/modules/video_filter/scene.c
+++ b/modules/video_filter/scene.c
@@ -308,7 +308,6 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic )
msg_Err( p_filter, "could not create snapshot %s", psz_filename );
goto error;
}
- path_sanitize( psz_filename );
i_ret = asprintf( &psz_temp, "%s.swp", psz_filename );
if( i_ret == -1 )
@@ -316,7 +315,6 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic )
msg_Err( p_filter, "could not create snapshot temporarily file %s", psz_temp );
goto error;
}
- path_sanitize( psz_temp );
/* Save the image */
i_ret = image_WriteUrl( p_sys->p_image, p_pic, &fmt_in, &fmt_out,
More information about the vlc-commits
mailing list