mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Limiting the length of the recording name in timers in case VDR is run with --vfat (replaces the previous change to svdrp.c)
This commit is contained in:
parent
9495aa9923
commit
a81e3699d1
6
HISTORY
6
HISTORY
@ -5613,9 +5613,9 @@ Video Disk Recorder Revision History
|
||||
- Fixed detecting directories in cFileNameList::Load().
|
||||
- Running the thread that removes deleted recordings at a low priority to (maybe)
|
||||
avoid stuttering replay in case the thread is run during replay.
|
||||
- Limiting the length of the recording name in timers created via SVDRP in case VDR
|
||||
is run with --vfat, in order to avoid names that are too long for Windows
|
||||
(suggested by Rolf Ahrenberg).
|
||||
- Limiting the length of the recording name in timers in case VDR is run with
|
||||
--vfat, in order to avoid names that are too long for Windows (suggested by Rolf
|
||||
Ahrenberg).
|
||||
- Using cString::sprintf() instead of asprintf() (thanks to Wolfgang Rohdewald
|
||||
for pointing out a possible problem if the return value is not checked).
|
||||
Plugin authors may want to consider doing the same. For convenience there is now
|
||||
|
25
svdrp.c
25
svdrp.c
@ -10,7 +10,7 @@
|
||||
* and interact with the Video Disk Recorder - or write a full featured
|
||||
* graphical interface that sits on top of an SVDRP connection.
|
||||
*
|
||||
* $Id: svdrp.c 1.107 2008/02/15 14:48:59 kls Exp $
|
||||
* $Id: svdrp.c 1.108 2008/02/15 15:10:49 kls Exp $
|
||||
*/
|
||||
|
||||
#include "svdrp.h"
|
||||
@ -40,8 +40,6 @@
|
||||
#include "tools.h"
|
||||
#include "videodir.h"
|
||||
|
||||
#define VFAT_MAX_FILENAME 40 // same as MAX_SUBTITLE_LENGTH in recording.c
|
||||
|
||||
// --- cSocket ---------------------------------------------------------------
|
||||
|
||||
cSocket::cSocket(int Port, int Queue)
|
||||
@ -1177,16 +1175,6 @@ void cSVDRP::CmdMODT(const char *Option)
|
||||
Reply(501, "Error in timer settings");
|
||||
return;
|
||||
}
|
||||
else if (VfatFileSystem) {
|
||||
const char *FileName = timer->File();
|
||||
const char *p = strrchr(FileName, '~');
|
||||
if (!p)
|
||||
p = FileName;
|
||||
if (strlen(p) > VFAT_MAX_FILENAME) {
|
||||
Reply(501, "File name too long for VFAT file system");
|
||||
return;
|
||||
}
|
||||
}
|
||||
*timer = t;
|
||||
Timers.SetModified();
|
||||
isyslog("timer %s modified (%s)", *timer->ToDescr(), timer->HasFlags(tfActive) ? "active" : "inactive");
|
||||
@ -1293,17 +1281,6 @@ void cSVDRP::CmdNEWT(const char *Option)
|
||||
if (*Option) {
|
||||
cTimer *timer = new cTimer;
|
||||
if (timer->Parse(Option)) {
|
||||
if (VfatFileSystem) {
|
||||
const char *FileName = timer->File();
|
||||
const char *p = strrchr(FileName, '~');
|
||||
if (!p)
|
||||
p = FileName;
|
||||
if (strlen(p) > VFAT_MAX_FILENAME) {
|
||||
Reply(501, "File name too long for VFAT file system");
|
||||
delete timer;
|
||||
return;
|
||||
}
|
||||
}
|
||||
cTimer *t = Timers.GetTimer(timer);
|
||||
if (!t) {
|
||||
Timers.Add(timer);
|
||||
|
17
timers.c
17
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 1.71 2008/02/10 16:26:25 kls Exp $
|
||||
* $Id: timers.c 1.72 2008/02/15 15:36:59 kls Exp $
|
||||
*/
|
||||
|
||||
#include "timers.h"
|
||||
@ -13,8 +13,11 @@
|
||||
#include "device.h"
|
||||
#include "i18n.h"
|
||||
#include "libsi/si.h"
|
||||
#include "recording.h"
|
||||
#include "remote.h"
|
||||
|
||||
#define VFAT_MAX_FILENAME 40 // same as MAX_SUBTITLE_LENGTH in recording.c
|
||||
|
||||
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
|
||||
// format characters in order to allow any number of blanks after a numeric
|
||||
// value!
|
||||
@ -285,6 +288,18 @@ bool cTimer::Parse(const char *s)
|
||||
}
|
||||
//TODO add more plausibility checks
|
||||
result = ParseDay(daybuffer, day, weekdays);
|
||||
if (VfatFileSystem) {
|
||||
char *p = strrchr(filebuffer, '~');
|
||||
if (p)
|
||||
p++;
|
||||
else
|
||||
p = filebuffer;
|
||||
if (strlen(p) > VFAT_MAX_FILENAME) {
|
||||
dsyslog("timer file name too long for VFAT file system: '%s'", p);
|
||||
p[VFAT_MAX_FILENAME] = 0;
|
||||
dsyslog("timer file name truncated to '%s'", p);
|
||||
}
|
||||
}
|
||||
Utf8Strn0Cpy(file, filebuffer, MaxFileName);
|
||||
strreplace(file, '|', ':');
|
||||
if (isnumber(channelbuffer))
|
||||
|
Loading…
Reference in New Issue
Block a user