1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed handling file name length on VFAT systems in case they contain UTF-8 characters

This commit is contained in:
Klaus Schmidinger 2009-08-09 12:45:36 +02:00
parent c5910f7987
commit 23b5b1336d
3 changed files with 19 additions and 5 deletions

View File

@ -1079,6 +1079,8 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
for adding cThread::SetIOPriority() and using it in cRemoveDeletedRecordingsThread
for suggesting to introduce cDevice::GetOsdSize()
for adding a note about the meaning of PERCENTAGEDELTA in cRingBuffer::UpdatePercentage()
for fixing handling file name length on VFAT systems in case they
contain UTF-8 characters
Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark

View File

@ -6136,7 +6136,7 @@ Video Disk Recorder Revision History
file in a wrong way.
- Fixed variable types in cIndexFile (reported by Udo Richter).
2009-06-21: Version 1.7.9
2009-08-09: Version 1.7.9
- Fixed storing the current OSD size in case the device has
changed it in its setup menu (reported by Reinhard Nissl).
@ -6146,3 +6146,5 @@ Video Disk Recorder Revision History
filtering.
- Fixed deleting expired timers if they have the VPS flag set, but the event they
are assigned to doesn't have a VPS tag.
- Fixed handling file name length on VFAT systems in case they
contain UTF-8 characters (thanks to Rolf Ahrenberg).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 2.2 2009/06/21 14:06:33 kls Exp $
* $Id: timers.c 2.3 2009/08/09 12:43:20 kls Exp $
*/
#include "timers.h"
@ -51,6 +51,11 @@ cTimer::cTimer(bool Instant, bool Pause, cChannel *Channel)
event = NULL;
if (Instant && channel)
snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : channel->Name());
if (VfatFileSystem && (Utf8StrLen(file) > VFAT_MAX_FILENAME)) {
dsyslog("timer file name too long for VFAT file system: '%s'", file);
file[Utf8SymChars(file, VFAT_MAX_FILENAME)] = 0;
dsyslog("timer file name truncated to '%s'", file);
}
}
cTimer::cTimer(const cEvent *Event)
@ -83,6 +88,11 @@ cTimer::cTimer(const cEvent *Event)
const char *Title = Event->Title();
if (!isempty(Title))
Utf8Strn0Cpy(file, Event->Title(), sizeof(file));
if (VfatFileSystem && (Utf8StrLen(file) > VFAT_MAX_FILENAME)) {
dsyslog("timer file name too long for VFAT file system: '%s'", file);
file[Utf8SymChars(file, VFAT_MAX_FILENAME)] = 0;
dsyslog("timer file name truncated to '%s'", file);
}
aux = NULL;
event = NULL; // let SetEvent() be called to get a log message
}
@ -296,13 +306,13 @@ bool cTimer::Parse(const char *s)
p++;
else
p = filebuffer;
if (strlen(p) > VFAT_MAX_FILENAME) {
if (Utf8StrLen(p) > VFAT_MAX_FILENAME) {
dsyslog("timer file name too long for VFAT file system: '%s'", p);
p[VFAT_MAX_FILENAME] = 0;
p[Utf8SymChars(p, VFAT_MAX_FILENAME)] = 0;
dsyslog("timer file name truncated to '%s'", p);
}
}
Utf8Strn0Cpy(file, filebuffer, MaxFileName);
Utf8Strn0Cpy(file, filebuffer, sizeof(file));
strreplace(file, '|', ':');
if (isnumber(channelbuffer))
channel = Channels.GetByNumber(atoi(channelbuffer));