]> git.vomp.tv Git - vompclient.git/commitdiff
10 CWFs
authorChris Tallon <chris@vomp.tv>
Tue, 14 Apr 2020 16:36:52 +0000 (17:36 +0100)
committerChris Tallon <chris@vomp.tv>
Tue, 14 Apr 2020 16:36:52 +0000 (17:36 +0100)
input.cc
inputman.cc
osdopenvg.cc
vchannelselect.cc
vdr.h
vvideolivetv.cc
wremoteconfig.cc

index 93eaf6e696987f961c227aeea7911dbd45905615..67b7298fa96edc4231b24586204ced4abb0b1559 100644 (file)
--- 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<UCHAR>(learnMode));
     InputMan::getInstance()->cancelLearnMode();
     return NA_LEARN;
   }
index a3ce116308c6cd6284bce76de607a8f8445a1633..402011210bbd0389228ff033b3e83dc307e360ac 100644 (file)
@@ -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()
index 8101a3d989b76e5c8b59089a3d4be5403fc291fd..7bb56e357fc972735a5bd0e706ea80eee0ac798d 100644 (file)
@@ -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<char*>(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<const unsigned char *>(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<std::mutex> 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)
index d53d4aa53795bc841b41dcdc12a7431a1ae9271b..8bdd594653622cd9e9a8afdb3d866856a4cab5aa 100644 (file)
@@ -37,7 +37,7 @@ VChannelSelect::VChannelSelect(Boxx* v)
   numGot = 0;
   ignoreTimer = false;
 
-  numWidth = static_cast<int>(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 168ab1ada3c3c824a2132dcbc344c43cd0ffdcf8..a7bc8d0a6a69a71844eba47bed98dd65328c7f1a 100644 (file)
--- 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;
index 6ff82731f3abe6ac6faa5f34cd45a5ebb009b85b..b7bd885bf26d8eeaf11444c4769b24f4f478f29e 100644 (file)
@@ -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;
index 96942dfaaf7d8da0fe6a92bc286dac8818f9b8e1..24e032c1c57ee1e8d7646addee8bbf76085e5338 100644 (file)
@@ -230,7 +230,9 @@ int WRemoteConfig::handleCommand(int command)
     case Input::OK:
     {
       learnmode = true;
-      InputMan::getInstance()->EnterLearningMode(reinterpret_cast<ULONG>(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<UCHAR>(reinterpret_cast<ULONG>(sl.getCurrentOptionData())));
       return 1;
     }
     case Input::BACK: