From 0fba9383d37e1018fed3f296422eea844f59b8d0 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 16 Feb 2020 23:03:37 +0000 Subject: [PATCH] 23 compiler warning fixes --- audioomx.cc | 14 ++++++-------- command.cc | 4 ++-- inputcec.cc | 2 +- log.cc | 6 ++++-- main.cc | 3 +++ media.h | 8 ++++---- mutex.cc | 4 ++++ signal.cc | 3 +++ vdr.cc | 12 ++++++------ videoomx.cc | 2 +- wol.cc | 6 +++--- wremoteconfig.cc | 9 ++------- wtabbar.cc | 2 +- 13 files changed, 40 insertions(+), 35 deletions(-) diff --git a/audioomx.cc b/audioomx.cc index 94f5137..b664925 100644 --- a/audioomx.cc +++ b/audioomx.cc @@ -2320,16 +2320,14 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, } - - -long long AudioOMX::SetStartOffset(long long curreftime, bool *rsync){ - VideoOMX *vw=(VideoOMX*)Video::getInstance(); +long long AudioOMX::SetStartOffset(long long curreftime, bool *rsync) +{ + VideoOMX* vw = dynamic_cast(Video::getInstance()); return vw->SetStartAudioOffset(curreftime,rsync); } -void AudioOMX::ResetTimeOffsets() { - VideoOMX *vw=(VideoOMX*)Video::getInstance(); +void AudioOMX::ResetTimeOffsets() +{ + VideoOMX* vw = dynamic_cast(Video::getInstance()); vw->ResetTimeOffsets(); } - - diff --git a/command.cc b/command.cc index 7f4ab5a..96336f6 100644 --- a/command.cc +++ b/command.cc @@ -1038,14 +1038,14 @@ void Command::doJustConnected(VConnect* vconnect) // Enter pre-keys here // handleCommand(Input::OK); // handleCommand(Input::THREE); -// handleCommand(Input::SIX); + handleCommand(Input::SIX); // handleCommand(Input::OK); // handleCommand(Input::UP); // handleCommand(Input::PLAY); // handleCommand(Input::DOWN); // handleCommand(Input::DOWN); // handleCommand(Input::DOWN); - // handleCommand(Input::OK); + handleCommand(Input::RIGHT); // handleCommand(Input::RED); } } diff --git a/inputcec.cc b/inputcec.cc index 1705c4d..97cec37 100644 --- a/inputcec.cc +++ b/inputcec.cc @@ -446,7 +446,7 @@ void InputCEC::InitKeymap() NAMETRICK2(CEC_USER_CONTROL_CODE_,MAX ); } -const char* InputCEC::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey) +const char* InputCEC::getHardCodedHardwareKeyNamesForVompKey(UCHAR /* vompKey */) { return ""; // FIXME } diff --git a/log.cc b/log.cc index 4da7d33..cd8e286 100644 --- a/log.cc +++ b/log.cc @@ -73,8 +73,10 @@ void Log::downLogLevel() log("Log", logLevel, "Log level is now %i", logLevel); } -int Log::init(int startLogLevel,const char* fileName, int tenabled) +int Log::init(int startLogLevel, const char* fileName, int tenabled) { + (void)fileName; + initted = 1; logLevel = startLogLevel; enabled = tenabled; @@ -110,7 +112,7 @@ int Log::log(const char *fromModule, int level,const char* message, ...) struct tm tms; LOCALTIME_R(&tv.tv_sec, &tms); spaceLeft -= strftime(buffer, spaceLeft, "%H:%M:%S.", &tms); - spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%06lu ", (unsigned long)tv.tv_usec); + spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%06lu ", static_cast(tv.tv_usec)); #else struct _timeb tb; _ftime(&tb); diff --git a/main.cc b/main.cc index efe6bc8..924d9a7 100644 --- a/main.cc +++ b/main.cc @@ -67,6 +67,8 @@ void threadSignalReceiverFunction(); #endif +ULLONG htonll(ULLONG); +ULLONG ntohll(ULLONG); void shutdown(int code); // Global variables -------------------------------------------------------------------------------------------------- @@ -107,6 +109,7 @@ int main(int argc, char** argv) break; case 'd': debugEnabled = true; // and... + [[fallthrough]]; case 'n': daemonize = false; break; diff --git a/media.h b/media.h index 4681bbe..9803904 100644 --- a/media.h +++ b/media.h @@ -114,10 +114,10 @@ class MediaInfo : public Serializable{ /** * return any info item contained within this info */ - virtual const char * getInfo(ULONG infoId) { return NULL;} - virtual ULLONG getIntegerInfo(ULONG infoId) { return 0;} - virtual const char * getInfoName(ULONG infoId) { return NULL;} - virtual bool hasInfo(ULONG infoId) { return false;} + virtual const char * getInfo(ULONG /* infoId */) { return NULL;} + virtual ULLONG getIntegerInfo(ULONG /* infoId */) { return 0;} + virtual const char * getInfoName(ULONG /* infoId */) { return NULL;} + virtual bool hasInfo(ULONG /* infoId */) { return false;} MediaInfo() { size=0; canPosition=true; diff --git a/mutex.cc b/mutex.cc index 6748626..42478c6 100644 --- a/mutex.cc +++ b/mutex.cc @@ -19,6 +19,10 @@ */ #include "mutex.h" +// FIXME - delete me. + + + #ifndef WIN32 #include #include diff --git a/signal.cc b/signal.cc index 3479cc9..bc4eb72 100644 --- a/signal.cc +++ b/signal.cc @@ -19,6 +19,9 @@ */ #include "signal.h" +// FIXME +// well, I say fix... Delete me. + Signal::Signal() { diff --git a/vdr.cc b/vdr.cc index 6e1b6ac..b7a28c3 100644 --- a/vdr.cc +++ b/vdr.cc @@ -176,7 +176,7 @@ void VDR::findServers(std::vector& servers) DatagramSocket ds(0); int haveAtLeastOne = 0; int retval; - int waitType = 1; + UCHAR waitType = 1; bool firstloop = true; while(findingServer) { @@ -185,11 +185,11 @@ void VDR::findServers(std::vector& servers) ds.shutdown(); ds.init(); logger->log("VDR", Log::NOTICE, "Broadcasting for server"); - ds.send("255.255.255.255", 51051, message, 15); - ds.send("255.255.255.255", 51052, message, 15); - ds.send("255.255.255.255", 51053, message, 15); - ds.send("255.255.255.255", 51054, message, 15); - ds.send("255.255.255.255", 51055, message, 15); + ds.send("255.255.255.255", 51051U, message, 15); + ds.send("255.255.255.255", 51052U, message, 15); + ds.send("255.255.255.255", 51053U, message, 15); + ds.send("255.255.255.255", 51054U, message, 15); + ds.send("255.255.255.255", 51055U, message, 15); if(!firstloop) wol->doWakeUp(); } retval = ds.waitforMessage(waitType); diff --git a/videoomx.cc b/videoomx.cc index 8f90ffe..eed1f7c 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -3208,7 +3208,7 @@ int VideoOMX::EnterIframePlayback() } Log::getInstance()->log("Video", Log::DEBUG, "EnterIframePlayback 2"); - ((AudioOMX*)Audio::getInstance())->DeAllocateCodecsOMX(); + dynamic_cast(Audio::getInstance())->DeAllocateCodecsOMX(); DeAllocateCodecsOMX(); AllocateCodecsOMX(); Log::getInstance()->log("Video", Log::DEBUG, diff --git a/wol.cc b/wol.cc index c5b7f0b..f54e9e8 100644 --- a/wol.cc +++ b/wol.cc @@ -202,7 +202,7 @@ int Wol::convertToBinary(char *bufp, unsigned char *addr) } if (c != 0) bufp++; - *ptr++ = (unsigned char) (val & 0377); + *ptr++ = static_cast(val & 0377); i++; /* We might get a semicolon here - not required. */ @@ -245,7 +245,7 @@ int Wol::doWakeUp() /* Set socket options */ #ifndef WIN32 - if (setsockopt (packet, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, + if (setsockopt (packet, SOL_SOCKET, SO_BROADCAST, static_cast(&optval), sizeof (optval)) < 0) #else if (setsockopt (packet, SOL_SOCKET, SO_BROADCAST, (char*)&optval, @@ -273,7 +273,7 @@ int Wol::doWakeUp() *ptr++ = ethaddr [i]; /* Send the packet out */ - if (sendto (packet,(char*) buf, 102, 0, reinterpret_cast(&sap), sizeof (sap)) < 0) + if (sendto (packet, static_cast(buf), 102, 0, reinterpret_cast(&sap), sizeof (sap)) < 0) { fprintf (stderr, " sendto failed, %s\n", strerror(errno)); diff --git a/wremoteconfig.cc b/wremoteconfig.cc index 1340a24..9eb5fb5 100644 --- a/wremoteconfig.cc +++ b/wremoteconfig.cc @@ -66,21 +66,16 @@ void WRemoteConfig::initSelectList(bool startup) for (UINT i = 0; i < 256; i++) { - Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "%u", i); const char* vompKeyName = InputMan::getVompKeyName(static_cast(i)); if (vompKeyName != NULL) { std::string line; line.reserve(150); line += vompKeyName; - line += ":\t"; - Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "A"); + line += ": \t"; line += inputMan->getHardCodedHardwareKeyNamesForVompKey(static_cast(i)); - line += '\t'; - Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "B"); + line += " \t"; // FIXME extra spaces for braindead strtok. Ditch strtok. line += inputMan->getAllHardwareKeyNamesAssignedToVompKey(static_cast(i)); - Log::getInstance()->log("WRemoteConfig", Log::DEBUG, "C"); - sl.addOption(line.c_str(), i, 0); } } diff --git a/wtabbar.cc b/wtabbar.cc index d9853f9..c28fabb 100644 --- a/wtabbar.cc +++ b/wtabbar.cc @@ -58,7 +58,7 @@ void WTabBar::addTab(const char* name, Boxx* boxx) for(UINT i = 0; i < strlen(name); i++) { - td.nameWidth += (UINT)charWidth(name[i]); + td.nameWidth += static_cast(charWidth(name[i])); } UINT newButtonX = 22; -- 2.39.5