From d2da4d0bf0375eb5b4db03b7be65e55f45152c22 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 25 Sep 2021 17:26:03 +0100 Subject: [PATCH] 43 CWFs --- boxstack.cc | 11 +++++------ boxx.cc | 2 +- config.cc | 2 +- inputlirc.cc | 4 ++-- inputman.cc | 2 +- inputman.h | 2 +- messagequeue.cc | 14 +++++++------- playerradiorec.cc | 2 +- recinfo.cc | 4 ++-- recording.cc | 2 +- tcp.cc | 6 ++++-- timers.cc | 16 ++++++++-------- vconnect.cc | 4 ++-- vepglistadvanced.cc | 2 +- vpicturebanner.cc | 4 ++-- vserverselect.cc | 1 - 16 files changed, 39 insertions(+), 39 deletions(-) diff --git a/boxstack.cc b/boxstack.cc index 415fb4b..9577475 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -187,7 +187,7 @@ int BoxStack::remove(Boxx* toDelete) // Delete the box //AVO: do this delete outside the lock to allow for recursive calls within the destructor // as this box is not in the stack any more, there is no chance for a second delete - LogNT::getInstance()->debug(TAG, "remove: going to delete boxx {}, num {}", (void*)toDelete, numBoxes); + LogNT::getInstance()->debug(TAG, "remove: going to delete boxx {}, num {}", static_cast(toDelete), numBoxes); delete toDelete; osd->doRender(); @@ -483,7 +483,7 @@ void BoxStack::removeAllExceptWallpaper() boxLock.unlock(); //AVO: do the delete outside the lock to allow for recursive deletes - LogNT::getInstance()->debug(TAG, "removeall: going to delete boxx {}, num={}", (void*)toDel, numBoxes); + LogNT::getInstance()->debug(TAG, "removeall: going to delete boxx {}, num={}", static_cast(toDel), numBoxes); if (display) Video::getInstance()->setVideoDisplay(*display); if (toDel) delete toDel; @@ -510,19 +510,18 @@ int BoxStack::handleCommand(int command) { LogNT::getInstance()->debug(TAG, "Giving command to i={}", i); retVal = boxes[i]->handleCommand(command); - if (retVal == 1) + if (retVal == ABANDON_COMMAND) { // not handled but don't give to any more boxes return 0; } - if (retVal == 2) + if (retVal == COMMAND_HANDLED) { - // command handled retVal2 = 1; break; } - else if (retVal == 4) + else if (retVal == DELETE_ME) { // LogNT::getInstance()->debug(TAG, "Return 4: i={}, boxes[i]={}", i, (void*)boxes[i]); remove(boxes[i]); diff --git a/boxx.cc b/boxx.cc index bc7bdcb..342f64c 100644 --- a/boxx.cc +++ b/boxx.cc @@ -94,7 +94,7 @@ void Boxx::remove(Boxx* oldChild) return; } } - LogNT::getInstance()->error(TAG, "Remove child box called, child {} not found", (void*)oldChild); + LogNT::getInstance()->error(TAG, "Remove child box called, child {} not found", static_cast(oldChild)); } void Boxx::removeVisibleChilds(Region & r) diff --git a/config.cc b/config.cc index 0b46e14..a6230a5 100644 --- a/config.cc +++ b/config.cc @@ -93,7 +93,7 @@ bool Config::getInt(const std::string& section, const std::string& key, int& out { Json::Value v = jconfigro[section][key]; if (!v.isInt64()) return false; - out = v.asInt64(); + out = static_cast(v.asInt64()); return true; } diff --git a/inputlirc.cc b/inputlirc.cc index c112ece..0e786e6 100644 --- a/inputlirc.cc +++ b/inputlirc.cc @@ -109,7 +109,7 @@ bool InputLIRC::start() std::string lircIP; bool checkA = Config::getInstance()->getString("input_lirc", "lirc_ip", lircIP); int lircPort = 8765; - bool checkB = Config::getInstance()->getInt("input_lirc", "lirc_port", lircPort); + /* bool checkB = */ Config::getInstance()->getInt("input_lirc", "lirc_port", lircPort); std::string lircSocket; bool checkC = Config::getInstance()->getString("input_lirc", "lirc_socket", lircSocket); @@ -124,7 +124,7 @@ bool InputLIRC::start() else if (checkA) // If no checkC, must be checkA { LogNT::getInstance()->info(TAG, "Starting with IP: {} {}", lircIP, lircPort); - tr = tcp.connect(lircIP, lircPort); + tr = tcp.connect(lircIP, static_cast(lircPort)); } if (!tr) diff --git a/inputman.cc b/inputman.cc index c7088f0..a8573ef 100644 --- a/inputman.cc +++ b/inputman.cc @@ -387,7 +387,7 @@ const char* InputMan::getVompKeyName(UCHAR number) } } -const UCHAR InputMan::getVompKeyNumber(const char* vompKeyName) +UCHAR InputMan::getVompKeyNumber(const char* vompKeyName) { if (!strcmp(vompKeyName, "VOLUMEUP")) return Input::VOLUMEUP; else if (!strcmp(vompKeyName, "VOLUMEDOWN")) return Input::VOLUMEDOWN; diff --git a/inputman.h b/inputman.h index 923a241..4740b15 100644 --- a/inputman.h +++ b/inputman.h @@ -117,7 +117,7 @@ class InputMan: public AbstractOption bool saveOptionstoServer(); static const char* getVompKeyName(UCHAR vompKey); - static const UCHAR getVompKeyNumber(const char* vompKeyName); + static UCHAR getVompKeyNumber(const char* vompKeyName); std::string getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey); diff --git a/messagequeue.cc b/messagequeue.cc index 51d67f2..22a16eb 100644 --- a/messagequeue.cc +++ b/messagequeue.cc @@ -68,7 +68,7 @@ void MessageQueue::addReceiver(MessageReceiver* newMR) if (std::find(receivers.begin(), receivers.end(), newMR) == receivers.end()) { - logger->debug(TAG, "addReceiver: not found, adding {}", (void*)newMR); + logger->debug(TAG, "addReceiver: not found, adding {}", static_cast(newMR)); receivers.push_back(newMR); } } @@ -83,13 +83,13 @@ void MessageQueue::removeReceiver(MessageReceiver* toRemove) while(1) { - logger->debug(TAG, "Attempt remove receiver {}", (void*)toRemove); + logger->debug(TAG, "Attempt remove receiver {}", static_cast(toRemove)); if (messageBeingProcessed && (messageBeingProcessed->to == toRemove)) { // The message currently being processed by Control is with the receiver we're trying to remove // Release mutex, delay and retry - logger->info(TAG, "Remove delay! Does this ever happen? {}", (void*)toRemove); + logger->info(TAG, "Remove delay! Does this ever happen? {}", static_cast(toRemove)); ul.unlock(); std::this_thread::sleep_for(std::chrono::milliseconds(100)); @@ -100,12 +100,12 @@ void MessageQueue::removeReceiver(MessageReceiver* toRemove) ReceiversI toRemoveI = std::find(receivers.begin(), receivers.end(), toRemove); if (toRemoveI == receivers.end()) { - logger->error(TAG, "Remove error 1 {}", (void*)toRemove); + logger->error(TAG, "Remove error 1 {}", static_cast(toRemove)); return; } receivers.erase(toRemoveI); - logger->debug(TAG, "Removed receiver {}", (void*)toRemove); + logger->debug(TAG, "Removed receiver {}", static_cast(toRemove)); break; } } @@ -131,13 +131,13 @@ void MessageQueue::messageLoop() if (!messageBeingProcessed->p_to && !receiverExists(messageBeingProcessed->to)) { // Receiver for this message has been deleted already - logger->debug(TAG, "Dropping message {} for non-existent receiver {}", (void*)messageBeingProcessed, (void*)messageBeingProcessed->to); + logger->debug(TAG, "Dropping message {} for non-existent receiver {}", static_cast(messageBeingProcessed), static_cast(messageBeingProcessed->to)); delete messageBeingProcessed; messageBeingProcessed = NULL; continue; } - logger->debug(TAG, "Dispatching message {} to {}", (void*)messageBeingProcessed, (void*)messageBeingProcessed->to); + logger->debug(TAG, "Dispatching message {} to {}", static_cast(messageBeingProcessed), static_cast(messageBeingProcessed->to)); lockWrapper.unlock(); dispatchMessage(messageBeingProcessed); diff --git a/playerradiorec.cc b/playerradiorec.cc index a4f881b..be63041 100644 --- a/playerradiorec.cc +++ b/playerradiorec.cc @@ -541,6 +541,6 @@ void PlayerRadioRec::threadMethod() m->from = this; m->message = Message::PLAYER_EVENT; m->parameter = PlayerRadioRec::STOP_PLAYBACK; - logger->debug(TAG, "Posting message to {}...", (void*)messageQueue); + logger->debug(TAG, "Posting message to {}...", static_cast(messageQueue)); messageQueue->postMessage(m); } diff --git a/recinfo.cc b/recinfo.cc index 77e9056..9c9cdf1 100644 --- a/recinfo.cc +++ b/recinfo.cc @@ -60,8 +60,8 @@ RecInfo::~RecInfo() for (ULONG i = 0; i < numComponents; i++) { - LogNT::getInstance()->info(TAG, "i: {}, languages[i]={:p}:{}", i, (void*)languages[i], languages[i]); - LogNT::getInstance()->info(TAG, "i: {}, descripti[i]={:p}:{}", i, (void*)descriptions[i], descriptions[i]); + LogNT::getInstance()->info(TAG, "i: {}, languages[i]={:p}:{}", i, static_cast(languages[i]), languages[i]); + LogNT::getInstance()->info(TAG, "i: {}, descripti[i]={:p}:{}", i, static_cast(descriptions[i]), descriptions[i]); if (languages[i]) delete[] (languages[i]); if (descriptions[i]) delete[] (descriptions[i]); } diff --git a/recording.cc b/recording.cc index 3142ef7..153e6d7 100644 --- a/recording.cc +++ b/recording.cc @@ -109,7 +109,7 @@ void Recording::loadRecInfo() if (recInfo) delete recInfo; recInfoFor = this; recInfo = vdr->getRecInfo(fileName); - logger->debug(TAG, "Recording has loaded recInfo {}", (void*)recInfo); + logger->debug(TAG, "Recording has loaded recInfo {}", static_cast(recInfo)); if (!vdr->isConnected()) Control::getInstance()->connectionLost(); diff --git a/tcp.cc b/tcp.cc index ddf955b..7debd2c 100644 --- a/tcp.cc +++ b/tcp.cc @@ -103,7 +103,7 @@ bool TCP::connectSocket(const std::string& socketFile) struct sockaddr_un uds; uds.sun_family = AF_UNIX; strcpy(uds.sun_path, socketFile.c_str()); - int connectResult = ::connect(sockfd, (struct sockaddr *)&uds, pathLength + sizeof(uds.sun_family)); + int connectResult = ::connect(sockfd, reinterpret_cast(&uds), pathLength + sizeof(uds.sun_family)); if (connectResult == 0) // success { @@ -161,11 +161,13 @@ bool TCP::connect(const std::string& ip, USHORT port) return waitForConnect(connectResult); } +#ifdef WIN32 bool TCP::waitForConnect(int connectResult) { -#ifdef WIN32 if ((connectResult != SOCKET_ERROR) || (WSAGetLastError() != WSAEWOULDBLOCK)) #else +bool TCP::waitForConnect(int) +{ if (errno != EINPROGRESS) #endif { diff --git a/timers.cc b/timers.cc index 4a69709..9f579cd 100644 --- a/timers.cc +++ b/timers.cc @@ -163,7 +163,7 @@ bool Timers::setTimerC(TimerReceiver* client, int clientReference, std::chrono:: timerList.push_back(t); recalc = true; timersCond.notify_all(); - logger->debug(TAG, "Timer set for {} ref {}", (void*)client, clientReference); + logger->debug(TAG, "Timer set for {} ref {}", static_cast(client), clientReference); return true; // unlock } @@ -258,7 +258,7 @@ void Timers::reap() // Master timers thread, mutex locked (or shutdown, mutex lo if (te->restartAfterFinish) { - logger->debug(TAG, "timerEventFinished RESTART for {} {}", (void*)te->client, te->clientReference); + logger->debug(TAG, "timerEventFinished RESTART for {} {}", static_cast(te->client), te->clientReference); te->restartAfterFinish = false; te->running = false; te->completed = false; @@ -312,7 +312,7 @@ bool Timers::cancelTimer(TimerReceiver* client, int clientReference) if (!initted) return false; - logger->debug(TAG, "Starting cancel timer {} {}, list size = {}", (void*)client, clientReference, timerList.size()); + logger->debug(TAG, "Starting cancel timer {} {}, list size = {}", static_cast(client), clientReference, timerList.size()); std::unique_lock lockWrapper(timersMutex); // lock @@ -343,7 +343,7 @@ bool Timers::cancelTimer(TimerReceiver* client, int clientReference) timerList.erase(i); delete foundTimerEvent; - logger->debug(TAG, "Removed timer for {} ref {}", (void*)client, clientReference); + logger->debug(TAG, "Removed timer for {} ref {}", static_cast(client), clientReference); recalc = true; timersCond.notify_all(); // shutdown could be being called? notify_all guarantees we wake masterLoop return true; // unlock @@ -353,7 +353,7 @@ bool Timers::cancelTimer(TimerReceiver* client, int clientReference) { // Case 2 b. // The thread requesting cancelTimer is the timer thread itself, the timer has already fired. - logger->debug(TAG, "{} ref {} cancelTimer itself calling - ignore", (void*)client, clientReference); + logger->debug(TAG, "{} ref {} cancelTimer itself calling - ignore", static_cast(client), clientReference); foundTimerEvent->restartAfterFinish = false; // in case a restart had already been set. return true; // unlock } @@ -365,10 +365,10 @@ bool Timers::cancelTimer(TimerReceiver* client, int clientReference) // So, wait on the cond and go around each time we wake. One of them will have been after the timerThread finished, // which turns it into a case 3. - logger->debug(TAG, "{} ref {} cancelTimer WAITING", (void*)client, clientReference); + logger->debug(TAG, "{} ref {} cancelTimer WAITING", static_cast(client), clientReference); timersCond.wait(lockWrapper); //unlocks in wait // locked - logger->debug(TAG, "{} ref {} cancelTimer go-around", (void*)client, clientReference); + logger->debug(TAG, "{} ref {} cancelTimer go-around", static_cast(client), clientReference); } // end of the big while loop } @@ -385,7 +385,7 @@ void TimerEvent::run() threadStartProtect.lock(); threadStartProtect.unlock(); - LogNT::getInstance()->debug(TAG, "sending timer to {} with parameter {}", (void*)client, clientReference); + LogNT::getInstance()->debug(TAG, "sending timer to {} with parameter {}", static_cast(client), clientReference); client->timercall(clientReference); Timers::getInstance()->reapTimerEvent(this); }); diff --git a/vconnect.cc b/vconnect.cc index fc5018f..a983689 100644 --- a/vconnect.cc +++ b/vconnect.cc @@ -123,7 +123,7 @@ void VConnect::threadMethod() int newPort; // copy around because of type mismatch if (config->getInt("server", "port", newPort)) { - serverFromConfig.port = newPort; + serverFromConfig.port = static_cast(newPort); logger->debug(TAG, "Port read fron config: {}", serverFromConfig.port); } @@ -162,7 +162,7 @@ void VConnect::threadMethod() // Now we have > 0 servers found - for (ULONG i = 0; i < numServers; i++) + for (int i = 0; i < numServers; i++) logger->info(TAG, "Found server: {} {} {} {}", vdpc[i].ipVersion, vdpc[i].ip.c_str(), vdpc[i].name.c_str(), vdpc[i].port, vdpc[i].version); if (numServers == 1) diff --git a/vepglistadvanced.cc b/vepglistadvanced.cc index e09c7fb..8f87ff3 100644 --- a/vepglistadvanced.cc +++ b/vepglistadvanced.cc @@ -467,7 +467,7 @@ void VEpgListAdvanced::updateEpgDataChannel() time_t now; time(&now); eventLista[0] = VDR::getInstance()->getChannelSchedule(channelNumber, now, 24 * 60 * 60 * 30); // one month - LogNT::getInstance()->debug(TAG, "Eventlist {:#x} {}", (void*)eventLista[0], channelNumber); + LogNT::getInstance()->debug(TAG, "Eventlist {:#x} {}", static_cast(eventLista[0]), channelNumber); } void VEpgListAdvanced::drawData(bool doIndexPop) diff --git a/vpicturebanner.cc b/vpicturebanner.cc index e266ab3..5083087 100644 --- a/vpicturebanner.cc +++ b/vpicturebanner.cc @@ -39,7 +39,7 @@ VPictureBanner::VPictureBanner(bool ld, bool sl) setPosition(50, v->getScreenHeight()-50); setTitleBarOn(0); info=NULL; - LogNT::getInstance()->debug("VPictureBanner", "created {}", (void*)this); + LogNT::getInstance()->debug("VPictureBanner", "created {}", static_cast(this)); //TODO compute sizes from text rotsize=70; infsize=50; @@ -50,7 +50,7 @@ VPictureBanner::VPictureBanner(bool ld, bool sl) VPictureBanner::~VPictureBanner() { MessageQueue::getInstance()->removeReceiver(this); - LogNT::getInstance()->debug("VPictureBanner", "deleted {}", (void*)this); + LogNT::getInstance()->debug("VPictureBanner", "deleted {}", static_cast(this)); } diff --git a/vserverselect.cc b/vserverselect.cc index 38f5c4c..0f01528 100644 --- a/vserverselect.cc +++ b/vserverselect.cc @@ -114,7 +114,6 @@ void VServerSelect::processMessage(Message* m) { if (sl.mouseLBDOWN(m->parameter - getScreenX(), m->tag - getScreenY())) { - // FIXME - this probably also breaks Input::sendInputKey(Input::OK); } } -- 2.39.2