]> git.vomp.tv Git - vompclient.git/commitdiff
All compiler warnings fixed for VDP6
authorChris Tallon <chris@vomp.tv>
Wed, 29 Jan 2020 15:45:16 +0000 (15:45 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 29 Jan 2020 15:45:16 +0000 (15:45 +0000)
vdp6.cc
vdp6.h

diff --git a/vdp6.cc b/vdp6.cc
index 5fb4daa641a103c11c00b9fda2e93ee9670bf272..7d321b6fae8ca016429b223daa79aa8b6a289f7a 100644 (file)
--- a/vdp6.cc
+++ b/vdp6.cc
@@ -30,7 +30,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "defines.h"
 #include "vdr.h"
 #include "log.h"
 #include "vdp6.h"
@@ -84,7 +83,7 @@ void VDP6::run()
                               
       int mlength;
       struct sockaddr_in6 theirAddr;
-      mlength = recvfrom(sock, vdpreply, 1000, 0, (struct sockaddr *)&theirAddr, &addrlen);
+      mlength = recvfrom(sock, vdpreply, 1000, 0, reinterpret_cast<struct sockaddr *>(&theirAddr), &addrlen);
       if (mlength == -1)
       {
         logger->log("VDP6", Log::ERR, "recvfrom error");
@@ -104,7 +103,7 @@ void VDP6::run()
       memcpy(&newServerVersion, &vdpreply[28], 4);
       newServer.version = ntohl(newServerVersion);
 
-      int newServerNameLength = mlength - 32;
+      UINT newServerNameLength = static_cast<UINT>(mlength - 32);
       newServer.name = new char[newServerNameLength];
       strcpy(newServer.name, &vdpreply[32]);
 
@@ -118,20 +117,20 @@ void VDP6::run()
   strcpy(message, "VDP-0001");
 
   struct if_nameindex* ifs = if_nameindex();
-  int ifIndex;
+  UINT ifIndex;
 
   for(int i = 0; ifs[i].if_index > 0; i++)
   {
     ifIndex = ifs[i].if_index;
     int d = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifIndex, sizeof(ifIndex));
-    d = sendto(sock, message, 15, 0, (struct sockaddr*)&saddr, sizeof(saddr));
+    d = sendto(sock, message, 15, 0, reinterpret_cast<struct sockaddr *>(&saddr), sizeof(saddr));
     if (d > 0) logger->log("VDP6", Log::DEBUG, "Transmitted IPv6 MC UDP on %s", ifs[i].if_name);
   }
 
   if_freenameindex(ifs);
 }
 
-int VDP6::numFound()
+UINT VDP6::numFound()
 {
   return servers.size();
 }
diff --git a/vdp6.h b/vdp6.h
index c3becdf8042557a7285ec016191415f7495cc8c6..d213deaff3e5ea841d424dd25a3ff43552539536 100644 (file)
--- a/vdp6.h
+++ b/vdp6.h
@@ -25,7 +25,9 @@
 #include <thread>
 #include <vector>
 
-class VDRServer;
+#include "defines.h"
+
+struct VDRServer;
 
 /*
  * Until VDP is reorganised, getServers must be called after stop
@@ -40,7 +42,7 @@ class VDP6
 
     void run();
     void stop();
-    int numFound();
+    UINT numFound();
     std::vector<VDRServer>* getServers() { return &servers; }
 
   private: