From 5aecd61e24d634a5c0bdbf5b5f386708bdb6a59b Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 14 Apr 2020 17:36:52 +0100 Subject: [PATCH] 10 CWFs --- input.cc | 2 +- inputman.cc | 50 ++++++++++++++++++++++++++++------------------- osdopenvg.cc | 6 +++--- vchannelselect.cc | 2 +- vdr.h | 4 ++-- vvideolivetv.cc | 9 ++++----- wremoteconfig.cc | 4 +++- 7 files changed, 44 insertions(+), 33 deletions(-) diff --git a/input.cc b/input.cc index 93eaf6e..67b7298 100644 --- a/input.cc +++ b/input.cc @@ -51,7 +51,7 @@ UCHAR Input::TranslateHWCList(HWC_TYPE code) { if (learnMode != NOLEARNMODE) { - setHWCtoCommand(code, learnMode); + setHWCtoCommand(code, static_cast(learnMode)); InputMan::getInstance()->cancelLearnMode(); return NA_LEARN; } diff --git a/inputman.cc b/inputman.cc index a3ce116..4020112 100644 --- a/inputman.cc +++ b/inputman.cc @@ -52,31 +52,44 @@ InputMan* InputMan::getInstance() bool InputMan::init() { - bool i1{}, i2{}, i3{}, i4{}; + bool ret; + bool oneOK{}; #ifdef VOMP_PLATFORM_RASPBERRY inputLinux = new InputLinux(); - i1 = inputLinux->init(); - if (!i1) { delete inputLinux; inputLinux = NULL; } + ret = inputLinux->init(); + if (ret) + oneOK = true; + else + { delete inputLinux; inputLinux = NULL; } // FIXME enable modules by new config system NCONFIG // inputCEC = new InputCEC(); -// i2 = inputCEC->init(); -// if (!i2) { delete inputCEC; inputCEC = NULL; } +// ret = inputCEC->init(); +// if (ret) +// oneOK = true; +// else +// { delete inputCEC; inputCEC = NULL; } #endif inputUDP = new InputUDP(); - i3 = inputUDP->init(); - if (!i3) { delete inputUDP; inputUDP = NULL; } + ret = inputUDP->init(); + if (ret) + oneOK = true; + else + { delete inputUDP; inputUDP = NULL; } #ifdef WIN32 inputWin = new InputWin(); - i4 = inputWin->init(); - if (!i4) { delete inputWin; inputWin = NULL; } + ret = inputWin->init(); + if (ret) + oneOK = true; + else + { delete inputWin; inputWin = NULL; } #endif - if (!i1 && !i2 && !i3 && !i4) + if (!oneOK) { Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not init any input module"); return false; @@ -90,21 +103,18 @@ bool InputMan::start() { Log::getInstance()->log("InputMan", Log::DEBUG, "Start"); - bool i1{}, i3{}; + bool oneOK{}; #ifdef VOMP_PLATFORM_RASPBERRY - if (inputLinux) - { - i1 = inputLinux->start(); - } + if (inputLinux && inputLinux->start()) oneOK = true; #endif - if (inputUDP) - { - i3 = inputUDP->start(); - } + if (inputUDP && inputUDP->start()) oneOK = true; + + if (!oneOK) + Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not start any input module"); - return i1; + return oneOK; } void InputMan::stop() diff --git a/osdopenvg.cc b/osdopenvg.cc index 8101a3d..7bb56e3 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -684,7 +684,7 @@ void OsdOpenVG::setFont(const char * fontname) { if (strcmp(fontname,cur_fontname)) { // new font! if (cur_fontname) free(cur_fontname); - cur_fontname=(char*)malloc(strlen(fontname)+1); + cur_fontname = static_cast(malloc(strlen(fontname)+1)); strcpy(cur_fontname,fontname); struct OpenVGCommand comm; @@ -1164,7 +1164,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) unsigned int buffer_len=(command.param1*command.param2)>>3; unsigned char * buffer=(unsigned char*)malloc(buffer_len); unsigned char * r_buffer1=buffer; - const unsigned char * r_buffer2=(const unsigned char *)command.data; + const unsigned char* r_buffer2= static_cast(command.data); unsigned char *buffer_end=buffer+buffer_len; while (r_buffer1!=buffer_end) { unsigned char byte=*r_buffer2; @@ -1420,7 +1420,7 @@ unsigned int OsdOpenVG::putOpenVGCommand(OpenVGCommand& comm,bool wait) // Log::getInstance()->log("OsdOpenVG", Log::DEBUG, "putOpenVGCommand wait_for"); std::unique_lock ul(vgTaskSignalMutex); - auto a = vgTaskSignal.wait_for(ul, std::chrono::milliseconds(100)); + /*auto a = */ vgTaskSignal.wait_for(ul, std::chrono::milliseconds(100)); ul.unlock(); /* if (a == std::cv_status::timeout) diff --git a/vchannelselect.cc b/vchannelselect.cc index d53d4aa..8bdd594 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -37,7 +37,7 @@ VChannelSelect::VChannelSelect(Boxx* v) numGot = 0; ignoreTimer = false; - numWidth = static_cast(VDR::getInstance()->getChannelNumberWidth()); + numWidth = VDR::getInstance()->getChannelNumberWidth(); if (numWidth > 10) numWidth = 10; for (int i = 0; i < numWidth; i++) input[i] = -1; diff --git a/vdr.h b/vdr.h index 168ab1a..a7bc8d0 100644 --- a/vdr.h +++ b/vdr.h @@ -130,7 +130,7 @@ public ExternLogger int connect(); void disconnect(); bool isConnected() { return connected; } - ULONG getChannelNumberWidth() { return channelNumberWidth; } + int getChannelNumberWidth() { return channelNumberWidth; } void setVDRShutdown(bool doShutdown) { doVDRShutdown = doShutdown; } void shutdownVDR(); @@ -237,7 +237,7 @@ public ExternLogger bool connected{}; ULONG maxChannelNumber{}; bool doVDRShutdown{}; - ULONG channelNumberWidth{1}; + int channelNumberWidth{1}; VDR_PacketReceiver* TEMP_SINGLE_VDR_PR; std::mutex threadStartProtect; diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 6ff8273..b7bd885 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -60,7 +60,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V chanList = tchanList; vchannelList = tvchannelList; - numberWidth = (int)VDR::getInstance()->getChannelNumberWidth(); + numberWidth = VDR::getInstance()->getChannelNumberWidth(); currentChannelIndex = 0; previousChannelIndex = 0; @@ -71,10 +71,9 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V playing = false; // Convert channel number to index - UINT i; - for(i = 0; i < chanList->size(); i++) + for(UINT i = 0; i < chanList->size(); i++) { - if ((*chanList)[i]->number == (UINT)initialChannelNumber) + if ((*chanList)[i]->number == initialChannelNumber) { currentChannelIndex = i; osdChannelIndex = i; @@ -923,7 +922,7 @@ bool VVideoLiveTV::channelChange(UCHAR changeType, UINT newData) UINT i; for(i = 0; i < chanList->size(); i++) { - if ((*chanList)[i]->number == (UINT)newData) + if ((*chanList)[i]->number == newData) { newChannel = i; break; diff --git a/wremoteconfig.cc b/wremoteconfig.cc index 96942df..24e032c 100644 --- a/wremoteconfig.cc +++ b/wremoteconfig.cc @@ -230,7 +230,9 @@ int WRemoteConfig::handleCommand(int command) case Input::OK: { learnmode = true; - InputMan::getInstance()->EnterLearningMode(reinterpret_cast(sl.getCurrentOptionData())); + // Two casts to get from void* to UCHAR. Wow. First reinterpret from void* to ULONG, then static to UCHAR + InputMan::getInstance()->EnterLearningMode( + static_cast(reinterpret_cast(sl.getCurrentOptionData()))); return 1; } case Input::BACK: -- 2.39.5