From ed643353b100bee75459c4ef2d0330e7a04e1f2a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 16 Aug 2002 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.1.7=20-=20Adapted=20VDR=20to=20the=20NEWSTR?= =?UTF-8?q?UCT=20driver.=20To=20use=20the=20new=20driver,=20compile=20VDR?= =?UTF-8?q?=20with=20=20=20'make=20NEWSTRUCT=3D1'=20(thanks=20to=20Holger?= =?UTF-8?q?=20W=C3=A4chtler=20for=20some=20valuable=20advice).=20=20=20By?= =?UTF-8?q?=20default=20it=20currently=20still=20uses=20the=20old=20driver?= =?UTF-8?q?.=20-=20Added=20some=20missing=20#includes=20(thanks=20to=20Mar?= =?UTF-8?q?tin=20Hammerschmid).=20-=20Changed=20the=20log=20error=20messag?= =?UTF-8?q?e=20"can't=20record=20MPEG1!"=20to=20"error=20in=20data=20strea?= =?UTF-8?q?m!",=20=20=20since=20the=20mentioning=20of=20MPEG1=20has=20irri?= =?UTF-8?q?tated=20many=20people.=20-=20Consistently=20using=20malloc/free?= =?UTF-8?q?=20and=20new/delete=20(thanks=20to=20Andreas=20Schultz).=20-=20?= =?UTF-8?q?Temporarily=20made=20cDevice::ProvidesCa()=20virtual=20(Andreas?= =?UTF-8?q?=20Schultz=20needs=20this=20=20=20in=20his=20DXR3=20plugin).=20?= =?UTF-8?q?-=20cDevice=20no=20longer=20exposes=20a=20file=20handle=20to=20?= =?UTF-8?q?cPlayer.=20A=20derived=20cPlayer=20class=20=20=20can=20now=20ca?= =?UTF-8?q?ll=20DevicePoll()=20to=20see=20whether=20the=20replay=20device?= =?UTF-8?q?=20is=20ready=20for=20=20=20further=20data.=20A=20derived=20cDe?= =?UTF-8?q?vice=20class=20must=20implement=20Poll()=20and=20shall=20=20=20?= =?UTF-8?q?check=20if=20any=20of=20its=20file=20handles=20is=20ready=20for?= =?UTF-8?q?=20data.=20-=20Implemented=20several=20replay=20modes=20to=20al?= =?UTF-8?q?low=20players=20that=20play=20only=20audio=20(thanks=20=20=20to?= =?UTF-8?q?=20Stefan=20Huelswitt).=20-=20Improved=20cCondVar::Wait()=20and?= =?UTF-8?q?=20implemented=20cCondVar::TimedWait()=20(thanks=20to=20=20=20S?= =?UTF-8?q?tefan=20Huelswitt).=20-=20VDR=20no=20longer=20gives=20up=20if?= =?UTF-8?q?=20there=20is=20no=20DVB=20device.=20It=20continues=20to=20work?= =?UTF-8?q?=20if=20=20=20there=20is=20at=20least=20one=20device,=20either?= =?UTF-8?q?=20a=20DVB=20device=20found=20by=20the=20core=20VDR=20code=20?= =?UTF-8?q?=20=20itself,=20or=20a=20device=20implemented=20by=20a=20plugin?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- recording.c | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'recording.c') diff --git a/recording.c b/recording.c index afa0e7f..be91540 100644 --- a/recording.c +++ b/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.65 2002/07/27 12:55:14 kls Exp $ + * $Id: recording.c 1.66 2002/08/11 11:48:11 kls Exp $ */ #include "recording.h" @@ -148,7 +148,7 @@ void AssertFreeDiskSpace(int Priority) cResumeFile::cResumeFile(const char *FileName) { - fileName = new char[strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1]; + fileName = MALLOC(char, strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1); if (fileName) { strcpy(fileName, FileName); strcat(fileName, RESUMEFILESUFFIX); @@ -159,7 +159,7 @@ cResumeFile::cResumeFile(const char *FileName) cResumeFile::~cResumeFile() { - delete fileName; + free(fileName); } int cResumeFile::Read(void) @@ -375,7 +375,7 @@ cRecording::cRecording(const char *FileName) struct stat buf; if (fstat(f, &buf) == 0) { int size = buf.st_size; - summary = new char[size + 1]; // +1 for terminating 0 + summary = MALLOC(char, size + 1); // +1 for terminating 0 if (summary) { int rbytes = safe_read(f, summary, size); if (rbytes >= 0) { @@ -385,7 +385,7 @@ cRecording::cRecording(const char *FileName) } else { LOG_ERROR_STR(SummaryFileName); - delete summary; + free(summary); summary = NULL; } @@ -399,17 +399,17 @@ cRecording::cRecording(const char *FileName) } else if (errno != ENOENT) LOG_ERROR_STR(SummaryFileName); - delete SummaryFileName; + free(SummaryFileName); } } cRecording::~cRecording() { - delete titleBuffer; - delete sortBuffer; - delete fileName; - delete name; - delete summary; + free(titleBuffer); + free(sortBuffer); + free(fileName); + free(name); + free(summary); } char *cRecording::StripEpisodeName(char *s) @@ -437,9 +437,9 @@ char *cRecording::SortName(void) if (!sortBuffer) { char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory) + 1)); int l = strxfrm(NULL, s, 0); - sortBuffer = new char[l]; + sortBuffer = MALLOC(char, l); strxfrm(sortBuffer, s, l); - delete s; + free(s); } return sortBuffer; } @@ -474,7 +474,7 @@ const char *cRecording::FileName(void) const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level) { char New = NewIndicator && IsNew() ? '*' : ' '; - delete titleBuffer; + free(titleBuffer); titleBuffer = NULL; if (Level < 0 || Level == HierarchyLevels()) { struct tm tm_r; @@ -524,7 +524,7 @@ const char *cRecording::PrefixFileName(char Prefix) { const char *p = PrefixVideoFileName(FileName(), Prefix); if (p) { - delete fileName; + free(fileName); fileName = strdup(p); return fileName; } @@ -555,7 +555,7 @@ bool cRecording::WriteSummary(void) } else LOG_ERROR_STR(SummaryFileName); - delete SummaryFileName; + free(SummaryFileName); } return true; } @@ -575,7 +575,7 @@ bool cRecording::Delete(void) isyslog("deleting recording %s", FileName()); result = RenameVideoFile(FileName(), NewName); } - delete NewName; + free(NewName); return result; } @@ -614,7 +614,7 @@ bool cRecordings::Load(bool Deleted) } else Interface->Error("Error while opening pipe!"); - delete cmd; + free(cmd); return result; } @@ -639,19 +639,19 @@ cMark::cMark(int Position, const char *Comment) cMark::~cMark() { - delete comment; + free(comment); } const char *cMark::ToText(void) { - delete buffer; + free(buffer); asprintf(&buffer, "%s%s%s\n", IndexToHMSF(position, true), comment ? " " : "", comment ? comment : ""); return buffer; } bool cMark::Parse(const char *s) { - delete comment; + free(comment); comment = NULL; position = HMSFToIndex(s); const char *p = strchr(s, ' '); @@ -742,7 +742,7 @@ void cRecordingUserCommand::InvokeCommand(const char *State, const char *Recordi asprintf(&cmd, "%s %s \"%s\"", command, State, strescape(RecordingFileName, "\"$")); isyslog("executing '%s'", cmd); SystemExec(cmd); - delete cmd; + free(cmd); } } @@ -782,13 +782,13 @@ cIndexFile::cIndexFile(const char *FileName, bool Record) last = (buf.st_size + delta) / sizeof(tIndex) - 1; if (!Record && last >= 0) { size = last + 1; - index = new tIndex[size]; + index = MALLOC(tIndex, size); if (index) { f = open(fileName, O_RDONLY); if (f >= 0) { if ((int)safe_read(f, index, buf.st_size) != buf.st_size) { esyslog("ERROR: can't read from file '%s'", fileName); - delete index; + free(index); index = NULL; close(f); f = -1; @@ -828,8 +828,8 @@ cIndexFile::~cIndexFile() { if (f >= 0) close(f); - delete fileName; - delete index; + free(fileName); + free(index); } bool cIndexFile::CatchUp(int Index) @@ -852,7 +852,7 @@ bool cIndexFile::CatchUp(int Index) if (lseek(f, offset, SEEK_SET) == offset) { if (safe_read(f, &index[last + 1], delta) != delta) { esyslog("ERROR: can't read from index"); - delete index; + free(index); index = NULL; close(f); f = -1; @@ -999,7 +999,7 @@ cFileName::cFileName(const char *FileName, bool Record, bool Blocking) cFileName::~cFileName() { Close(); - delete fileName; + free(fileName); } int cFileName::Open(void) -- cgit v1.2.3