From acc0eb1627126014f0cf0861348cf456d329577b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 22 Oct 2011 20:40:19 +0300 Subject: Convert some uses of assignments to initializer lists in constructors. --- display.c | 7 ++----- displaybase.c | 27 +++++++-------------------- menu.c | 51 +++++++++++++++++++-------------------------------- osdteletext.c | 5 +---- txtrecv.c | 15 +++++++-------- txtrender.c | 12 +++++------- 6 files changed, 41 insertions(+), 76 deletions(-) diff --git a/display.c b/display.c index c9ac59f..8d6b49c 100644 --- a/display.c +++ b/display.c @@ -176,11 +176,8 @@ cDisplay4BPP::cDisplay4BPP(int x0, int y0, int width, int height) cDisplay4BPPHalf::cDisplay4BPPHalf(int x0, int y0, int width, int height, bool upper) - : cDisplay(width,height) { - - OsdX0=x0; - OsdY0=y0; - Upper=upper; + : cDisplay(width,height), Upper(upper), OsdX0(x0), OsdY0(y0) +{ osd=NULL; // Redirect all real init work to method diff --git a/displaybase.c b/displaybase.c index 0e82834..537835d 100644 --- a/displaybase.c +++ b/displaybase.c @@ -19,26 +19,13 @@ #include "txtfont.h" -cDisplay::cDisplay(int width, int height) { - Concealed=false; - Blinked=false; - FlushLock=0; - Zoom=Zoom_Off; - osd=NULL; - ScaleX=1; - ScaleY=1; - OffsetX=0; - OffsetY=0; - Width=width; - Height=height; - Background=clrGray50; - Boxed=false; - - MessageX=0; - MessageY=0; - MessageW=0; - MessageH=0; - MessageFont=cFont::GetFont(fontSml); +cDisplay::cDisplay(int width, int height) + : Zoom(Zoom_Off), Concealed(false), Blinked(false), FlushLock(0), + Boxed(false), Width(width), Height(height), Background(clrGray50), + osd(NULL), ScaleX(1), ScaleY(1), OffsetX(0), OffsetY(0), + MessageFont(cFont::GetFont(fontSml)), MessageX(0), MessageY(0), + MessageW(0), MessageH(0) +{ } cDisplay::~cDisplay() { diff --git a/menu.c b/menu.c index 3718060..72504b9 100644 --- a/menu.c +++ b/menu.c @@ -43,23 +43,16 @@ int TeletextBrowser::currentChannelNumber=0; TeletextBrowser* TeletextBrowser::self=0; -TeletextBrowser::TeletextBrowser(cTxtStatus *txtSt,Storage *s) { - storage = s; - cursorPos=0; - pageFound=true; - selectingChannel=false; - needClearMessage=false; - selectingChannelNumber=-1; +TeletextBrowser::TeletextBrowser(cTxtStatus *txtSt,Storage *s) + : cursorPos(0), pageFound(true), selectingChannel(false), + needClearMessage(false), selectingChannelNumber(-1), txtStatus(txtSt), + suspendedReceiving(false), previousPage(currentPage), + previousSubPage(currentSubPage), pageBeforeNumberInput(currentPage), + lastActivity(time(NULL)), inactivityTimeout(-1), storage(s) +{ self=this; - txtStatus=txtSt; //if (txtStatus) // txtStatus->ForceReceiving(true); - suspendedReceiving=false; - previousPage=currentPage; - previousSubPage=currentSubPage; - pageBeforeNumberInput=currentPage; - lastActivity=time(NULL); - inactivityTimeout=-1; } @@ -639,30 +632,24 @@ void TeletextBrowser::UpdateClock() { TeletextSetup ttSetup; -TeletextSetup::TeletextSetup() { +TeletextSetup::TeletextSetup() //Set default values for setup options - - configuredClrBackground=clrGray50; - + : configuredClrBackground(clrGray50), showClock(true), + suspendReceiving(false), autoUpdatePage(true), + //OSDHeight+width default values given in Start() + OSDHAlign(50), OSDVAlign(50), + //use the value set for VDR's min user inactivity. + //Initially this value could be changed via the plugin's setup, but I removed that + //because there is no advantage, but a possible problem when VDR's value is change + //after the plugin has stored its own value. + inactivityTimeout(Setup.MinUserInactivity), + HideMainMenu(false) +{ //init key bindings for (int i=0;i<10;i++) mapKeyToAction[0]=(eTeletextAction)0; mapKeyToAction[3]=Zoom; mapKeyToAction[2]=HalfPage; mapKeyToAction[0]=SwitchChannel; - - showClock=true; - suspendReceiving=false; - autoUpdatePage=true; - HideMainMenu=false; - //OSDHeight+width default values given in Start() - OSDHAlign=50; - OSDVAlign=50; - - //use the value set for VDR's min user inactivity. - //Initially this value could be changed via the plugin's setup, but I removed that - //because there is no advantage, but a possible problem when VDR's value is change - //after the plugin has stored its own value. - inactivityTimeout=Setup.MinUserInactivity; } diff --git a/osdteletext.c b/osdteletext.c index 642b9eb..df83018 100644 --- a/osdteletext.c +++ b/osdteletext.c @@ -101,14 +101,11 @@ protected: cPluginTeletextosd::cPluginTeletextosd(void) + : txtStatus(0), startReceiver(true), storage(NULL), maxStorage(-1) { // Initialize any member variables here. // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! - txtStatus=0; - startReceiver=true; - storage = NULL; - maxStorage=-1; } cPluginTeletextosd::~cPluginTeletextosd() diff --git a/txtrecv.c b/txtrecv.c index c6df703..a3448be 100644 --- a/txtrecv.c +++ b/txtrecv.c @@ -100,9 +100,9 @@ int Storage::cleanSubDir(const char *dir) { return bytesDeleted; } -Storage::Storage() { - byteCount=0; - failedFreeSpace=false; +Storage::Storage() + : byteCount(0), failedFreeSpace(false) +{ } Storage::~Storage() { @@ -179,9 +179,9 @@ void Storage::prepareDirectory(tChannelID chan) { #define TELETEXT_PAGESIZE 972 -LegacyStorage::LegacyStorage(int maxMB) { - fsBlockSize=1; - pageBytes=TELETEXT_PAGESIZE; +LegacyStorage::LegacyStorage(int maxMB) + : fsBlockSize(1), pageBytes(TELETEXT_PAGESIZE) +{ initMaxStorage(maxMB); } @@ -473,9 +473,8 @@ bool cTelePage::IsTopTextPage() } cTxtStatus::cTxtStatus(bool storeTopText, Storage* storage) - :storeTopText(storeTopText), storage(storage) + : receiver(NULL), storeTopText(storeTopText), storage(storage) { - receiver = NULL; } cTxtStatus::~cTxtStatus() diff --git a/txtrender.c b/txtrender.c index f4b27e6..ea41077 100644 --- a/txtrender.c +++ b/txtrender.c @@ -219,13 +219,11 @@ inline enumCharsets GetG2Charset(int codepage) { } -cRenderPage::cRenderPage() { - Dirty=false; - DirtyAll=false; - - // Todo: make this configurable - FirstG0CodePage=0; - SecondG0CodePage=0; +cRenderPage::cRenderPage() + : Dirty(false), DirtyAll(false), + // Todo: make this configurable + FirstG0CodePage(0), SecondG0CodePage(0) +{ } enum enumSizeMode { -- cgit v1.2.3