summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2009-08-09 12:45:36 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2009-08-09 12:45:36 +0200
commit23b5b1336dbabcf3b79889d39906de24712f8066 (patch)
tree6a4243a6dbc5d585a9f45673e7e6be95e8c25733
parentc5910f79873651559f0e30a77419ddc30e044c0d (diff)
downloadvdr-23b5b1336dbabcf3b79889d39906de24712f8066.tar.gz
vdr-23b5b1336dbabcf3b79889d39906de24712f8066.tar.bz2
Fixed handling file name length on VFAT systems in case they contain UTF-8 characters
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY4
-rw-r--r--timers.c18
3 files changed, 19 insertions, 5 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 350f8a2c..dfa7a356 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -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
diff --git a/HISTORY b/HISTORY
index 7d3c59c9..b70ab127 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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).
diff --git a/timers.c b/timers.c
index 191c0312..a684bb4a 100644
--- a/timers.c
+++ b/timers.c
@@ -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));