From 49dd1c2c97122590657eabf9a92b4c4f6b15bdfb Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 6 Feb 2020 15:59:53 +0000 Subject: [PATCH] 20 warnings. Ish. Change Message::ADD_VIEW to use void* data for view pointer --- GNUmakefile | 2 +- boxstack.cc | 2 +- surfacevector.h | 6 +++--- tcp.cc | 10 ++++++---- vepgsettimer.cc | 2 +- vmedialist.cc | 2 +- vradiorec.cc | 2 +- vrecording.cc | 2 +- vsleeptimer.cc | 2 +- vteletextview.cc | 2 +- vvideomedia.cc | 2 +- vvideorec.cc | 2 +- wol.cc | 2 +- 13 files changed, 20 insertions(+), 18 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 81267bf..8238280 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -61,7 +61,7 @@ OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY) CROSSLIBS = INCLUDES = -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/ImageMagick -I/usr/include/ImageMagick-6 -I/usr/include/arm-linux-gnueabihf/ImageMagick-6 PLATFORM = -DVOMP_PLATFORM_RASPBERRY -CXXFLAGS_EXTRA = +CXXFLAGS_EXTRA = -Wno-psabi endif ifeq ($(vomp_platform),crossraspberry) diff --git a/boxstack.cc b/boxstack.cc index 5ba9cc8..9813615 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -591,7 +591,7 @@ void BoxStack::processMessage(Message* m) } case Message::ADD_VIEW: { - Boxx* toAdd = reinterpret_cast(m->parameter); + Boxx* toAdd = reinterpret_cast(m->data); add(toAdd); toAdd->draw(); update(toAdd); diff --git a/surfacevector.h b/surfacevector.h index a052452..903df7a 100644 --- a/surfacevector.h +++ b/surfacevector.h @@ -64,7 +64,7 @@ class SurfaceVector : public Surface void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c); void readPixel(int /* x */, int /* y */, unsigned char* /* r */, unsigned char* /* g */, unsigned char* /* b */) {}; - void screenShot(const char* fileName) {}; + void screenShot(const char* /* fileName */) {}; protected: @@ -75,8 +75,8 @@ class SurfaceVector : public Surface Mutex command_mutex; OsdVector* osd; - void drawPixel(int x, int y, unsigned int c, bool fastdraw){}; // these are not supported! - void drawPixel(int x, int y, Colour& c, bool fastdraw){}; + void drawPixel(int /* x */, int /* y */, unsigned int /* c */, bool /* fastdraw */){}; // these are not supported! + void drawPixel(int /* x */, int /* y */, Colour& /* c */, bool /* fastdraw */){}; }; #endif diff --git a/tcp.cc b/tcp.cc index 278816c..bbee70d 100644 --- a/tcp.cc +++ b/tcp.cc @@ -227,9 +227,9 @@ int TCP::connectTo(char* host, unsigned short port) // so the socket became available for writing. Contrary to expectation, this doesn't actually // mean it connected... - int soError; + int soError; // SO_ERROR optval is int socklen_t soErrorSize = sizeof(soError); - int gso = getsockopt(sock, SOL_SOCKET, SO_ERROR,(char*) &soError, &soErrorSize); + int gso = getsockopt(sock, SOL_SOCKET, SO_ERROR, reinterpret_cast(&soError), &soErrorSize); if ((gso == 0) && (soError == 0)) { @@ -263,7 +263,9 @@ The full documentation: void TCP::setReceiveWindow(size_t rxBufferSize) { // Set receive window - int r = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&rxBufferSize, sizeof(size_t)); + // According to docs, optval in setsockopt is a pointer to int unless otherwise noted + int rxSize = rxBufferSize; + int r = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&rxSize), sizeof(size_t)); Log::getInstance()->log("TCP", Log::DEBUG, "Set receive window to %i, success(=0): %i", rxBufferSize, r); } @@ -282,7 +284,7 @@ int TCP::sendData(void* bufR, size_t count) size_t bytes_sent = 0; int this_write; - unsigned char* buf = (unsigned char*)bufR; + unsigned char* buf = static_cast(bufR); MUTEX_LOCK(&mutex); diff --git a/vepgsettimer.cc b/vepgsettimer.cc index 0725c08..2f1bf3b 100644 --- a/vepgsettimer.cc +++ b/vepgsettimer.cc @@ -279,7 +279,7 @@ void VEpgSetTimer::doit() Message* m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter = (ULONG)vi; + m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } diff --git a/vmedialist.cc b/vmedialist.cc index 63db05f..472d3cc 100644 --- a/vmedialist.cc +++ b/vmedialist.cc @@ -1184,7 +1184,7 @@ int VMediaList::load() { Message* m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter = (ULONG)vi; + m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } return 1; diff --git a/vradiorec.cc b/vradiorec.cc index 9b9b5f0..416a1e3 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -177,7 +177,7 @@ void VRadioRec::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter = (ULONG)vi; + m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } } diff --git a/vrecording.cc b/vrecording.cc index cb569d9..3e50fdc 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -265,7 +265,7 @@ int VRecording::handleCommand(int command) Message* m = new Message(); m->message = Message::ADD_VIEW; m->to = BoxStack::getInstance(); - m->parameter = (ULONG)vi; + m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); if (ret == 1) diff --git a/vsleeptimer.cc b/vsleeptimer.cc index 7402047..826e33d 100644 --- a/vsleeptimer.cc +++ b/vsleeptimer.cc @@ -161,7 +161,7 @@ void Sleeptimer::threadMethod() Message* m1 = new Message(); m1->message = Message::ADD_VIEW; m1->to = BoxStack::getInstance(); - m1->parameter = reinterpret_cast(count); + m1->data = reinterpret_cast(count); MessageQueue::getInstance()->postMessage(m1); } MILLISLEEP(1000); diff --git a/vteletextview.cc b/vteletextview.cc index bc765f6..5e47bc4 100644 --- a/vteletextview.cc +++ b/vteletextview.cc @@ -175,7 +175,7 @@ void VTeletextView::doKey(int command) } -void VTeletextView::timercall(int clientReference) +void VTeletextView::timercall(int /* clientReference */) { } diff --git a/vvideomedia.cc b/vvideomedia.cc index d6154f8..efb2bdc 100644 --- a/vvideomedia.cc +++ b/vvideomedia.cc @@ -193,7 +193,7 @@ void VVideoMedia::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter = (ULONG)vi; + m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } } diff --git a/vvideorec.cc b/vvideorec.cc index 43e4b7b..0be0d5c 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -214,7 +214,7 @@ void VVideoRec::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; m->to = boxstack; - m->parameter = (ULONG)vi; + m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } } diff --git a/wol.cc b/wol.cc index 38f1244..c5b7f0b 100644 --- a/wol.cc +++ b/wol.cc @@ -273,7 +273,7 @@ int Wol::doWakeUp() *ptr++ = ethaddr [i]; /* Send the packet out */ - if (sendto (packet,(char*) buf, 102, 0, (struct sockaddr *)&sap, sizeof (sap)) < 0) + if (sendto (packet,(char*) buf, 102, 0, reinterpret_cast(&sap), sizeof (sap)) < 0) { fprintf (stderr, " sendto failed, %s\n", strerror(errno)); -- 2.39.5