Mercurial > pidgin.yaz
changeset 19268:db6218615be4
bcopy and bzero shouldn't be used. This allows Alver to compile nat-pmp.c on one of his obscure systems (and I fixed some other stuff that I noticed at the same time).
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 14 Aug 2007 18:31:01 +0000 |
parents | 8c126e388ea4 |
children | 85324e9d0821 |
files | libpurple/nat-pmp.c libpurple/protocols/bonjour/dns_sd_proxy.h libpurple/protocols/zephyr/zephyr.c libpurple/win32/libc_interface.h |
diffstat | 4 files changed, 17 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/nat-pmp.c Tue Aug 14 05:20:12 2007 +0000 +++ b/libpurple/nat-pmp.c Tue Aug 14 18:31:01 2007 +0000 @@ -210,19 +210,19 @@ struct sockaddr addr, mask; get_rtaddrs(rtm->rtm_addrs, sa, rti_info); - bzero(&addr, sizeof(addr)); + memset(&addr, 0, sizeof(addr)); if (rtm->rtm_addrs & RTA_DST) - bcopy(rti_info[RTAX_DST], &addr, rti_info[RTAX_DST]->sa_len); + memcpy(&addr, rti_info[RTAX_DST], sizeof(addr)); - bzero(&mask, sizeof(mask)); + memset(&mask, 0, sizeof(mask)); if (rtm->rtm_addrs & RTA_NETMASK) - bcopy(rti_info[RTAX_NETMASK], &mask, rti_info[RTAX_NETMASK]->sa_len); + memcpy(&mask, rti_info[RTAX_NETMASK], sizeof(mask)); if (rtm->rtm_addrs & RTA_GATEWAY && is_default_route(&addr, &mask)) - { + { if (rti_info[RTAX_GATEWAY]) { struct sockaddr_in *rti_sin = (struct sockaddr_in *)rti_info[RTAX_GATEWAY]; sin = g_new0(struct sockaddr_in, 1); @@ -291,10 +291,10 @@ sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); /* Clean out both req and resp structures */ - bzero(&req, sizeof(PurplePmpIpRequest)); - bzero(&resp, sizeof(PurplePmpIpResponse)); + memset(&req, 0, sizeof(PurplePmpIpRequest)); + memset(&resp, 0, sizeof(PurplePmpIpResponse)); req.version = 0; - req.opcode = 0; + req.opcode = 0; /* The NAT-PMP spec says we should attempt to contact the gateway 9 times, doubling the time we wait each time. * Even starting with a timeout of 0.1 seconds, that means that we have a total waiting of 204.6 seconds. @@ -323,12 +323,12 @@ g_free(gateway); pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; return NULL; - } + } /* TODO: Non-blocking! */ len = sizeof(struct sockaddr_in); if (recvfrom(sendfd, &resp, sizeof(PurplePmpIpResponse), 0, (struct sockaddr *)(&addr), &len) < 0) - { + { if (errno != EAGAIN) { purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", strerror(errno)); @@ -365,7 +365,7 @@ struct in_addr in; in.s_addr = resp.address; purple_debug_info("nat-pmp", "address: %s\n", inet_ntoa(in)); -#endif +#endif publicsockaddr->sin_addr.s_addr = resp.address; @@ -408,9 +408,9 @@ sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); /* Set up the req */ - bzero(&req, sizeof(PurplePmpMapRequest)); + memset(&req, 0, sizeof(PurplePmpMapRequest)); req.version = 0; - req.opcode = ((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP); + req.opcode = ((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP); req.privateport = htons(privateport); /* What a difference byte ordering makes...d'oh! */ req.publicport = htons(publicport); req.lifetime = htonl(lifetime); @@ -509,7 +509,7 @@ { static int handle; - return &handle; + return &handle; } void @@ -517,7 +517,7 @@ { purple_signal_connect(purple_network_get_handle(), "network-configuration-changed", purple_pmp_get_handle(), PURPLE_CALLBACK(purple_pmp_network_config_changed_cb), - GINT_TO_POINTER(0)); + GINT_TO_POINTER(0)); } #else /* #ifdef NET_RT_DUMP */ char *
--- a/libpurple/protocols/bonjour/dns_sd_proxy.h Tue Aug 14 05:20:12 2007 +0000 +++ b/libpurple/protocols/bonjour/dns_sd_proxy.h Tue Aug 14 18:31:01 2007 +0000 @@ -6,14 +6,8 @@ /* fixup to make pidgin compile against win32 bonjour */ #ifdef _WIN32 #define _MSL_STDINT_H -#undef bzero #endif #include <dns_sd.h> -/* dns_sd.h defines bzero and we also do in libc_internal.h */ -#ifdef _WIN32 -#undef bzero #endif - -#endif
--- a/libpurple/protocols/zephyr/zephyr.c Tue Aug 14 05:20:12 2007 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Tue Aug 14 18:31:01 2007 +0000 @@ -1151,7 +1151,7 @@ size_t bufsize = strlen(msg) + 3; char *buf = g_new0(char,bufsize); g_snprintf(buf,1+strlen(msg)+2," %c%s",'\0',msg); - bzero((char *)¬ice, sizeof(notice)); + memset((char *)¬ice, 0, sizeof(notice)); notice.z_kind = ACKED; notice.z_port = 0; notice.z_opcode = tree_child(find_node(newparsetree,"opcode"),2)->contents; @@ -2205,7 +2205,7 @@ } else if (use_zeph02(zephyr)) { ZNotice_t notice; char *buf = g_strdup_printf("%s%c%s", sig, '\0', html_buf2); - bzero((char *)¬ice, sizeof(notice)); + memset((char *)¬ice, 0, sizeof(notice)); notice.z_kind = ACKED; notice.z_port = 0;
--- a/libpurple/win32/libc_interface.h Tue Aug 14 05:20:12 2007 +0000 +++ b/libpurple/win32/libc_interface.h Tue Aug 14 18:31:01 2007 +0000 @@ -99,8 +99,6 @@ #define strerror( errornum ) \ wpurple_strerror( errornum ) -#define bzero( dest, size ) memset( dest, 0, size ) - /* unistd.h */ #define read( fd, buf, buflen ) \ wpurple_read( fd, buf, buflen )