diff options
author | LRN <lrn1986@gmail.com> | 2013-12-19 18:38:55 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-12-19 18:38:55 +0000 |
commit | a9e7ed1a67e96140bb2d41251de1520fc755f52c (patch) | |
tree | b5e5ddfc5087dd4510b0c73b4b03a9621f4cadbc /src | |
parent | 29a3fd0c128715ee22065776e51e8340d1e846d8 (diff) | |
download | gnunet-a9e7ed1a67e96140bb2d41251de1520fc755f52c.tar.gz gnunet-a9e7ed1a67e96140bb2d41251de1520fc755f52c.zip |
W32 NSP: Don't use 64-bit types, link to libgcc statically
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/Makefile.am | 2 | ||||
-rw-r--r-- | src/gns/gnunet-gns-helper-service-w32.c | 21 | ||||
-rw-r--r-- | src/gns/w32nsp.c | 16 | ||||
-rw-r--r-- | src/gns/w32resolver.h | 2 |
4 files changed, 14 insertions, 27 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index af982976e..fc115077f 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am | |||
@@ -212,7 +212,7 @@ libw32nsp_la_LIBADD = \ | |||
212 | -lole32 -lws2_32 | 212 | -lole32 -lws2_32 |
213 | libw32nsp_la_LDFLAGS = \ | 213 | libw32nsp_la_LDFLAGS = \ |
214 | -export-symbols $(top_srcdir)/src/gns/w32nsp.def \ | 214 | -export-symbols $(top_srcdir)/src/gns/w32nsp.def \ |
215 | $(GN_LIB_LDFLAGS) | 215 | $(GN_LIB_LDFLAGS) -static-libgcc |
216 | 216 | ||
217 | libgnunetgns_la_SOURCES = \ | 217 | libgnunetgns_la_SOURCES = \ |
218 | gns_api.c gns.h | 218 | gns_api.c gns.h |
diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c index 93b843697..9a17198af 100644 --- a/src/gns/gnunet-gns-helper-service-w32.c +++ b/src/gns/gnunet-gns-helper-service-w32.c | |||
@@ -364,10 +364,8 @@ process_lookup_result (void* cls, uint32_t rd_count, | |||
364 | msg->sc_data1 = htonl (rq->sc.Data1); | 364 | msg->sc_data1 = htonl (rq->sc.Data1); |
365 | msg->sc_data2 = htons (rq->sc.Data2); | 365 | msg->sc_data2 = htons (rq->sc.Data2); |
366 | msg->sc_data3 = htons (rq->sc.Data3); | 366 | msg->sc_data3 = htons (rq->sc.Data3); |
367 | msg->sc_data4 = 0; | ||
368 | for (i = 0; i < 8; i++) | 367 | for (i = 0; i < 8; i++) |
369 | msg->sc_data4 |= rq->sc.Data4[i] << ((7 - i) * 8); | 368 | msg->sc_data4[i] = rq->sc.Data4[i]; |
370 | msg->sc_data4 = GNUNET_htonll (msg->sc_data4); | ||
371 | qs = (WSAQUERYSETW *) &msg[1]; | 369 | qs = (WSAQUERYSETW *) &msg[1]; |
372 | ptr = (char *) &qs[1]; | 370 | ptr = (char *) &qs[1]; |
373 | GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg)); | 371 | GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg)); |
@@ -649,7 +647,6 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
649 | const struct GNUNET_W32RESOLVER_GetMessage *msg; | 647 | const struct GNUNET_W32RESOLVER_GetMessage *msg; |
650 | GUID sc; | 648 | GUID sc; |
651 | uint16_t size; | 649 | uint16_t size; |
652 | uint64_t data4; | ||
653 | int i; | 650 | int i; |
654 | const wchar_t *hostname; | 651 | const wchar_t *hostname; |
655 | int af; | 652 | int af; |
@@ -674,16 +671,20 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
674 | msg = (const struct GNUNET_W32RESOLVER_GetMessage *) message; | 671 | msg = (const struct GNUNET_W32RESOLVER_GetMessage *) message; |
675 | size = msize - sizeof (struct GNUNET_W32RESOLVER_GetMessage); | 672 | size = msize - sizeof (struct GNUNET_W32RESOLVER_GetMessage); |
676 | af = ntohl (msg->af); | 673 | af = ntohl (msg->af); |
677 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got NBO GUID: %08X-%04X-%04X-%016llX\n", | 674 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
678 | msg->sc_data1, msg->sc_data2, msg->sc_data3, msg->sc_data4); | 675 | "Got NBO GUID: %08X-%04X-%04X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n", |
676 | msg->sc_data1, msg->sc_data2, msg->sc_data3, msg->sc_data4[0], msg->sc_data4[1], | ||
677 | msg->sc_data4[2], msg->sc_data4[3], msg->sc_data4[4], msg->sc_data4[5], | ||
678 | msg->sc_data4[6], msg->sc_data4[7]); | ||
679 | sc.Data1 = ntohl (msg->sc_data1); | 679 | sc.Data1 = ntohl (msg->sc_data1); |
680 | sc.Data2 = ntohs (msg->sc_data2); | 680 | sc.Data2 = ntohs (msg->sc_data2); |
681 | sc.Data3 = ntohs (msg->sc_data3); | 681 | sc.Data3 = ntohs (msg->sc_data3); |
682 | data4 = GNUNET_ntohll (msg->sc_data4); | ||
683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got GUID: %08X-%04X-%04X-%016llX\n", | ||
684 | sc.Data1, sc.Data2, sc.Data3, data4); | ||
685 | for (i = 0; i < 8; i++) | 682 | for (i = 0; i < 8; i++) |
686 | sc.Data4[i] = 0xFF & (data4 >> ((7 - i) * 8)); | 683 | sc.Data4[i] = msg->sc_data4[i]; |
684 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
685 | "Got GUID: %08X-%04X-%04X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n", | ||
686 | sc.Data1, sc.Data2, sc.Data3, sc.Data4[0], sc.Data4[1], sc.Data4[2], | ||
687 | sc.Data4[3], sc.Data4[4], sc.Data4[5], sc.Data4[6], sc.Data4[7]); | ||
687 | 688 | ||
688 | hostname = (const wchar_t *) &msg[1]; | 689 | hostname = (const wchar_t *) &msg[1]; |
689 | if (hostname[size - 1] != L'\0') | 690 | if (hostname[size - 1] != L'\0') |
diff --git a/src/gns/w32nsp.c b/src/gns/w32nsp.c index d6a589d4f..fcd922560 100644 --- a/src/gns/w32nsp.c +++ b/src/gns/w32nsp.c | |||
@@ -82,18 +82,6 @@ | |||
82 | #define STATE_REPLY 0x04 | 82 | #define STATE_REPLY 0x04 |
83 | #define STATE_GHBN 0x08 | 83 | #define STATE_GHBN 0x08 |
84 | 84 | ||
85 | uint64_t | ||
86 | GNUNET_htonll (uint64_t n) | ||
87 | { | ||
88 | #if __BYTE_ORDER == __BIG_ENDIAN | ||
89 | return n; | ||
90 | #elif __BYTE_ORDER == __LITTLE_ENDIAN | ||
91 | return (((uint64_t) htonl (n)) << 32) + htonl (n >> 32); | ||
92 | #else | ||
93 | #error byteorder undefined | ||
94 | #endif | ||
95 | } | ||
96 | |||
97 | CRITICAL_SECTION records_cs; | 85 | CRITICAL_SECTION records_cs; |
98 | 86 | ||
99 | struct record | 87 | struct record |
@@ -258,10 +246,8 @@ send_name_to_ip_request (LPWSAQUERYSETW lpqsRestrictions, | |||
258 | msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1); | 246 | msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1); |
259 | msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2); | 247 | msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2); |
260 | msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3); | 248 | msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3); |
261 | msg->sc_data4 = 0; | ||
262 | for (i = 0; i < 8; i++) | 249 | for (i = 0; i < 8; i++) |
263 | msg->sc_data4 |= ((uint64_t) lpqsRestrictions->lpServiceClassId->Data4[i]) << ((7 - i) * 8); | 250 | msg->sc_data4[i] = lpqsRestrictions->lpServiceClassId->Data4[i]; |
264 | msg->sc_data4 = GNUNET_htonll (msg->sc_data4); | ||
265 | *resolver = connect_to_dns_resolver (); | 251 | *resolver = connect_to_dns_resolver (); |
266 | if (*resolver != INVALID_SOCKET) | 252 | if (*resolver != INVALID_SOCKET) |
267 | { | 253 | { |
diff --git a/src/gns/w32resolver.h b/src/gns/w32resolver.h index 4fd76a94f..ce5f668a3 100644 --- a/src/gns/w32resolver.h +++ b/src/gns/w32resolver.h | |||
@@ -62,7 +62,7 @@ struct GNUNET_W32RESOLVER_GetMessage | |||
62 | uint32_t sc_data1 GNUNET_PACKED; | 62 | uint32_t sc_data1 GNUNET_PACKED; |
63 | uint16_t sc_data2 GNUNET_PACKED; | 63 | uint16_t sc_data2 GNUNET_PACKED; |
64 | uint16_t sc_data3 GNUNET_PACKED; | 64 | uint16_t sc_data3 GNUNET_PACKED; |
65 | uint64_t sc_data4 GNUNET_PACKED; | 65 | uint8_t sc_data4[8]; |
66 | /* followed by 0-terminated string for A/AAAA lookup */ | 66 | /* followed by 0-terminated string for A/AAAA lookup */ |
67 | }; | 67 | }; |
68 | 68 | ||