mdns: fix three alignment warnings
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 20 Feb 2013 11:18:52 +0000 (12:18 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 20 Feb 2013 11:22:59 +0000 (12:22 +0100)
src/NetworkInterfaces.c: In function 'CreateRouterElectionSocket':
src/NetworkInterfaces.c:288:16: error: cast increases required alignment of target type [-Werror=cast-align]
src/NetworkInterfaces.c: In function 'CreateHelloSocket':
src/NetworkInterfaces.c:383:16: error: cast increases required alignment of target type [-Werror=cast-align]
src/mdns.c: In function 'ip_checksum':
src/mdns.c:94:18: error: cast increases required alignment of target type [-Werror=cast-align]

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/mdns/src/NetworkInterfaces.c
lib/mdns/src/mdns.c

index 44cd522..831a004 100644 (file)
@@ -285,7 +285,7 @@ CreateRouterElectionSocket(const char *ifName)
                        BmfPError("Could not get ipv4 address of %s interface", ifName);
                        goto bail;
                }
                        BmfPError("Could not get ipv4 address of %s interface", ifName);
                        goto bail;
                }
-               ipv4_addr = ((struct sockaddr_in *)&req.ifr_addr)->sin_addr;
+               ipv4_addr = ((struct sockaddr_in *)(void *) &req.ifr_addr)->sin_addr;
                mc_settings.imr_interface = ipv4_addr;
                errno = 0;
                if (setsockopt(rxSocket, ipProtoSetting, ipAddMembershipSetting,
                mc_settings.imr_interface = ipv4_addr;
                errno = 0;
                if (setsockopt(rxSocket, ipProtoSetting, ipAddMembershipSetting,
@@ -380,7 +380,7 @@ static int CreateHelloSocket(const char *ifName) {
                        BmfPError("Could not get ipv4 address of %s interface", ifName);
                        goto bail;
                }
                        BmfPError("Could not get ipv4 address of %s interface", ifName);
                        goto bail;
                }
-               ipv4_addr = ((struct sockaddr_in *)&req.ifr_addr)->sin_addr;
+               ipv4_addr = ((struct sockaddr_in *)(void *) &req.ifr_addr)->sin_addr;
                address.in4.sin_addr = ipv4_addr;
                address.in4.sin_family = ipFamilySetting;
                address.in4.sin_port = ipPort;
                address.in4.sin_addr = ipv4_addr;
                address.in4.sin_family = ipFamilySetting;
                address.in4.sin_port = ipPort;
index a5d386d..3012f85 100644 (file)
@@ -91,7 +91,7 @@ static uint16_t ip_checksum(char* data, int len)
     else
         len = (len >> 1) + 1;
     while (len > 0) {
     else
         len = (len >> 1) + 1;
     while (len > 0) {
-        sum += *((unsigned short int*)data);
+        sum += *((unsigned short int*)(void *)data);
         data += sizeof(unsigned short int);
         len--;
     }
         data += sizeof(unsigned short int);
         len--;
     }