[gssdp] win32: Set host_mask and host_addr
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp] win32: Set host_mask and host_addr
- Date: Sun, 11 Nov 2018 06:19:40 +0000 (UTC)
commit d159b099184b009f6af2c557061b98eb1da7c0cb
Author: Jens Georg <mail jensge org>
Date: Sun Nov 11 06:49:55 2018 +0100
win32: Set host_mask and host_addr
more win32 fixes after the latest gssdp-net changes
libgssdp/gssdp-net-win32.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/libgssdp/gssdp-net-win32.c b/libgssdp/gssdp-net-win32.c
index 5bc582b..e0c2071 100644
--- a/libgssdp/gssdp-net-win32.c
+++ b/libgssdp/gssdp-net-win32.c
@@ -201,19 +201,15 @@ gssdp_net_get_host_ip (GSSDPNetworkDevice *device)
}
if (p != NULL) {
- gint32 mask = 0;
+ GInetAddress *mask_addr;
device->host_ip = g_strdup (p);
- /* This relies on the compiler doing an arithmetic
- * shift here!
- */
- if (address_prefix->PrefixLength > 0) {
- mask = (gint32) 0x80000000;
- mask >>= address_prefix->PrefixLength - 1;
- }
- device->mask.sin_family = AF_INET;
- device->mask.sin_port = 0;
- device->mask.sin_addr.s_addr = htonl ((guint32) mask);
+ device->host_addr = g_inet_address_new_from_string (device->host_ip);
+ mask_addr = g_inet_address_new_from_string (q);
+ device->host_mask = g_inet_address_mask_new (mask_addr,
+ address_prefix->PrefixLength,
+ NULL);
+ g_object_unref (mask_addr);
if (device->iface_name == NULL)
device->iface_name = g_strdup (adapter->AdapterName);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]