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 --- menu.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index bb25385..5b56b3a 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.203 2002/08/03 09:55:44 kls Exp $ + * $Id: menu.c 1.205 2002/08/15 11:28:08 kls Exp $ */ #include "menu.h" @@ -32,8 +32,6 @@ #define CHNUMWIDTH (Channels.Count() > 999 ? 5 : 4) // there are people with more than 999 channels... -const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~"; - // --- cMenuEditChanItem ----------------------------------------------------- class cMenuEditChanItem : public cMenuEditIntItem { @@ -936,7 +934,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch) char *buffer; asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString()); SetTitle(buffer, false); - delete buffer; + free(buffer); int Line = 2; cMenuTextItem *item; const char *Title = eventInfo->GetTitle(); @@ -1040,7 +1038,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha Add(new cMenuWhatsOnItem(pArray[a]), pArray[a]->GetChannelNumber() == CurrentChannelNr); currentChannel = CurrentChannelNr; - delete pArray; + free(pArray); SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch")); } @@ -1173,11 +1171,11 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel) char *buffer = NULL; asprintf(&buffer, tr("Schedule - %s"), Channel->name); SetTitle(buffer); - delete buffer; + free(buffer); if (schedules) { const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule(); int num = Schedule->NumEvents(); - const cEventInfo **pArray = (const cEventInfo **)malloc(num * sizeof(cEventInfo *)); + const cEventInfo **pArray = MALLOC(const cEventInfo *, num); if (pArray) { time_t now = time(NULL); int numreal = 0; @@ -1191,7 +1189,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel) for (int a = 0; a < numreal; a++) Add(new cMenuScheduleItem(pArray[a])); - delete pArray; + free(pArray); } } } @@ -1306,8 +1304,8 @@ cMenuRecordingItem::cMenuRecordingItem(cRecording *Recording, int Level) cMenuRecordingItem::~cMenuRecordingItem() { - delete fileName; - delete name; + free(fileName); + free(name); } void cMenuRecordingItem::IncrementCounter(bool New) @@ -1344,7 +1342,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) { Add(Item); LastItem = Item; - delete LastItemText; + free(LastItemText); LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters! } else @@ -1357,7 +1355,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) } } } - delete LastItemText; + free(LastItemText); if (Current() < 0) SetCurrent(First()); else if (OpenSubMenus && Open(true)) @@ -1370,7 +1368,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) cMenuRecordings::~cMenuRecordings() { helpKeys = -1; - delete base; + free(base); } void cMenuRecordings::SetHelpKeys(void) @@ -1417,7 +1415,7 @@ bool cMenuRecordings::Open(bool OpenSubMenus) t = buffer; } AddSubMenu(new cMenuRecordings(t, level + 1, OpenSubMenus)); - delete buffer; + free(buffer); return true; } return false; @@ -1766,7 +1764,7 @@ cMenuSetupPlugins::cMenuSetupPlugins(void) char *buffer = NULL; asprintf(&buffer, "%s (%s) - %s", p->Name(), p->Version(), p->Description()); Add(new cMenuSetupPluginItem(hk(buffer), i)); - delete buffer; + free(buffer); } else break; @@ -1901,7 +1899,7 @@ eOSState cMenuCommands::Execute(void) asprintf(&buffer, "%s...", command->Title()); Interface->Status(buffer); Interface->Flush(); - delete buffer; + free(buffer); const char *Result = command->Execute(); if (Result) return AddSubMenu(new cMenuText(command->Title(), Result, fontFix)); @@ -2013,7 +2011,7 @@ void cMenuMain::Set(void) char *buffer = NULL; asprintf(&buffer, "%s%s", STOP_RECORDING, ON_PRIMARY_INTERFACE); Add(new cOsdItem(buffer, osStopRecord)); - delete buffer; + free(buffer); } const char *s = NULL; @@ -2021,7 +2019,7 @@ void cMenuMain::Set(void) char *buffer = NULL; asprintf(&buffer, "%s%s", STOP_RECORDING, s); Add(new cOsdItem(buffer, osStopRecord)); - delete buffer; + free(buffer); } // Editing control: @@ -2452,8 +2450,8 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer) cRecordControl::~cRecordControl() { Stop(true); - delete instantId; - delete fileName; + free(instantId); + free(fileName); } #define INSTANT_REC_EPG_LOOKAHEAD 300 // seconds to look into the EPG data for an instant recording @@ -2701,8 +2699,8 @@ cReplayControl::~cReplayControl() void cReplayControl::SetRecording(const char *FileName, const char *Title) { - delete fileName; - delete title; + free(fileName); + free(title); fileName = FileName ? strdup(FileName) : NULL; title = Title ? strdup(Title) : NULL; } @@ -2715,7 +2713,7 @@ const char *cReplayControl::LastReplayed(void) void cReplayControl::ClearLastReplayed(const char *FileName) { if (fileName && FileName && strcmp(fileName, FileName) == 0) { - delete fileName; + free(fileName); fileName = NULL; } } -- cgit v1.2.3