Skip to content

Commit

Permalink
Merge branch 'master' of github.com:parrot/parrot
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Zhuo committed Jan 25, 2011
2 parents 7bbc1e7 + a29e645 commit 102e7e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions include/parrot/platform_interface.h
Expand Up @@ -91,6 +91,8 @@ INTVAL Parrot_io_send(PARROT_INTERP, PIOHANDLE handle, ARGIN(const char *buf), s
INTVAL Parrot_io_recv(PARROT_INTERP, PIOHANDLE handle, ARGOUT(char *buf), size_t len);
INTVAL Parrot_io_poll(PARROT_INTERP, PIOHANDLE handle, int which, int sec, int usec);
INTVAL Parrot_io_close_socket(PARROT_INTERP, PIOHANDLE handle);
PMC *Parrot_io_remote_address(PARROT_INTERP, ARGIN(PMC *sock));
PMC *Parrot_io_local_address(PARROT_INTERP, ARGIN(PMC *sock));

/*
** Math:
Expand Down
4 changes: 2 additions & 2 deletions src/io/socket_api.c
Expand Up @@ -301,7 +301,7 @@ Parrot_io_connect_handle(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(PMC *address))

/* Connect to an IPv6 addrinfo if an UnManagedStruct was provided as address */
if (!PMC_IS_NULL(address) && address->vtable->base_type == enum_class_UnManagedStruct) {
res = VTABLE_get_pointer(interp, address);
res = (struct addrinfo *)VTABLE_get_pointer(interp, address);

for (walk = res; walk != NULL; walk = walk->ai_next) {
fd = socket(walk->ai_family, walk->ai_socktype, walk->ai_protocol);
Expand Down Expand Up @@ -382,7 +382,7 @@ Parrot_io_bind_handle(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(PMC *address))

/* Bind to an IPv6 address (UnManagedStruct with an struct addrinfo inside */
if (!PMC_IS_NULL(address) && address->vtable->base_type == enum_class_UnManagedStruct) {
res = VTABLE_get_pointer(interp, address);
res = (struct addrinfo *)VTABLE_get_pointer(interp, address);

for (walk = res; walk != NULL; walk = walk->ai_next) {
fd = socket(walk->ai_family, walk->ai_socktype, walk->ai_protocol);
Expand Down
4 changes: 2 additions & 2 deletions src/platform/generic/socket.c
Expand Up @@ -259,8 +259,8 @@ Parrot_io_listen(SHIM_INTERP, PIOHANDLE os_handle, INTVAL sec)

/*
=item C<PIOHANDLE Parrot_io_accept(PARROT_INTERP, PIOHANDLE os_handle, void
*addr)>
=item C<PIOHANDLE Parrot_io_accept(PARROT_INTERP, PIOHANDLE os_handle, PMC *
remote_addr)>
Accept a new connection and return a newly created C<ParrotIO> socket.
Expand Down
5 changes: 2 additions & 3 deletions src/pmc/sockaddr.pmc
Expand Up @@ -137,7 +137,6 @@ Returns the string representation of this sockaddr by calling C<getnameinfo(3)>.
*/
VTABLE STRING *get_string() {
Parrot_Sockaddr_attributes * const data = PARROT_SOCKADDR(SELF);
struct sockaddr_storage *addr = data->pointer;
/* TODO: get hostname, not only numeric */
char buf[INET6_ADDRSTRLEN+1];
/* numeric port maximum is 65535, so 5 chars */
Expand All @@ -146,7 +145,7 @@ Returns the string representation of this sockaddr by calling C<getnameinfo(3)>.
if (!data->pointer)
return Parrot_sprintf_c(interp, "(?)");

getnameinfo((struct sockaddr_storage*)data->pointer, data->len, buf,
getnameinfo((struct sockaddr *)data->pointer, data->len, buf,
sizeof(buf), portbuf, sizeof(portbuf), NI_NUMERICHOST | NI_NUMERICSERV);
return Parrot_str_format_data(interp, "%s:%s", buf, portbuf);
}
Expand All @@ -166,7 +165,7 @@ Copies a C<sockaddr_in> or C<sockaddr_in6> from the given C<addrinfo> pointer
VTABLE void set_pointer(void *value) {
Parrot_Sockaddr_attributes * const data = PARROT_SOCKADDR(SELF);

struct addrinfo *walk = value;
struct addrinfo *walk = (struct addrinfo *)value;
memcpy(data->pointer, walk->ai_addr, walk->ai_addrlen);
data->len = walk->ai_addrlen;
}
Expand Down

0 comments on commit 102e7e2

Please sign in to comment.