[vlc-devel] commit: filename_sanitize: spaces are forbidden only when beginning and ending. ( Rémi Duraffort )
git version control
git at videolan.org
Sat Apr 4 21:21:04 CEST 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Apr 4 21:20:14 2009 +0200| [7e44fa82ecb750b17360c4a0290590eb4676db67] | committer: Rémi Duraffort
filename_sanitize: spaces are forbidden only when beginning and ending.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e44fa82ecb750b17360c4a0290590eb4676db67
---
src/text/strings.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/src/text/strings.c b/src/text/strings.c
index 3381840..77f175a 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -1034,6 +1034,12 @@ char* filename_sanitize( const char *str_origin )
return str_base;
}
+#if defined( WIN32 )
+ // Change leading spaces into underscores
+ while( *str && *str == ' ' )
+ *str++ = '_';
+#endif
+
while( *str )
{
switch( *str )
@@ -1050,12 +1056,23 @@ char* filename_sanitize( const char *str_origin )
case '|':
case '<':
case '>':
- case ' ':
#endif
*str = '_';
}
str++;
}
+
+#if defined( WIN32 )
+ // Change trailing spaces into underscores
+ str--;
+ while( str != str_base )
+ {
+ if( *str != ' ' )
+ break;
+ *str-- = '_';
+ }
+#endif
+
return str_base;
}
More information about the vlc-devel
mailing list