From 1bab69ac3508a070e7e1a18c86eb9a3f6d4d1394 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 29 Jan 2020 15:45:16 +0000 Subject: [PATCH] All compiler warnings fixed for VDP6 --- vdp6.cc | 11 +++++------ vdp6.h | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/vdp6.cc b/vdp6.cc index 5fb4daa..7d321b6 100644 --- a/vdp6.cc +++ b/vdp6.cc @@ -30,7 +30,6 @@ #include #include -#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(&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(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(&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 c3becdf..d213dea 100644 --- a/vdp6.h +++ b/vdp6.h @@ -25,7 +25,9 @@ #include #include -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* getServers() { return &servers; } private: -- 2.39.5