summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-08-11 13:32:23 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2002-08-11 13:32:23 +0200
commit9a1a16f3d42b2f48b26eb3daef3a195fc0f2a13e (patch)
tree7d7d8667832651e37cd8de53296d0bcd32dba085 /menu.c
parentb9c4cb0ec9c417c483be2a40cd66f839b063015f (diff)
downloadvdr-9a1a16f3d42b2f48b26eb3daef3a195fc0f2a13e.tar.gz
vdr-9a1a16f3d42b2f48b26eb3daef3a195fc0f2a13e.tar.bz2
Consistently using malloc/free and new/delete
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/menu.c b/menu.c
index bb253859..7a2e0ea6 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.204 2002/08/11 11:50:20 kls Exp $
*/
#include "menu.h"
@@ -936,7 +936,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 +1040,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 +1173,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 +1191,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
for (int a = 0; a < numreal; a++)
Add(new cMenuScheduleItem(pArray[a]));
- delete pArray;
+ free(pArray);
}
}
}
@@ -1306,8 +1306,8 @@ cMenuRecordingItem::cMenuRecordingItem(cRecording *Recording, int Level)
cMenuRecordingItem::~cMenuRecordingItem()
{
- delete fileName;
- delete name;
+ free(fileName);
+ free(name);
}
void cMenuRecordingItem::IncrementCounter(bool New)
@@ -1344,7 +1344,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 +1357,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 +1370,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
cMenuRecordings::~cMenuRecordings()
{
helpKeys = -1;
- delete base;
+ free(base);
}
void cMenuRecordings::SetHelpKeys(void)
@@ -1417,7 +1417,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 +1766,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 +1901,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 +2013,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 +2021,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 +2452,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 +2701,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 +2715,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;
}
}