mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Modified handling invalid characters in VFAT mode
This commit is contained in:
parent
61dd9815ae
commit
4011e244ff
3
HISTORY
3
HISTORY
@ -5230,7 +5230,7 @@ Video Disk Recorder Revision History
|
||||
- Changes to the OSD settings in the "Setup/OSD" menu now immediately take effect
|
||||
when the "Ok" key is pressed.
|
||||
|
||||
2007-06-15: Version 1.5.4
|
||||
2007-06-16: Version 1.5.4
|
||||
|
||||
- Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3).
|
||||
- Fixed a crash in i18n character set conversion (thanks to Alexander Riedel,
|
||||
@ -5239,3 +5239,4 @@ Video Disk Recorder Revision History
|
||||
- Using nl_langinfo(CODESET) to determine the local codeset to use (thanks to
|
||||
Thomas Günther). The codeset names in 'libsi/si.c' have been changed to the
|
||||
canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out).
|
||||
- Modified handling invalid characters in VFAT mode.
|
||||
|
28
recording.c
28
recording.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: recording.c 1.151 2006/10/07 12:46:22 kls Exp $
|
||||
* $Id: recording.c 1.152 2007/06/16 08:57:22 kls Exp $
|
||||
*/
|
||||
|
||||
#include "recording.h"
|
||||
@ -406,34 +406,14 @@ char *ExchangeChars(char *s, bool ToFileSystem)
|
||||
// The VFAT file system can't handle all characters, so we
|
||||
// have to take extra efforts to encode/decode them:
|
||||
if (ToFileSystem) {
|
||||
const char *InvalidChars = "\"\\/:*?|<>#";
|
||||
switch (*p) {
|
||||
// characters that can be used "as is":
|
||||
case '!':
|
||||
case '@':
|
||||
case '$':
|
||||
case '%':
|
||||
case '&':
|
||||
case '(':
|
||||
case ')':
|
||||
case '+':
|
||||
case ',':
|
||||
case '-':
|
||||
case ';':
|
||||
case '=':
|
||||
case '0' ... '9':
|
||||
case 'a' ... 'z':
|
||||
case 'A' ... 'Z':
|
||||
case 'ä': case 'Ä':
|
||||
case 'ö': case 'Ö':
|
||||
case 'ü': case 'Ü':
|
||||
case 'ß':
|
||||
break;
|
||||
// characters that can be mapped to other characters:
|
||||
case ' ': *p = '_'; break;
|
||||
case '~': *p = '/'; break;
|
||||
// characters that have to be encoded:
|
||||
default:
|
||||
if (*p != '.' || !*(p + 1) || *(p + 1) == '~') { // Windows can't handle '.' at the end of directory names
|
||||
if (strchr(InvalidChars, *p) || *p == '.' && (!*(p + 1) || *(p + 1) == '~')) { // Windows can't handle '.' at the end of file/directory names
|
||||
int l = p - s;
|
||||
s = (char *)realloc(s, strlen(s) + 10);
|
||||
p = s + l;
|
||||
@ -450,7 +430,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
|
||||
// mapped characters:
|
||||
case '_': *p = ' '; break;
|
||||
case '/': *p = '~'; break;
|
||||
// encodes characters:
|
||||
// encoded characters:
|
||||
case '#': {
|
||||
if (strlen(p) > 2) {
|
||||
char buf[3];
|
||||
|
Loading…
Reference in New Issue
Block a user