1
0
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:
Klaus Schmidinger 2007-06-16 08:59:39 +02:00
parent 61dd9815ae
commit 4011e244ff
2 changed files with 6 additions and 25 deletions

View File

@ -5230,7 +5230,7 @@ Video Disk Recorder Revision History
- Changes to the OSD settings in the "Setup/OSD" menu now immediately take effect - Changes to the OSD settings in the "Setup/OSD" menu now immediately take effect
when the "Ok" key is pressed. 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). - 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, - 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 - 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 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). canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out).
- Modified handling invalid characters in VFAT mode.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "recording.h"
@ -406,34 +406,14 @@ char *ExchangeChars(char *s, bool ToFileSystem)
// The VFAT file system can't handle all characters, so we // The VFAT file system can't handle all characters, so we
// have to take extra efforts to encode/decode them: // have to take extra efforts to encode/decode them:
if (ToFileSystem) { if (ToFileSystem) {
const char *InvalidChars = "\"\\/:*?|<>#";
switch (*p) { 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: // characters that can be mapped to other characters:
case ' ': *p = '_'; break; case ' ': *p = '_'; break;
case '~': *p = '/'; break; case '~': *p = '/'; break;
// characters that have to be encoded: // characters that have to be encoded:
default: 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; int l = p - s;
s = (char *)realloc(s, strlen(s) + 10); s = (char *)realloc(s, strlen(s) + 10);
p = s + l; p = s + l;
@ -450,7 +430,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
// mapped characters: // mapped characters:
case '_': *p = ' '; break; case '_': *p = ' '; break;
case '/': *p = '~'; break; case '/': *p = '~'; break;
// encodes characters: // encoded characters:
case '#': { case '#': {
if (strlen(p) > 2) { if (strlen(p) > 2) {
char buf[3]; char buf[3];