Created
December 31, 2014 09:59
-
-
Save saghul/776f759a7cc5318af810 to your computer and use it in GitHub Desktop.
astyle test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/fs-poll.c b/src/fs-poll.c | |
index 0de15b1..e365af4 100644 | |
--- a/src/fs-poll.c | |
+++ b/src/fs-poll.c | |
@@ -225,19 +225,19 @@ static void timer_close_cb(uv_handle_t* handle) { | |
static int statbuf_eq(const uv_stat_t* a, const uv_stat_t* b) { | |
return a->st_ctim.tv_nsec == b->st_ctim.tv_nsec | |
- && a->st_mtim.tv_nsec == b->st_mtim.tv_nsec | |
- && a->st_birthtim.tv_nsec == b->st_birthtim.tv_nsec | |
- && a->st_ctim.tv_sec == b->st_ctim.tv_sec | |
- && a->st_mtim.tv_sec == b->st_mtim.tv_sec | |
- && a->st_birthtim.tv_sec == b->st_birthtim.tv_sec | |
- && a->st_size == b->st_size | |
- && a->st_mode == b->st_mode | |
- && a->st_uid == b->st_uid | |
- && a->st_gid == b->st_gid | |
- && a->st_ino == b->st_ino | |
- && a->st_dev == b->st_dev | |
- && a->st_flags == b->st_flags | |
- && a->st_gen == b->st_gen; | |
+ && a->st_mtim.tv_nsec == b->st_mtim.tv_nsec | |
+ && a->st_birthtim.tv_nsec == b->st_birthtim.tv_nsec | |
+ && a->st_ctim.tv_sec == b->st_ctim.tv_sec | |
+ && a->st_mtim.tv_sec == b->st_mtim.tv_sec | |
+ && a->st_birthtim.tv_sec == b->st_birthtim.tv_sec | |
+ && a->st_size == b->st_size | |
+ && a->st_mode == b->st_mode | |
+ && a->st_uid == b->st_uid | |
+ && a->st_gid == b->st_gid | |
+ && a->st_ino == b->st_ino | |
+ && a->st_dev == b->st_dev | |
+ && a->st_flags == b->st_flags | |
+ && a->st_gen == b->st_gen; | |
} | |
diff --git a/src/inet.c b/src/inet.c | |
index c948b2e..fe45846 100644 | |
--- a/src/inet.c | |
+++ b/src/inet.c | |
@@ -39,12 +39,12 @@ static int inet_pton6(const char *src, unsigned char *dst); | |
int uv_inet_ntop(int af, const void* src, char* dst, size_t size) { | |
switch (af) { | |
- case AF_INET: | |
- return (inet_ntop4(src, dst, size)); | |
- case AF_INET6: | |
- return (inet_ntop6(src, dst, size)); | |
- default: | |
- return UV_EAFNOSUPPORT; | |
+ case AF_INET: | |
+ return (inet_ntop4(src, dst, size)); | |
+ case AF_INET6: | |
+ return (inet_ntop6(src, dst, size)); | |
+ default: | |
+ return UV_EAFNOSUPPORT; | |
} | |
/* NOTREACHED */ | |
} | |
@@ -78,7 +78,9 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { | |
* to use pointer overlays. All the world's not a VAX. | |
*/ | |
char tmp[UV__INET6_ADDRSTRLEN], *tp; | |
- struct { int base, len; } best, cur; | |
+ struct { | |
+ int base, len; | |
+ } best, cur; | |
unsigned int words[sizeof(struct in6_addr) / sizeof(uint16_t)]; | |
int i; | |
@@ -132,8 +134,8 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { | |
*tp++ = ':'; | |
/* Is this address an encapsulated IPv4? */ | |
if (i == 6 && best.base == 0 && (best.len == 6 || | |
- (best.len == 7 && words[7] != 0x0001) || | |
- (best.len == 5 && words[5] == 0xffff))) { | |
+ (best.len == 7 && words[7] != 0x0001) || | |
+ (best.len == 5 && words[5] == 0xffff))) { | |
int err = inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)); | |
if (err) | |
return err; | |
@@ -163,25 +165,25 @@ int uv_inet_pton(int af, const char* src, void* dst) { | |
return UV_EINVAL; | |
switch (af) { | |
- case AF_INET: | |
- return (inet_pton4(src, dst)); | |
- case AF_INET6: { | |
- int len; | |
- char tmp[UV__INET6_ADDRSTRLEN], *s, *p; | |
- s = (char*) src; | |
- p = strchr(src, '%'); | |
- if (p != NULL) { | |
- s = tmp; | |
- len = p - src; | |
- if (len > UV__INET6_ADDRSTRLEN-1) | |
- return UV_EINVAL; | |
- memcpy(s, src, len); | |
- s[len] = '\0'; | |
+ case AF_INET: | |
+ return (inet_pton4(src, dst)); | |
+ case AF_INET6: { | |
+ int len; | |
+ char tmp[UV__INET6_ADDRSTRLEN], *s, *p; | |
+ s = (char*) src; | |
+ p = strchr(src, '%'); | |
+ if (p != NULL) { | |
+ s = tmp; | |
+ len = p - src; | |
+ if (len > UV__INET6_ADDRSTRLEN-1) | |
+ return UV_EINVAL; | |
+ memcpy(s, src, len); | |
+ s[len] = '\0'; | |
+ } | |
+ return inet_pton6(s, dst); | |
} | |
- return inet_pton6(s, dst); | |
- } | |
- default: | |
- return UV_EAFNOSUPPORT; | |
+ default: | |
+ return UV_EAFNOSUPPORT; | |
} | |
/* NOTREACHED */ | |
} | |
@@ -228,7 +230,7 @@ static int inet_pton4(const char *src, unsigned char *dst) { | |
static int inet_pton6(const char *src, unsigned char *dst) { | |
static const char xdigits_l[] = "0123456789abcdef", | |
- xdigits_u[] = "0123456789ABCDEF"; | |
+ xdigits_u[] = "0123456789ABCDEF"; | |
unsigned char tmp[sizeof(struct in6_addr)], *tp, *endp, *colonp; | |
const char *xdigits, *curtok; | |
int ch, seen_xdigits; | |
diff --git a/src/threadpool.c b/src/threadpool.c | |
index 33890f0..a68956f 100644 | |
--- a/src/threadpool.c | |
+++ b/src/threadpool.c | |
@@ -279,24 +279,24 @@ int uv_cancel(uv_req_t* req) { | |
uv_loop_t* loop; | |
switch (req->type) { | |
- case UV_FS: | |
- loop = ((uv_fs_t*) req)->loop; | |
- wreq = &((uv_fs_t*) req)->work_req; | |
- break; | |
- case UV_GETADDRINFO: | |
- loop = ((uv_getaddrinfo_t*) req)->loop; | |
- wreq = &((uv_getaddrinfo_t*) req)->work_req; | |
- break; | |
- case UV_GETNAMEINFO: | |
- loop = ((uv_getnameinfo_t*) req)->loop; | |
- wreq = &((uv_getnameinfo_t*) req)->work_req; | |
- break; | |
- case UV_WORK: | |
- loop = ((uv_work_t*) req)->loop; | |
- wreq = &((uv_work_t*) req)->work_req; | |
- break; | |
- default: | |
- return UV_EINVAL; | |
+ case UV_FS: | |
+ loop = ((uv_fs_t*) req)->loop; | |
+ wreq = &((uv_fs_t*) req)->work_req; | |
+ break; | |
+ case UV_GETADDRINFO: | |
+ loop = ((uv_getaddrinfo_t*) req)->loop; | |
+ wreq = &((uv_getaddrinfo_t*) req)->work_req; | |
+ break; | |
+ case UV_GETNAMEINFO: | |
+ loop = ((uv_getnameinfo_t*) req)->loop; | |
+ wreq = &((uv_getnameinfo_t*) req)->work_req; | |
+ break; | |
+ case UV_WORK: | |
+ loop = ((uv_work_t*) req)->loop; | |
+ wreq = &((uv_work_t*) req)->work_req; | |
+ break; | |
+ default: | |
+ return UV_EINVAL; | |
} | |
return uv__work_cancel(loop, req, wreq); | |
diff --git a/src/unix/aix.c b/src/unix/aix.c | |
index 349c2b5..4d2d7a6 100644 | |
--- a/src/unix/aix.c | |
+++ b/src/unix/aix.c | |
@@ -134,12 +134,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { | |
pqry.fd = pc.fd; | |
rc = pollset_query(loop->backend_fd, &pqry); | |
switch (rc) { | |
- case -1: | |
- assert(0 && "Failed to query pollset for file descriptor"); | |
- abort(); | |
- case 0: | |
- assert(0 && "Pollset does not contain file descriptor"); | |
- abort(); | |
+ case -1: | |
+ assert(0 && "Failed to query pollset for file descriptor"); | |
+ abort(); | |
+ case 0: | |
+ assert(0 && "Pollset does not contain file descriptor"); | |
+ abort(); | |
} | |
/* If we got here then the pollset already contained the file descriptor even though | |
* we didn't think it should. This probably shouldn't happen, but we can continue. */ | |
@@ -320,7 +320,7 @@ int uv_exepath(char* buffer, size_t* size) { | |
* Three possibilities for argv[0]: | |
* i) an absolute path such as: /home/user/myprojects/nodejs/node | |
* ii) a relative path such as: ./node or ./myprojects/nodejs/node | |
- * iii) a bare filename such as "node", after exporting PATH variable | |
+ * iii) a bare filename such as "node", after exporting PATH variable | |
* to its location. | |
*/ | |
@@ -331,16 +331,16 @@ int uv_exepath(char* buffer, size_t* size) { | |
/* This could or could not be a symlink. */ | |
res = readlink(symlink, temp_buffer, PATH_MAX-1); | |
- /* if readlink fails, it is a normal file just copy symlink to the | |
+ /* if readlink fails, it is a normal file just copy symlink to the | |
* output buffer. | |
*/ | |
if (res < 0) { | |
assert(*size > strlen(symlink)); | |
strcpy(buffer, symlink); | |
- /* If it is a link, the resolved filename is again a relative path, | |
- * make it absolute. | |
- */ | |
+ /* If it is a link, the resolved filename is again a relative path, | |
+ * make it absolute. | |
+ */ | |
} else { | |
assert(*size > (strlen(symlink) + 1 + strlen(temp_buffer))); | |
snprintf(buffer, *size-1, "%s/%s", dirname(symlink), temp_buffer); | |
@@ -348,7 +348,7 @@ int uv_exepath(char* buffer, size_t* size) { | |
*size = strlen(buffer); | |
return 0; | |
- /* case #2, relative path with usage of '.' */ | |
+ /* case #2, relative path with usage of '.' */ | |
} else if (argv[0][0] == '.') { | |
char *relative = strchr(argv[0], '/'); | |
if (relative == NULL) | |
@@ -375,7 +375,7 @@ int uv_exepath(char* buffer, size_t* size) { | |
*size = strlen(buffer); | |
return 0; | |
- /* case #3, relative path without usage of '.', such as invocations in Node test suite. */ | |
+ /* case #3, relative path without usage of '.', such as invocations in Node test suite. */ | |
} else if (strchr(argv[0], '/') != NULL) { | |
/* Get the current working directory to resolve the relative path. */ | |
snprintf(cwd, PATH_MAX-1, "/proc/%lu/cwd", (unsigned long) getpid()); | |
@@ -397,7 +397,7 @@ int uv_exepath(char* buffer, size_t* size) { | |
} | |
*size = strlen(buffer); | |
return 0; | |
- /* Usage of absolute filename with location exported in PATH */ | |
+ /* Usage of absolute filename with location exported in PATH */ | |
} else { | |
char clonedpath[8192]; /* assume 8k buffer will fit PATH */ | |
char *token = NULL; | |
@@ -492,7 +492,9 @@ void uv_loadavg(double avg[3]) { | |
perfstat_cpu_total_t ps_total; | |
int result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1); | |
if (result == -1) { | |
- avg[0] = 0.; avg[1] = 0.; avg[2] = 0.; | |
+ avg[0] = 0.; | |
+ avg[1] = 0.; | |
+ avg[2] = 0.; | |
return; | |
} | |
avg[0] = ps_total.loadavg[0] / (double)(1 << SBITS); | |
@@ -517,7 +519,7 @@ static char *uv__rawname(char *cp) { | |
} | |
-/* | |
+/* | |
* Determine whether given pathname is a directory | |
* Returns 0 if the path is a directory, -1 if not | |
* | |
@@ -537,11 +539,11 @@ static int uv__path_is_a_directory(char* filename) { | |
} | |
-/* | |
+/* | |
* Check whether AHAFS is mounted. | |
* Returns 0 if AHAFS is mounted, or an error code < 0 on failure | |
*/ | |
-static int uv__is_ahafs_mounted(void){ | |
+static int uv__is_ahafs_mounted(void) { | |
int rv, i = 2; | |
struct vmount *p; | |
int size_multiplier = 10; | |
@@ -612,7 +614,7 @@ static int uv__makedir_p(const char *dir) { | |
return mkdir(tmp, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); | |
} | |
-/* | |
+/* | |
* Creates necessary subdirectories in the AIX Event Infrastructure | |
* file system for monitoring the object specified. | |
* Returns code from mkdir call | |
@@ -637,7 +639,7 @@ static int uv__make_subdirs_p(const char *filename) { | |
strncat(cmd, filename, (p - filename)); | |
rc = uv__makedir_p(cmd); | |
- if (rc == -1 && errno != EEXIST){ | |
+ if (rc == -1 && errno != EEXIST) { | |
return -errno; | |
} | |
@@ -675,7 +677,8 @@ static int uv__setup_ahafs(const char* filename, int *fd) { | |
strcat(mon_file, filename); | |
strcat(mon_file, ".mon"); | |
- *fd = 0; errno = 0; | |
+ *fd = 0; | |
+ errno = 0; | |
/* Open the monitor file, creating it if necessary */ | |
*fd = open(mon_file, O_CREAT|O_RDWR); | |
@@ -730,7 +733,7 @@ static int uv__skip_lines(char **p, int n) { | |
/* | |
* Parse the event occurrence data to figure out what event just occurred | |
* and take proper action. | |
- * | |
+ * | |
* The buf is a pointer to the buffer containing the event occurrence data | |
* Returns 0 on success, -1 if unrecoverable error in parsing | |
* | |
@@ -784,15 +787,14 @@ static int uv__parse_data(char *buf, int *events, uv_fs_event_t* handle) { | |
handle->dir_filename = strdup((const char*)&filename); | |
} else | |
return -1; | |
- } | |
+ } | |
} else { /* Regular File */ | |
if (evp_rc == AHAFS_MODFILE_RENAME) | |
*events = UV_RENAME; | |
else | |
*events = UV_CHANGE; | |
} | |
- } | |
- else | |
+ } else | |
return -1; | |
return 0; | |
@@ -834,7 +836,7 @@ static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int | |
*/ | |
if (uv__path_is_a_directory(handle->path) == 0) { | |
p = handle->dir_filename; | |
- while(*p != NULL){ | |
+ while(*p != NULL) { | |
fname[i]= *p; | |
i++; | |
p++; | |
@@ -1102,7 +1104,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { | |
int uv_interface_addresses(uv_interface_address_t** addresses, | |
- int* count) { | |
+ int* count) { | |
uv_interface_address_t* address; | |
int sockfd, size = 1; | |
struct ifconf ifc; | |
@@ -1133,7 +1135,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { | |
p = ifr; | |
ifr = (struct ifreq*) | |
- ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); | |
+ ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); | |
if (!(p->ifr_addr.sa_family == AF_INET6 || | |
p->ifr_addr.sa_family == AF_INET)) | |
@@ -1153,7 +1155,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
/* Alloc the return interface structs */ | |
*addresses = (uv_interface_address_t*) | |
- malloc(*count * sizeof(uv_interface_address_t)); | |
+ malloc(*count * sizeof(uv_interface_address_t)); | |
if (!(*addresses)) { | |
uv__close(sockfd); | |
return -ENOMEM; | |
@@ -1164,7 +1166,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { | |
p = ifr; | |
ifr = (struct ifreq*) | |
- ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); | |
+ ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); | |
if (!(p->ifr_addr.sa_family == AF_INET6 || | |
p->ifr_addr.sa_family == AF_INET)) | |
@@ -1204,7 +1206,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
int i; | |
for (i = 0; i < count; ++i) { | |
diff --git a/src/unix/android-ifaddrs.c b/src/unix/android-ifaddrs.c | |
index 3cda578..9cfa14a 100644 | |
--- a/src/unix/android-ifaddrs.c | |
+++ b/src/unix/android-ifaddrs.c | |
@@ -35,668 +35,568 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
#include <linux/netlink.h> | |
#include <linux/rtnetlink.h> | |
-typedef struct NetlinkList | |
-{ | |
- struct NetlinkList *m_next; | |
- struct nlmsghdr *m_data; | |
- unsigned int m_size; | |
+typedef struct NetlinkList { | |
+ struct NetlinkList *m_next; | |
+ struct nlmsghdr *m_data; | |
+ unsigned int m_size; | |
} NetlinkList; | |
-static int netlink_socket(void) | |
-{ | |
- struct sockaddr_nl l_addr; | |
+static int netlink_socket(void) { | |
+ struct sockaddr_nl l_addr; | |
- int l_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); | |
- if(l_socket < 0) | |
- { | |
- return -1; | |
- } | |
+ int l_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); | |
+ if(l_socket < 0) { | |
+ return -1; | |
+ } | |
- memset(&l_addr, 0, sizeof(l_addr)); | |
- l_addr.nl_family = AF_NETLINK; | |
- if(bind(l_socket, (struct sockaddr *)&l_addr, sizeof(l_addr)) < 0) | |
- { | |
- close(l_socket); | |
- return -1; | |
- } | |
+ memset(&l_addr, 0, sizeof(l_addr)); | |
+ l_addr.nl_family = AF_NETLINK; | |
+ if(bind(l_socket, (struct sockaddr *)&l_addr, sizeof(l_addr)) < 0) { | |
+ close(l_socket); | |
+ return -1; | |
+ } | |
- return l_socket; | |
+ return l_socket; | |
} | |
-static int netlink_send(int p_socket, int p_request) | |
-{ | |
- char l_buffer[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct rtgenmsg))]; | |
+static int netlink_send(int p_socket, int p_request) { | |
+ char l_buffer[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct rtgenmsg))]; | |
- struct nlmsghdr *l_hdr; | |
- struct rtgenmsg *l_msg; | |
- struct sockaddr_nl l_addr; | |
+ struct nlmsghdr *l_hdr; | |
+ struct rtgenmsg *l_msg; | |
+ struct sockaddr_nl l_addr; | |
- memset(l_buffer, 0, sizeof(l_buffer)); | |
+ memset(l_buffer, 0, sizeof(l_buffer)); | |
- l_hdr = (struct nlmsghdr *)l_buffer; | |
- l_msg = (struct rtgenmsg *)NLMSG_DATA(l_hdr); | |
+ l_hdr = (struct nlmsghdr *)l_buffer; | |
+ l_msg = (struct rtgenmsg *)NLMSG_DATA(l_hdr); | |
- l_hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*l_msg)); | |
- l_hdr->nlmsg_type = p_request; | |
- l_hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; | |
- l_hdr->nlmsg_pid = 0; | |
- l_hdr->nlmsg_seq = p_socket; | |
- l_msg->rtgen_family = AF_UNSPEC; | |
+ l_hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*l_msg)); | |
+ l_hdr->nlmsg_type = p_request; | |
+ l_hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; | |
+ l_hdr->nlmsg_pid = 0; | |
+ l_hdr->nlmsg_seq = p_socket; | |
+ l_msg->rtgen_family = AF_UNSPEC; | |
- memset(&l_addr, 0, sizeof(l_addr)); | |
- l_addr.nl_family = AF_NETLINK; | |
- return (sendto(p_socket, l_hdr, l_hdr->nlmsg_len, 0, (struct sockaddr *)&l_addr, sizeof(l_addr))); | |
+ memset(&l_addr, 0, sizeof(l_addr)); | |
+ l_addr.nl_family = AF_NETLINK; | |
+ return (sendto(p_socket, l_hdr, l_hdr->nlmsg_len, 0, (struct sockaddr *)&l_addr, sizeof(l_addr))); | |
} | |
-static int netlink_recv(int p_socket, void *p_buffer, size_t p_len) | |
-{ | |
- struct sockaddr_nl l_addr; | |
- struct msghdr l_msg; | |
- | |
- struct iovec l_iov; | |
- l_iov.iov_base = p_buffer; | |
- l_iov.iov_len = p_len; | |
- | |
- for(;;) | |
- { | |
- int l_result; | |
- l_msg.msg_name = (void *)&l_addr; | |
- l_msg.msg_namelen = sizeof(l_addr); | |
- l_msg.msg_iov = &l_iov; | |
- l_msg.msg_iovlen = 1; | |
- l_msg.msg_control = NULL; | |
- l_msg.msg_controllen = 0; | |
- l_msg.msg_flags = 0; | |
- l_result = recvmsg(p_socket, &l_msg, 0); | |
- | |
- if(l_result < 0) | |
- { | |
- if(errno == EINTR) | |
- { | |
- continue; | |
- } | |
- return -2; | |
- } | |
+static int netlink_recv(int p_socket, void *p_buffer, size_t p_len) { | |
+ struct sockaddr_nl l_addr; | |
+ struct msghdr l_msg; | |
- /* Buffer was too small */ | |
- if(l_msg.msg_flags & MSG_TRUNC) | |
- { | |
- return -1; | |
- } | |
- return l_result; | |
+ struct iovec l_iov; | |
+ l_iov.iov_base = p_buffer; | |
+ l_iov.iov_len = p_len; | |
+ | |
+ for(;;) { | |
+ int l_result; | |
+ l_msg.msg_name = (void *)&l_addr; | |
+ l_msg.msg_namelen = sizeof(l_addr); | |
+ l_msg.msg_iov = &l_iov; | |
+ l_msg.msg_iovlen = 1; | |
+ l_msg.msg_control = NULL; | |
+ l_msg.msg_controllen = 0; | |
+ l_msg.msg_flags = 0; | |
+ l_result = recvmsg(p_socket, &l_msg, 0); | |
+ | |
+ if(l_result < 0) { | |
+ if(errno == EINTR) { | |
+ continue; | |
+ } | |
+ return -2; | |
+ } | |
+ | |
+ /* Buffer was too small */ | |
+ if(l_msg.msg_flags & MSG_TRUNC) { | |
+ return -1; | |
} | |
+ return l_result; | |
+ } | |
} | |
-static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_done) | |
-{ | |
- size_t l_size = 4096; | |
- void *l_buffer = NULL; | |
+static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_done) { | |
+ size_t l_size = 4096; | |
+ void *l_buffer = NULL; | |
- for(;;) | |
- { | |
- int l_read; | |
+ for(;;) { | |
+ int l_read; | |
- free(l_buffer); | |
- l_buffer = malloc(l_size); | |
- if (l_buffer == NULL) | |
- { | |
- return NULL; | |
- } | |
+ free(l_buffer); | |
+ l_buffer = malloc(l_size); | |
+ if (l_buffer == NULL) { | |
+ return NULL; | |
+ } | |
- l_read = netlink_recv(p_socket, l_buffer, l_size); | |
- *p_size = l_read; | |
- if(l_read == -2) | |
- { | |
- free(l_buffer); | |
- return NULL; | |
+ l_read = netlink_recv(p_socket, l_buffer, l_size); | |
+ *p_size = l_read; | |
+ if(l_read == -2) { | |
+ free(l_buffer); | |
+ return NULL; | |
+ } | |
+ if(l_read >= 0) { | |
+ pid_t l_pid = getpid(); | |
+ struct nlmsghdr *l_hdr; | |
+ for(l_hdr = (struct nlmsghdr *)l_buffer; NLMSG_OK(l_hdr, (unsigned int)l_read); l_hdr = (struct nlmsghdr *)NLMSG_NEXT(l_hdr, l_read)) { | |
+ if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) { | |
+ continue; | |
} | |
- if(l_read >= 0) | |
- { | |
- pid_t l_pid = getpid(); | |
- struct nlmsghdr *l_hdr; | |
- for(l_hdr = (struct nlmsghdr *)l_buffer; NLMSG_OK(l_hdr, (unsigned int)l_read); l_hdr = (struct nlmsghdr *)NLMSG_NEXT(l_hdr, l_read)) | |
- { | |
- if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) | |
- { | |
- continue; | |
- } | |
- | |
- if(l_hdr->nlmsg_type == NLMSG_DONE) | |
- { | |
- *p_done = 1; | |
- break; | |
- } | |
- | |
- if(l_hdr->nlmsg_type == NLMSG_ERROR) | |
- { | |
- free(l_buffer); | |
- return NULL; | |
- } | |
- } | |
- return l_buffer; | |
+ | |
+ if(l_hdr->nlmsg_type == NLMSG_DONE) { | |
+ *p_done = 1; | |
+ break; | |
} | |
- l_size *= 2; | |
+ if(l_hdr->nlmsg_type == NLMSG_ERROR) { | |
+ free(l_buffer); | |
+ return NULL; | |
+ } | |
+ } | |
+ return l_buffer; | |
} | |
+ | |
+ l_size *= 2; | |
+ } | |
} | |
-static NetlinkList *newListItem(struct nlmsghdr *p_data, unsigned int p_size) | |
-{ | |
- NetlinkList *l_item = malloc(sizeof(NetlinkList)); | |
- if (l_item == NULL) | |
- { | |
- return NULL; | |
- } | |
+static NetlinkList *newListItem(struct nlmsghdr *p_data, unsigned int p_size) { | |
+ NetlinkList *l_item = malloc(sizeof(NetlinkList)); | |
+ if (l_item == NULL) { | |
+ return NULL; | |
+ } | |
- l_item->m_next = NULL; | |
- l_item->m_data = p_data; | |
- l_item->m_size = p_size; | |
- return l_item; | |
+ l_item->m_next = NULL; | |
+ l_item->m_data = p_data; | |
+ l_item->m_size = p_size; | |
+ return l_item; | |
} | |
-static void freeResultList(NetlinkList *p_list) | |
-{ | |
- NetlinkList *l_cur; | |
- while(p_list) | |
- { | |
- l_cur = p_list; | |
- p_list = p_list->m_next; | |
- free(l_cur->m_data); | |
- free(l_cur); | |
- } | |
+static void freeResultList(NetlinkList *p_list) { | |
+ NetlinkList *l_cur; | |
+ while(p_list) { | |
+ l_cur = p_list; | |
+ p_list = p_list->m_next; | |
+ free(l_cur->m_data); | |
+ free(l_cur); | |
+ } | |
} | |
-static NetlinkList *getResultList(int p_socket, int p_request) | |
-{ | |
- int l_size; | |
- int l_done; | |
- NetlinkList *l_list; | |
- NetlinkList *l_end; | |
+static NetlinkList *getResultList(int p_socket, int p_request) { | |
+ int l_size; | |
+ int l_done; | |
+ NetlinkList *l_list; | |
+ NetlinkList *l_end; | |
- if(netlink_send(p_socket, p_request) < 0) | |
- { | |
- return NULL; | |
- } | |
+ if(netlink_send(p_socket, p_request) < 0) { | |
+ return NULL; | |
+ } | |
- l_list = NULL; | |
- l_end = NULL; | |
+ l_list = NULL; | |
+ l_end = NULL; | |
- l_done = 0; | |
- while(!l_done) | |
- { | |
- NetlinkList *l_item; | |
+ l_done = 0; | |
+ while(!l_done) { | |
+ NetlinkList *l_item; | |
- struct nlmsghdr *l_hdr = getNetlinkResponse(p_socket, &l_size, &l_done); | |
- /* Error */ | |
- if(!l_hdr) | |
- { | |
- freeResultList(l_list); | |
- return NULL; | |
- } | |
+ struct nlmsghdr *l_hdr = getNetlinkResponse(p_socket, &l_size, &l_done); | |
+ /* Error */ | |
+ if(!l_hdr) { | |
+ freeResultList(l_list); | |
+ return NULL; | |
+ } | |
- l_item = newListItem(l_hdr, l_size); | |
- if (!l_item) | |
- { | |
- freeResultList(l_list); | |
- return NULL; | |
- } | |
- if(!l_list) | |
- { | |
- l_list = l_item; | |
- } | |
- else | |
- { | |
- l_end->m_next = l_item; | |
- } | |
- l_end = l_item; | |
+ l_item = newListItem(l_hdr, l_size); | |
+ if (!l_item) { | |
+ freeResultList(l_list); | |
+ return NULL; | |
} | |
- return l_list; | |
+ if(!l_list) { | |
+ l_list = l_item; | |
+ } else { | |
+ l_end->m_next = l_item; | |
+ } | |
+ l_end = l_item; | |
+ } | |
+ return l_list; | |
} | |
-static size_t maxSize(size_t a, size_t b) | |
-{ | |
- return (a > b ? a : b); | |
+static size_t maxSize(size_t a, size_t b) { | |
+ return (a > b ? a : b); | |
} | |
-static size_t calcAddrLen(sa_family_t p_family, int p_dataSize) | |
-{ | |
- switch(p_family) | |
- { | |
- case AF_INET: | |
- return sizeof(struct sockaddr_in); | |
- case AF_INET6: | |
- return sizeof(struct sockaddr_in6); | |
- case AF_PACKET: | |
- return maxSize(sizeof(struct sockaddr_ll), offsetof(struct sockaddr_ll, sll_addr) + p_dataSize); | |
- default: | |
- return maxSize(sizeof(struct sockaddr), offsetof(struct sockaddr, sa_data) + p_dataSize); | |
- } | |
+static size_t calcAddrLen(sa_family_t p_family, int p_dataSize) { | |
+ switch(p_family) { | |
+ case AF_INET: | |
+ return sizeof(struct sockaddr_in); | |
+ case AF_INET6: | |
+ return sizeof(struct sockaddr_in6); | |
+ case AF_PACKET: | |
+ return maxSize(sizeof(struct sockaddr_ll), offsetof(struct sockaddr_ll, sll_addr) + p_dataSize); | |
+ default: | |
+ return maxSize(sizeof(struct sockaddr), offsetof(struct sockaddr, sa_data) + p_dataSize); | |
+ } | |
} | |
-static void makeSockaddr(sa_family_t p_family, struct sockaddr *p_dest, void *p_data, size_t p_size) | |
-{ | |
- switch(p_family) | |
- { | |
- case AF_INET: | |
- memcpy(&((struct sockaddr_in*)p_dest)->sin_addr, p_data, p_size); | |
- break; | |
- case AF_INET6: | |
- memcpy(&((struct sockaddr_in6*)p_dest)->sin6_addr, p_data, p_size); | |
- break; | |
- case AF_PACKET: | |
- memcpy(((struct sockaddr_ll*)p_dest)->sll_addr, p_data, p_size); | |
- ((struct sockaddr_ll*)p_dest)->sll_halen = p_size; | |
- break; | |
- default: | |
- memcpy(p_dest->sa_data, p_data, p_size); | |
- break; | |
- } | |
- p_dest->sa_family = p_family; | |
+static void makeSockaddr(sa_family_t p_family, struct sockaddr *p_dest, void *p_data, size_t p_size) { | |
+ switch(p_family) { | |
+ case AF_INET: | |
+ memcpy(&((struct sockaddr_in*)p_dest)->sin_addr, p_data, p_size); | |
+ break; | |
+ case AF_INET6: | |
+ memcpy(&((struct sockaddr_in6*)p_dest)->sin6_addr, p_data, p_size); | |
+ break; | |
+ case AF_PACKET: | |
+ memcpy(((struct sockaddr_ll*)p_dest)->sll_addr, p_data, p_size); | |
+ ((struct sockaddr_ll*)p_dest)->sll_halen = p_size; | |
+ break; | |
+ default: | |
+ memcpy(p_dest->sa_data, p_data, p_size); | |
+ break; | |
+ } | |
+ p_dest->sa_family = p_family; | |
} | |
-static void addToEnd(struct ifaddrs **p_resultList, struct ifaddrs *p_entry) | |
-{ | |
- if(!*p_resultList) | |
- { | |
- *p_resultList = p_entry; | |
- } | |
- else | |
- { | |
- struct ifaddrs *l_cur = *p_resultList; | |
- while(l_cur->ifa_next) | |
- { | |
- l_cur = l_cur->ifa_next; | |
- } | |
- l_cur->ifa_next = p_entry; | |
+static void addToEnd(struct ifaddrs **p_resultList, struct ifaddrs *p_entry) { | |
+ if(!*p_resultList) { | |
+ *p_resultList = p_entry; | |
+ } else { | |
+ struct ifaddrs *l_cur = *p_resultList; | |
+ while(l_cur->ifa_next) { | |
+ l_cur = l_cur->ifa_next; | |
} | |
+ l_cur->ifa_next = p_entry; | |
+ } | |
} | |
-static int interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList) | |
-{ | |
- struct ifaddrs *l_entry; | |
- | |
- char *l_index; | |
- char *l_name; | |
- char *l_addr; | |
- char *l_data; | |
- | |
- struct ifinfomsg *l_info = (struct ifinfomsg *)NLMSG_DATA(p_hdr); | |
- | |
- size_t l_nameSize = 0; | |
- size_t l_addrSize = 0; | |
- size_t l_dataSize = 0; | |
- | |
- size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); | |
- struct rtattr *l_rta; | |
- for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) | |
- { | |
- size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
- switch(l_rta->rta_type) | |
- { | |
- case IFLA_ADDRESS: | |
- case IFLA_BROADCAST: | |
- l_addrSize += NLMSG_ALIGN(calcAddrLen(AF_PACKET, l_rtaDataSize)); | |
- break; | |
- case IFLA_IFNAME: | |
- l_nameSize += NLMSG_ALIGN(l_rtaSize + 1); | |
- break; | |
- case IFLA_STATS: | |
- l_dataSize += NLMSG_ALIGN(l_rtaSize); | |
- break; | |
- default: | |
- break; | |
- } | |
- } | |
- | |
- l_entry = malloc(sizeof(struct ifaddrs) + sizeof(int) + l_nameSize + l_addrSize + l_dataSize); | |
- if (l_entry == NULL) | |
- { | |
- return -1; | |
+static int interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList) { | |
+ struct ifaddrs *l_entry; | |
+ | |
+ char *l_index; | |
+ char *l_name; | |
+ char *l_addr; | |
+ char *l_data; | |
+ | |
+ struct ifinfomsg *l_info = (struct ifinfomsg *)NLMSG_DATA(p_hdr); | |
+ | |
+ size_t l_nameSize = 0; | |
+ size_t l_addrSize = 0; | |
+ size_t l_dataSize = 0; | |
+ | |
+ size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); | |
+ struct rtattr *l_rta; | |
+ for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) { | |
+ size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
+ switch(l_rta->rta_type) { | |
+ case IFLA_ADDRESS: | |
+ case IFLA_BROADCAST: | |
+ l_addrSize += NLMSG_ALIGN(calcAddrLen(AF_PACKET, l_rtaDataSize)); | |
+ break; | |
+ case IFLA_IFNAME: | |
+ l_nameSize += NLMSG_ALIGN(l_rtaSize + 1); | |
+ break; | |
+ case IFLA_STATS: | |
+ l_dataSize += NLMSG_ALIGN(l_rtaSize); | |
+ break; | |
+ default: | |
+ break; | |
} | |
- memset(l_entry, 0, sizeof(struct ifaddrs)); | |
- l_entry->ifa_name = ""; | |
- | |
- l_index = ((char *)l_entry) + sizeof(struct ifaddrs); | |
- l_name = l_index + sizeof(int); | |
- l_addr = l_name + l_nameSize; | |
- l_data = l_addr + l_addrSize; | |
- | |
- /* Save the interface index so we can look it up when handling the | |
- * addresses. | |
- */ | |
- memcpy(l_index, &l_info->ifi_index, sizeof(int)); | |
- | |
- l_entry->ifa_flags = l_info->ifi_flags; | |
- | |
- l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); | |
- for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) | |
- { | |
- void *l_rtaData = RTA_DATA(l_rta); | |
- size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
- switch(l_rta->rta_type) | |
- { | |
- case IFLA_ADDRESS: | |
- case IFLA_BROADCAST: | |
- { | |
- size_t l_addrLen = calcAddrLen(AF_PACKET, l_rtaDataSize); | |
- makeSockaddr(AF_PACKET, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize); | |
- ((struct sockaddr_ll *)l_addr)->sll_ifindex = l_info->ifi_index; | |
- ((struct sockaddr_ll *)l_addr)->sll_hatype = l_info->ifi_type; | |
- if(l_rta->rta_type == IFLA_ADDRESS) | |
- { | |
- l_entry->ifa_addr = (struct sockaddr *)l_addr; | |
- } | |
- else | |
- { | |
- l_entry->ifa_broadaddr = (struct sockaddr *)l_addr; | |
- } | |
- l_addr += NLMSG_ALIGN(l_addrLen); | |
- break; | |
- } | |
- case IFLA_IFNAME: | |
- strncpy(l_name, l_rtaData, l_rtaDataSize); | |
- l_name[l_rtaDataSize] = '\0'; | |
- l_entry->ifa_name = l_name; | |
- break; | |
- case IFLA_STATS: | |
- memcpy(l_data, l_rtaData, l_rtaDataSize); | |
- l_entry->ifa_data = l_data; | |
- break; | |
- default: | |
- break; | |
+ } | |
+ | |
+ l_entry = malloc(sizeof(struct ifaddrs) + sizeof(int) + l_nameSize + l_addrSize + l_dataSize); | |
+ if (l_entry == NULL) { | |
+ return -1; | |
+ } | |
+ memset(l_entry, 0, sizeof(struct ifaddrs)); | |
+ l_entry->ifa_name = ""; | |
+ | |
+ l_index = ((char *)l_entry) + sizeof(struct ifaddrs); | |
+ l_name = l_index + sizeof(int); | |
+ l_addr = l_name + l_nameSize; | |
+ l_data = l_addr + l_addrSize; | |
+ | |
+ /* Save the interface index so we can look it up when handling the | |
+ * addresses. | |
+ */ | |
+ memcpy(l_index, &l_info->ifi_index, sizeof(int)); | |
+ | |
+ l_entry->ifa_flags = l_info->ifi_flags; | |
+ | |
+ l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); | |
+ for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) { | |
+ void *l_rtaData = RTA_DATA(l_rta); | |
+ size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
+ switch(l_rta->rta_type) { | |
+ case IFLA_ADDRESS: | |
+ case IFLA_BROADCAST: { | |
+ size_t l_addrLen = calcAddrLen(AF_PACKET, l_rtaDataSize); | |
+ makeSockaddr(AF_PACKET, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize); | |
+ ((struct sockaddr_ll *)l_addr)->sll_ifindex = l_info->ifi_index; | |
+ ((struct sockaddr_ll *)l_addr)->sll_hatype = l_info->ifi_type; | |
+ if(l_rta->rta_type == IFLA_ADDRESS) { | |
+ l_entry->ifa_addr = (struct sockaddr *)l_addr; | |
+ } else { | |
+ l_entry->ifa_broadaddr = (struct sockaddr *)l_addr; | |
} | |
+ l_addr += NLMSG_ALIGN(l_addrLen); | |
+ break; | |
+ } | |
+ case IFLA_IFNAME: | |
+ strncpy(l_name, l_rtaData, l_rtaDataSize); | |
+ l_name[l_rtaDataSize] = '\0'; | |
+ l_entry->ifa_name = l_name; | |
+ break; | |
+ case IFLA_STATS: | |
+ memcpy(l_data, l_rtaData, l_rtaDataSize); | |
+ l_entry->ifa_data = l_data; | |
+ break; | |
+ default: | |
+ break; | |
} | |
+ } | |
- addToEnd(p_resultList, l_entry); | |
- return 0; | |
+ addToEnd(p_resultList, l_entry); | |
+ return 0; | |
} | |
-static struct ifaddrs *findInterface(int p_index, struct ifaddrs **p_links, int p_numLinks) | |
-{ | |
- int l_num = 0; | |
- struct ifaddrs *l_cur = *p_links; | |
- while(l_cur && l_num < p_numLinks) | |
- { | |
- char *l_indexPtr = ((char *)l_cur) + sizeof(struct ifaddrs); | |
- int l_index; | |
- memcpy(&l_index, l_indexPtr, sizeof(int)); | |
- if(l_index == p_index) | |
- { | |
- return l_cur; | |
- } | |
- | |
- l_cur = l_cur->ifa_next; | |
- ++l_num; | |
+static struct ifaddrs *findInterface(int p_index, struct ifaddrs **p_links, int p_numLinks) { | |
+ int l_num = 0; | |
+ struct ifaddrs *l_cur = *p_links; | |
+ while(l_cur && l_num < p_numLinks) { | |
+ char *l_indexPtr = ((char *)l_cur) + sizeof(struct ifaddrs); | |
+ int l_index; | |
+ memcpy(&l_index, l_indexPtr, sizeof(int)); | |
+ if(l_index == p_index) { | |
+ return l_cur; | |
} | |
- return NULL; | |
+ | |
+ l_cur = l_cur->ifa_next; | |
+ ++l_num; | |
+ } | |
+ return NULL; | |
} | |
-static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, int p_numLinks) | |
-{ | |
- struct ifaddrmsg *l_info = (struct ifaddrmsg *)NLMSG_DATA(p_hdr); | |
- struct ifaddrs *l_interface = findInterface(l_info->ifa_index, p_resultList, p_numLinks); | |
+static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, int p_numLinks) { | |
+ struct ifaddrmsg *l_info = (struct ifaddrmsg *)NLMSG_DATA(p_hdr); | |
+ struct ifaddrs *l_interface = findInterface(l_info->ifa_index, p_resultList, p_numLinks); | |
- size_t l_nameSize = 0; | |
- size_t l_addrSize = 0; | |
+ size_t l_nameSize = 0; | |
+ size_t l_addrSize = 0; | |
- int l_addedNetmask = 0; | |
+ int l_addedNetmask = 0; | |
- size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); | |
- struct rtattr *l_rta; | |
- struct ifaddrs *l_entry; | |
+ size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); | |
+ struct rtattr *l_rta; | |
+ struct ifaddrs *l_entry; | |
- char *l_name; | |
- char *l_addr; | |
+ char *l_name; | |
+ char *l_addr; | |
- for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) | |
- { | |
- size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
- if(l_info->ifa_family == AF_PACKET) | |
- { | |
- continue; | |
- } | |
+ for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) { | |
+ size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
+ if(l_info->ifa_family == AF_PACKET) { | |
+ continue; | |
+ } | |
- switch(l_rta->rta_type) | |
- { | |
- case IFA_ADDRESS: | |
- case IFA_LOCAL: | |
- if((l_info->ifa_family == AF_INET || l_info->ifa_family == AF_INET6) && !l_addedNetmask) | |
- { | |
- /* Make room for netmask */ | |
- l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); | |
- l_addedNetmask = 1; | |
- } | |
- case IFA_BROADCAST: | |
- l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); | |
- break; | |
- case IFA_LABEL: | |
- l_nameSize += NLMSG_ALIGN(l_rtaSize + 1); | |
- break; | |
- default: | |
- break; | |
+ switch(l_rta->rta_type) { | |
+ case IFA_ADDRESS: | |
+ case IFA_LOCAL: | |
+ if((l_info->ifa_family == AF_INET || l_info->ifa_family == AF_INET6) && !l_addedNetmask) { | |
+ /* Make room for netmask */ | |
+ l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); | |
+ l_addedNetmask = 1; | |
} | |
+ case IFA_BROADCAST: | |
+ l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); | |
+ break; | |
+ case IFA_LABEL: | |
+ l_nameSize += NLMSG_ALIGN(l_rtaSize + 1); | |
+ break; | |
+ default: | |
+ break; | |
} | |
+ } | |
+ | |
+ l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize); | |
+ if (l_entry == NULL) { | |
+ return -1; | |
+ } | |
+ memset(l_entry, 0, sizeof(struct ifaddrs)); | |
+ l_entry->ifa_name = (l_interface ? l_interface->ifa_name : ""); | |
+ | |
+ l_name = ((char *)l_entry) + sizeof(struct ifaddrs); | |
+ l_addr = l_name + l_nameSize; | |
+ | |
+ l_entry->ifa_flags = l_info->ifa_flags; | |
+ if(l_interface) { | |
+ l_entry->ifa_flags |= l_interface->ifa_flags; | |
+ } | |
+ | |
+ l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); | |
+ for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) { | |
+ void *l_rtaData = RTA_DATA(l_rta); | |
+ size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
+ switch(l_rta->rta_type) { | |
+ case IFA_ADDRESS: | |
+ case IFA_BROADCAST: | |
+ case IFA_LOCAL: { | |
+ size_t l_addrLen = calcAddrLen(l_info->ifa_family, l_rtaDataSize); | |
+ makeSockaddr(l_info->ifa_family, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize); | |
+ if(l_info->ifa_family == AF_INET6) { | |
+ if(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)l_rtaData) || IN6_IS_ADDR_MC_LINKLOCAL((struct in6_addr *)l_rtaData)) { | |
+ ((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index; | |
+ } | |
+ } | |
- l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize); | |
- if (l_entry == NULL) | |
- { | |
- return -1; | |
+ /* Apparently in a point-to-point network IFA_ADDRESS contains | |
+ * the dest address and IFA_LOCAL contains the local address | |
+ */ | |
+ if(l_rta->rta_type == IFA_ADDRESS) { | |
+ if(l_entry->ifa_addr) { | |
+ l_entry->ifa_dstaddr = (struct sockaddr *)l_addr; | |
+ } else { | |
+ l_entry->ifa_addr = (struct sockaddr *)l_addr; | |
+ } | |
+ } else if(l_rta->rta_type == IFA_LOCAL) { | |
+ if(l_entry->ifa_addr) { | |
+ l_entry->ifa_dstaddr = l_entry->ifa_addr; | |
+ } | |
+ l_entry->ifa_addr = (struct sockaddr *)l_addr; | |
+ } else { | |
+ l_entry->ifa_broadaddr = (struct sockaddr *)l_addr; | |
+ } | |
+ l_addr += NLMSG_ALIGN(l_addrLen); | |
+ break; | |
+ } | |
+ case IFA_LABEL: | |
+ strncpy(l_name, l_rtaData, l_rtaDataSize); | |
+ l_name[l_rtaDataSize] = '\0'; | |
+ l_entry->ifa_name = l_name; | |
+ break; | |
+ default: | |
+ break; | |
} | |
- memset(l_entry, 0, sizeof(struct ifaddrs)); | |
- l_entry->ifa_name = (l_interface ? l_interface->ifa_name : ""); | |
- | |
- l_name = ((char *)l_entry) + sizeof(struct ifaddrs); | |
- l_addr = l_name + l_nameSize; | |
- | |
- l_entry->ifa_flags = l_info->ifa_flags; | |
- if(l_interface) | |
- { | |
- l_entry->ifa_flags |= l_interface->ifa_flags; | |
+ } | |
+ | |
+ if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6)) { | |
+ unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128); | |
+ unsigned l_prefix = (l_info->ifa_prefixlen > l_maxPrefix ? l_maxPrefix : l_info->ifa_prefixlen); | |
+ char l_mask[16] = {0}; | |
+ unsigned i; | |
+ for(i=0; i<(l_prefix/8); ++i) { | |
+ l_mask[i] = 0xff; | |
} | |
- | |
- l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); | |
- for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) | |
- { | |
- void *l_rtaData = RTA_DATA(l_rta); | |
- size_t l_rtaDataSize = RTA_PAYLOAD(l_rta); | |
- switch(l_rta->rta_type) | |
- { | |
- case IFA_ADDRESS: | |
- case IFA_BROADCAST: | |
- case IFA_LOCAL: | |
- { | |
- size_t l_addrLen = calcAddrLen(l_info->ifa_family, l_rtaDataSize); | |
- makeSockaddr(l_info->ifa_family, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize); | |
- if(l_info->ifa_family == AF_INET6) | |
- { | |
- if(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)l_rtaData) || IN6_IS_ADDR_MC_LINKLOCAL((struct in6_addr *)l_rtaData)) | |
- { | |
- ((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index; | |
- } | |
- } | |
- | |
- /* Apparently in a point-to-point network IFA_ADDRESS contains | |
- * the dest address and IFA_LOCAL contains the local address | |
- */ | |
- if(l_rta->rta_type == IFA_ADDRESS) | |
- { | |
- if(l_entry->ifa_addr) | |
- { | |
- l_entry->ifa_dstaddr = (struct sockaddr *)l_addr; | |
- } | |
- else | |
- { | |
- l_entry->ifa_addr = (struct sockaddr *)l_addr; | |
- } | |
- } | |
- else if(l_rta->rta_type == IFA_LOCAL) | |
- { | |
- if(l_entry->ifa_addr) | |
- { | |
- l_entry->ifa_dstaddr = l_entry->ifa_addr; | |
- } | |
- l_entry->ifa_addr = (struct sockaddr *)l_addr; | |
- } | |
- else | |
- { | |
- l_entry->ifa_broadaddr = (struct sockaddr *)l_addr; | |
- } | |
- l_addr += NLMSG_ALIGN(l_addrLen); | |
- break; | |
- } | |
- case IFA_LABEL: | |
- strncpy(l_name, l_rtaData, l_rtaDataSize); | |
- l_name[l_rtaDataSize] = '\0'; | |
- l_entry->ifa_name = l_name; | |
- break; | |
- default: | |
- break; | |
- } | |
+ if(l_prefix % 8) { | |
+ l_mask[i] = 0xff << (8 - (l_prefix % 8)); | |
} | |
- if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6)) | |
- { | |
- unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128); | |
- unsigned l_prefix = (l_info->ifa_prefixlen > l_maxPrefix ? l_maxPrefix : l_info->ifa_prefixlen); | |
- char l_mask[16] = {0}; | |
- unsigned i; | |
- for(i=0; i<(l_prefix/8); ++i) | |
- { | |
- l_mask[i] = 0xff; | |
- } | |
- if(l_prefix % 8) | |
- { | |
- l_mask[i] = 0xff << (8 - (l_prefix % 8)); | |
- } | |
+ makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8); | |
+ l_entry->ifa_netmask = (struct sockaddr *)l_addr; | |
+ } | |
- makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8); | |
- l_entry->ifa_netmask = (struct sockaddr *)l_addr; | |
- } | |
- | |
- addToEnd(p_resultList, l_entry); | |
- return 0; | |
+ addToEnd(p_resultList, l_entry); | |
+ return 0; | |
} | |
-static int interpretLinks(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList) | |
-{ | |
- | |
- int l_numLinks = 0; | |
- pid_t l_pid = getpid(); | |
- for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) | |
- { | |
- unsigned int l_nlsize = p_netlinkList->m_size; | |
- struct nlmsghdr *l_hdr; | |
- for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) | |
- { | |
- if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) | |
- { | |
- continue; | |
- } | |
- | |
- if(l_hdr->nlmsg_type == NLMSG_DONE) | |
- { | |
- break; | |
- } | |
- | |
- if(l_hdr->nlmsg_type == RTM_NEWLINK) | |
- { | |
- if(interpretLink(l_hdr, p_resultList) == -1) | |
- { | |
- return -1; | |
- } | |
- ++l_numLinks; | |
- } | |
+static int interpretLinks(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList) { | |
+ | |
+ int l_numLinks = 0; | |
+ pid_t l_pid = getpid(); | |
+ for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) { | |
+ unsigned int l_nlsize = p_netlinkList->m_size; | |
+ struct nlmsghdr *l_hdr; | |
+ for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) { | |
+ if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) { | |
+ continue; | |
+ } | |
+ | |
+ if(l_hdr->nlmsg_type == NLMSG_DONE) { | |
+ break; | |
+ } | |
+ | |
+ if(l_hdr->nlmsg_type == RTM_NEWLINK) { | |
+ if(interpretLink(l_hdr, p_resultList) == -1) { | |
+ return -1; | |
} | |
+ ++l_numLinks; | |
+ } | |
} | |
- return l_numLinks; | |
+ } | |
+ return l_numLinks; | |
} | |
-static int interpretAddrs(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList, int p_numLinks) | |
-{ | |
- pid_t l_pid = getpid(); | |
- for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) | |
- { | |
- unsigned int l_nlsize = p_netlinkList->m_size; | |
- struct nlmsghdr *l_hdr; | |
- for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) | |
- { | |
- if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) | |
- { | |
- continue; | |
- } | |
- | |
- if(l_hdr->nlmsg_type == NLMSG_DONE) | |
- { | |
- break; | |
- } | |
- | |
- if(l_hdr->nlmsg_type == RTM_NEWADDR) | |
- { | |
- if (interpretAddr(l_hdr, p_resultList, p_numLinks) == -1) | |
- { | |
- return -1; | |
- } | |
- } | |
+static int interpretAddrs(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList, int p_numLinks) { | |
+ pid_t l_pid = getpid(); | |
+ for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) { | |
+ unsigned int l_nlsize = p_netlinkList->m_size; | |
+ struct nlmsghdr *l_hdr; | |
+ for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) { | |
+ if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) { | |
+ continue; | |
+ } | |
+ | |
+ if(l_hdr->nlmsg_type == NLMSG_DONE) { | |
+ break; | |
+ } | |
+ | |
+ if(l_hdr->nlmsg_type == RTM_NEWADDR) { | |
+ if (interpretAddr(l_hdr, p_resultList, p_numLinks) == -1) { | |
+ return -1; | |
} | |
+ } | |
} | |
- return 0; | |
+ } | |
+ return 0; | |
} | |
-int getifaddrs(struct ifaddrs **ifap) | |
-{ | |
- int l_socket; | |
- int l_result; | |
- int l_numLinks; | |
- NetlinkList *l_linkResults; | |
- NetlinkList *l_addrResults; | |
- | |
- if(!ifap) | |
- { | |
- return -1; | |
- } | |
- *ifap = NULL; | |
- | |
- l_socket = netlink_socket(); | |
- if(l_socket < 0) | |
- { | |
- return -1; | |
- } | |
- | |
- l_linkResults = getResultList(l_socket, RTM_GETLINK); | |
- if(!l_linkResults) | |
- { | |
- close(l_socket); | |
- return -1; | |
- } | |
- | |
- l_addrResults = getResultList(l_socket, RTM_GETADDR); | |
- if(!l_addrResults) | |
- { | |
- close(l_socket); | |
- freeResultList(l_linkResults); | |
- return -1; | |
- } | |
- | |
- l_result = 0; | |
- l_numLinks = interpretLinks(l_socket, l_linkResults, ifap); | |
- if(l_numLinks == -1 || interpretAddrs(l_socket, l_addrResults, ifap, l_numLinks) == -1) | |
- { | |
- l_result = -1; | |
- } | |
+int getifaddrs(struct ifaddrs **ifap) { | |
+ int l_socket; | |
+ int l_result; | |
+ int l_numLinks; | |
+ NetlinkList *l_linkResults; | |
+ NetlinkList *l_addrResults; | |
+ | |
+ if(!ifap) { | |
+ return -1; | |
+ } | |
+ *ifap = NULL; | |
+ | |
+ l_socket = netlink_socket(); | |
+ if(l_socket < 0) { | |
+ return -1; | |
+ } | |
+ | |
+ l_linkResults = getResultList(l_socket, RTM_GETLINK); | |
+ if(!l_linkResults) { | |
+ close(l_socket); | |
+ return -1; | |
+ } | |
- freeResultList(l_linkResults); | |
- freeResultList(l_addrResults); | |
+ l_addrResults = getResultList(l_socket, RTM_GETADDR); | |
+ if(!l_addrResults) { | |
close(l_socket); | |
- return l_result; | |
+ freeResultList(l_linkResults); | |
+ return -1; | |
+ } | |
+ | |
+ l_result = 0; | |
+ l_numLinks = interpretLinks(l_socket, l_linkResults, ifap); | |
+ if(l_numLinks == -1 || interpretAddrs(l_socket, l_addrResults, ifap, l_numLinks) == -1) { | |
+ l_result = -1; | |
+ } | |
+ | |
+ freeResultList(l_linkResults); | |
+ freeResultList(l_addrResults); | |
+ close(l_socket); | |
+ return l_result; | |
} | |
-void freeifaddrs(struct ifaddrs *ifa) | |
-{ | |
- struct ifaddrs *l_cur; | |
- while(ifa) | |
- { | |
- l_cur = ifa; | |
- ifa = ifa->ifa_next; | |
- free(l_cur); | |
- } | |
+void freeifaddrs(struct ifaddrs *ifa) { | |
+ struct ifaddrs *l_cur; | |
+ while(ifa) { | |
+ l_cur = ifa; | |
+ ifa = ifa->ifa_next; | |
+ free(l_cur); | |
+ } | |
} | |
diff --git a/src/unix/async.c b/src/unix/async.c | |
index b794ea6..5756e9c 100644 | |
--- a/src/unix/async.c | |
+++ b/src/unix/async.c | |
@@ -109,8 +109,8 @@ static int uv__async_make_pending(int* pending) { | |
{ | |
unsigned int val = 1; | |
__asm__ __volatile__ ("xchgl %0, %1" | |
- : "+r" (val) | |
- : "m" (*pending)); | |
+ : "+r" (val) | |
+ : "m" (*pending)); | |
return val != 0; | |
} | |
#elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 0) | |
@@ -217,8 +217,7 @@ int uv__async_start(uv_loop_t* loop, struct uv__async* wa, uv__async_cb cb) { | |
if (err >= 0) { | |
pipefd[0] = err; | |
pipefd[1] = -1; | |
- } | |
- else if (err == -ENOSYS) { | |
+ } else if (err == -ENOSYS) { | |
err = uv__make_pipe(pipefd, UV__F_NONBLOCK); | |
#if defined(__linux__) | |
/* Save a file descriptor by opening one of the pipe descriptors as | |
diff --git a/src/unix/core.c b/src/unix/core.c | |
index 6f284ff..2bd467e 100644 | |
--- a/src/unix/core.c | |
+++ b/src/unix/core.c | |
@@ -98,66 +98,66 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { | |
handle->close_cb = close_cb; | |
switch (handle->type) { | |
- case UV_NAMED_PIPE: | |
- uv__pipe_close((uv_pipe_t*)handle); | |
- break; | |
- | |
- case UV_TTY: | |
- uv__stream_close((uv_stream_t*)handle); | |
- break; | |
- | |
- case UV_TCP: | |
- uv__tcp_close((uv_tcp_t*)handle); | |
- break; | |
- | |
- case UV_UDP: | |
- uv__udp_close((uv_udp_t*)handle); | |
- break; | |
- | |
- case UV_PREPARE: | |
- uv__prepare_close((uv_prepare_t*)handle); | |
- break; | |
- | |
- case UV_CHECK: | |
- uv__check_close((uv_check_t*)handle); | |
- break; | |
- | |
- case UV_IDLE: | |
- uv__idle_close((uv_idle_t*)handle); | |
- break; | |
- | |
- case UV_ASYNC: | |
- uv__async_close((uv_async_t*)handle); | |
- break; | |
- | |
- case UV_TIMER: | |
- uv__timer_close((uv_timer_t*)handle); | |
- break; | |
- | |
- case UV_PROCESS: | |
- uv__process_close((uv_process_t*)handle); | |
- break; | |
- | |
- case UV_FS_EVENT: | |
- uv__fs_event_close((uv_fs_event_t*)handle); | |
- break; | |
- | |
- case UV_POLL: | |
- uv__poll_close((uv_poll_t*)handle); | |
- break; | |
- | |
- case UV_FS_POLL: | |
- uv__fs_poll_close((uv_fs_poll_t*)handle); | |
- break; | |
- | |
- case UV_SIGNAL: | |
- uv__signal_close((uv_signal_t*) handle); | |
- /* Signal handles may not be closed immediately. The signal code will */ | |
- /* itself close uv__make_close_pending whenever appropriate. */ | |
- return; | |
+ case UV_NAMED_PIPE: | |
+ uv__pipe_close((uv_pipe_t*)handle); | |
+ break; | |
+ | |
+ case UV_TTY: | |
+ uv__stream_close((uv_stream_t*)handle); | |
+ break; | |
+ | |
+ case UV_TCP: | |
+ uv__tcp_close((uv_tcp_t*)handle); | |
+ break; | |
+ | |
+ case UV_UDP: | |
+ uv__udp_close((uv_udp_t*)handle); | |
+ break; | |
+ | |
+ case UV_PREPARE: | |
+ uv__prepare_close((uv_prepare_t*)handle); | |
+ break; | |
+ | |
+ case UV_CHECK: | |
+ uv__check_close((uv_check_t*)handle); | |
+ break; | |
+ | |
+ case UV_IDLE: | |
+ uv__idle_close((uv_idle_t*)handle); | |
+ break; | |
+ | |
+ case UV_ASYNC: | |
+ uv__async_close((uv_async_t*)handle); | |
+ break; | |
+ | |
+ case UV_TIMER: | |
+ uv__timer_close((uv_timer_t*)handle); | |
+ break; | |
- default: | |
- assert(0); | |
+ case UV_PROCESS: | |
+ uv__process_close((uv_process_t*)handle); | |
+ break; | |
+ | |
+ case UV_FS_EVENT: | |
+ uv__fs_event_close((uv_fs_event_t*)handle); | |
+ break; | |
+ | |
+ case UV_POLL: | |
+ uv__poll_close((uv_poll_t*)handle); | |
+ break; | |
+ | |
+ case UV_FS_POLL: | |
+ uv__fs_poll_close((uv_fs_poll_t*)handle); | |
+ break; | |
+ | |
+ case UV_SIGNAL: | |
+ uv__signal_close((uv_signal_t*) handle); | |
+ /* Signal handles may not be closed immediately. The signal code will */ | |
+ /* itself close uv__make_close_pending whenever appropriate. */ | |
+ return; | |
+ | |
+ default: | |
+ assert(0); | |
} | |
uv__make_close_pending(handle); | |
@@ -297,7 +297,7 @@ static int uv__loop_alive(const uv_loop_t* loop) { | |
int uv_loop_alive(const uv_loop_t* loop) { | |
- return uv__loop_alive(loop); | |
+ return uv__loop_alive(loop); | |
} | |
@@ -668,22 +668,22 @@ int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) { | |
int fd_out; | |
switch (handle->type) { | |
- case UV_TCP: | |
- case UV_NAMED_PIPE: | |
- case UV_TTY: | |
- fd_out = uv__stream_fd((uv_stream_t*) handle); | |
- break; | |
+ case UV_TCP: | |
+ case UV_NAMED_PIPE: | |
+ case UV_TTY: | |
+ fd_out = uv__stream_fd((uv_stream_t*) handle); | |
+ break; | |
- case UV_UDP: | |
- fd_out = ((uv_udp_t *) handle)->io_watcher.fd; | |
- break; | |
+ case UV_UDP: | |
+ fd_out = ((uv_udp_t *) handle)->io_watcher.fd; | |
+ break; | |
- case UV_POLL: | |
- fd_out = ((uv_poll_t *) handle)->io_watcher.fd; | |
- break; | |
+ case UV_POLL: | |
+ fd_out = ((uv_poll_t *) handle)->io_watcher.fd; | |
+ break; | |
- default: | |
- return -EINVAL; | |
+ default: | |
+ return -EINVAL; | |
} | |
if (uv__is_closing(handle) || fd_out == -1) | |
@@ -836,8 +836,7 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { | |
loop->nfds--; | |
w->events = 0; | |
} | |
- } | |
- else if (QUEUE_EMPTY(&w->watcher_queue)) | |
+ } else if (QUEUE_EMPTY(&w->watcher_queue)) | |
QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); | |
} | |
diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c | |
index b7267ca..8eec5c5 100644 | |
--- a/src/unix/darwin-proctitle.c | |
+++ b/src/unix/darwin-proctitle.c | |
@@ -56,17 +56,17 @@ int uv__set_process_title(const char* title) { | |
return uv__pthread_setname_np(title); | |
#else | |
CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, | |
- const char*, | |
- CFStringEncoding); | |
+ const char*, | |
+ CFStringEncoding); | |
CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); | |
void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); | |
void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); | |
CFTypeRef (*pLSGetCurrentApplicationASN)(void); | |
OSStatus (*pLSSetApplicationInformationItem)(int, | |
- CFTypeRef, | |
- CFStringRef, | |
- CFStringRef, | |
- CFDictionaryRef*); | |
+ CFTypeRef, | |
+ CFStringRef, | |
+ CFStringRef, | |
+ CFDictionaryRef*); | |
void* application_services_handle; | |
void* core_foundation_handle; | |
CFBundleRef launch_services_bundle; | |
@@ -77,7 +77,7 @@ int uv__set_process_title(const char* title) { | |
OSStatus (*pSetApplicationIsDaemon)(int); | |
CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); | |
void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, | |
- void*); | |
+ void*); | |
CFTypeRef asn; | |
int err; | |
@@ -95,13 +95,13 @@ int uv__set_process_title(const char* title) { | |
goto out; | |
*(void **)(&pCFStringCreateWithCString) = | |
- dlsym(core_foundation_handle, "CFStringCreateWithCString"); | |
+ dlsym(core_foundation_handle, "CFStringCreateWithCString"); | |
*(void **)(&pCFBundleGetBundleWithIdentifier) = | |
- dlsym(core_foundation_handle, "CFBundleGetBundleWithIdentifier"); | |
+ dlsym(core_foundation_handle, "CFBundleGetBundleWithIdentifier"); | |
*(void **)(&pCFBundleGetDataPointerForName) = | |
- dlsym(core_foundation_handle, "CFBundleGetDataPointerForName"); | |
+ dlsym(core_foundation_handle, "CFBundleGetDataPointerForName"); | |
*(void **)(&pCFBundleGetFunctionPointerForName) = | |
- dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName"); | |
+ dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName"); | |
if (pCFStringCreateWithCString == NULL || | |
pCFBundleGetBundleWithIdentifier == NULL || | |
@@ -113,41 +113,41 @@ int uv__set_process_title(const char* title) { | |
#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) | |
launch_services_bundle = | |
- pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices")); | |
+ pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices")); | |
if (launch_services_bundle == NULL) | |
goto out; | |
*(void **)(&pLSGetCurrentApplicationASN) = | |
- pCFBundleGetFunctionPointerForName(launch_services_bundle, | |
- S("_LSGetCurrentApplicationASN")); | |
+ pCFBundleGetFunctionPointerForName(launch_services_bundle, | |
+ S("_LSGetCurrentApplicationASN")); | |
if (pLSGetCurrentApplicationASN == NULL) | |
goto out; | |
*(void **)(&pLSSetApplicationInformationItem) = | |
- pCFBundleGetFunctionPointerForName(launch_services_bundle, | |
- S("_LSSetApplicationInformationItem")); | |
+ pCFBundleGetFunctionPointerForName(launch_services_bundle, | |
+ S("_LSSetApplicationInformationItem")); | |
if (pLSSetApplicationInformationItem == NULL) | |
goto out; | |
display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle, | |
- S("_kLSDisplayNameKey")); | |
+ S("_kLSDisplayNameKey")); | |
if (display_name_key == NULL || *display_name_key == NULL) | |
goto out; | |
*(void **)(&pCFBundleGetInfoDictionary) = dlsym(core_foundation_handle, | |
- "CFBundleGetInfoDictionary"); | |
+ "CFBundleGetInfoDictionary"); | |
*(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle, | |
- "CFBundleGetMainBundle"); | |
+ "CFBundleGetMainBundle"); | |
if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) | |
goto out; | |
/* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */ | |
hi_services_bundle = | |
- pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); | |
+ pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); | |
err = -ENOENT; | |
if (hi_services_bundle == NULL) | |
goto out; | |
@@ -156,12 +156,12 @@ int uv__set_process_title(const char* title) { | |
hi_services_bundle, | |
S("SetApplicationIsDaemon")); | |
*(void **)(&pLSApplicationCheckIn) = pCFBundleGetFunctionPointerForName( | |
- launch_services_bundle, | |
- S("_LSApplicationCheckIn")); | |
+ launch_services_bundle, | |
+ S("_LSApplicationCheckIn")); | |
*(void **)(&pLSSetApplicationLaunchServicesServerConnectionStatus) = | |
- pCFBundleGetFunctionPointerForName( | |
- launch_services_bundle, | |
- S("_LSSetApplicationLaunchServicesServerConnectionStatus")); | |
+ pCFBundleGetFunctionPointerForName( | |
+ launch_services_bundle, | |
+ S("_LSSetApplicationLaunchServicesServerConnectionStatus")); | |
if (pSetApplicationIsDaemon == NULL || | |
pLSApplicationCheckIn == NULL || | |
pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) { | |
diff --git a/src/unix/darwin.c b/src/unix/darwin.c | |
index c9a45ed..5355630 100644 | |
--- a/src/unix/darwin.c | |
+++ b/src/unix/darwin.c | |
@@ -315,7 +315,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
int i; | |
for (i = 0; i < count; i++) { | |
diff --git a/src/unix/dl.c b/src/unix/dl.c | |
index ad45fc8..47ea4ea 100644 | |
--- a/src/unix/dl.c | |
+++ b/src/unix/dl.c | |
@@ -75,8 +75,7 @@ static int uv__dlerror(uv_lib_t* lib) { | |
if (errmsg) { | |
lib->errmsg = strdup(errmsg); | |
return -1; | |
- } | |
- else { | |
+ } else { | |
lib->errmsg = NULL; | |
return 0; | |
} | |
diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c | |
index d59e377..8d0a2a3 100644 | |
--- a/src/unix/freebsd.c | |
+++ b/src/unix/freebsd.c | |
@@ -336,7 +336,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { | |
if (getifaddrs(&addrs)) | |
return -errno; | |
- *count = 0; | |
+ *count = 0; | |
/* Count the number of interfaces */ | |
for (ent = addrs; ent != NULL; ent = ent->ifa_next) { | |
@@ -414,7 +414,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
int i; | |
for (i = 0; i < count; i++) { | |
diff --git a/src/unix/fs.c b/src/unix/fs.c | |
index 65fd012..e590e12 100644 | |
--- a/src/unix/fs.c | |
+++ b/src/unix/fs.c | |
@@ -177,15 +177,15 @@ skip: | |
return r; | |
switch (errno) { | |
- case ENOENT: | |
- if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF) | |
- break; | |
+ case ENOENT: | |
+ if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF) | |
+ break; | |
/* Fall through. */ | |
- case EACCES: | |
- case ENOTDIR: | |
- errno = ENOSYS; | |
- break; | |
+ case EACCES: | |
+ case ENOTDIR: | |
+ errno = ENOSYS; | |
+ break; | |
} | |
return r; | |
@@ -253,7 +253,7 @@ static ssize_t uv__fs_read(uv_fs_t* req) { | |
size_t index; | |
# if defined(__linux__) | |
- retry: | |
+retry: | |
# endif | |
nread = 0; | |
index = 0; | |
@@ -611,7 +611,7 @@ static ssize_t uv__fs_write(uv_fs_t* req) { | |
size_t index; | |
# if defined(__linux__) | |
- retry: | |
+retry: | |
# endif | |
written = 0; | |
index = 0; | |
@@ -763,67 +763,67 @@ static void uv__fs_work(struct uv__work* w) { | |
break; | |
switch (req->fs_type) { | |
- X(ACCESS, access(req->path, req->flags)); | |
- X(CHMOD, chmod(req->path, req->mode)); | |
- X(CHOWN, chown(req->path, req->uid, req->gid)); | |
- X(CLOSE, close(req->file)); | |
- X(FCHMOD, fchmod(req->file, req->mode)); | |
- X(FCHOWN, fchown(req->file, req->uid, req->gid)); | |
- X(FDATASYNC, uv__fs_fdatasync(req)); | |
- X(FSTAT, uv__fs_fstat(req->file, &req->statbuf)); | |
- X(FSYNC, fsync(req->file)); | |
- X(FTRUNCATE, ftruncate(req->file, req->off)); | |
- X(FUTIME, uv__fs_futime(req)); | |
- X(LSTAT, uv__fs_lstat(req->path, &req->statbuf)); | |
- X(LINK, link(req->path, req->new_path)); | |
- X(MKDIR, mkdir(req->path, req->mode)); | |
- X(MKDTEMP, uv__fs_mkdtemp(req)); | |
- X(READ, uv__fs_read(req)); | |
- X(SCANDIR, uv__fs_scandir(req)); | |
- X(READLINK, uv__fs_readlink(req)); | |
- X(RENAME, rename(req->path, req->new_path)); | |
- X(RMDIR, rmdir(req->path)); | |
- X(SENDFILE, uv__fs_sendfile(req)); | |
- X(STAT, uv__fs_stat(req->path, &req->statbuf)); | |
- X(SYMLINK, symlink(req->path, req->new_path)); | |
- X(UNLINK, unlink(req->path)); | |
- X(UTIME, uv__fs_utime(req)); | |
- X(WRITE, uv__fs_write(req)); | |
- case UV_FS_OPEN: | |
+ X(ACCESS, access(req->path, req->flags)); | |
+ X(CHMOD, chmod(req->path, req->mode)); | |
+ X(CHOWN, chown(req->path, req->uid, req->gid)); | |
+ X(CLOSE, close(req->file)); | |
+ X(FCHMOD, fchmod(req->file, req->mode)); | |
+ X(FCHOWN, fchown(req->file, req->uid, req->gid)); | |
+ X(FDATASYNC, uv__fs_fdatasync(req)); | |
+ X(FSTAT, uv__fs_fstat(req->file, &req->statbuf)); | |
+ X(FSYNC, fsync(req->file)); | |
+ X(FTRUNCATE, ftruncate(req->file, req->off)); | |
+ X(FUTIME, uv__fs_futime(req)); | |
+ X(LSTAT, uv__fs_lstat(req->path, &req->statbuf)); | |
+ X(LINK, link(req->path, req->new_path)); | |
+ X(MKDIR, mkdir(req->path, req->mode)); | |
+ X(MKDTEMP, uv__fs_mkdtemp(req)); | |
+ X(READ, uv__fs_read(req)); | |
+ X(SCANDIR, uv__fs_scandir(req)); | |
+ X(READLINK, uv__fs_readlink(req)); | |
+ X(RENAME, rename(req->path, req->new_path)); | |
+ X(RMDIR, rmdir(req->path)); | |
+ X(SENDFILE, uv__fs_sendfile(req)); | |
+ X(STAT, uv__fs_stat(req->path, &req->statbuf)); | |
+ X(SYMLINK, symlink(req->path, req->new_path)); | |
+ X(UNLINK, unlink(req->path)); | |
+ X(UTIME, uv__fs_utime(req)); | |
+ X(WRITE, uv__fs_write(req)); | |
+ case UV_FS_OPEN: | |
#ifdef O_CLOEXEC | |
- /* Try O_CLOEXEC before entering locks */ | |
- if (!no_cloexec_support) { | |
- r = open(req->path, req->flags | O_CLOEXEC, req->mode); | |
- if (r >= 0) | |
- break; | |
- if (errno != EINVAL) | |
- break; | |
- no_cloexec_support = 1; | |
- } | |
+ /* Try O_CLOEXEC before entering locks */ | |
+ if (!no_cloexec_support) { | |
+ r = open(req->path, req->flags | O_CLOEXEC, req->mode); | |
+ if (r >= 0) | |
+ break; | |
+ if (errno != EINVAL) | |
+ break; | |
+ no_cloexec_support = 1; | |
+ } | |
#endif /* O_CLOEXEC */ | |
- if (req->cb != NULL) | |
- uv_rwlock_rdlock(&req->loop->cloexec_lock); | |
- r = open(req->path, req->flags, req->mode); | |
- | |
- /* | |
- * In case of failure `uv__cloexec` will leave error in `errno`, | |
- * so it is enough to just set `r` to `-1`. | |
- */ | |
- if (r >= 0 && uv__cloexec(r, 1) != 0) { | |
- r = uv__close(r); | |
- if (r != 0 && r != -EINPROGRESS) | |
- abort(); | |
- r = -1; | |
- } | |
- if (req->cb != NULL) | |
- uv_rwlock_rdunlock(&req->loop->cloexec_lock); | |
- break; | |
- default: abort(); | |
+ if (req->cb != NULL) | |
+ uv_rwlock_rdlock(&req->loop->cloexec_lock); | |
+ r = open(req->path, req->flags, req->mode); | |
+ | |
+ /* | |
+ * In case of failure `uv__cloexec` will leave error in `errno`, | |
+ * so it is enough to just set `r` to `-1`. | |
+ */ | |
+ if (r >= 0 && uv__cloexec(r, 1) != 0) { | |
+ r = uv__close(r); | |
+ if (r != 0 && r != -EINPROGRESS) | |
+ abort(); | |
+ r = -1; | |
+ } | |
+ if (req->cb != NULL) | |
+ uv_rwlock_rdunlock(&req->loop->cloexec_lock); | |
+ break; | |
+ default: | |
+ abort(); | |
} | |
#undef X | |
- } | |
- while (r == -1 && errno == EINTR && retry_on_eintr); | |
+ } while (r == -1 && errno == EINTR && retry_on_eintr); | |
if (r == -1) | |
req->result = -errno; | |
diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c | |
index 4908530..056dae4 100644 | |
--- a/src/unix/fsevents.c | |
+++ b/src/unix/fsevents.c | |
@@ -115,29 +115,29 @@ static void (*pCFRunLoopRemoveSource)(CFRunLoopRef, | |
CFStringRef); | |
static void (*pCFRunLoopRun)(void); | |
static CFRunLoopSourceRef (*pCFRunLoopSourceCreate)(CFAllocatorRef, | |
- CFIndex, | |
- CFRunLoopSourceContext*); | |
+ CFIndex, | |
+ CFRunLoopSourceContext*); | |
static void (*pCFRunLoopSourceSignal)(CFRunLoopSourceRef); | |
static void (*pCFRunLoopStop)(CFRunLoopRef); | |
static void (*pCFRunLoopWakeUp)(CFRunLoopRef); | |
static CFStringRef (*pCFStringCreateWithFileSystemRepresentation)( | |
- CFAllocatorRef, | |
- const char*); | |
+ CFAllocatorRef, | |
+ const char*); | |
static CFStringEncoding (*pCFStringGetSystemEncoding)(void); | |
static CFStringRef (*pkCFRunLoopDefaultMode); | |
static FSEventStreamRef (*pFSEventStreamCreate)(CFAllocatorRef, | |
- FSEventStreamCallback, | |
- FSEventStreamContext*, | |
- CFArrayRef, | |
- FSEventStreamEventId, | |
- CFTimeInterval, | |
- FSEventStreamCreateFlags); | |
+ FSEventStreamCallback, | |
+ FSEventStreamContext*, | |
+ CFArrayRef, | |
+ FSEventStreamEventId, | |
+ CFTimeInterval, | |
+ FSEventStreamCreateFlags); | |
static void (*pFSEventStreamFlushSync)(FSEventStreamRef); | |
static void (*pFSEventStreamInvalidate)(FSEventStreamRef); | |
static void (*pFSEventStreamRelease)(FSEventStreamRef); | |
static void (*pFSEventStreamScheduleWithRunLoop)(FSEventStreamRef, | |
- CFRunLoopRef, | |
- CFStringRef); | |
+ CFRunLoopRef, | |
+ CFStringRef); | |
static Boolean (*pFSEventStreamStart)(FSEventStreamRef); | |
static void (*pFSEventStreamStop)(FSEventStreamRef); | |
@@ -439,7 +439,7 @@ static void uv__fsevents_reschedule(uv_fs_event_t* handle) { | |
assert(curr->realpath != NULL); | |
paths[i] = | |
- pCFStringCreateWithFileSystemRepresentation(NULL, curr->realpath); | |
+ pCFStringCreateWithFileSystemRepresentation(NULL, curr->realpath); | |
if (paths[i] == NULL) { | |
uv_mutex_unlock(&state->fsevent_mutex); | |
goto final; | |
diff --git a/src/unix/getaddrinfo.c b/src/unix/getaddrinfo.c | |
index faf9add..5604844 100644 | |
--- a/src/unix/getaddrinfo.c | |
+++ b/src/unix/getaddrinfo.c | |
@@ -39,53 +39,69 @@ | |
int uv__getaddrinfo_translate_error(int sys_err) { | |
switch (sys_err) { | |
- case 0: return 0; | |
+ case 0: | |
+ return 0; | |
#if defined(EAI_ADDRFAMILY) | |
- case EAI_ADDRFAMILY: return UV_EAI_ADDRFAMILY; | |
+ case EAI_ADDRFAMILY: | |
+ return UV_EAI_ADDRFAMILY; | |
#endif | |
#if defined(EAI_AGAIN) | |
- case EAI_AGAIN: return UV_EAI_AGAIN; | |
+ case EAI_AGAIN: | |
+ return UV_EAI_AGAIN; | |
#endif | |
#if defined(EAI_BADFLAGS) | |
- case EAI_BADFLAGS: return UV_EAI_BADFLAGS; | |
+ case EAI_BADFLAGS: | |
+ return UV_EAI_BADFLAGS; | |
#endif | |
#if defined(EAI_BADHINTS) | |
- case EAI_BADHINTS: return UV_EAI_BADHINTS; | |
+ case EAI_BADHINTS: | |
+ return UV_EAI_BADHINTS; | |
#endif | |
#if defined(EAI_CANCELED) | |
- case EAI_CANCELED: return UV_EAI_CANCELED; | |
+ case EAI_CANCELED: | |
+ return UV_EAI_CANCELED; | |
#endif | |
#if defined(EAI_FAIL) | |
- case EAI_FAIL: return UV_EAI_FAIL; | |
+ case EAI_FAIL: | |
+ return UV_EAI_FAIL; | |
#endif | |
#if defined(EAI_FAMILY) | |
- case EAI_FAMILY: return UV_EAI_FAMILY; | |
+ case EAI_FAMILY: | |
+ return UV_EAI_FAMILY; | |
#endif | |
#if defined(EAI_MEMORY) | |
- case EAI_MEMORY: return UV_EAI_MEMORY; | |
+ case EAI_MEMORY: | |
+ return UV_EAI_MEMORY; | |
#endif | |
#if defined(EAI_NODATA) | |
- case EAI_NODATA: return UV_EAI_NODATA; | |
+ case EAI_NODATA: | |
+ return UV_EAI_NODATA; | |
#endif | |
#if defined(EAI_NONAME) | |
# if !defined(EAI_NODATA) || EAI_NODATA != EAI_NONAME | |
- case EAI_NONAME: return UV_EAI_NONAME; | |
+ case EAI_NONAME: | |
+ return UV_EAI_NONAME; | |
# endif | |
#endif | |
#if defined(EAI_OVERFLOW) | |
- case EAI_OVERFLOW: return UV_EAI_OVERFLOW; | |
+ case EAI_OVERFLOW: | |
+ return UV_EAI_OVERFLOW; | |
#endif | |
#if defined(EAI_PROTOCOL) | |
- case EAI_PROTOCOL: return UV_EAI_PROTOCOL; | |
+ case EAI_PROTOCOL: | |
+ return UV_EAI_PROTOCOL; | |
#endif | |
#if defined(EAI_SERVICE) | |
- case EAI_SERVICE: return UV_EAI_SERVICE; | |
+ case EAI_SERVICE: | |
+ return UV_EAI_SERVICE; | |
#endif | |
#if defined(EAI_SOCKTYPE) | |
- case EAI_SOCKTYPE: return UV_EAI_SOCKTYPE; | |
+ case EAI_SOCKTYPE: | |
+ return UV_EAI_SOCKTYPE; | |
#endif | |
#if defined(EAI_SYSTEM) | |
- case EAI_SYSTEM: return -errno; | |
+ case EAI_SYSTEM: | |
+ return -errno; | |
#endif | |
} | |
assert(!"unknown EAI_* error code"); | |
diff --git a/src/unix/internal.h b/src/unix/internal.h | |
index daad61b..3f5d47b 100644 | |
--- a/src/unix/internal.h | |
+++ b/src/unix/internal.h | |
@@ -193,7 +193,7 @@ void uv__run_prepare(uv_loop_t* loop); | |
/* stream */ | |
void uv__stream_init(uv_loop_t* loop, uv_stream_t* stream, | |
- uv_handle_type type); | |
+ uv_handle_type type); | |
int uv__stream_open(uv_stream_t*, int fd, int flags); | |
void uv__stream_destroy(uv_stream_t* stream); | |
#if defined(__APPLE__) | |
diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c | |
index aaadcd8..f40fee3 100644 | |
--- a/src/unix/kqueue.c | |
+++ b/src/unix/kqueue.c | |
@@ -93,7 +93,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { | |
if (w->cb == uv__fs_event) { | |
filter = EVFILT_VNODE; | |
fflags = NOTE_ATTRIB | NOTE_WRITE | NOTE_RENAME | |
- | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE; | |
+ | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE; | |
op = EV_ADD | EV_ONESHOT; /* Stop the event from firing repeatedly. */ | |
} | |
@@ -329,7 +329,7 @@ static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) { | |
/* Watcher operates in one-shot mode, re-arm it. */ | |
fflags = NOTE_ATTRIB | NOTE_WRITE | NOTE_RENAME | |
- | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE; | |
+ | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE; | |
EV_SET(&ev, w->fd, EVFILT_VNODE, EV_ADD | EV_ONESHOT, fflags, 0, 0); | |
diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c | |
index 4ff1a84..8d5e58e 100644 | |
--- a/src/unix/linux-core.c | |
+++ b/src/unix/linux-core.c | |
@@ -469,9 +469,9 @@ int uv_uptime(double* uptime) { | |
* is suspended. | |
*/ | |
if (no_clock_boottime) { | |
- retry: r = clock_gettime(CLOCK_MONOTONIC, &now); | |
- } | |
- else if ((r = clock_gettime(CLOCK_BOOTTIME, &now)) && errno == EINVAL) { | |
+retry: | |
+ r = clock_gettime(CLOCK_MONOTONIC, &now); | |
+ } else if ((r = clock_gettime(CLOCK_BOOTTIME, &now)) && errno == EINVAL) { | |
no_clock_boottime = 1; | |
goto retry; | |
} | |
@@ -736,7 +736,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { | |
int uv_interface_addresses(uv_interface_address_t** addresses, | |
- int* count) { | |
+ int* count) { | |
#ifndef HAVE_IFADDRS_H | |
return -ENOSYS; | |
#else | |
@@ -831,7 +831,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
int i; | |
for (i = 0; i < count; i++) { | |
diff --git a/src/unix/linux-inotify.c b/src/unix/linux-inotify.c | |
index 2ecc5eb..afaea43 100644 | |
--- a/src/unix/linux-inotify.c | |
+++ b/src/unix/linux-inotify.c | |
@@ -191,13 +191,13 @@ int uv_fs_event_start(uv_fs_event_t* handle, | |
return err; | |
events = UV__IN_ATTRIB | |
- | UV__IN_CREATE | |
- | UV__IN_MODIFY | |
- | UV__IN_DELETE | |
- | UV__IN_DELETE_SELF | |
- | UV__IN_MOVE_SELF | |
- | UV__IN_MOVED_FROM | |
- | UV__IN_MOVED_TO; | |
+ | UV__IN_CREATE | |
+ | UV__IN_MODIFY | |
+ | UV__IN_DELETE | |
+ | UV__IN_DELETE_SELF | |
+ | UV__IN_MOVE_SELF | |
+ | UV__IN_MOVED_FROM | |
+ | UV__IN_MOVED_TO; | |
wd = uv__inotify_add_watch(handle->loop->inotify_fd, path, events); | |
if (wd == -1) | |
diff --git a/src/unix/linux-syscalls.c b/src/unix/linux-syscalls.c | |
index 7bf2c0f..f923dfe 100644 | |
--- a/src/unix/linux-syscalls.c | |
+++ b/src/unix/linux-syscalls.c | |
@@ -44,7 +44,7 @@ | |
# if defined(__x86_64__) | |
# define __NR_accept4 288 | |
# elif defined(__i386__) | |
- /* Nothing. Handled through socketcall(). */ | |
+/* Nothing. Handled through socketcall(). */ | |
# elif defined(__arm__) | |
# define __NR_accept4 (UV_SYSCALL_BASE + 366) | |
# endif | |
@@ -409,8 +409,7 @@ int uv__recvmmsg(int fd, | |
int uv__utimesat(int dirfd, | |
const char* path, | |
const struct timespec times[2], | |
- int flags) | |
-{ | |
+ int flags) { | |
#if defined(__NR_utimensat) | |
return syscall(__NR_utimensat, dirfd, path, times, flags); | |
#else | |
diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c | |
index cde8d4d..c96d36b 100644 | |
--- a/src/unix/openbsd.c | |
+++ b/src/unix/openbsd.c | |
@@ -288,7 +288,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { | |
int uv_interface_addresses(uv_interface_address_t** addresses, | |
- int* count) { | |
+ int* count) { | |
struct ifaddrs *addrs, *ent; | |
uv_interface_address_t* address; | |
int i; | |
@@ -297,7 +297,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
if (getifaddrs(&addrs) != 0) | |
return -errno; | |
- *count = 0; | |
+ *count = 0; | |
/* Count the number of interfaces */ | |
for (ent = addrs; ent != NULL; ent = ent->ifa_next) { | |
@@ -371,7 +371,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
int i; | |
for (i = 0; i < count; i++) { | |
diff --git a/src/unix/pipe.c b/src/unix/pipe.c | |
index b20fb92..b57fe1e 100644 | |
--- a/src/unix/pipe.c | |
+++ b/src/unix/pipe.c | |
@@ -143,9 +143,9 @@ int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { | |
void uv_pipe_connect(uv_connect_t* req, | |
- uv_pipe_t* handle, | |
- const char* name, | |
- uv_connect_cb cb) { | |
+ uv_pipe_t* handle, | |
+ const char* name, | |
+ uv_connect_cb cb) { | |
struct sockaddr_un saddr; | |
int new_sock; | |
int err; | |
@@ -168,8 +168,7 @@ void uv_pipe_connect(uv_connect_t* req, | |
do { | |
r = connect(uv__stream_fd(handle), | |
(struct sockaddr*)&saddr, sizeof saddr); | |
- } | |
- while (r == -1 && errno == EINTR); | |
+ } while (r == -1 && errno == EINTR); | |
if (r == -1 && errno != EINPROGRESS) { | |
err = -errno; | |
diff --git a/src/unix/poll.c b/src/unix/poll.c | |
index a34a8d1..6276c28 100644 | |
--- a/src/unix/poll.c | |
+++ b/src/unix/poll.c | |
@@ -59,7 +59,7 @@ int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { | |
int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, | |
- uv_os_sock_t socket) { | |
+ uv_os_sock_t socket) { | |
return uv_poll_init(loop, handle, socket); | |
} | |
diff --git a/src/unix/process.c b/src/unix/process.c | |
index be283b4..ad77510 100644 | |
--- a/src/unix/process.c | |
+++ b/src/unix/process.c | |
@@ -192,32 +192,32 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) { | |
mask = UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM; | |
switch (container->flags & mask) { | |
- case UV_IGNORE: | |
- return 0; | |
- | |
- case UV_CREATE_PIPE: | |
- assert(container->data.stream != NULL); | |
- if (container->data.stream->type != UV_NAMED_PIPE) | |
- return -EINVAL; | |
- else | |
- return uv__make_socketpair(fds, 0); | |
- | |
- case UV_INHERIT_FD: | |
- case UV_INHERIT_STREAM: | |
- if (container->flags & UV_INHERIT_FD) | |
- fd = container->data.fd; | |
- else | |
- fd = uv__stream_fd(container->data.stream); | |
- | |
- if (fd == -1) | |
+ case UV_IGNORE: | |
+ return 0; | |
+ | |
+ case UV_CREATE_PIPE: | |
+ assert(container->data.stream != NULL); | |
+ if (container->data.stream->type != UV_NAMED_PIPE) | |
+ return -EINVAL; | |
+ else | |
+ return uv__make_socketpair(fds, 0); | |
+ | |
+ case UV_INHERIT_FD: | |
+ case UV_INHERIT_STREAM: | |
+ if (container->flags & UV_INHERIT_FD) | |
+ fd = container->data.fd; | |
+ else | |
+ fd = uv__stream_fd(container->data.stream); | |
+ | |
+ if (fd == -1) | |
+ return -EINVAL; | |
+ | |
+ fds[1] = fd; | |
+ return 0; | |
+ | |
+ default: | |
+ assert(0 && "Unexpected flags"); | |
return -EINVAL; | |
- | |
- fds[1] = fd; | |
- return 0; | |
- | |
- default: | |
- assert(0 && "Unexpected flags"); | |
- return -EINVAL; | |
} | |
} | |
diff --git a/src/unix/signal.c b/src/unix/signal.c | |
index 0b7a405..c019007 100644 | |
--- a/src/unix/signal.c | |
+++ b/src/unix/signal.c | |
@@ -45,7 +45,7 @@ static void uv__signal_stop(uv_signal_t* handle); | |
static pthread_once_t uv__signal_global_init_guard = PTHREAD_ONCE_INIT; | |
static struct uv__signal_tree_s uv__signal_tree = | |
- RB_INITIALIZER(uv__signal_tree); | |
+ RB_INITIALIZER(uv__signal_tree); | |
static int uv__signal_lock_pipefd[2]; | |
diff --git a/src/unix/stream.c b/src/unix/stream.c | |
index d41a342..03f8c43 100644 | |
--- a/src/unix/stream.c | |
+++ b/src/unix/stream.c | |
@@ -608,16 +608,16 @@ int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) { | |
int err; | |
switch (stream->type) { | |
- case UV_TCP: | |
- err = uv_tcp_listen((uv_tcp_t*)stream, backlog, cb); | |
- break; | |
+ case UV_TCP: | |
+ err = uv_tcp_listen((uv_tcp_t*)stream, backlog, cb); | |
+ break; | |
- case UV_NAMED_PIPE: | |
- err = uv_pipe_listen((uv_pipe_t*)stream, backlog, cb); | |
- break; | |
+ case UV_NAMED_PIPE: | |
+ err = uv_pipe_listen((uv_pipe_t*)stream, backlog, cb); | |
+ break; | |
- default: | |
- err = -EINVAL; | |
+ default: | |
+ err = -EINVAL; | |
} | |
if (err == 0) | |
@@ -793,8 +793,7 @@ start: | |
do { | |
n = sendmsg(uv__stream_fd(stream), &msg, 0); | |
- } | |
- while (n == -1 && errno == EINTR); | |
+ } while (n == -1 && errno == EINTR); | |
} else { | |
do { | |
if (iovcnt == 1) { | |
@@ -802,8 +801,7 @@ start: | |
} else { | |
n = writev(uv__stream_fd(stream), iov, iovcnt); | |
} | |
- } | |
- while (n == -1 && errno == EINTR); | |
+ } while (n == -1 && errno == EINTR); | |
} | |
if (n < 0) { | |
@@ -932,7 +930,7 @@ uv_handle_type uv__handle_type(int fd) { | |
case AF_INET: | |
case AF_INET6: | |
return UV_TCP; | |
- } | |
+ } | |
} | |
if (type == SOCK_DGRAM && | |
@@ -974,7 +972,7 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) { | |
queue_size = queued_fds->size + 8; | |
queued_fds = realloc(queued_fds, | |
(queue_size - 1) * sizeof(*queued_fds->fds) + | |
- sizeof(*queued_fds)); | |
+ sizeof(*queued_fds)); | |
/* | |
* Allocation failure, report back. | |
@@ -1011,7 +1009,7 @@ static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) { | |
if (cmsg->cmsg_type != SCM_RIGHTS) { | |
fprintf(stderr, "ignoring non-SCM_RIGHTS ancillary data: %d\n", | |
- cmsg->cmsg_type); | |
+ cmsg->cmsg_type); | |
continue; | |
} | |
@@ -1069,8 +1067,8 @@ static void uv__read(uv_stream_t* stream) { | |
* tcp->read_cb is NULL or not? | |
*/ | |
while (stream->read_cb | |
- && (stream->flags & UV_STREAM_READING) | |
- && (count-- > 0)) { | |
+ && (stream->flags & UV_STREAM_READING) | |
+ && (count-- > 0)) { | |
assert(stream->alloc_cb != NULL); | |
stream->alloc_cb((uv_handle_t*)stream, 64 * 1024, &buf); | |
@@ -1086,8 +1084,7 @@ static void uv__read(uv_stream_t* stream) { | |
if (!is_ipc) { | |
do { | |
nread = read(uv__stream_fd(stream), buf.base, buf.len); | |
- } | |
- while (nread < 0 && errno == EINTR); | |
+ } while (nread < 0 && errno == EINTR); | |
} else { | |
/* ipc uses recvmsg */ | |
msg.msg_flags = 0; | |
@@ -1101,8 +1098,7 @@ static void uv__read(uv_stream_t* stream) { | |
do { | |
nread = uv__recvmsg(uv__stream_fd(stream), &msg, 0); | |
- } | |
- while (nread < 0 && errno == EINTR); | |
+ } while (nread < 0 && errno == EINTR); | |
} | |
if (nread < 0) { | |
@@ -1358,11 +1354,9 @@ int uv_write2(uv_write_t* req, | |
*/ | |
if (stream->connect_req) { | |
/* Still connecting, do nothing. */ | |
- } | |
- else if (empty_queue) { | |
+ } else if (empty_queue) { | |
uv__write(stream); | |
- } | |
- else { | |
+ } else { | |
/* | |
* blocking streams should never have anything in the queue. | |
* if this assert fires then somehow the blocking stream isn't being | |
@@ -1447,7 +1441,7 @@ int uv_read_start(uv_stream_t* stream, | |
uv_alloc_cb alloc_cb, | |
uv_read_cb read_cb) { | |
assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || | |
- stream->type == UV_TTY); | |
+ stream->type == UV_TTY); | |
if (stream->flags & UV_CLOSING) | |
return -EINVAL; | |
diff --git a/src/unix/sunos.c b/src/unix/sunos.c | |
index d6fb7f4..ef728e6 100644 | |
--- a/src/unix/sunos.c | |
+++ b/src/unix/sunos.c | |
@@ -374,8 +374,7 @@ static void uv__fs_event_read(uv_loop_t* loop, | |
do { | |
memset(&timeout, 0, sizeof timeout); | |
r = port_getn(loop->fs_fd, &pe, 1, &n, &timeout); | |
- } | |
- while (r == -1 && errno == EINTR); | |
+ } while (r == -1 && errno == EINTR); | |
if ((r == -1 && errno == ETIME) || n == 0) | |
break; | |
@@ -397,8 +396,7 @@ static void uv__fs_event_read(uv_loop_t* loop, | |
if (r != 0) | |
handle->cb(handle, NULL, 0, r); | |
} | |
- } | |
- while (handle->fd != PORT_DELETED); | |
+ } while (handle->fd != PORT_DELETED); | |
} | |
@@ -597,7 +595,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { | |
assert(knp->data_type == KSTAT_DATA_INT32 || | |
knp->data_type == KSTAT_DATA_INT64); | |
cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32 | |
- : knp->value.i64; | |
+ : knp->value.i64; | |
knp = kstat_data_lookup(ksp, (char*) "brand"); | |
assert(knp->data_type == KSTAT_DATA_STRING); | |
@@ -716,7 +714,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { | |
} | |
address->is_internal = !!((ent->ifa_flags & IFF_PRIVATE) || | |
- (ent->ifa_flags & IFF_LOOPBACK)); | |
+ (ent->ifa_flags & IFF_LOOPBACK)); | |
address++; | |
} | |
@@ -748,7 +746,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
int i; | |
for (i = 0; i < count; i++) { | |
diff --git a/src/unix/tcp.c b/src/unix/tcp.c | |
index 8c19c1a..db76f6d 100644 | |
--- a/src/unix/tcp.c | |
+++ b/src/unix/tcp.c | |
@@ -131,10 +131,10 @@ int uv__tcp_connect(uv_connect_t* req, | |
if (errno == EINPROGRESS) | |
; /* not an error */ | |
else if (errno == ECONNREFUSED) | |
- /* If we get a ECONNREFUSED wait until the next tick to report the | |
- * error. Solaris wants to report immediately--other unixes want to | |
- * wait. | |
- */ | |
+ /* If we get a ECONNREFUSED wait until the next tick to report the | |
+ * error. Solaris wants to report immediately--other unixes want to | |
+ * wait. | |
+ */ | |
handle->delayed_error = -errno; | |
else | |
return -errno; | |
diff --git a/src/unix/thread.c b/src/unix/thread.c | |
index 7a55bd6..d15a41e 100644 | |
--- a/src/unix/thread.c | |
+++ b/src/unix/thread.c | |
@@ -38,8 +38,7 @@ struct thread_ctx { | |
}; | |
-static void* uv__thread_start(void *arg) | |
-{ | |
+static void* uv__thread_start(void *arg) { | |
struct thread_ctx *ctx_p; | |
struct thread_ctx ctx; | |
diff --git a/src/unix/udp.c b/src/unix/udp.c | |
index 71a0e41..275537e 100644 | |
--- a/src/unix/udp.c | |
+++ b/src/unix/udp.c | |
@@ -173,16 +173,14 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { | |
do { | |
nread = recvmsg(handle->io_watcher.fd, &h, 0); | |
- } | |
- while (nread == -1 && errno == EINTR); | |
+ } while (nread == -1 && errno == EINTR); | |
if (nread == -1) { | |
if (errno == EAGAIN || errno == EWOULDBLOCK) | |
handle->recv_cb(handle, 0, &buf, NULL, 0); | |
else | |
handle->recv_cb(handle, -errno, &buf, NULL, 0); | |
- } | |
- else { | |
+ } else { | |
const struct sockaddr *addr; | |
if (h.msg_namelen == 0) | |
addr = NULL; | |
@@ -198,9 +196,9 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { | |
} | |
/* recv_cb callback may decide to pause or close the handle */ | |
while (nread != -1 | |
- && count-- > 0 | |
- && handle->io_watcher.fd != -1 | |
- && handle->recv_cb != NULL); | |
+ && count-- > 0 | |
+ && handle->io_watcher.fd != -1 | |
+ && handle->recv_cb != NULL); | |
} | |
@@ -220,7 +218,7 @@ static void uv__udp_sendmsg(uv_udp_t* handle) { | |
memset(&h, 0, sizeof h); | |
h.msg_name = &req->addr; | |
h.msg_namelen = (req->addr.ss_family == AF_INET6 ? | |
- sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)); | |
+ sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)); | |
h.msg_iov = (struct iovec*) req->bufs; | |
h.msg_iovlen = req->nbufs; | |
@@ -341,27 +339,25 @@ static int uv__udp_maybe_deferred_bind(uv_udp_t* handle, | |
return 0; | |
switch (domain) { | |
- case AF_INET: | |
- { | |
- struct sockaddr_in* addr = (void*)&taddr; | |
- memset(addr, 0, sizeof *addr); | |
- addr->sin_family = AF_INET; | |
- addr->sin_addr.s_addr = INADDR_ANY; | |
- addrlen = sizeof *addr; | |
- break; | |
- } | |
- case AF_INET6: | |
- { | |
- struct sockaddr_in6* addr = (void*)&taddr; | |
- memset(addr, 0, sizeof *addr); | |
- addr->sin6_family = AF_INET6; | |
- addr->sin6_addr = in6addr_any; | |
- addrlen = sizeof *addr; | |
- break; | |
- } | |
- default: | |
- assert(0 && "unsupported address family"); | |
- abort(); | |
+ case AF_INET: { | |
+ struct sockaddr_in* addr = (void*)&taddr; | |
+ memset(addr, 0, sizeof *addr); | |
+ addr->sin_family = AF_INET; | |
+ addr->sin_addr.s_addr = INADDR_ANY; | |
+ addrlen = sizeof *addr; | |
+ break; | |
+ } | |
+ case AF_INET6: { | |
+ struct sockaddr_in6* addr = (void*)&taddr; | |
+ memset(addr, 0, sizeof *addr); | |
+ addr->sin6_family = AF_INET6; | |
+ addr->sin6_addr = in6addr_any; | |
+ addrlen = sizeof *addr; | |
+ break; | |
+ } | |
+ default: | |
+ assert(0 && "unsupported address family"); | |
+ abort(); | |
} | |
return uv__udp_bind(handle, (const struct sockaddr*) &taddr, addrlen, flags); | |
@@ -480,14 +476,14 @@ static int uv__udp_set_membership4(uv_udp_t* handle, | |
mreq.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr; | |
switch (membership) { | |
- case UV_JOIN_GROUP: | |
- optname = IP_ADD_MEMBERSHIP; | |
- break; | |
- case UV_LEAVE_GROUP: | |
- optname = IP_DROP_MEMBERSHIP; | |
- break; | |
- default: | |
- return -EINVAL; | |
+ case UV_JOIN_GROUP: | |
+ optname = IP_ADD_MEMBERSHIP; | |
+ break; | |
+ case UV_LEAVE_GROUP: | |
+ optname = IP_DROP_MEMBERSHIP; | |
+ break; | |
+ default: | |
+ return -EINVAL; | |
} | |
if (setsockopt(handle->io_watcher.fd, | |
@@ -523,14 +519,14 @@ static int uv__udp_set_membership6(uv_udp_t* handle, | |
mreq.ipv6mr_multiaddr = multicast_addr->sin6_addr; | |
switch (membership) { | |
- case UV_JOIN_GROUP: | |
- optname = IPV6_ADD_MEMBERSHIP; | |
- break; | |
- case UV_LEAVE_GROUP: | |
- optname = IPV6_DROP_MEMBERSHIP; | |
- break; | |
- default: | |
- return -EINVAL; | |
+ case UV_JOIN_GROUP: | |
+ optname = IPV6_ADD_MEMBERSHIP; | |
+ break; | |
+ case UV_LEAVE_GROUP: | |
+ optname = IPV6_DROP_MEMBERSHIP; | |
+ break; | |
+ default: | |
+ return -EINVAL; | |
} | |
if (setsockopt(handle->io_watcher.fd, | |
diff --git a/src/uv-common.c b/src/uv-common.c | |
index f84f8c4..ee7c721 100644 | |
--- a/src/uv-common.c | |
+++ b/src/uv-common.c | |
@@ -37,7 +37,7 @@ | |
size_t uv_handle_size(uv_handle_type type) { | |
switch (type) { | |
- UV_HANDLE_TYPE_MAP(XX) | |
+ UV_HANDLE_TYPE_MAP(XX) | |
default: | |
return -1; | |
} | |
@@ -45,7 +45,7 @@ size_t uv_handle_size(uv_handle_type type) { | |
size_t uv_req_size(uv_req_type type) { | |
switch(type) { | |
- UV_REQ_TYPE_MAP(XX) | |
+ UV_REQ_TYPE_MAP(XX) | |
default: | |
return -1; | |
} | |
@@ -70,7 +70,7 @@ uv_buf_t uv_buf_init(char* base, unsigned int len) { | |
#define UV_ERR_NAME_GEN(name, _) case UV_ ## name: return #name; | |
const char* uv_err_name(int err) { | |
switch (err) { | |
- UV_ERRNO_MAP(UV_ERR_NAME_GEN) | |
+ UV_ERRNO_MAP(UV_ERR_NAME_GEN) | |
default: | |
assert(0); | |
return NULL; | |
@@ -82,7 +82,7 @@ const char* uv_err_name(int err) { | |
#define UV_STRERROR_GEN(name, msg) case UV_ ## name: return msg; | |
const char* uv_strerror(int err) { | |
switch (err) { | |
- UV_ERRNO_MAP(UV_STRERROR_GEN) | |
+ UV_ERRNO_MAP(UV_STRERROR_GEN) | |
default: | |
return "Unknown system error"; | |
} | |
@@ -287,9 +287,10 @@ static void uv__print_handles(uv_loop_t* loop, int only_active) { | |
switch (h->type) { | |
#define X(uc, lc) case UV_##uc: type = #lc; break; | |
- UV_HANDLE_TYPE_MAP(X) | |
+ UV_HANDLE_TYPE_MAP(X) | |
#undef X | |
- default: type = "<unknown>"; | |
+ default: | |
+ type = "<unknown>"; | |
} | |
fprintf(stderr, | |
diff --git a/src/uv-common.h b/src/uv-common.h | |
index 7d3c58f..a362cf3 100644 | |
--- a/src/uv-common.h | |
+++ b/src/uv-common.h | |
@@ -68,10 +68,10 @@ int uv__tcp_bind(uv_tcp_t* tcp, | |
unsigned int flags); | |
int uv__tcp_connect(uv_connect_t* req, | |
- uv_tcp_t* handle, | |
- const struct sockaddr* addr, | |
- unsigned int addrlen, | |
- uv_connect_cb cb); | |
+ uv_tcp_t* handle, | |
+ const struct sockaddr* addr, | |
+ unsigned int addrlen, | |
+ uv_connect_cb cb); | |
int uv__udp_bind(uv_udp_t* handle, | |
const struct sockaddr* addr, | |
diff --git a/src/win/async.c b/src/win/async.c | |
index ad240ab..c574e4a 100644 | |
--- a/src/win/async.c | |
+++ b/src/win/async.c | |
@@ -85,7 +85,7 @@ int uv_async_send(uv_async_t* handle) { | |
void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
assert(handle->type == UV_ASYNC); | |
assert(req->type == UV_WAKEUP); | |
diff --git a/src/win/core.c b/src/win/core.c | |
index 2bef8b7..1fcd468 100644 | |
--- a/src/win/core.c | |
+++ b/src/win/core.c | |
@@ -380,7 +380,7 @@ static int uv__loop_alive(const uv_loop_t* loop) { | |
int uv_loop_alive(const uv_loop_t* loop) { | |
- return uv__loop_alive(loop); | |
+ return uv__loop_alive(loop); | |
} | |
@@ -447,28 +447,28 @@ int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd) { | |
uv_os_fd_t fd_out; | |
switch (handle->type) { | |
- case UV_TCP: | |
- fd_out = (uv_os_fd_t)((uv_tcp_t*) handle)->socket; | |
- break; | |
+ case UV_TCP: | |
+ fd_out = (uv_os_fd_t)((uv_tcp_t*) handle)->socket; | |
+ break; | |
- case UV_NAMED_PIPE: | |
- fd_out = ((uv_pipe_t*) handle)->handle; | |
- break; | |
+ case UV_NAMED_PIPE: | |
+ fd_out = ((uv_pipe_t*) handle)->handle; | |
+ break; | |
- case UV_TTY: | |
- fd_out = ((uv_tty_t*) handle)->handle; | |
- break; | |
+ case UV_TTY: | |
+ fd_out = ((uv_tty_t*) handle)->handle; | |
+ break; | |
- case UV_UDP: | |
- fd_out = (uv_os_fd_t)((uv_udp_t*) handle)->socket; | |
- break; | |
+ case UV_UDP: | |
+ fd_out = (uv_os_fd_t)((uv_udp_t*) handle)->socket; | |
+ break; | |
- case UV_POLL: | |
- fd_out = (uv_os_fd_t)((uv_poll_t*) handle)->socket; | |
- break; | |
+ case UV_POLL: | |
+ fd_out = (uv_os_fd_t)((uv_poll_t*) handle)->socket; | |
+ break; | |
- default: | |
- return UV_EINVAL; | |
+ default: | |
+ return UV_EINVAL; | |
} | |
if (uv_is_closing(handle) || fd_out == INVALID_HANDLE_VALUE) | |
diff --git a/src/win/dl.c b/src/win/dl.c | |
index e5f3407..d3908e4 100644 | |
--- a/src/win/dl.c | |
+++ b/src/win/dl.c | |
@@ -69,7 +69,7 @@ const char* uv_dlerror(const uv_lib_t* lib) { | |
} | |
-static void uv__format_fallback_error(uv_lib_t* lib, int errorno){ | |
+static void uv__format_fallback_error(uv_lib_t* lib, int errorno) { | |
DWORD_PTR args[1] = { (DWORD_PTR) errorno }; | |
LPSTR fallback_error = "error: %1!d!"; | |
diff --git a/src/win/error.c b/src/win/error.c | |
index 5c55147..8c3e828 100644 | |
--- a/src/win/error.c | |
+++ b/src/win/error.c | |
@@ -38,8 +38,8 @@ void uv_fatal_error(const int errorno, const char* syscall) { | |
const char* errmsg; | |
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | | |
- FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, | |
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buf, 0, NULL); | |
+ FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorno, | |
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buf, 0, NULL); | |
if (buf) { | |
errmsg = buf; | |
@@ -70,101 +70,197 @@ int uv_translate_sys_error(int sys_errno) { | |
} | |
switch (sys_errno) { | |
- case ERROR_NOACCESS: return UV_EACCES; | |
- case WSAEACCES: return UV_EACCES; | |
- case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE; | |
- case WSAEADDRINUSE: return UV_EADDRINUSE; | |
- case WSAEADDRNOTAVAIL: return UV_EADDRNOTAVAIL; | |
- case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT; | |
- case WSAEWOULDBLOCK: return UV_EAGAIN; | |
- case WSAEALREADY: return UV_EALREADY; | |
- case ERROR_INVALID_FLAGS: return UV_EBADF; | |
- case ERROR_INVALID_HANDLE: return UV_EBADF; | |
- case ERROR_LOCK_VIOLATION: return UV_EBUSY; | |
- case ERROR_PIPE_BUSY: return UV_EBUSY; | |
- case ERROR_SHARING_VIOLATION: return UV_EBUSY; | |
- case ERROR_OPERATION_ABORTED: return UV_ECANCELED; | |
- case WSAEINTR: return UV_ECANCELED; | |
- case ERROR_NO_UNICODE_TRANSLATION: return UV_ECHARSET; | |
- case ERROR_CONNECTION_ABORTED: return UV_ECONNABORTED; | |
- case WSAECONNABORTED: return UV_ECONNABORTED; | |
- case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED; | |
- case WSAECONNREFUSED: return UV_ECONNREFUSED; | |
- case ERROR_NETNAME_DELETED: return UV_ECONNRESET; | |
- case WSAECONNRESET: return UV_ECONNRESET; | |
- case ERROR_ALREADY_EXISTS: return UV_EEXIST; | |
- case ERROR_FILE_EXISTS: return UV_EEXIST; | |
- case ERROR_BUFFER_OVERFLOW: return UV_EFAULT; | |
- case WSAEFAULT: return UV_EFAULT; | |
- case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH; | |
- case WSAEHOSTUNREACH: return UV_EHOSTUNREACH; | |
- case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL; | |
- case ERROR_INVALID_DATA: return UV_EINVAL; | |
- case ERROR_INVALID_PARAMETER: return UV_EINVAL; | |
- case ERROR_SYMLINK_NOT_SUPPORTED: return UV_EINVAL; | |
- case WSAEINVAL: return UV_EINVAL; | |
- case WSAEPFNOSUPPORT: return UV_EINVAL; | |
- case WSAESOCKTNOSUPPORT: return UV_EINVAL; | |
- case ERROR_BEGINNING_OF_MEDIA: return UV_EIO; | |
- case ERROR_BUS_RESET: return UV_EIO; | |
- case ERROR_CRC: return UV_EIO; | |
- case ERROR_DEVICE_DOOR_OPEN: return UV_EIO; | |
- case ERROR_DEVICE_REQUIRES_CLEANING: return UV_EIO; | |
- case ERROR_DISK_CORRUPT: return UV_EIO; | |
- case ERROR_EOM_OVERFLOW: return UV_EIO; | |
- case ERROR_FILEMARK_DETECTED: return UV_EIO; | |
- case ERROR_GEN_FAILURE: return UV_EIO; | |
- case ERROR_INVALID_BLOCK_LENGTH: return UV_EIO; | |
- case ERROR_IO_DEVICE: return UV_EIO; | |
- case ERROR_NO_DATA_DETECTED: return UV_EIO; | |
- case ERROR_NO_SIGNAL_SENT: return UV_EIO; | |
- case ERROR_OPEN_FAILED: return UV_EIO; | |
- case ERROR_SETMARK_DETECTED: return UV_EIO; | |
- case ERROR_SIGNAL_REFUSED: return UV_EIO; | |
- case WSAEISCONN: return UV_EISCONN; | |
- case ERROR_CANT_RESOLVE_FILENAME: return UV_ELOOP; | |
- case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE; | |
- case WSAEMFILE: return UV_EMFILE; | |
- case WSAEMSGSIZE: return UV_EMSGSIZE; | |
- case ERROR_FILENAME_EXCED_RANGE: return UV_ENAMETOOLONG; | |
- case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH; | |
- case WSAENETUNREACH: return UV_ENETUNREACH; | |
- case WSAENOBUFS: return UV_ENOBUFS; | |
- case ERROR_DIRECTORY: return UV_ENOENT; | |
- case ERROR_FILE_NOT_FOUND: return UV_ENOENT; | |
- case ERROR_INVALID_NAME: return UV_ENOENT; | |
- case ERROR_INVALID_DRIVE: return UV_ENOENT; | |
- case ERROR_INVALID_REPARSE_DATA: return UV_ENOENT; | |
- case ERROR_MOD_NOT_FOUND: return UV_ENOENT; | |
- case ERROR_PATH_NOT_FOUND: return UV_ENOENT; | |
- case WSAHOST_NOT_FOUND: return UV_ENOENT; | |
- case WSANO_DATA: return UV_ENOENT; | |
- case ERROR_NOT_ENOUGH_MEMORY: return UV_ENOMEM; | |
- case ERROR_OUTOFMEMORY: return UV_ENOMEM; | |
- case ERROR_CANNOT_MAKE: return UV_ENOSPC; | |
- case ERROR_DISK_FULL: return UV_ENOSPC; | |
- case ERROR_EA_TABLE_FULL: return UV_ENOSPC; | |
- case ERROR_END_OF_MEDIA: return UV_ENOSPC; | |
- case ERROR_HANDLE_DISK_FULL: return UV_ENOSPC; | |
- case ERROR_NOT_CONNECTED: return UV_ENOTCONN; | |
- case WSAENOTCONN: return UV_ENOTCONN; | |
- case ERROR_DIR_NOT_EMPTY: return UV_ENOTEMPTY; | |
- case WSAENOTSOCK: return UV_ENOTSOCK; | |
- case ERROR_NOT_SUPPORTED: return UV_ENOTSUP; | |
- case ERROR_BROKEN_PIPE: return UV_EOF; | |
- case ERROR_ACCESS_DENIED: return UV_EPERM; | |
- case ERROR_PRIVILEGE_NOT_HELD: return UV_EPERM; | |
- case ERROR_BAD_PIPE: return UV_EPIPE; | |
- case ERROR_NO_DATA: return UV_EPIPE; | |
- case ERROR_PIPE_NOT_CONNECTED: return UV_EPIPE; | |
- case WSAESHUTDOWN: return UV_EPIPE; | |
- case WSAEPROTONOSUPPORT: return UV_EPROTONOSUPPORT; | |
- case ERROR_WRITE_PROTECT: return UV_EROFS; | |
- case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT; | |
- case WSAETIMEDOUT: return UV_ETIMEDOUT; | |
- case ERROR_NOT_SAME_DEVICE: return UV_EXDEV; | |
- case ERROR_INVALID_FUNCTION: return UV_EISDIR; | |
- case ERROR_META_EXPANSION_TOO_LONG: return UV_E2BIG; | |
- default: return UV_UNKNOWN; | |
+ case ERROR_NOACCESS: | |
+ return UV_EACCES; | |
+ case WSAEACCES: | |
+ return UV_EACCES; | |
+ case ERROR_ADDRESS_ALREADY_ASSOCIATED: | |
+ return UV_EADDRINUSE; | |
+ case WSAEADDRINUSE: | |
+ return UV_EADDRINUSE; | |
+ case WSAEADDRNOTAVAIL: | |
+ return UV_EADDRNOTAVAIL; | |
+ case WSAEAFNOSUPPORT: | |
+ return UV_EAFNOSUPPORT; | |
+ case WSAEWOULDBLOCK: | |
+ return UV_EAGAIN; | |
+ case WSAEALREADY: | |
+ return UV_EALREADY; | |
+ case ERROR_INVALID_FLAGS: | |
+ return UV_EBADF; | |
+ case ERROR_INVALID_HANDLE: | |
+ return UV_EBADF; | |
+ case ERROR_LOCK_VIOLATION: | |
+ return UV_EBUSY; | |
+ case ERROR_PIPE_BUSY: | |
+ return UV_EBUSY; | |
+ case ERROR_SHARING_VIOLATION: | |
+ return UV_EBUSY; | |
+ case ERROR_OPERATION_ABORTED: | |
+ return UV_ECANCELED; | |
+ case WSAEINTR: | |
+ return UV_ECANCELED; | |
+ case ERROR_NO_UNICODE_TRANSLATION: | |
+ return UV_ECHARSET; | |
+ case ERROR_CONNECTION_ABORTED: | |
+ return UV_ECONNABORTED; | |
+ case WSAECONNABORTED: | |
+ return UV_ECONNABORTED; | |
+ case ERROR_CONNECTION_REFUSED: | |
+ return UV_ECONNREFUSED; | |
+ case WSAECONNREFUSED: | |
+ return UV_ECONNREFUSED; | |
+ case ERROR_NETNAME_DELETED: | |
+ return UV_ECONNRESET; | |
+ case WSAECONNRESET: | |
+ return UV_ECONNRESET; | |
+ case ERROR_ALREADY_EXISTS: | |
+ return UV_EEXIST; | |
+ case ERROR_FILE_EXISTS: | |
+ return UV_EEXIST; | |
+ case ERROR_BUFFER_OVERFLOW: | |
+ return UV_EFAULT; | |
+ case WSAEFAULT: | |
+ return UV_EFAULT; | |
+ case ERROR_HOST_UNREACHABLE: | |
+ return UV_EHOSTUNREACH; | |
+ case WSAEHOSTUNREACH: | |
+ return UV_EHOSTUNREACH; | |
+ case ERROR_INSUFFICIENT_BUFFER: | |
+ return UV_EINVAL; | |
+ case ERROR_INVALID_DATA: | |
+ return UV_EINVAL; | |
+ case ERROR_INVALID_PARAMETER: | |
+ return UV_EINVAL; | |
+ case ERROR_SYMLINK_NOT_SUPPORTED: | |
+ return UV_EINVAL; | |
+ case WSAEINVAL: | |
+ return UV_EINVAL; | |
+ case WSAEPFNOSUPPORT: | |
+ return UV_EINVAL; | |
+ case WSAESOCKTNOSUPPORT: | |
+ return UV_EINVAL; | |
+ case ERROR_BEGINNING_OF_MEDIA: | |
+ return UV_EIO; | |
+ case ERROR_BUS_RESET: | |
+ return UV_EIO; | |
+ case ERROR_CRC: | |
+ return UV_EIO; | |
+ case ERROR_DEVICE_DOOR_OPEN: | |
+ return UV_EIO; | |
+ case ERROR_DEVICE_REQUIRES_CLEANING: | |
+ return UV_EIO; | |
+ case ERROR_DISK_CORRUPT: | |
+ return UV_EIO; | |
+ case ERROR_EOM_OVERFLOW: | |
+ return UV_EIO; | |
+ case ERROR_FILEMARK_DETECTED: | |
+ return UV_EIO; | |
+ case ERROR_GEN_FAILURE: | |
+ return UV_EIO; | |
+ case ERROR_INVALID_BLOCK_LENGTH: | |
+ return UV_EIO; | |
+ case ERROR_IO_DEVICE: | |
+ return UV_EIO; | |
+ case ERROR_NO_DATA_DETECTED: | |
+ return UV_EIO; | |
+ case ERROR_NO_SIGNAL_SENT: | |
+ return UV_EIO; | |
+ case ERROR_OPEN_FAILED: | |
+ return UV_EIO; | |
+ case ERROR_SETMARK_DETECTED: | |
+ return UV_EIO; | |
+ case ERROR_SIGNAL_REFUSED: | |
+ return UV_EIO; | |
+ case WSAEISCONN: | |
+ return UV_EISCONN; | |
+ case ERROR_CANT_RESOLVE_FILENAME: | |
+ return UV_ELOOP; | |
+ case ERROR_TOO_MANY_OPEN_FILES: | |
+ return UV_EMFILE; | |
+ case WSAEMFILE: | |
+ return UV_EMFILE; | |
+ case WSAEMSGSIZE: | |
+ return UV_EMSGSIZE; | |
+ case ERROR_FILENAME_EXCED_RANGE: | |
+ return UV_ENAMETOOLONG; | |
+ case ERROR_NETWORK_UNREACHABLE: | |
+ return UV_ENETUNREACH; | |
+ case WSAENETUNREACH: | |
+ return UV_ENETUNREACH; | |
+ case WSAENOBUFS: | |
+ return UV_ENOBUFS; | |
+ case ERROR_DIRECTORY: | |
+ return UV_ENOENT; | |
+ case ERROR_FILE_NOT_FOUND: | |
+ return UV_ENOENT; | |
+ case ERROR_INVALID_NAME: | |
+ return UV_ENOENT; | |
+ case ERROR_INVALID_DRIVE: | |
+ return UV_ENOENT; | |
+ case ERROR_INVALID_REPARSE_DATA: | |
+ return UV_ENOENT; | |
+ case ERROR_MOD_NOT_FOUND: | |
+ return UV_ENOENT; | |
+ case ERROR_PATH_NOT_FOUND: | |
+ return UV_ENOENT; | |
+ case WSAHOST_NOT_FOUND: | |
+ return UV_ENOENT; | |
+ case WSANO_DATA: | |
+ return UV_ENOENT; | |
+ case ERROR_NOT_ENOUGH_MEMORY: | |
+ return UV_ENOMEM; | |
+ case ERROR_OUTOFMEMORY: | |
+ return UV_ENOMEM; | |
+ case ERROR_CANNOT_MAKE: | |
+ return UV_ENOSPC; | |
+ case ERROR_DISK_FULL: | |
+ return UV_ENOSPC; | |
+ case ERROR_EA_TABLE_FULL: | |
+ return UV_ENOSPC; | |
+ case ERROR_END_OF_MEDIA: | |
+ return UV_ENOSPC; | |
+ case ERROR_HANDLE_DISK_FULL: | |
+ return UV_ENOSPC; | |
+ case ERROR_NOT_CONNECTED: | |
+ return UV_ENOTCONN; | |
+ case WSAENOTCONN: | |
+ return UV_ENOTCONN; | |
+ case ERROR_DIR_NOT_EMPTY: | |
+ return UV_ENOTEMPTY; | |
+ case WSAENOTSOCK: | |
+ return UV_ENOTSOCK; | |
+ case ERROR_NOT_SUPPORTED: | |
+ return UV_ENOTSUP; | |
+ case ERROR_BROKEN_PIPE: | |
+ return UV_EOF; | |
+ case ERROR_ACCESS_DENIED: | |
+ return UV_EPERM; | |
+ case ERROR_PRIVILEGE_NOT_HELD: | |
+ return UV_EPERM; | |
+ case ERROR_BAD_PIPE: | |
+ return UV_EPIPE; | |
+ case ERROR_NO_DATA: | |
+ return UV_EPIPE; | |
+ case ERROR_PIPE_NOT_CONNECTED: | |
+ return UV_EPIPE; | |
+ case WSAESHUTDOWN: | |
+ return UV_EPIPE; | |
+ case WSAEPROTONOSUPPORT: | |
+ return UV_EPROTONOSUPPORT; | |
+ case ERROR_WRITE_PROTECT: | |
+ return UV_EROFS; | |
+ case ERROR_SEM_TIMEOUT: | |
+ return UV_ETIMEDOUT; | |
+ case WSAETIMEDOUT: | |
+ return UV_ETIMEDOUT; | |
+ case ERROR_NOT_SAME_DEVICE: | |
+ return UV_EXDEV; | |
+ case ERROR_INVALID_FUNCTION: | |
+ return UV_EISDIR; | |
+ case ERROR_META_EXPANSION_TOO_LONG: | |
+ return UV_E2BIG; | |
+ default: | |
+ return UV_UNKNOWN; | |
} | |
} | |
diff --git a/src/win/fs-event.c b/src/win/fs-event.c | |
index 7ad99a8..070adf8 100644 | |
--- a/src/win/fs-event.c | |
+++ b/src/win/fs-event.c | |
@@ -45,13 +45,13 @@ static void uv_fs_event_queue_readdirchanges(uv_loop_t* loop, | |
uv_directory_watcher_buffer_size, | |
FALSE, | |
FILE_NOTIFY_CHANGE_FILE_NAME | | |
- FILE_NOTIFY_CHANGE_DIR_NAME | | |
- FILE_NOTIFY_CHANGE_ATTRIBUTES | | |
- FILE_NOTIFY_CHANGE_SIZE | | |
- FILE_NOTIFY_CHANGE_LAST_WRITE | | |
- FILE_NOTIFY_CHANGE_LAST_ACCESS | | |
- FILE_NOTIFY_CHANGE_CREATION | | |
- FILE_NOTIFY_CHANGE_SECURITY, | |
+ FILE_NOTIFY_CHANGE_DIR_NAME | | |
+ FILE_NOTIFY_CHANGE_ATTRIBUTES | | |
+ FILE_NOTIFY_CHANGE_SIZE | | |
+ FILE_NOTIFY_CHANGE_LAST_WRITE | | |
+ FILE_NOTIFY_CHANGE_LAST_ACCESS | | |
+ FILE_NOTIFY_CHANGE_CREATION | | |
+ FILE_NOTIFY_CHANGE_SECURITY, | |
NULL, | |
&handle->req.overlapped, | |
NULL)) { | |
@@ -65,7 +65,7 @@ static void uv_fs_event_queue_readdirchanges(uv_loop_t* loop, | |
static int uv_split_path(const WCHAR* filename, WCHAR** dir, | |
- WCHAR** file) { | |
+ WCHAR** file) { | |
int len = wcslen(filename); | |
int i = len; | |
while (i > 0 && filename[--i] != '\\' && filename[i] != '/'); | |
@@ -152,7 +152,7 @@ int uv_fs_event_start(uv_fs_event_t* handle, | |
} | |
if (!uv_utf8_to_utf16(path, pathw, | |
- name_size / sizeof(WCHAR))) { | |
+ name_size / sizeof(WCHAR))) { | |
return uv_translate_sys_error(GetLastError()); | |
} | |
@@ -166,7 +166,7 @@ int uv_fs_event_start(uv_fs_event_t* handle, | |
is_path_dir = (attr & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0; | |
if (is_path_dir) { | |
- /* path is a directory, so that's the directory that we will watch. */ | |
+ /* path is a directory, so that's the directory that we will watch. */ | |
handle->dirw = pathw; | |
dir_to_watch = pathw; | |
} else { | |
@@ -199,11 +199,11 @@ int uv_fs_event_start(uv_fs_event_t* handle, | |
handle->dir_handle = CreateFileW(dir_to_watch, | |
FILE_LIST_DIRECTORY, | |
FILE_SHARE_READ | FILE_SHARE_DELETE | | |
- FILE_SHARE_WRITE, | |
+ FILE_SHARE_WRITE, | |
NULL, | |
OPEN_EXISTING, | |
FILE_FLAG_BACKUP_SEMANTICS | | |
- FILE_FLAG_OVERLAPPED, | |
+ FILE_FLAG_OVERLAPPED, | |
NULL); | |
if (dir) { | |
@@ -239,13 +239,13 @@ int uv_fs_event_start(uv_fs_event_t* handle, | |
uv_directory_watcher_buffer_size, | |
FALSE, | |
FILE_NOTIFY_CHANGE_FILE_NAME | | |
- FILE_NOTIFY_CHANGE_DIR_NAME | | |
- FILE_NOTIFY_CHANGE_ATTRIBUTES | | |
- FILE_NOTIFY_CHANGE_SIZE | | |
- FILE_NOTIFY_CHANGE_LAST_WRITE | | |
- FILE_NOTIFY_CHANGE_LAST_ACCESS | | |
- FILE_NOTIFY_CHANGE_CREATION | | |
- FILE_NOTIFY_CHANGE_SECURITY, | |
+ FILE_NOTIFY_CHANGE_DIR_NAME | | |
+ FILE_NOTIFY_CHANGE_ATTRIBUTES | | |
+ FILE_NOTIFY_CHANGE_SIZE | | |
+ FILE_NOTIFY_CHANGE_LAST_WRITE | | |
+ FILE_NOTIFY_CHANGE_LAST_ACCESS | | |
+ FILE_NOTIFY_CHANGE_CREATION | | |
+ FILE_NOTIFY_CHANGE_SECURITY, | |
NULL, | |
&handle->req.overlapped, | |
NULL)) { | |
@@ -324,7 +324,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { | |
void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, | |
- uv_fs_event_t* handle) { | |
+ uv_fs_event_t* handle) { | |
FILE_NOTIFY_INFORMATION* file_info; | |
int err, sizew, size, result; | |
char* filename = NULL; | |
@@ -360,10 +360,10 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, | |
* or if the filename filter matches. | |
*/ | |
if (handle->dirw || | |
- _wcsnicmp(handle->filew, file_info->FileName, | |
- file_info->FileNameLength / sizeof(WCHAR)) == 0 || | |
- _wcsnicmp(handle->short_filew, file_info->FileName, | |
- file_info->FileNameLength / sizeof(WCHAR)) == 0) { | |
+ _wcsnicmp(handle->filew, file_info->FileName, | |
+ file_info->FileNameLength / sizeof(WCHAR)) == 0 || | |
+ _wcsnicmp(handle->short_filew, file_info->FileName, | |
+ file_info->FileNameLength / sizeof(WCHAR)) == 0) { | |
if (handle->dirw) { | |
/* | |
@@ -372,10 +372,10 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, | |
* For removed and renamed events, we do not provide the file name. | |
*/ | |
if (file_info->Action != FILE_ACTION_REMOVED && | |
- file_info->Action != FILE_ACTION_RENAMED_OLD_NAME) { | |
+ file_info->Action != FILE_ACTION_RENAMED_OLD_NAME) { | |
/* Construct a full path to the file. */ | |
size = wcslen(handle->dirw) + | |
- file_info->FileNameLength / sizeof(WCHAR) + 2; | |
+ file_info->FileNameLength / sizeof(WCHAR) + 2; | |
filenamew = (WCHAR*)malloc(size * sizeof(WCHAR)); | |
if (!filenamew) { | |
@@ -383,8 +383,8 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, | |
} | |
_snwprintf(filenamew, size, L"%s\\%.*s", handle->dirw, | |
- file_info->FileNameLength / sizeof(WCHAR), | |
- file_info->FileName); | |
+ file_info->FileNameLength / sizeof(WCHAR), | |
+ file_info->FileName); | |
filenamew[size - 1] = L'\0'; | |
diff --git a/src/win/fs.c b/src/win/fs.c | |
index 7a1818c..4f5921c 100644 | |
--- a/src/win/fs.c | |
+++ b/src/win/fs.c | |
@@ -120,7 +120,7 @@ void uv_fs_init() { | |
INLINE static int fs__capture_path(uv_loop_t* loop, uv_fs_t* req, | |
- const char* path, const char* new_path, const int copy_path) { | |
+ const char* path, const char* new_path, const int copy_path) { | |
char* buf; | |
char* pos; | |
ssize_t buf_sz = 0, path_len, pathw_len = 0, new_pathw_len = 0; | |
@@ -222,7 +222,7 @@ INLINE static int fs__capture_path(uv_loop_t* loop, uv_fs_t* req, | |
INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req, | |
- uv_fs_type fs_type, const uv_fs_cb cb) { | |
+ uv_fs_type fs_type, const uv_fs_cb cb) { | |
uv_req_init(loop, (uv_req_t*) req); | |
req->type = UV_FS; | |
@@ -237,7 +237,7 @@ INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req, | |
INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, | |
- uint64_t* target_len_ptr) { | |
+ uint64_t* target_len_ptr) { | |
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; | |
REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer; | |
WCHAR *w_target; | |
@@ -260,11 +260,11 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, | |
if (reparse_data->ReparseTag == IO_REPARSE_TAG_SYMLINK) { | |
/* Real symlink */ | |
w_target = reparse_data->SymbolicLinkReparseBuffer.PathBuffer + | |
- (reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset / | |
- sizeof(WCHAR)); | |
+ (reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset / | |
+ sizeof(WCHAR)); | |
w_target_len = | |
- reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / | |
- sizeof(WCHAR); | |
+ reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength / | |
+ sizeof(WCHAR); | |
/* Real symlinks can contain pretty much everything, but the only thing */ | |
/* we really care about is undoing the implicit conversion to an NT */ | |
@@ -303,10 +303,10 @@ INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, | |
} else if (reparse_data->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { | |
/* Junction. */ | |
w_target = reparse_data->MountPointReparseBuffer.PathBuffer + | |
- (reparse_data->MountPointReparseBuffer.SubstituteNameOffset / | |
- sizeof(WCHAR)); | |
+ (reparse_data->MountPointReparseBuffer.SubstituteNameOffset / | |
+ sizeof(WCHAR)); | |
w_target_len = reparse_data->MountPointReparseBuffer.SubstituteNameLength / | |
- sizeof(WCHAR); | |
+ sizeof(WCHAR); | |
/* Only treat junctions that look like \??\<drive>:\ as symlink. */ | |
/* Junctions can also be used as mount points, like \??\Volume{<guid>}, */ | |
@@ -399,18 +399,18 @@ void fs__open(uv_fs_t* req) { | |
/* convert flags and mode to CreateFile parameters */ | |
switch (flags & (_O_RDONLY | _O_WRONLY | _O_RDWR)) { | |
- case _O_RDONLY: | |
- access = FILE_GENERIC_READ; | |
- attributes |= FILE_FLAG_BACKUP_SEMANTICS; | |
- break; | |
- case _O_WRONLY: | |
- access = FILE_GENERIC_WRITE; | |
- break; | |
- case _O_RDWR: | |
- access = FILE_GENERIC_READ | FILE_GENERIC_WRITE; | |
- break; | |
- default: | |
- goto einval; | |
+ case _O_RDONLY: | |
+ access = FILE_GENERIC_READ; | |
+ attributes |= FILE_FLAG_BACKUP_SEMANTICS; | |
+ break; | |
+ case _O_WRONLY: | |
+ access = FILE_GENERIC_WRITE; | |
+ break; | |
+ case _O_RDWR: | |
+ access = FILE_GENERIC_READ | FILE_GENERIC_WRITE; | |
+ break; | |
+ default: | |
+ goto einval; | |
} | |
if (flags & _O_APPEND) { | |
@@ -428,26 +428,26 @@ void fs__open(uv_fs_t* req) { | |
share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; | |
switch (flags & (_O_CREAT | _O_EXCL | _O_TRUNC)) { | |
- case 0: | |
- case _O_EXCL: | |
- disposition = OPEN_EXISTING; | |
- break; | |
- case _O_CREAT: | |
- disposition = OPEN_ALWAYS; | |
- break; | |
- case _O_CREAT | _O_EXCL: | |
- case _O_CREAT | _O_TRUNC | _O_EXCL: | |
- disposition = CREATE_NEW; | |
- break; | |
- case _O_TRUNC: | |
- case _O_TRUNC | _O_EXCL: | |
- disposition = TRUNCATE_EXISTING; | |
- break; | |
- case _O_CREAT | _O_TRUNC: | |
- disposition = CREATE_ALWAYS; | |
- break; | |
- default: | |
- goto einval; | |
+ case 0: | |
+ case _O_EXCL: | |
+ disposition = OPEN_EXISTING; | |
+ break; | |
+ case _O_CREAT: | |
+ disposition = OPEN_ALWAYS; | |
+ break; | |
+ case _O_CREAT | _O_EXCL: | |
+ case _O_CREAT | _O_TRUNC | _O_EXCL: | |
+ disposition = CREATE_NEW; | |
+ break; | |
+ case _O_TRUNC: | |
+ case _O_TRUNC | _O_EXCL: | |
+ disposition = TRUNCATE_EXISTING; | |
+ break; | |
+ case _O_CREAT | _O_TRUNC: | |
+ disposition = CREATE_ALWAYS; | |
+ break; | |
+ default: | |
+ goto einval; | |
} | |
attributes |= FILE_ATTRIBUTE_NORMAL; | |
@@ -467,16 +467,16 @@ void fs__open(uv_fs_t* req) { | |
} | |
switch (flags & (_O_SEQUENTIAL | _O_RANDOM)) { | |
- case 0: | |
- break; | |
- case _O_SEQUENTIAL: | |
- attributes |= FILE_FLAG_SEQUENTIAL_SCAN; | |
- break; | |
- case _O_RANDOM: | |
- attributes |= FILE_FLAG_RANDOM_ACCESS; | |
- break; | |
- default: | |
- goto einval; | |
+ case 0: | |
+ break; | |
+ case _O_SEQUENTIAL: | |
+ attributes |= FILE_FLAG_SEQUENTIAL_SCAN; | |
+ break; | |
+ case _O_RANDOM: | |
+ attributes |= FILE_FLAG_RANDOM_ACCESS; | |
+ break; | |
+ default: | |
+ goto einval; | |
} | |
/* Setting this flag makes it possible to open a directory. */ | |
@@ -520,7 +520,7 @@ void fs__open(uv_fs_t* req) { | |
SET_REQ_RESULT(req, fd); | |
return; | |
- einval: | |
+einval: | |
SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER); | |
} | |
@@ -927,10 +927,10 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) { | |
} | |
nt_status = pNtQueryVolumeInformationFile(handle, | |
- &io_status, | |
- &volume_info, | |
- sizeof volume_info, | |
- FileFsVolumeInformation); | |
+ &io_status, | |
+ &volume_info, | |
+ sizeof volume_info, | |
+ FileFsVolumeInformation); | |
/* Buffer overflow (a warning status code) is expected here. */ | |
if (io_status.Status == STATUS_NOT_IMPLEMENTED) { | |
@@ -992,7 +992,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) { | |
/* st_blocks contains the on-disk allocation size in 512-byte units. */ | |
statbuf->st_blocks = | |
- file_info.StandardInformation.AllocationSize.QuadPart >> 9ULL; | |
+ file_info.StandardInformation.AllocationSize.QuadPart >> 9ULL; | |
statbuf->st_nlink = file_info.StandardInformation.NumberOfLinks; | |
@@ -1234,7 +1234,7 @@ static void fs__access(uv_fs_t* req) { | |
if ((req->flags & W_OK) && | |
((attr & FILE_ATTRIBUTE_READONLY) || | |
- (attr & FILE_ATTRIBUTE_DIRECTORY))) { | |
+ (attr & FILE_ATTRIBUTE_DIRECTORY))) { | |
SET_REQ_WIN32_ERROR(req, UV_EPERM); | |
return; | |
} | |
@@ -1366,7 +1366,7 @@ static void fs__link(uv_fs_t* req) { | |
static void fs__create_junction(uv_fs_t* req, const WCHAR* path, | |
- const WCHAR* new_path) { | |
+ const WCHAR* new_path) { | |
HANDLE handle = INVALID_HANDLE_VALUE; | |
REPARSE_DATA_BUFFER *buffer = NULL; | |
int created = 0; | |
@@ -1385,7 +1385,7 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path, | |
is_absolute = 1; | |
} else { | |
is_absolute = target_len >= 3 && IS_LETTER(path[0]) && | |
- path[1] == L':' && IS_SLASH(path[2]); | |
+ path[1] == L':' && IS_SLASH(path[2]); | |
} | |
if (!is_absolute) { | |
@@ -1396,9 +1396,9 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path, | |
/* Do a pessimistic calculation of the required buffer size */ | |
needed_buf_size = | |
- FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) + | |
- JUNCTION_PREFIX_LEN * sizeof(WCHAR) + | |
- 2 * (target_len + 2) * sizeof(WCHAR); | |
+ FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) + | |
+ JUNCTION_PREFIX_LEN * sizeof(WCHAR) + | |
+ 2 * (target_len + 2) * sizeof(WCHAR); | |
/* Allocate the buffer */ | |
buffer = (REPARSE_DATA_BUFFER*)malloc(needed_buf_size); | |
@@ -1414,7 +1414,7 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path, | |
start = path_buf_len; | |
wcsncpy((WCHAR*)&path_buf[path_buf_len], JUNCTION_PREFIX, | |
- JUNCTION_PREFIX_LEN); | |
+ JUNCTION_PREFIX_LEN); | |
path_buf_len += JUNCTION_PREFIX_LEN; | |
add_slash = 0; | |
@@ -1472,9 +1472,9 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path, | |
/* Calculate how much buffer space was actually used */ | |
used_buf_size = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) + | |
- path_buf_len * sizeof(WCHAR); | |
+ path_buf_len * sizeof(WCHAR); | |
used_data_size = used_buf_size - | |
- FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer); | |
+ FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer); | |
/* Put general info in the data buffer */ | |
buffer->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; | |
@@ -1495,7 +1495,7 @@ static void fs__create_junction(uv_fs_t* req, const WCHAR* path, | |
NULL, | |
OPEN_EXISTING, | |
FILE_FLAG_BACKUP_SEMANTICS | | |
- FILE_FLAG_OPEN_REPARSE_POINT, | |
+ FILE_FLAG_OPEN_REPARSE_POINT, | |
NULL); | |
if (handle == INVALID_HANDLE_VALUE) { | |
SET_REQ_WIN32_ERROR(req, GetLastError()); | |
@@ -1607,33 +1607,33 @@ static void uv__fs_work(struct uv__work* w) { | |
#define XX(uc, lc) case UV_FS_##uc: fs__##lc(req); break; | |
switch (req->fs_type) { | |
- XX(OPEN, open) | |
- XX(CLOSE, close) | |
- XX(READ, read) | |
- XX(WRITE, write) | |
- XX(SENDFILE, sendfile) | |
- XX(STAT, stat) | |
- XX(LSTAT, lstat) | |
- XX(FSTAT, fstat) | |
- XX(FTRUNCATE, ftruncate) | |
- XX(UTIME, utime) | |
- XX(FUTIME, futime) | |
- XX(ACCESS, access) | |
- XX(CHMOD, chmod) | |
- XX(FCHMOD, fchmod) | |
- XX(FSYNC, fsync) | |
- XX(FDATASYNC, fdatasync) | |
- XX(UNLINK, unlink) | |
- XX(RMDIR, rmdir) | |
- XX(MKDIR, mkdir) | |
- XX(MKDTEMP, mkdtemp) | |
- XX(RENAME, rename) | |
- XX(SCANDIR, scandir) | |
- XX(LINK, link) | |
- XX(SYMLINK, symlink) | |
- XX(READLINK, readlink) | |
- XX(CHOWN, chown) | |
- XX(FCHOWN, fchown); | |
+ XX(OPEN, open) | |
+ XX(CLOSE, close) | |
+ XX(READ, read) | |
+ XX(WRITE, write) | |
+ XX(SENDFILE, sendfile) | |
+ XX(STAT, stat) | |
+ XX(LSTAT, lstat) | |
+ XX(FSTAT, fstat) | |
+ XX(FTRUNCATE, ftruncate) | |
+ XX(UTIME, utime) | |
+ XX(FUTIME, futime) | |
+ XX(ACCESS, access) | |
+ XX(CHMOD, chmod) | |
+ XX(FCHMOD, fchmod) | |
+ XX(FSYNC, fsync) | |
+ XX(FDATASYNC, fdatasync) | |
+ XX(UNLINK, unlink) | |
+ XX(RMDIR, rmdir) | |
+ XX(MKDIR, mkdir) | |
+ XX(MKDTEMP, mkdtemp) | |
+ XX(RENAME, rename) | |
+ XX(SCANDIR, scandir) | |
+ XX(LINK, link) | |
+ XX(SYMLINK, symlink) | |
+ XX(READLINK, readlink) | |
+ XX(CHOWN, chown) | |
+ XX(FCHOWN, fchown); | |
default: | |
assert(!"bad uv_fs_type"); | |
} | |
@@ -1676,7 +1676,7 @@ void uv_fs_req_cleanup(uv_fs_t* req) { | |
int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, | |
- int mode, uv_fs_cb cb) { | |
+ int mode, uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_OPEN, cb); | |
@@ -1780,7 +1780,7 @@ int uv_fs_write(uv_loop_t* loop, | |
int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_UNLINK, cb); | |
@@ -1801,7 +1801,7 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_MKDIR, cb); | |
@@ -1824,7 +1824,7 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, | |
int uv_fs_mkdtemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_MKDTEMP, cb); | |
@@ -1864,7 +1864,7 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { | |
int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_SCANDIR, cb); | |
@@ -1887,7 +1887,7 @@ int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, | |
int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
- const char* new_path, uv_fs_cb cb) { | |
+ const char* new_path, uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_LINK, cb); | |
@@ -1908,7 +1908,7 @@ int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
- const char* new_path, int flags, uv_fs_cb cb) { | |
+ const char* new_path, int flags, uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_SYMLINK, cb); | |
@@ -1931,7 +1931,7 @@ int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_READLINK, cb); | |
@@ -1952,7 +1952,7 @@ int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, | |
- uv_gid_t gid, uv_fs_cb cb) { | |
+ uv_gid_t gid, uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_CHOWN, cb); | |
@@ -1973,7 +1973,7 @@ int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, | |
int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_uid_t uid, | |
- uv_gid_t gid, uv_fs_cb cb) { | |
+ uv_gid_t gid, uv_fs_cb cb) { | |
uv_fs_req_init(loop, req, UV_FS_FCHOWN, cb); | |
if (cb) { | |
@@ -2041,7 +2041,7 @@ int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) { | |
int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, | |
- const char* new_path, uv_fs_cb cb) { | |
+ const char* new_path, uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_RENAME, cb); | |
@@ -2090,7 +2090,7 @@ int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) { | |
int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file fd, | |
- int64_t offset, uv_fs_cb cb) { | |
+ int64_t offset, uv_fs_cb cb) { | |
uv_fs_req_init(loop, req, UV_FS_FTRUNCATE, cb); | |
req->fd = fd; | |
@@ -2108,7 +2108,7 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file fd, | |
int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file fd_out, | |
- uv_file fd_in, int64_t in_offset, size_t length, uv_fs_cb cb) { | |
+ uv_file fd_in, int64_t in_offset, size_t length, uv_fs_cb cb) { | |
uv_fs_req_init(loop, req, UV_FS_SENDFILE, cb); | |
req->fd = fd_in; | |
@@ -2152,7 +2152,7 @@ int uv_fs_access(uv_loop_t* loop, | |
int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_CHMOD, cb); | |
@@ -2175,7 +2175,7 @@ int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, | |
int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file fd, int mode, | |
- uv_fs_cb cb) { | |
+ uv_fs_cb cb) { | |
uv_fs_req_init(loop, req, UV_FS_FCHMOD, cb); | |
req->fd = fd; | |
@@ -2192,7 +2192,7 @@ int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file fd, int mode, | |
int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, | |
- double mtime, uv_fs_cb cb) { | |
+ double mtime, uv_fs_cb cb) { | |
int err; | |
uv_fs_req_init(loop, req, UV_FS_UTIME, cb); | |
@@ -2216,7 +2216,7 @@ int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, | |
int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file fd, double atime, | |
- double mtime, uv_fs_cb cb) { | |
+ double mtime, uv_fs_cb cb) { | |
uv_fs_req_init(loop, req, UV_FS_FUTIME, cb); | |
req->fd = fd; | |
diff --git a/src/win/getaddrinfo.c b/src/win/getaddrinfo.c | |
index 53a6084..6c46c35 100644 | |
--- a/src/win/getaddrinfo.c | |
+++ b/src/win/getaddrinfo.c | |
@@ -32,16 +32,26 @@ | |
int uv__getaddrinfo_translate_error(int sys_err) { | |
switch (sys_err) { | |
- case 0: return 0; | |
- case WSATRY_AGAIN: return UV_EAI_AGAIN; | |
- case WSAEINVAL: return UV_EAI_BADFLAGS; | |
- case WSANO_RECOVERY: return UV_EAI_FAIL; | |
- case WSAEAFNOSUPPORT: return UV_EAI_FAMILY; | |
- case WSA_NOT_ENOUGH_MEMORY: return UV_EAI_MEMORY; | |
- case WSAHOST_NOT_FOUND: return UV_EAI_NONAME; | |
- case WSATYPE_NOT_FOUND: return UV_EAI_SERVICE; | |
- case WSAESOCKTNOSUPPORT: return UV_EAI_SOCKTYPE; | |
- default: return uv_translate_sys_error(sys_err); | |
+ case 0: | |
+ return 0; | |
+ case WSATRY_AGAIN: | |
+ return UV_EAI_AGAIN; | |
+ case WSAEINVAL: | |
+ return UV_EAI_BADFLAGS; | |
+ case WSANO_RECOVERY: | |
+ return UV_EAI_FAIL; | |
+ case WSAEAFNOSUPPORT: | |
+ return UV_EAI_FAMILY; | |
+ case WSA_NOT_ENOUGH_MEMORY: | |
+ return UV_EAI_MEMORY; | |
+ case WSAHOST_NOT_FOUND: | |
+ return UV_EAI_NONAME; | |
+ case WSATYPE_NOT_FOUND: | |
+ return UV_EAI_SERVICE; | |
+ case WSAESOCKTNOSUPPORT: | |
+ return UV_EAI_SOCKTYPE; | |
+ default: | |
+ return uv_translate_sys_error(sys_err); | |
} | |
} | |
@@ -50,23 +60,23 @@ int uv__getaddrinfo_translate_error(int sys_err) { | |
* MinGW is missing this | |
*/ | |
#if !defined(_MSC_VER) && !defined(__MINGW64_VERSION_MAJOR) | |
- typedef struct addrinfoW { | |
- int ai_flags; | |
- int ai_family; | |
- int ai_socktype; | |
- int ai_protocol; | |
- size_t ai_addrlen; | |
- WCHAR* ai_canonname; | |
- struct sockaddr* ai_addr; | |
- struct addrinfoW* ai_next; | |
- } ADDRINFOW, *PADDRINFOW; | |
- | |
- DECLSPEC_IMPORT int WSAAPI GetAddrInfoW(const WCHAR* node, | |
- const WCHAR* service, | |
- const ADDRINFOW* hints, | |
- PADDRINFOW* result); | |
- | |
- DECLSPEC_IMPORT void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo); | |
+typedef struct addrinfoW { | |
+ int ai_flags; | |
+ int ai_family; | |
+ int ai_socktype; | |
+ int ai_protocol; | |
+ size_t ai_addrlen; | |
+ WCHAR* ai_canonname; | |
+ struct sockaddr* ai_addr; | |
+ struct addrinfoW* ai_next; | |
+} ADDRINFOW, *PADDRINFOW; | |
+ | |
+DECLSPEC_IMPORT int WSAAPI GetAddrInfoW(const WCHAR* node, | |
+ const WCHAR* service, | |
+ const ADDRINFOW* hints, | |
+ PADDRINFOW* result); | |
+ | |
+DECLSPEC_IMPORT void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo); | |
#endif | |
@@ -116,8 +126,8 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) { | |
assert(req->retcode == 0); | |
req->retcode = UV_EAI_CANCELED; | |
if (req->res != NULL) { | |
- FreeAddrInfoW(req->res); | |
- req->res = NULL; | |
+ FreeAddrInfoW(req->res); | |
+ req->res = NULL; | |
} | |
goto complete; | |
} | |
@@ -128,7 +138,7 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) { | |
addrinfow_ptr = req->res; | |
while (addrinfow_ptr != NULL) { | |
addrinfo_len += addrinfo_struct_len + | |
- ALIGNED_SIZE(addrinfow_ptr->ai_addrlen); | |
+ ALIGNED_SIZE(addrinfow_ptr->ai_addrlen); | |
if (addrinfow_ptr->ai_canonname != NULL) { | |
name_len = uv_utf16_to_utf8(addrinfow_ptr->ai_canonname, -1, NULL, 0); | |
if (name_len == 0) { | |
@@ -251,7 +261,7 @@ int uv_getaddrinfo(uv_loop_t* loop, | |
int err; | |
if (req == NULL || getaddrinfo_cb == NULL || | |
- (node == NULL && service == NULL)) { | |
+ (node == NULL && service == NULL)) { | |
err = WSAEINVAL; | |
goto error; | |
} | |
diff --git a/src/win/handle-inl.h b/src/win/handle-inl.h | |
index 8d0334c..7cf9d6e 100644 | |
--- a/src/win/handle-inl.h | |
+++ b/src/win/handle-inl.h | |
@@ -162,8 +162,7 @@ INLINE static void uv_process_endgames(uv_loop_t* loop) { | |
} | |
} | |
-INLINE static HANDLE uv__get_osfhandle(int fd) | |
-{ | |
+INLINE static HANDLE uv__get_osfhandle(int fd) { | |
/* _get_osfhandle() raises an assert in debug builds if the FD is invalid. */ | |
/* But it also correctly checks the FD and returns INVALID_HANDLE_VALUE */ | |
/* for invalid FDs in release builds (or if you let the assert continue). */ | |
diff --git a/src/win/handle.c b/src/win/handle.c | |
index 72b49d9..e91dd46 100644 | |
--- a/src/win/handle.c | |
+++ b/src/win/handle.c | |
@@ -60,7 +60,7 @@ uv_handle_type uv_guess_handle(uv_file file) { | |
int uv_is_active(const uv_handle_t* handle) { | |
return (handle->flags & UV__HANDLE_ACTIVE) && | |
- !(handle->flags & UV__HANDLE_CLOSING); | |
+ !(handle->flags & UV__HANDLE_CLOSING); | |
} | |
diff --git a/src/win/internal.h b/src/win/internal.h | |
index 89290ae..2084257 100644 | |
--- a/src/win/internal.h | |
+++ b/src/win/internal.h | |
@@ -133,26 +133,26 @@ typedef struct { | |
int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb); | |
int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client); | |
int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, | |
- uv_read_cb read_cb); | |
+ uv_read_cb read_cb); | |
int uv_tcp_write(uv_loop_t* loop, uv_write_t* req, uv_tcp_t* handle, | |
- const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); | |
+ const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); | |
void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req); | |
void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_write_t* req); | |
+ uv_write_t* req); | |
void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_req_t* req); | |
+ uv_req_t* req); | |
void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_connect_t* req); | |
+ uv_connect_t* req); | |
void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp); | |
void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle); | |
int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, | |
- int tcp_connection); | |
+ int tcp_connection); | |
int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, | |
- LPWSAPROTOCOL_INFOW protocol_info); | |
+ LPWSAPROTOCOL_INFOW protocol_info); | |
/* | |
@@ -160,7 +160,7 @@ int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, | |
*/ | |
void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, uv_req_t* req); | |
void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle, | |
- uv_udp_send_t* req); | |
+ uv_udp_send_t* req); | |
void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle); | |
void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle); | |
@@ -170,31 +170,31 @@ void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle); | |
* Pipes | |
*/ | |
int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, | |
- char* name, size_t nameSize); | |
+ char* name, size_t nameSize); | |
int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb); | |
int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client); | |
int uv_pipe_read_start(uv_pipe_t* handle, uv_alloc_cb alloc_cb, | |
- uv_read_cb read_cb); | |
+ uv_read_cb read_cb); | |
int uv_pipe_write(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, | |
- const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); | |
+ const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); | |
int uv_pipe_write2(uv_loop_t* loop, uv_write_t* req, uv_pipe_t* handle, | |
- const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, | |
- uv_write_cb cb); | |
+ const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, | |
+ uv_write_cb cb); | |
void uv__pipe_pause_read(uv_pipe_t* handle); | |
void uv__pipe_unpause_read(uv_pipe_t* handle); | |
void uv__pipe_stop_read(uv_pipe_t* handle); | |
void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_req_t* req); | |
+ uv_req_t* req); | |
void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_write_t* req); | |
+ uv_write_t* req); | |
void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_req_t* raw_req); | |
+ uv_req_t* raw_req); | |
void uv_process_pipe_connect_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_connect_t* req); | |
+ uv_connect_t* req); | |
void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_shutdown_t* req); | |
+ uv_shutdown_t* req); | |
void uv_pipe_close(uv_loop_t* loop, uv_pipe_t* handle); | |
void uv_pipe_cleanup(uv_loop_t* loop, uv_pipe_t* handle); | |
@@ -207,22 +207,22 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle); | |
void uv_console_init(); | |
int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, | |
- uv_read_cb read_cb); | |
+ uv_read_cb read_cb); | |
int uv_tty_read_stop(uv_tty_t* handle); | |
int uv_tty_write(uv_loop_t* loop, uv_write_t* req, uv_tty_t* handle, | |
- const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); | |
+ const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb); | |
void uv_tty_close(uv_tty_t* handle); | |
void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_req_t* req); | |
+ uv_req_t* req); | |
void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_write_t* req); | |
+ uv_write_t* req); | |
/* TODO: remove me */ | |
void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_req_t* raw_req); | |
+ uv_req_t* raw_req); | |
/* TODO: remove me */ | |
void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_connect_t* req); | |
+ uv_connect_t* req); | |
void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle); | |
@@ -231,7 +231,7 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle); | |
* Poll watchers | |
*/ | |
void uv_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, | |
- uv_req_t* req); | |
+ uv_req_t* req); | |
int uv_poll_close(uv_loop_t* loop, uv_poll_t* handle); | |
void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle); | |
@@ -266,7 +266,7 @@ void uv_async_close(uv_loop_t* loop, uv_async_t* handle); | |
void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle); | |
void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle, | |
- uv_req_t* req); | |
+ uv_req_t* req); | |
/* | |
@@ -279,7 +279,7 @@ void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle); | |
void uv_signal_endgame(uv_loop_t* loop, uv_signal_t* handle); | |
void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle, | |
- uv_req_t* req); | |
+ uv_req_t* req); | |
/* | |
@@ -306,7 +306,7 @@ void uv_fs_init(); | |
* FS Event | |
*/ | |
void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req, | |
- uv_fs_event_t* handle); | |
+ uv_fs_event_t* handle); | |
void uv_fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle); | |
void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle); | |
@@ -357,15 +357,15 @@ BOOL uv_get_acceptex_function(SOCKET socket, LPFN_ACCEPTEX* target); | |
BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target); | |
int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers, | |
- DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, | |
- LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); | |
+ DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, | |
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); | |
int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers, | |
- DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, | |
- int* addr_len, WSAOVERLAPPED *overlapped, | |
- LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); | |
+ DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, | |
+ int* addr_len, WSAOVERLAPPED *overlapped, | |
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine); | |
int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info_in, | |
- AFD_POLL_INFO* info_out, OVERLAPPED* overlapped); | |
+ AFD_POLL_INFO* info_out, OVERLAPPED* overlapped); | |
/* Whether there are any non-IFS LSPs stacked on TCP */ | |
extern int uv_tcp_non_ifs_lsp_ipv4; | |
diff --git a/src/win/pipe.c b/src/win/pipe.c | |
index c78051d..1b3b6b2 100644 | |
--- a/src/win/pipe.c | |
+++ b/src/win/pipe.c | |
@@ -116,8 +116,8 @@ static void uv_pipe_connection_init(uv_pipe_t* handle) { | |
assert(!(handle->flags & UV_HANDLE_PIPESERVER)); | |
if (pCancelSynchronousIo && | |
handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) { | |
- uv_mutex_init(&handle->readfile_mutex); | |
- handle->flags |= UV_HANDLE_PIPE_READ_CANCELABLE; | |
+ uv_mutex_init(&handle->readfile_mutex); | |
+ handle->flags |= UV_HANDLE_PIPE_READ_CANCELABLE; | |
} | |
} | |
@@ -181,7 +181,7 @@ static HANDLE open_named_pipe(const WCHAR* name, DWORD* duplex_flags) { | |
int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, | |
- char* name, size_t nameSize) { | |
+ char* name, size_t nameSize) { | |
HANDLE pipeHandle; | |
int err; | |
char* ptr = (char*)handle; | |
@@ -190,9 +190,9 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, | |
uv_unique_pipe_name(ptr, name, nameSize); | |
pipeHandle = CreateNamedPipeA(name, | |
- access | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, | |
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 0, | |
- NULL); | |
+ access | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, | |
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 0, | |
+ NULL); | |
if (pipeHandle != INVALID_HANDLE_VALUE) { | |
/* No name collisions. We're done. */ | |
@@ -221,7 +221,7 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access, | |
return 0; | |
- error: | |
+error: | |
if (pipeHandle != INVALID_HANDLE_VALUE) { | |
CloseHandle(pipeHandle); | |
} | |
@@ -478,7 +478,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { | |
} | |
handle->accept_reqs = (uv_pipe_accept_t*) | |
- malloc(sizeof(uv_pipe_accept_t) * handle->pending_instances); | |
+ malloc(sizeof(uv_pipe_accept_t) * handle->pending_instances); | |
if (!handle->accept_reqs) { | |
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc"); | |
} | |
@@ -509,10 +509,10 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { | |
* If this fails then there's already a pipe server for the given pipe name. | |
*/ | |
handle->accept_reqs[0].pipeHandle = CreateNamedPipeW(handle->name, | |
- PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | | |
- FILE_FLAG_FIRST_PIPE_INSTANCE, | |
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, | |
- PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); | |
+ PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | | |
+ FILE_FLAG_FIRST_PIPE_INSTANCE, | |
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, | |
+ PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); | |
if (handle->accept_reqs[0].pipeHandle == INVALID_HANDLE_VALUE) { | |
err = GetLastError(); | |
@@ -591,7 +591,7 @@ static DWORD WINAPI pipe_connect_thread_proc(void* parameter) { | |
void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, | |
- const char* name, uv_connect_cb cb) { | |
+ const char* name, uv_connect_cb cb) { | |
uv_loop_t* loop = handle->loop; | |
int err, nameSize; | |
HANDLE pipeHandle = INVALID_HANDLE_VALUE; | |
@@ -672,21 +672,21 @@ error: | |
void uv__pipe_pause_read(uv_pipe_t* handle) { | |
if (handle->flags & UV_HANDLE_PIPE_READ_CANCELABLE) { | |
- /* Pause the ReadFile task briefly, to work | |
- around the Windows kernel bug that causes | |
- any access to a NamedPipe to deadlock if | |
- any process has called ReadFile */ | |
- HANDLE h; | |
- uv_mutex_lock(&handle->readfile_mutex); | |
+ /* Pause the ReadFile task briefly, to work | |
+ around the Windows kernel bug that causes | |
+ any access to a NamedPipe to deadlock if | |
+ any process has called ReadFile */ | |
+ HANDLE h; | |
+ uv_mutex_lock(&handle->readfile_mutex); | |
+ h = handle->readfile_thread; | |
+ while (h) { | |
+ /* spinlock: we expect this to finish quickly, | |
+ or we are probably about to deadlock anyways | |
+ (in the kernel), so it doesn't matter */ | |
+ pCancelSynchronousIo(h); | |
+ SwitchToThread(); /* yield thread control briefly */ | |
h = handle->readfile_thread; | |
- while (h) { | |
- /* spinlock: we expect this to finish quickly, | |
- or we are probably about to deadlock anyways | |
- (in the kernel), so it doesn't matter */ | |
- pCancelSynchronousIo(h); | |
- SwitchToThread(); /* yield thread control briefly */ | |
- h = handle->readfile_thread; | |
- } | |
+ } | |
} | |
} | |
@@ -765,16 +765,16 @@ void uv_pipe_close(uv_loop_t* loop, uv_pipe_t* handle) { | |
static void uv_pipe_queue_accept(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_pipe_accept_t* req, BOOL firstInstance) { | |
+ uv_pipe_accept_t* req, BOOL firstInstance) { | |
assert(handle->flags & UV_HANDLE_LISTENING); | |
if (!firstInstance) { | |
assert(req->pipeHandle == INVALID_HANDLE_VALUE); | |
req->pipeHandle = CreateNamedPipeW(handle->name, | |
- PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, | |
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, | |
- PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); | |
+ PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, | |
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, | |
+ PIPE_UNLIMITED_INSTANCES, 65536, 65536, 0, NULL); | |
if (req->pipeHandle == INVALID_HANDLE_VALUE) { | |
SET_REQ_ERROR(req, GetLastError()); | |
@@ -1091,8 +1091,8 @@ static void uv_pipe_queue_read(uv_loop_t* loop, uv_pipe_t* handle) { | |
} | |
if (req->wait_handle == INVALID_HANDLE_VALUE) { | |
if (!RegisterWaitForSingleObject(&req->wait_handle, | |
- req->overlapped.hEvent, post_completion_read_wait, (void*) req, | |
- INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
+ req->overlapped.hEvent, post_completion_read_wait, (void*) req, | |
+ INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
SET_REQ_ERROR(req, GetLastError()); | |
goto error; | |
} | |
@@ -1199,8 +1199,8 @@ static int uv_pipe_write_impl(uv_loop_t* loop, | |
/* Only TCP handles are supported for sharing. */ | |
if (send_handle && ((send_handle->type != UV_TCP) || | |
- (!(send_handle->flags & UV_HANDLE_BOUND) && | |
- !(send_handle->flags & UV_HANDLE_CONNECTION)))) { | |
+ (!(send_handle->flags & UV_HANDLE_BOUND) && | |
+ !(send_handle->flags & UV_HANDLE_CONNECTION)))) { | |
return ERROR_NOT_SUPPORTED; | |
} | |
@@ -1224,7 +1224,7 @@ static int uv_pipe_write_impl(uv_loop_t* loop, | |
tcp_send_handle = (uv_tcp_t*)send_handle; | |
err = uv_tcp_duplicate_socket(tcp_send_handle, handle->ipc_pid, | |
- &ipc_frame.socket_info_ex.socket_info); | |
+ &ipc_frame.socket_info_ex.socket_info); | |
if (err) { | |
return err; | |
} | |
@@ -1282,11 +1282,11 @@ static int uv_pipe_write_impl(uv_loop_t* loop, | |
} | |
result = WriteFile(handle->handle, | |
- &ipc_frame, | |
- ipc_frame.header.flags & UV_IPC_TCP_SERVER ? | |
- sizeof(ipc_frame) : sizeof(ipc_frame.header), | |
- NULL, | |
- &ipc_header_req->overlapped); | |
+ &ipc_frame, | |
+ ipc_frame.header.flags & UV_IPC_TCP_SERVER ? | |
+ sizeof(ipc_frame) : sizeof(ipc_frame.header), | |
+ NULL, | |
+ &ipc_header_req->overlapped); | |
if (!result && GetLastError() != ERROR_IO_PENDING) { | |
err = GetLastError(); | |
CloseHandle(ipc_header_req->overlapped.hEvent); | |
@@ -1317,7 +1317,7 @@ static int uv_pipe_write_impl(uv_loop_t* loop, | |
} | |
if ((handle->flags & | |
- (UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) == | |
+ (UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) == | |
(UV_HANDLE_BLOCKING_WRITES | UV_HANDLE_NON_OVERLAPPED_PIPE)) { | |
DWORD bytes; | |
result = WriteFile(handle->handle, | |
@@ -1414,8 +1414,8 @@ static int uv_pipe_write_impl(uv_loop_t* loop, | |
uv_fatal_error(GetLastError(), "CreateEvent"); | |
} | |
if (!RegisterWaitForSingleObject(&req->wait_handle, | |
- req->overlapped.hEvent, post_completion_write_wait, (void*) req, | |
- INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
+ req->overlapped.hEvent, post_completion_write_wait, (void*) req, | |
+ INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
return GetLastError(); | |
} | |
} | |
@@ -1455,7 +1455,7 @@ int uv_pipe_write2(uv_loop_t* loop, | |
static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_buf_t buf) { | |
+ uv_buf_t buf) { | |
/* If there is an eof timer running, we don't need it any more, */ | |
/* so discard it. */ | |
eof_timer_destroy(handle); | |
@@ -1468,7 +1468,7 @@ static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle, | |
static void uv_pipe_read_error(uv_loop_t* loop, uv_pipe_t* handle, int error, | |
- uv_buf_t buf) { | |
+ uv_buf_t buf) { | |
/* If there is an eof timer running, we don't need it any more, */ | |
/* so discard it. */ | |
eof_timer_destroy(handle); | |
@@ -1480,7 +1480,7 @@ static void uv_pipe_read_error(uv_loop_t* loop, uv_pipe_t* handle, int error, | |
static void uv_pipe_read_error_or_eof(uv_loop_t* loop, uv_pipe_t* handle, | |
- int error, uv_buf_t buf) { | |
+ int error, uv_buf_t buf) { | |
if (error == ERROR_BROKEN_PIPE) { | |
uv_pipe_read_eof(loop, handle, buf); | |
} else { | |
@@ -1506,7 +1506,7 @@ void uv__pipe_insert_pending_socket(uv_pipe_t* handle, | |
void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
DWORD bytes, avail; | |
uv_buf_t buf; | |
uv_ipc_frame_uv_stream ipc_frame; | |
@@ -1528,11 +1528,11 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
/* Do non-blocking reads until the buffer is empty */ | |
while (handle->flags & UV_HANDLE_READING) { | |
if (!PeekNamedPipe(handle->handle, | |
- NULL, | |
- 0, | |
- NULL, | |
- &avail, | |
- NULL)) { | |
+ NULL, | |
+ 0, | |
+ NULL, | |
+ &avail, | |
+ NULL)) { | |
uv_pipe_read_error_or_eof(loop, handle, GetLastError(), uv_null_buf_); | |
break; | |
} | |
@@ -1554,17 +1554,17 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
&bytes, | |
NULL)) { | |
uv_pipe_read_error_or_eof(loop, handle, GetLastError(), | |
- uv_null_buf_); | |
+ uv_null_buf_); | |
break; | |
} | |
assert(bytes == sizeof(ipc_frame.header)); | |
assert(ipc_frame.header.flags <= (UV_IPC_TCP_SERVER | UV_IPC_RAW_DATA | | |
- UV_IPC_TCP_CONNECTION)); | |
+ UV_IPC_TCP_CONNECTION)); | |
if (ipc_frame.header.flags & UV_IPC_TCP_SERVER) { | |
assert(avail - sizeof(ipc_frame.header) >= | |
- sizeof(ipc_frame.socket_info_ex)); | |
+ sizeof(ipc_frame.socket_info_ex)); | |
/* Read the TCP socket info. */ | |
if (!ReadFile(handle->handle, | |
@@ -1573,7 +1573,7 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
&bytes, | |
NULL)) { | |
uv_pipe_read_error_or_eof(loop, handle, GetLastError(), | |
- uv_null_buf_); | |
+ uv_null_buf_); | |
break; | |
} | |
@@ -1581,9 +1581,9 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
/* Store the pending socket info. */ | |
uv__pipe_insert_pending_socket( | |
- handle, | |
- &ipc_frame.socket_info_ex, | |
- ipc_frame.header.flags & UV_IPC_TCP_CONNECTION); | |
+ handle, | |
+ &ipc_frame.socket_info_ex, | |
+ ipc_frame.header.flags & UV_IPC_TCP_CONNECTION); | |
} | |
if (ipc_frame.header.flags & UV_IPC_RAW_DATA) { | |
@@ -1638,7 +1638,7 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle, | |
void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_write_t* req) { | |
+ uv_write_t* req) { | |
int err; | |
assert(handle->type == UV_NAMED_PIPE); | |
@@ -1690,7 +1690,7 @@ void uv_process_pipe_write_req(uv_loop_t* loop, uv_pipe_t* handle, | |
void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_req_t* raw_req) { | |
+ uv_req_t* raw_req) { | |
uv_pipe_accept_t* req = (uv_pipe_accept_t*) raw_req; | |
assert(handle->type == UV_NAMED_PIPE); | |
@@ -1725,7 +1725,7 @@ void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle, | |
void uv_process_pipe_connect_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_connect_t* req) { | |
+ uv_connect_t* req) { | |
int err; | |
assert(handle->type == UV_NAMED_PIPE); | |
@@ -1747,7 +1747,7 @@ void uv_process_pipe_connect_req(uv_loop_t* loop, uv_pipe_t* handle, | |
void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle, | |
- uv_shutdown_t* req) { | |
+ uv_shutdown_t* req) { | |
assert(handle->type == UV_NAMED_PIPE); | |
UNREGISTER_HANDLE_REQ(loop, handle, req); | |
diff --git a/src/win/poll.c b/src/win/poll.c | |
index 578d9ff..7ac4f3e 100644 | |
--- a/src/win/poll.c | |
+++ b/src/win/poll.c | |
@@ -29,12 +29,18 @@ | |
static const GUID uv_msafd_provider_ids[UV_MSAFD_PROVIDER_COUNT] = { | |
- {0xe70f1aa0, 0xab8b, 0x11cf, | |
- {0x8c, 0xa3, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}, | |
- {0xf9eab0c0, 0x26d4, 0x11d0, | |
- {0xbb, 0xbf, 0x00, 0xaa, 0x00, 0x6c, 0x34, 0xe4}}, | |
- {0x9fc48064, 0x7298, 0x43e4, | |
- {0xb7, 0xbd, 0x18, 0x1f, 0x20, 0x89, 0x79, 0x2a}} | |
+ { | |
+ 0xe70f1aa0, 0xab8b, 0x11cf, | |
+ {0x8c, 0xa3, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92} | |
+ }, | |
+ { | |
+ 0xf9eab0c0, 0x26d4, 0x11d0, | |
+ {0xbb, 0xbf, 0x00, 0xaa, 0x00, 0x6c, 0x34, 0xe4} | |
+ }, | |
+ { | |
+ 0x9fc48064, 0x7298, 0x43e4, | |
+ {0xb7, 0xbd, 0x18, 0x1f, 0x20, 0x89, 0x79, 0x2a} | |
+ } | |
}; | |
typedef struct uv_single_fd_set_s { | |
@@ -106,7 +112,7 @@ static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) { | |
if (handle->events & UV_READABLE) { | |
afd_poll_info->Handles[0].Events |= AFD_POLL_RECEIVE | | |
- AFD_POLL_DISCONNECT | AFD_POLL_ACCEPT | AFD_POLL_ABORT; | |
+ AFD_POLL_DISCONNECT | AFD_POLL_ACCEPT | AFD_POLL_ABORT; | |
} | |
if (handle->events & UV_WRITABLE) { | |
afd_poll_info->Handles[0].Events |= AFD_POLL_SEND | AFD_POLL_CONNECT_FAIL; | |
@@ -182,11 +188,11 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, | |
unsigned char events = 0; | |
if ((afd_poll_info->Handles[0].Events & (AFD_POLL_RECEIVE | | |
- AFD_POLL_DISCONNECT | AFD_POLL_ACCEPT | AFD_POLL_ABORT)) != 0) { | |
+ AFD_POLL_DISCONNECT | AFD_POLL_ACCEPT | AFD_POLL_ABORT)) != 0) { | |
events |= UV_READABLE; | |
} | |
if ((afd_poll_info->Handles[0].Events & (AFD_POLL_SEND | | |
- AFD_POLL_CONNECT_FAIL)) != 0) { | |
+ AFD_POLL_CONNECT_FAIL)) != 0) { | |
events |= UV_WRITABLE; | |
} | |
@@ -205,7 +211,7 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, | |
} | |
if ((handle->events & ~(handle->submitted_events_1 | | |
- handle->submitted_events_2)) != 0) { | |
+ handle->submitted_events_2)) != 0) { | |
uv__fast_poll_submit_poll_req(loop, handle); | |
} else if ((handle->flags & UV__HANDLE_CLOSING) && | |
handle->submitted_events_1 == 0 && | |
@@ -229,7 +235,7 @@ static int uv__fast_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { | |
} | |
if ((handle->events & ~(handle->submitted_events_1 | | |
- handle->submitted_events_2)) != 0) { | |
+ handle->submitted_events_2)) != 0) { | |
uv__fast_poll_submit_poll_req(handle->loop, handle); | |
} | |
@@ -280,7 +286,7 @@ static SOCKET uv__fast_poll_create_peer_socket(HANDLE iocp, | |
return sock; | |
- error: | |
+error: | |
closesocket(sock); | |
return INVALID_SOCKET; | |
} | |
@@ -449,7 +455,7 @@ static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle, | |
} | |
if ((handle->events & ~(handle->submitted_events_1 | | |
- handle->submitted_events_2)) != 0) { | |
+ handle->submitted_events_2)) != 0) { | |
uv__slow_poll_submit_poll_req(loop, handle); | |
} else if ((handle->flags & UV__HANDLE_CLOSING) && | |
handle->submitted_events_1 == 0 && | |
@@ -473,7 +479,7 @@ static int uv__slow_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) { | |
} | |
if ((handle->events & | |
- ~(handle->submitted_events_1 | handle->submitted_events_2)) != 0) { | |
+ ~(handle->submitted_events_1 | handle->submitted_events_2)) != 0) { | |
uv__slow_poll_submit_poll_req(handle->loop, handle); | |
} | |
@@ -500,7 +506,7 @@ int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { | |
int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle, | |
- uv_os_sock_t socket) { | |
+ uv_os_sock_t socket) { | |
WSAPROTOCOL_INFOW protocol_info; | |
int len; | |
SOCKET peer_socket, base_socket; | |
diff --git a/src/win/process-stdio.c b/src/win/process-stdio.c | |
index 98566da..e12a79e 100644 | |
--- a/src/win/process-stdio.c | |
+++ b/src/win/process-stdio.c | |
@@ -96,7 +96,7 @@ void uv_disable_stdio_inheritance(void) { | |
static int uv__create_stdio_pipe_pair(uv_loop_t* loop, | |
- uv_pipe_t* server_pipe, HANDLE* child_pipe_ptr, unsigned int flags) { | |
+ uv_pipe_t* server_pipe, HANDLE* child_pipe_ptr, unsigned int flags) { | |
char pipe_name[64]; | |
SECURITY_ATTRIBUTES sa; | |
DWORD server_access = 0; | |
@@ -177,7 +177,7 @@ static int uv__create_stdio_pipe_pair(uv_loop_t* loop, | |
*child_pipe_ptr = child_pipe; | |
return 0; | |
- error: | |
+error: | |
if (server_pipe->handle != INVALID_HANDLE_VALUE) { | |
uv_pipe_cleanup(loop, server_pipe); | |
} | |
@@ -237,7 +237,7 @@ static int uv__duplicate_fd(uv_loop_t* loop, int fd, HANDLE* dup) { | |
int uv__create_nul_handle(HANDLE* handle_ptr, | |
- DWORD access) { | |
+ DWORD access) { | |
HANDLE handle; | |
SECURITY_ATTRIBUTES sa; | |
@@ -301,7 +301,7 @@ int uv__stdio_create(uv_loop_t* loop, | |
} | |
switch (fdopt.flags & (UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | | |
- UV_INHERIT_STREAM)) { | |
+ UV_INHERIT_STREAM)) { | |
case UV_IGNORE: | |
/* Starting a process with no stdin/stout/stderr can confuse it. */ | |
/* So no matter what the user specified, we make sure the first */ | |
@@ -311,7 +311,7 @@ int uv__stdio_create(uv_loop_t* loop, | |
/* INVALID_HANDLE_VALUE, which should be okay. */ | |
if (i <= 2) { | |
DWORD access = (i == 0) ? FILE_GENERIC_READ : | |
- FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES; | |
+ FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES; | |
err = uv__create_nul_handle(&CHILD_STDIO_HANDLE(buffer, i), | |
access); | |
@@ -442,7 +442,7 @@ int uv__stdio_create(uv_loop_t* loop, | |
*buffer_ptr = buffer; | |
return 0; | |
- error: | |
+error: | |
uv__stdio_destroy(buffer); | |
return err; | |
} | |
diff --git a/src/win/process.c b/src/win/process.c | |
index 3a0106f..c973105 100644 | |
--- a/src/win/process.c | |
+++ b/src/win/process.c | |
@@ -89,10 +89,10 @@ static void uv__init_global_job_handle(void) { | |
memset(&info, 0, sizeof info); | |
info.BasicLimitInformation.LimitFlags = | |
- JOB_OBJECT_LIMIT_BREAKAWAY_OK | | |
- JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | | |
- JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION | | |
- JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; | |
+ JOB_OBJECT_LIMIT_BREAKAWAY_OK | | |
+ JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | | |
+ JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION | | |
+ JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; | |
uv_global_job_handle_ = CreateJobObjectW(&attr, NULL); | |
if (uv_global_job_handle_ == NULL) | |
@@ -178,7 +178,7 @@ static WCHAR* search_path_join_test(const WCHAR* dir, | |
/* It's a full path without drive letter, use cwd's drive letter only */ | |
cwd_len = 2; | |
} else if (dir_len >= 2 && dir[1] == L':' && | |
- (dir_len < 3 || (dir[2] != L'/' && dir[2] != L'\\'))) { | |
+ (dir_len < 3 || (dir[2] != L'/' && dir[2] != L'\\'))) { | |
/* It's a relative path with drive letter (ext.g. D:../some/file) | |
* Replace drive letter in dir by full cwd if it points to the same drive, | |
* otherwise use the dir only. | |
@@ -198,7 +198,7 @@ static WCHAR* search_path_join_test(const WCHAR* dir, | |
/* Allocate buffer for output */ | |
result = result_pos = (WCHAR*)malloc(sizeof(WCHAR) * | |
- (cwd_len + 1 + dir_len + 1 + name_len + 1 + ext_len + 1)); | |
+ (cwd_len + 1 + dir_len + 1 + name_len + 1 + ext_len + 1)); | |
/* Copy cwd */ | |
wcsncpy(result_pos, cwd, cwd_len); | |
@@ -340,8 +340,8 @@ static WCHAR* path_search_walk_ext(const WCHAR *dir, | |
* | |
*/ | |
static WCHAR* search_path(const WCHAR *file, | |
- WCHAR *cwd, | |
- const WCHAR *path) { | |
+ WCHAR *cwd, | |
+ const WCHAR *path) { | |
int file_has_dir; | |
WCHAR* result = NULL; | |
WCHAR *file_name_start; | |
@@ -365,9 +365,9 @@ static WCHAR* search_path(const WCHAR *file, | |
/* name. */ | |
for (file_name_start = (WCHAR*)file + file_len; | |
file_name_start > file | |
- && file_name_start[-1] != L'\\' | |
- && file_name_start[-1] != L'/' | |
- && file_name_start[-1] != L':'; | |
+ && file_name_start[-1] != L'\\' | |
+ && file_name_start[-1] != L'/' | |
+ && file_name_start[-1] != L':'; | |
file_name_start--); | |
file_has_dir = file_name_start != file; | |
@@ -379,10 +379,10 @@ static WCHAR* search_path(const WCHAR *file, | |
if (file_has_dir) { | |
/* The file has a path inside, don't use path */ | |
result = path_search_walk_ext( | |
- file, file_name_start - file, | |
- file_name_start, file_len - (file_name_start - file), | |
- cwd, cwd_len, | |
- name_has_ext); | |
+ file, file_name_start - file, | |
+ file_name_start, file_len - (file_name_start - file), | |
+ cwd, cwd_len, | |
+ name_has_ext); | |
} else { | |
dir_end = path; | |
@@ -745,7 +745,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) { | |
cmp = -1; | |
} else { | |
cmp = env_strncmp(required_vars[i].wide_eq, | |
- required_vars[i].len, | |
+ required_vars[i].len, | |
*ptr_copy); | |
} | |
if (cmp < 0) { | |
@@ -960,16 +960,16 @@ int uv_spawn(uv_loop_t* loop, | |
goto done; | |
err = make_program_args( | |
- options->args, | |
- options->flags & UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS, | |
- &arguments); | |
+ options->args, | |
+ options->flags & UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS, | |
+ &arguments); | |
if (err) | |
goto done; | |
if (options->env) { | |
- err = make_program_env(options->env, &env); | |
- if (err) | |
- goto done; | |
+ err = make_program_env(options->env, &env); | |
+ if (err) | |
+ goto done; | |
} | |
if (options->cwd) { | |
@@ -1076,15 +1076,15 @@ int uv_spawn(uv_loop_t* loop, | |
} | |
if (!CreateProcessW(application_path, | |
- arguments, | |
- NULL, | |
- NULL, | |
- 1, | |
- process_flags, | |
- env, | |
- cwd, | |
- &startup, | |
- &info)) { | |
+ arguments, | |
+ NULL, | |
+ NULL, | |
+ 1, | |
+ process_flags, | |
+ env, | |
+ cwd, | |
+ &startup, | |
+ &info)) { | |
/* CreateProcessW failed. */ | |
err = GetLastError(); | |
goto done; | |
@@ -1130,8 +1130,8 @@ int uv_spawn(uv_loop_t* loop, | |
/* Setup notifications for when the child process exits. */ | |
result = RegisterWaitForSingleObject(&process->wait_handle, | |
- process->process_handle, exit_wait_callback, (void*)process, INFINITE, | |
- WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE); | |
+ process->process_handle, exit_wait_callback, (void*)process, INFINITE, | |
+ WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE); | |
if (!result) { | |
uv_fatal_error(GetLastError(), "RegisterWaitForSingleObject"); | |
} | |
@@ -1145,7 +1145,7 @@ int uv_spawn(uv_loop_t* loop, | |
uv__handle_start(process); | |
/* Cleanup, whether we succeeded or failed. */ | |
- done: | |
+done: | |
free(application); | |
free(application_path); | |
free(arguments); | |
@@ -1229,7 +1229,7 @@ int uv_process_kill(uv_process_t* process, int signum) { | |
int uv_kill(int pid, int signum) { | |
int err; | |
HANDLE process_handle = OpenProcess(PROCESS_TERMINATE | | |
- PROCESS_QUERY_INFORMATION, FALSE, pid); | |
+ PROCESS_QUERY_INFORMATION, FALSE, pid); | |
if (process_handle == NULL) { | |
err = GetLastError(); | |
diff --git a/src/win/req-inl.h b/src/win/req-inl.h | |
index 46c7d9b..d006cbb 100644 | |
--- a/src/win/req-inl.h | |
+++ b/src/win/req-inl.h | |
@@ -167,9 +167,9 @@ INLINE static int uv_process_reqs(uv_loop_t* loop) { | |
/* Tcp shutdown requests don't come here. */ | |
assert(((uv_shutdown_t*) req)->handle->type == UV_NAMED_PIPE); | |
uv_process_pipe_shutdown_req( | |
- loop, | |
- (uv_pipe_t*) ((uv_shutdown_t*) req)->handle, | |
- (uv_shutdown_t*) req); | |
+ loop, | |
+ (uv_pipe_t*) ((uv_shutdown_t*) req)->handle, | |
+ (uv_shutdown_t*) req); | |
break; | |
case UV_UDP_RECV: | |
diff --git a/src/win/signal.c b/src/win/signal.c | |
index 2c64a55..cd2838e 100644 | |
--- a/src/win/signal.c | |
+++ b/src/win/signal.c | |
@@ -79,7 +79,7 @@ int uv__signal_dispatch(int signum) { | |
handle != NULL && handle->signum == signum; | |
handle = RB_NEXT(uv_signal_tree_s, &uv__signal_tree, handle)) { | |
unsigned long previous = InterlockedExchange( | |
- (volatile LONG*) &handle->pending_signum, signum); | |
+ (volatile LONG*) &handle->pending_signum, signum); | |
if (!previous) { | |
POST_COMPLETION_FOR_REQ(handle->loop, &handle->signal_req); | |
@@ -115,8 +115,8 @@ static BOOL WINAPI uv__signal_control_handler(DWORD type) { | |
case CTRL_LOGOFF_EVENT: | |
case CTRL_SHUTDOWN_EVENT: | |
- /* These signals are only sent to services. Services have their own */ | |
- /* notification mechanism, so there's no point in handling these. */ | |
+ /* These signals are only sent to services. Services have their own */ | |
+ /* notification mechanism, so there's no point in handling these. */ | |
default: | |
/* We don't handle these. */ | |
@@ -309,14 +309,14 @@ int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum) { | |
void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
long dispatched_signum; | |
assert(handle->type == UV_SIGNAL); | |
assert(req->type == UV_SIGNAL_REQ); | |
dispatched_signum = InterlockedExchange( | |
- (volatile LONG*) &handle->pending_signum, 0); | |
+ (volatile LONG*) &handle->pending_signum, 0); | |
assert(dispatched_signum != 0); | |
/* Check if the pending signal equals the signum that we are watching for. */ | |
diff --git a/src/win/stream.c b/src/win/stream.c | |
index 057f72e..63c4a4b 100644 | |
--- a/src/win/stream.c | |
+++ b/src/win/stream.c | |
@@ -66,7 +66,7 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) { | |
int uv_read_start(uv_stream_t* handle, uv_alloc_cb alloc_cb, | |
- uv_read_cb read_cb) { | |
+ uv_read_cb read_cb) { | |
int err; | |
if (handle->flags & UV_HANDLE_READING) { | |
diff --git a/src/win/tcp.c b/src/win/tcp.c | |
index cff2929..0c25923 100644 | |
--- a/src/win/tcp.c | |
+++ b/src/win/tcp.c | |
@@ -79,7 +79,7 @@ static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsign | |
static int uv_tcp_set_socket(uv_loop_t* loop, uv_tcp_t* handle, | |
- SOCKET socket, int family, int imported) { | |
+ SOCKET socket, int family, int imported) { | |
DWORD yes = 1; | |
int non_ifs_lsp; | |
int err; | |
@@ -113,8 +113,8 @@ static int uv_tcp_set_socket(uv_loop_t* loop, uv_tcp_t* handle, | |
if (pSetFileCompletionNotificationModes && | |
!(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) { | |
if (pSetFileCompletionNotificationModes((HANDLE) socket, | |
- FILE_SKIP_SET_EVENT_ON_HANDLE | | |
- FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { | |
+ FILE_SKIP_SET_EVENT_ON_HANDLE | | |
+ FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { | |
handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; | |
} else if (GetLastError() != ERROR_INVALID_FUNCTION) { | |
return GetLastError(); | |
@@ -416,8 +416,8 @@ static void uv_tcp_queue_accept(uv_tcp_t* handle, uv_tcp_accept_t* req) { | |
if (handle->flags & UV_HANDLE_EMULATE_IOCP && | |
req->wait_handle == INVALID_HANDLE_VALUE && | |
!RegisterWaitForSingleObject(&req->wait_handle, | |
- req->event_handle, post_completion, (void*) req, | |
- INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
+ req->event_handle, post_completion, (void*) req, | |
+ INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
SET_REQ_ERROR(req, GetLastError()); | |
uv_insert_pending_req(loop, (uv_req_t*)req); | |
handle->reqs_pending++; | |
@@ -499,8 +499,8 @@ static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) { | |
if (handle->flags & UV_HANDLE_EMULATE_IOCP && | |
req->wait_handle == INVALID_HANDLE_VALUE && | |
!RegisterWaitForSingleObject(&req->wait_handle, | |
- req->event_handle, post_completion, (void*) req, | |
- INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
+ req->event_handle, post_completion, (void*) req, | |
+ INFINITE, WT_EXECUTEINWAITTHREAD)) { | |
SET_REQ_ERROR(req, GetLastError()); | |
uv_insert_pending_req(loop, (uv_req_t*)req); | |
} | |
@@ -560,11 +560,11 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { | |
INCREASE_ACTIVE_COUNT(loop, handle); | |
simultaneous_accepts = handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT ? 1 | |
- : uv_simultaneous_server_accepts; | |
+ : uv_simultaneous_server_accepts; | |
if(!handle->accept_reqs) { | |
handle->accept_reqs = (uv_tcp_accept_t*) | |
- malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t)); | |
+ malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t)); | |
if (!handle->accept_reqs) { | |
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc"); | |
} | |
@@ -677,7 +677,7 @@ int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client) { | |
int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, | |
- uv_read_cb read_cb) { | |
+ uv_read_cb read_cb) { | |
uv_loop_t* loop = handle->loop; | |
handle->flags |= UV_HANDLE_READING; | |
@@ -862,8 +862,8 @@ int uv_tcp_write(uv_loop_t* loop, | |
handle->write_queue_size += req->queued_bytes; | |
if (handle->flags & UV_HANDLE_EMULATE_IOCP && | |
!RegisterWaitForSingleObject(&req->wait_handle, | |
- req->event_handle, post_write_completion, (void*) req, | |
- INFINITE, WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE)) { | |
+ req->event_handle, post_write_completion, (void*) req, | |
+ INFINITE, WT_EXECUTEINWAITTHREAD | WT_EXECUTEONLYONCE)) { | |
SET_REQ_ERROR(req, GetLastError()); | |
uv_insert_pending_req(loop, (uv_req_t*)req); | |
} | |
@@ -877,7 +877,7 @@ int uv_tcp_write(uv_loop_t* loop, | |
void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
DWORD bytes, flags, err; | |
uv_buf_t buf; | |
@@ -1003,7 +1003,7 @@ done: | |
void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_write_t* req) { | |
+ uv_write_t* req) { | |
int err; | |
assert(handle->type == UV_TCP); | |
@@ -1044,7 +1044,7 @@ void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, | |
void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_req_t* raw_req) { | |
+ uv_req_t* raw_req) { | |
uv_tcp_accept_t* req = (uv_tcp_accept_t*) raw_req; | |
int err; | |
@@ -1065,11 +1065,11 @@ void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, | |
} | |
} | |
} else if (REQ_SUCCESS(req) && | |
- setsockopt(req->accept_socket, | |
- SOL_SOCKET, | |
- SO_UPDATE_ACCEPT_CONTEXT, | |
- (char*)&handle->socket, | |
- sizeof(handle->socket)) == 0) { | |
+ setsockopt(req->accept_socket, | |
+ SOL_SOCKET, | |
+ SO_UPDATE_ACCEPT_CONTEXT, | |
+ (char*)&handle->socket, | |
+ sizeof(handle->socket)) == 0) { | |
req->next_pending = handle->pending_accepts; | |
handle->pending_accepts = req; | |
@@ -1093,7 +1093,7 @@ void uv_process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, | |
void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, | |
- uv_connect_t* req) { | |
+ uv_connect_t* req) { | |
int err; | |
assert(handle->type == UV_TCP); | |
@@ -1103,10 +1103,10 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, | |
err = 0; | |
if (REQ_SUCCESS(req)) { | |
if (setsockopt(handle->socket, | |
- SOL_SOCKET, | |
- SO_UPDATE_CONNECT_CONTEXT, | |
- NULL, | |
- 0) == 0) { | |
+ SOL_SOCKET, | |
+ SO_UPDATE_CONNECT_CONTEXT, | |
+ NULL, | |
+ 0) == 0) { | |
uv_connection_init((uv_stream_t*)handle); | |
handle->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; | |
loop->active_tcp_streams++; | |
@@ -1123,7 +1123,7 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, | |
int uv_tcp_import(uv_tcp_t* tcp, uv__ipc_socket_info_ex* socket_info_ex, | |
- int tcp_connection) { | |
+ int tcp_connection) { | |
int err; | |
SOCKET socket = WSASocketW(FROM_PROTOCOL_INFO, | |
FROM_PROTOCOL_INFO, | |
@@ -1208,7 +1208,7 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay) { | |
int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, | |
- LPWSAPROTOCOL_INFOW protocol_info) { | |
+ LPWSAPROTOCOL_INFOW protocol_info) { | |
if (!(handle->flags & UV_HANDLE_CONNECTION)) { | |
/* | |
* We're about to share the socket with another process. Because | |
@@ -1278,7 +1278,7 @@ static int uv_tcp_try_cancel_io(uv_tcp_t* tcp) { | |
/* Check if we have any non-IFS LSPs stacked on top of TCP */ | |
non_ifs_lsp = (tcp->flags & UV_HANDLE_IPV6) ? uv_tcp_non_ifs_lsp_ipv6 : | |
- uv_tcp_non_ifs_lsp_ipv4; | |
+ uv_tcp_non_ifs_lsp_ipv4; | |
/* If there are non-ifs LSPs then try to obtain a base handle for the */ | |
/* socket. This will always fail on Windows XP/3k. */ | |
diff --git a/src/win/thread.c b/src/win/thread.c | |
index a697d7a..f78bb34 100644 | |
--- a/src/win/thread.c | |
+++ b/src/win/thread.c | |
@@ -76,7 +76,7 @@ inline static int uv_cond_condvar_timedwait(uv_cond_t* cond, | |
static NOINLINE void uv__once_inner(uv_once_t* guard, | |
- void (*callback)(void)) { | |
+ void (*callback)(void)) { | |
DWORD result; | |
HANDLE existing_event, created_event; | |
@@ -87,8 +87,8 @@ static NOINLINE void uv__once_inner(uv_once_t* guard, | |
} | |
existing_event = InterlockedCompareExchangePointer(&guard->event, | |
- created_event, | |
- NULL); | |
+ created_event, | |
+ NULL); | |
if (existing_event == NULL) { | |
/* We won the race */ | |
@@ -126,8 +126,7 @@ struct thread_ctx { | |
}; | |
-static UINT __stdcall uv__thread_start(void* arg) | |
-{ | |
+static UINT __stdcall uv__thread_start(void* arg) { | |
struct thread_ctx *ctx_p; | |
struct thread_ctx ctx; | |
@@ -155,7 +154,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { | |
ctx->arg = arg; | |
/* Create the thread in suspended state so we have a chance to pass | |
- * its own creation handle to it */ | |
+ * its own creation handle to it */ | |
thread = (HANDLE) _beginthreadex(NULL, | |
0, | |
uv__thread_start, | |
@@ -478,9 +477,9 @@ inline static int uv_cond_fallback_init(uv_cond_t* cond) { | |
/* Create an auto-reset event. */ | |
cond->fallback.signal_event = CreateEvent(NULL, /* no security */ | |
- FALSE, /* auto-reset event */ | |
- FALSE, /* non-signaled initially */ | |
- NULL); /* unnamed */ | |
+ FALSE, /* auto-reset event */ | |
+ FALSE, /* non-signaled initially */ | |
+ NULL); /* unnamed */ | |
if (!cond->fallback.signal_event) { | |
err = GetLastError(); | |
goto error2; | |
@@ -488,9 +487,9 @@ inline static int uv_cond_fallback_init(uv_cond_t* cond) { | |
/* Create a manual-reset event. */ | |
cond->fallback.broadcast_event = CreateEvent(NULL, /* no security */ | |
- TRUE, /* manual-reset */ | |
- FALSE, /* non-signaled */ | |
- NULL); /* unnamed */ | |
+ TRUE, /* manual-reset */ | |
+ FALSE, /* non-signaled */ | |
+ NULL); /* unnamed */ | |
if (!cond->fallback.broadcast_event) { | |
err = GetLastError(); | |
goto error; | |
@@ -597,7 +596,7 @@ void uv_cond_broadcast(uv_cond_t* cond) { | |
inline int uv_cond_wait_helper(uv_cond_t* cond, uv_mutex_t* mutex, | |
- DWORD dwMilliseconds) { | |
+ DWORD dwMilliseconds) { | |
DWORD result; | |
int last_waiter; | |
HANDLE handles[2] = { | |
@@ -622,7 +621,7 @@ inline int uv_cond_wait_helper(uv_cond_t* cond, uv_mutex_t* mutex, | |
EnterCriticalSection(&cond->fallback.waiters_count_lock); | |
cond->fallback.waiters_count--; | |
last_waiter = result == WAIT_OBJECT_0 + 1 | |
- && cond->fallback.waiters_count == 0; | |
+ && cond->fallback.waiters_count == 0; | |
LeaveCriticalSection(&cond->fallback.waiters_count_lock); | |
/* Some thread called <pthread_cond_broadcast>. */ | |
@@ -683,7 +682,7 @@ inline static int uv_cond_condvar_timedwait(uv_cond_t* cond, | |
int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, | |
- uint64_t timeout) { | |
+ uint64_t timeout) { | |
if (HAVE_CONDVAR_API()) | |
return uv_cond_condvar_timedwait(cond, mutex, timeout); | |
else | |
diff --git a/src/win/timer.c b/src/win/timer.c | |
index 0da541a..18474eb 100644 | |
--- a/src/win/timer.c | |
+++ b/src/win/timer.c | |
@@ -93,7 +93,7 @@ static uint64_t get_clamped_due_time(uint64_t loop_time, uint64_t timeout) { | |
int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, uint64_t timeout, | |
- uint64_t repeat) { | |
+ uint64_t repeat) { | |
uv_loop_t* loop = handle->loop; | |
uv_timer_t* old; | |
diff --git a/src/win/tty.c b/src/win/tty.c | |
index be4a8b8..5474f9a 100644 | |
--- a/src/win/tty.c | |
+++ b/src/win/tty.c | |
@@ -406,7 +406,7 @@ static void uv_tty_queue_read_line(uv_loop_t* loop, uv_tty_t* handle) { | |
uv_insert_pending_req(loop, (uv_req_t*)req); | |
} | |
- out: | |
+out: | |
handle->flags |= UV_HANDLE_READ_PENDING; | |
handle->reqs_pending++; | |
} | |
@@ -422,7 +422,7 @@ static void uv_tty_queue_read(uv_loop_t* loop, uv_tty_t* handle) { | |
static const char* get_vt100_fn_key(DWORD code, char shift, char ctrl, | |
- size_t* len) { | |
+ size_t* len) { | |
#define VK_CASE(vk, normal_str, shift_str, ctrl_str, shift_ctrl_str) \ | |
case (vk): \ | |
if (shift && ctrl) { \ | |
@@ -440,44 +440,44 @@ static const char* get_vt100_fn_key(DWORD code, char shift, char ctrl, | |
} | |
switch (code) { | |
- /* These mappings are the same as Cygwin's. Unmodified and alt-modified */ | |
- /* keypad keys comply with linux console, modifiers comply with xterm */ | |
- /* modifier usage. F1..f12 and shift-f1..f10 comply with linux console, */ | |
- /* f6..f12 with and without modifiers comply with rxvt. */ | |
- VK_CASE(VK_INSERT, "[2~", "[2;2~", "[2;5~", "[2;6~") | |
- VK_CASE(VK_END, "[4~", "[4;2~", "[4;5~", "[4;6~") | |
- VK_CASE(VK_DOWN, "[B", "[1;2B", "[1;5B", "[1;6B") | |
- VK_CASE(VK_NEXT, "[6~", "[6;2~", "[6;5~", "[6;6~") | |
- VK_CASE(VK_LEFT, "[D", "[1;2D", "[1;5D", "[1;6D") | |
- VK_CASE(VK_CLEAR, "[G", "[1;2G", "[1;5G", "[1;6G") | |
- VK_CASE(VK_RIGHT, "[C", "[1;2C", "[1;5C", "[1;6C") | |
- VK_CASE(VK_UP, "[A", "[1;2A", "[1;5A", "[1;6A") | |
- VK_CASE(VK_HOME, "[1~", "[1;2~", "[1;5~", "[1;6~") | |
- VK_CASE(VK_PRIOR, "[5~", "[5;2~", "[5;5~", "[5;6~") | |
- VK_CASE(VK_DELETE, "[3~", "[3;2~", "[3;5~", "[3;6~") | |
- VK_CASE(VK_NUMPAD0, "[2~", "[2;2~", "[2;5~", "[2;6~") | |
- VK_CASE(VK_NUMPAD1, "[4~", "[4;2~", "[4;5~", "[4;6~") | |
- VK_CASE(VK_NUMPAD2, "[B", "[1;2B", "[1;5B", "[1;6B") | |
- VK_CASE(VK_NUMPAD3, "[6~", "[6;2~", "[6;5~", "[6;6~") | |
- VK_CASE(VK_NUMPAD4, "[D", "[1;2D", "[1;5D", "[1;6D") | |
- VK_CASE(VK_NUMPAD5, "[G", "[1;2G", "[1;5G", "[1;6G") | |
- VK_CASE(VK_NUMPAD6, "[C", "[1;2C", "[1;5C", "[1;6C") | |
- VK_CASE(VK_NUMPAD7, "[A", "[1;2A", "[1;5A", "[1;6A") | |
- VK_CASE(VK_NUMPAD8, "[1~", "[1;2~", "[1;5~", "[1;6~") | |
- VK_CASE(VK_NUMPAD9, "[5~", "[5;2~", "[5;5~", "[5;6~") | |
- VK_CASE(VK_DECIMAL, "[3~", "[3;2~", "[3;5~", "[3;6~") | |
- VK_CASE(VK_F1, "[[A", "[23~", "[11^", "[23^" ) | |
- VK_CASE(VK_F2, "[[B", "[24~", "[12^", "[24^" ) | |
- VK_CASE(VK_F3, "[[C", "[25~", "[13^", "[25^" ) | |
- VK_CASE(VK_F4, "[[D", "[26~", "[14^", "[26^" ) | |
- VK_CASE(VK_F5, "[[E", "[28~", "[15^", "[28^" ) | |
- VK_CASE(VK_F6, "[17~", "[29~", "[17^", "[29^" ) | |
- VK_CASE(VK_F7, "[18~", "[31~", "[18^", "[31^" ) | |
- VK_CASE(VK_F8, "[19~", "[32~", "[19^", "[32^" ) | |
- VK_CASE(VK_F9, "[20~", "[33~", "[20^", "[33^" ) | |
- VK_CASE(VK_F10, "[21~", "[34~", "[21^", "[34^" ) | |
- VK_CASE(VK_F11, "[23~", "[23$", "[23^", "[23@" ) | |
- VK_CASE(VK_F12, "[24~", "[24$", "[24^", "[24@" ) | |
+ /* These mappings are the same as Cygwin's. Unmodified and alt-modified */ | |
+ /* keypad keys comply with linux console, modifiers comply with xterm */ | |
+ /* modifier usage. F1..f12 and shift-f1..f10 comply with linux console, */ | |
+ /* f6..f12 with and without modifiers comply with rxvt. */ | |
+ VK_CASE(VK_INSERT, "[2~", "[2;2~", "[2;5~", "[2;6~") | |
+ VK_CASE(VK_END, "[4~", "[4;2~", "[4;5~", "[4;6~") | |
+ VK_CASE(VK_DOWN, "[B", "[1;2B", "[1;5B", "[1;6B") | |
+ VK_CASE(VK_NEXT, "[6~", "[6;2~", "[6;5~", "[6;6~") | |
+ VK_CASE(VK_LEFT, "[D", "[1;2D", "[1;5D", "[1;6D") | |
+ VK_CASE(VK_CLEAR, "[G", "[1;2G", "[1;5G", "[1;6G") | |
+ VK_CASE(VK_RIGHT, "[C", "[1;2C", "[1;5C", "[1;6C") | |
+ VK_CASE(VK_UP, "[A", "[1;2A", "[1;5A", "[1;6A") | |
+ VK_CASE(VK_HOME, "[1~", "[1;2~", "[1;5~", "[1;6~") | |
+ VK_CASE(VK_PRIOR, "[5~", "[5;2~", "[5;5~", "[5;6~") | |
+ VK_CASE(VK_DELETE, "[3~", "[3;2~", "[3;5~", "[3;6~") | |
+ VK_CASE(VK_NUMPAD0, "[2~", "[2;2~", "[2;5~", "[2;6~") | |
+ VK_CASE(VK_NUMPAD1, "[4~", "[4;2~", "[4;5~", "[4;6~") | |
+ VK_CASE(VK_NUMPAD2, "[B", "[1;2B", "[1;5B", "[1;6B") | |
+ VK_CASE(VK_NUMPAD3, "[6~", "[6;2~", "[6;5~", "[6;6~") | |
+ VK_CASE(VK_NUMPAD4, "[D", "[1;2D", "[1;5D", "[1;6D") | |
+ VK_CASE(VK_NUMPAD5, "[G", "[1;2G", "[1;5G", "[1;6G") | |
+ VK_CASE(VK_NUMPAD6, "[C", "[1;2C", "[1;5C", "[1;6C") | |
+ VK_CASE(VK_NUMPAD7, "[A", "[1;2A", "[1;5A", "[1;6A") | |
+ VK_CASE(VK_NUMPAD8, "[1~", "[1;2~", "[1;5~", "[1;6~") | |
+ VK_CASE(VK_NUMPAD9, "[5~", "[5;2~", "[5;5~", "[5;6~") | |
+ VK_CASE(VK_DECIMAL, "[3~", "[3;2~", "[3;5~", "[3;6~") | |
+ VK_CASE(VK_F1, "[[A", "[23~", "[11^", "[23^" ) | |
+ VK_CASE(VK_F2, "[[B", "[24~", "[12^", "[24^" ) | |
+ VK_CASE(VK_F3, "[[C", "[25~", "[13^", "[25^" ) | |
+ VK_CASE(VK_F4, "[[D", "[26~", "[14^", "[26^" ) | |
+ VK_CASE(VK_F5, "[[E", "[28~", "[15^", "[28^" ) | |
+ VK_CASE(VK_F6, "[17~", "[29~", "[17^", "[29^" ) | |
+ VK_CASE(VK_F7, "[18~", "[31~", "[18^", "[31^" ) | |
+ VK_CASE(VK_F8, "[19~", "[32~", "[19^", "[32^" ) | |
+ VK_CASE(VK_F9, "[20~", "[33~", "[20^", "[33^" ) | |
+ VK_CASE(VK_F10, "[21~", "[34~", "[21^", "[34^" ) | |
+ VK_CASE(VK_F11, "[23~", "[23$", "[23^", "[23@" ) | |
+ VK_CASE(VK_F12, "[24~", "[24$", "[24^", "[24@" ) | |
default: | |
*len = 0; | |
@@ -488,7 +488,7 @@ static const char* get_vt100_fn_key(DWORD code, char shift, char ctrl, | |
void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
/* Shortcut for handle->last_input_record.Event.KeyEvent. */ | |
#define KEV handle->last_input_record.Event.KeyEvent | |
@@ -574,7 +574,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
/* Ignore keyup events, unless the left alt key was held and a valid */ | |
/* unicode character was emitted. */ | |
if (!KEV.bKeyDown && !(((KEV.dwControlKeyState & LEFT_ALT_PRESSED) || | |
- KEV.wVirtualKeyCode==VK_MENU) && KEV.uChar.UnicodeChar != 0)) { | |
+ KEV.wVirtualKeyCode==VK_MENU) && KEV.uChar.UnicodeChar != 0)) { | |
continue; | |
} | |
@@ -584,25 +584,25 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
if ((KEV.dwControlKeyState & LEFT_ALT_PRESSED) && | |
!(KEV.dwControlKeyState & ENHANCED_KEY) && | |
(KEV.wVirtualKeyCode == VK_INSERT || | |
- KEV.wVirtualKeyCode == VK_END || | |
- KEV.wVirtualKeyCode == VK_DOWN || | |
- KEV.wVirtualKeyCode == VK_NEXT || | |
- KEV.wVirtualKeyCode == VK_LEFT || | |
- KEV.wVirtualKeyCode == VK_CLEAR || | |
- KEV.wVirtualKeyCode == VK_RIGHT || | |
- KEV.wVirtualKeyCode == VK_HOME || | |
- KEV.wVirtualKeyCode == VK_UP || | |
- KEV.wVirtualKeyCode == VK_PRIOR || | |
- KEV.wVirtualKeyCode == VK_NUMPAD0 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD1 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD2 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD3 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD4 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD5 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD6 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD7 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD8 || | |
- KEV.wVirtualKeyCode == VK_NUMPAD9)) { | |
+ KEV.wVirtualKeyCode == VK_END || | |
+ KEV.wVirtualKeyCode == VK_DOWN || | |
+ KEV.wVirtualKeyCode == VK_NEXT || | |
+ KEV.wVirtualKeyCode == VK_LEFT || | |
+ KEV.wVirtualKeyCode == VK_CLEAR || | |
+ KEV.wVirtualKeyCode == VK_RIGHT || | |
+ KEV.wVirtualKeyCode == VK_HOME || | |
+ KEV.wVirtualKeyCode == VK_UP || | |
+ KEV.wVirtualKeyCode == VK_PRIOR || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD0 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD1 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD2 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD3 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD4 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD5 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD6 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD7 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD8 || | |
+ KEV.wVirtualKeyCode == VK_NUMPAD9)) { | |
continue; | |
} | |
@@ -621,7 +621,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
/* a compose sequence. */ | |
if ((KEV.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) | |
&& !(KEV.dwControlKeyState & (LEFT_CTRL_PRESSED | | |
- RIGHT_CTRL_PRESSED)) && KEV.bKeyDown) { | |
+ RIGHT_CTRL_PRESSED)) && KEV.bKeyDown) { | |
handle->last_key[0] = '\033'; | |
prefix_len = 1; | |
} else { | |
@@ -632,7 +632,8 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
KEV.uChar.UnicodeChar < 0xE000) { | |
/* UTF-16 surrogate pair */ | |
WCHAR utf16_buffer[2] = { handle->last_utf16_high_surrogate, | |
- KEV.uChar.UnicodeChar}; | |
+ KEV.uChar.UnicodeChar | |
+ }; | |
char_len = WideCharToMultiByte(CP_UTF8, | |
0, | |
utf16_buffer, | |
@@ -677,11 +678,11 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
size_t prefix_len, vt100_len; | |
vt100 = get_vt100_fn_key(KEV.wVirtualKeyCode, | |
- !!(KEV.dwControlKeyState & SHIFT_PRESSED), | |
- !!(KEV.dwControlKeyState & ( | |
- LEFT_CTRL_PRESSED | | |
- RIGHT_CTRL_PRESSED)), | |
- &vt100_len); | |
+ !!(KEV.dwControlKeyState & SHIFT_PRESSED), | |
+ !!(KEV.dwControlKeyState & ( | |
+ LEFT_CTRL_PRESSED | | |
+ RIGHT_CTRL_PRESSED)), | |
+ &vt100_len); | |
/* If we were unable to map to a vt100 sequence, just ignore. */ | |
if (!vt100) { | |
@@ -745,7 +746,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
handle->read_cb((uv_stream_t*) handle, buf_used, &buf); | |
} | |
- out: | |
+out: | |
/* Wait for more input events. */ | |
if ((handle->flags & UV_HANDLE_READING) && | |
!(handle->flags & UV_HANDLE_READ_PENDING)) { | |
@@ -760,7 +761,7 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle, | |
void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
uv_buf_t buf; | |
assert(handle->type == UV_TTY); | |
@@ -804,7 +805,7 @@ void uv_process_tty_read_line_req(uv_loop_t* loop, uv_tty_t* handle, | |
void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
assert(handle->type == UV_TTY); | |
assert(handle->flags & UV_HANDLE_TTY_READABLE); | |
@@ -820,7 +821,7 @@ void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle, | |
int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb, | |
- uv_read_cb read_cb) { | |
+ uv_read_cb read_cb) { | |
uv_loop_t* loop = handle->loop; | |
if (!(handle->flags & UV_HANDLE_TTY_READABLE)) { | |
@@ -915,8 +916,8 @@ static void uv_tty_update_virtual_window(CONSOLE_SCREEN_BUFFER_INFO* info) { | |
static COORD uv_tty_make_real_coord(uv_tty_t* handle, | |
- CONSOLE_SCREEN_BUFFER_INFO* info, int x, unsigned char x_relative, int y, | |
- unsigned char y_relative) { | |
+ CONSOLE_SCREEN_BUFFER_INFO* info, int x, unsigned char x_relative, int y, | |
+ unsigned char y_relative) { | |
COORD result; | |
uv_tty_update_virtual_window(info); | |
@@ -952,7 +953,7 @@ static COORD uv_tty_make_real_coord(uv_tty_t* handle, | |
static int uv_tty_emit_text(uv_tty_t* handle, WCHAR buffer[], DWORD length, | |
- DWORD* error) { | |
+ DWORD* error) { | |
DWORD written; | |
if (*error != ERROR_SUCCESS) { | |
@@ -973,7 +974,7 @@ static int uv_tty_emit_text(uv_tty_t* handle, WCHAR buffer[], DWORD length, | |
static int uv_tty_move_caret(uv_tty_t* handle, int x, unsigned char x_relative, | |
- int y, unsigned char y_relative, DWORD* error) { | |
+ int y, unsigned char y_relative, DWORD* error) { | |
CONSOLE_SCREEN_BUFFER_INFO info; | |
COORD pos; | |
@@ -981,7 +982,7 @@ static int uv_tty_move_caret(uv_tty_t* handle, int x, unsigned char x_relative, | |
return -1; | |
} | |
- retry: | |
+retry: | |
if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { | |
*error = GetLastError(); | |
} | |
@@ -1025,7 +1026,7 @@ static int uv_tty_reset(uv_tty_t* handle, DWORD* error) { | |
} | |
/* Clear the screen buffer. */ | |
- retry: | |
+retry: | |
if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { | |
*error = GetLastError(); | |
return -1; | |
@@ -1061,7 +1062,7 @@ static int uv_tty_reset(uv_tty_t* handle, DWORD* error) { | |
static int uv_tty_clear(uv_tty_t* handle, int dir, char entire_screen, | |
- DWORD* error) { | |
+ DWORD* error) { | |
CONSOLE_SCREEN_BUFFER_INFO info; | |
COORD start, end; | |
DWORD count, written; | |
@@ -1106,7 +1107,7 @@ static int uv_tty_clear(uv_tty_t* handle, int dir, char entire_screen, | |
y2r = x2r; | |
} | |
- retry: | |
+retry: | |
if (!GetConsoleScreenBufferInfo(handle->handle, &info)) { | |
*error = GetLastError(); | |
return -1; | |
@@ -1118,10 +1119,10 @@ static int uv_tty_clear(uv_tty_t* handle, int dir, char entire_screen, | |
(start.Y * info.dwSize.X + start.X) + 1; | |
if (!(FillConsoleOutputCharacterW(handle->handle, | |
- L'\x20', | |
- count, | |
- start, | |
- &written) && | |
+ L'\x20', | |
+ count, | |
+ start, | |
+ &written) && | |
FillConsoleOutputAttribute(handle->handle, | |
info.wAttributes, | |
written, | |
@@ -1305,7 +1306,7 @@ static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) { | |
static int uv_tty_save_state(uv_tty_t* handle, unsigned char save_attributes, | |
- DWORD* error) { | |
+ DWORD* error) { | |
CONSOLE_SCREEN_BUFFER_INFO info; | |
if (*error != ERROR_SUCCESS) { | |
@@ -1325,7 +1326,7 @@ static int uv_tty_save_state(uv_tty_t* handle, unsigned char save_attributes, | |
if (save_attributes) { | |
handle->saved_attributes = info.wAttributes & | |
- (FOREGROUND_INTENSITY | BACKGROUND_INTENSITY); | |
+ (FOREGROUND_INTENSITY | BACKGROUND_INTENSITY); | |
handle->flags |= UV_HANDLE_TTY_SAVED_ATTRIBUTES; | |
} | |
@@ -1334,7 +1335,7 @@ static int uv_tty_save_state(uv_tty_t* handle, unsigned char save_attributes, | |
static int uv_tty_restore_state(uv_tty_t* handle, | |
- unsigned char restore_attributes, DWORD* error) { | |
+ unsigned char restore_attributes, DWORD* error) { | |
CONSOLE_SCREEN_BUFFER_INFO info; | |
WORD new_attributes; | |
@@ -1530,7 +1531,7 @@ static int uv_tty_write_bufs(uv_tty_t* handle, | |
ansi_parser_state = ANSI_NORMAL; | |
continue; | |
- case '8': | |
+ case '8': | |
/* Restore the cursor position and text attributes */ | |
FLUSH_TEXT(); | |
uv_tty_restore_state(handle, 1, error); | |
@@ -1565,12 +1566,12 @@ static int uv_tty_write_bufs(uv_tty_t* handle, | |
ansi_parser_state |= ANSI_IN_ARG; | |
handle->ansi_csi_argc++; | |
handle->ansi_csi_argv[handle->ansi_csi_argc - 1] = | |
- (unsigned short) utf8_codepoint - '0'; | |
+ (unsigned short) utf8_codepoint - '0'; | |
continue; | |
} else { | |
/* We were already parsing a number. Parse next digit. */ | |
uint32_t value = 10 * | |
- handle->ansi_csi_argv[handle->ansi_csi_argc - 1]; | |
+ handle->ansi_csi_argv[handle->ansi_csi_argc - 1]; | |
/* Check for overflow. */ | |
if (value > UINT16_MAX) { | |
@@ -1578,9 +1579,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle, | |
continue; | |
} | |
- handle->ansi_csi_argv[handle->ansi_csi_argc - 1] = | |
- (unsigned short) value + (utf8_codepoint - '0'); | |
- continue; | |
+ handle->ansi_csi_argv[handle->ansi_csi_argc - 1] = | |
+ (unsigned short) value + (utf8_codepoint - '0'); | |
+ continue; | |
} | |
} else if (utf8_codepoint == ';') { | |
@@ -1662,7 +1663,7 @@ static int uv_tty_write_bufs(uv_tty_t* handle, | |
/* cursor horizontal move absolute */ | |
FLUSH_TEXT(); | |
x = (handle->ansi_csi_argc >= 1 && handle->ansi_csi_argv[0]) | |
- ? handle->ansi_csi_argv[0] - 1 : 0; | |
+ ? handle->ansi_csi_argv[0] - 1 : 0; | |
uv_tty_move_caret(handle, x, 0, 0, 1, error); | |
break; | |
@@ -1671,9 +1672,9 @@ static int uv_tty_write_bufs(uv_tty_t* handle, | |
/* cursor move absolute */ | |
FLUSH_TEXT(); | |
y = (handle->ansi_csi_argc >= 1 && handle->ansi_csi_argv[0]) | |
- ? handle->ansi_csi_argv[0] - 1 : 0; | |
+ ? handle->ansi_csi_argv[0] - 1 : 0; | |
x = (handle->ansi_csi_argc >= 2 && handle->ansi_csi_argv[1]) | |
- ? handle->ansi_csi_argv[1] - 1 : 0; | |
+ ? handle->ansi_csi_argv[1] - 1 : 0; | |
uv_tty_move_caret(handle, x, 0, y, 0, error); | |
break; | |
@@ -1765,14 +1766,14 @@ static int uv_tty_write_bufs(uv_tty_t* handle, | |
} | |
} else { | |
if (utf8_codepoint == '\007' || (utf8_codepoint == '\\' && | |
- (ansi_parser_state & ANSI_ESCAPE_SEEN))) { | |
+ (ansi_parser_state & ANSI_ESCAPE_SEEN))) { | |
/* End of sequence */ | |
ansi_parser_state = ANSI_NORMAL; | |
} else if (utf8_codepoint == '\033') { | |
/* Escape character */ | |
ansi_parser_state |= ANSI_ESCAPE_SEEN; | |
} else if (utf8_codepoint == '"') { | |
- /* String starting */ | |
+ /* String starting */ | |
ansi_parser_state |= ANSI_IN_STRING; | |
ansi_parser_state &= ~ANSI_ESCAPE_SEEN; | |
ansi_parser_state &= ~ANSI_BACKSLASH_SEEN; | |
@@ -1879,7 +1880,7 @@ int uv_tty_write(uv_loop_t* loop, | |
void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_write_t* req) { | |
+ uv_write_t* req) { | |
int err; | |
handle->write_queue_size -= req->queued_bytes; | |
@@ -1957,14 +1958,14 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) { | |
/* TODO: remove me */ | |
void uv_process_tty_accept_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_req_t* raw_req) { | |
+ uv_req_t* raw_req) { | |
abort(); | |
} | |
/* TODO: remove me */ | |
void uv_process_tty_connect_req(uv_loop_t* loop, uv_tty_t* handle, | |
- uv_connect_t* req) { | |
+ uv_connect_t* req) { | |
abort(); | |
} | |
diff --git a/src/win/udp.c b/src/win/udp.c | |
index 73b5bd5..a126579 100644 | |
--- a/src/win/udp.c | |
+++ b/src/win/udp.c | |
@@ -56,7 +56,7 @@ int uv_udp_getsockname(const uv_udp_t* handle, | |
static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket, | |
- int family) { | |
+ int family) { | |
DWORD yes = 1; | |
WSAPROTOCOL_INFOW info; | |
int opt_len; | |
@@ -99,8 +99,8 @@ static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket, | |
if (info.ProtocolChain.ChainLen == 1) { | |
if (pSetFileCompletionNotificationModes((HANDLE)socket, | |
- FILE_SKIP_SET_EVENT_ON_HANDLE | | |
- FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { | |
+ FILE_SKIP_SET_EVENT_ON_HANDLE | | |
+ FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) { | |
handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; | |
handle->func_wsarecv = uv_wsarecv_workaround; | |
handle->func_wsarecvfrom = uv_wsarecvfrom_workaround; | |
@@ -328,7 +328,7 @@ static void uv_udp_queue_recv(uv_loop_t* loop, uv_udp_t* handle) { | |
int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, | |
- uv_udp_recv_cb recv_cb) { | |
+ uv_udp_recv_cb recv_cb) { | |
uv_loop_t* loop = handle->loop; | |
int err; | |
@@ -421,7 +421,7 @@ static int uv__send(uv_udp_send_t* req, | |
void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle, | |
- uv_req_t* req) { | |
+ uv_req_t* req) { | |
uv_buf_t buf; | |
int partial; | |
@@ -531,7 +531,7 @@ done: | |
void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle, | |
- uv_udp_send_t* req) { | |
+ uv_udp_send_t* req) { | |
int err; | |
assert(handle->type == UV_UDP); | |
@@ -642,14 +642,14 @@ int uv__udp_set_membership6(uv_udp_t* handle, | |
mreq.ipv6mr_multiaddr = multicast_addr->sin6_addr; | |
switch (membership) { | |
- case UV_JOIN_GROUP: | |
- optname = IPV6_ADD_MEMBERSHIP; | |
- break; | |
- case UV_LEAVE_GROUP: | |
- optname = IPV6_DROP_MEMBERSHIP; | |
- break; | |
- default: | |
- return UV_EINVAL; | |
+ case UV_JOIN_GROUP: | |
+ optname = IPV6_ADD_MEMBERSHIP; | |
+ break; | |
+ case UV_LEAVE_GROUP: | |
+ optname = IPV6_DROP_MEMBERSHIP; | |
+ break; | |
+ default: | |
+ return UV_EINVAL; | |
} | |
if (setsockopt(handle->socket, | |
diff --git a/src/win/util.c b/src/win/util.c | |
index 43d843f..4bfcd84 100644 | |
--- a/src/win/util.c | |
+++ b/src/win/util.c | |
@@ -73,7 +73,7 @@ void uv__util_init() { | |
InitializeCriticalSection(&process_title_lock); | |
/* Retrieve high-resolution timer frequency | |
- * and precompute its reciprocal. | |
+ * and precompute its reciprocal. | |
*/ | |
if (QueryPerformanceFrequency(&perf_frequency)) { | |
hrtime_interval_ = 1.0 / perf_frequency.QuadPart; | |
@@ -84,7 +84,7 @@ void uv__util_init() { | |
int uv_utf16_to_utf8(const WCHAR* utf16Buffer, size_t utf16Size, | |
- char* utf8Buffer, size_t utf8Size) { | |
+ char* utf8Buffer, size_t utf8Size) { | |
return WideCharToMultiByte(CP_UTF8, | |
0, | |
utf16Buffer, | |
@@ -97,7 +97,7 @@ int uv_utf16_to_utf8(const WCHAR* utf16Buffer, size_t utf16Size, | |
int uv_utf8_to_utf16(const char* utf8Buffer, WCHAR* utf16Buffer, | |
- size_t utf16Size) { | |
+ size_t utf16Size) { | |
return MultiByteToWideChar(CP_UTF8, | |
0, | |
utf8Buffer, | |
@@ -159,7 +159,7 @@ int uv_exepath(char* buffer, size_t* size_ptr) { | |
*size_ptr = utf8_len - 1; | |
return 0; | |
- error: | |
+error: | |
free(utf16_buffer); | |
return uv_translate_sys_error(err); | |
} | |
@@ -317,7 +317,7 @@ uint64_t uv_get_free_memory(void) { | |
memory_status.dwLength = sizeof(memory_status); | |
if (!GlobalMemoryStatusEx(&memory_status)) { | |
- return -1; | |
+ return -1; | |
} | |
return (uint64_t)memory_status.ullAvailPhys; | |
@@ -567,7 +567,7 @@ int uv_uptime(double* uptime) { | |
goto internalError; | |
counter_definition = (PERF_COUNTER_DEFINITION*) (buffer + | |
- data_block->HeaderLength + object_type->HeaderLength); | |
+ data_block->HeaderLength + object_type->HeaderLength); | |
for (i = 0; i < object_type->NumCounters; i++) { | |
if ((BYTE*) counter_definition + sizeof(*counter_definition) > | |
buffer + data_size) { | |
@@ -591,7 +591,7 @@ int uv_uptime(double* uptime) { | |
} | |
counter_definition = (PERF_COUNTER_DEFINITION*) | |
- ((BYTE*) counter_definition + counter_definition->ByteLength); | |
+ ((BYTE*) counter_definition + counter_definition->ByteLength); | |
} | |
/* If we get here, the uptime value was not found. */ | |
@@ -599,7 +599,7 @@ int uv_uptime(double* uptime) { | |
*uptime = 0; | |
return UV_ENOSYS; | |
- internalError: | |
+internalError: | |
free(malloced_buffer); | |
*uptime = 0; | |
return UV_EIO; | |
@@ -704,7 +704,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) { | |
cpu_info->speed = cpu_speed; | |
cpu_info->cpu_times.user = sppi[i].UserTime.QuadPart / 10000; | |
cpu_info->cpu_times.sys = (sppi[i].KernelTime.QuadPart - | |
- sppi[i].IdleTime.QuadPart) / 10000; | |
+ sppi[i].IdleTime.QuadPart) / 10000; | |
cpu_info->cpu_times.idle = sppi[i].IdleTime.QuadPart / 10000; | |
cpu_info->cpu_times.irq = sppi[i].InterruptTime.QuadPart / 10000; | |
cpu_info->cpu_times.nice = 0; | |
@@ -755,7 +755,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) { | |
return 0; | |
- error: | |
+error: | |
/* This is safe because the cpu_infos array is zeroed on allocation. */ | |
for (i = 0; i < cpu_count; i++) | |
free(cpu_infos[i].model); | |
@@ -779,9 +779,9 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { | |
static int is_windows_version_or_greater(DWORD os_major, | |
- DWORD os_minor, | |
- WORD service_pack_major, | |
- WORD service_pack_minor) { | |
+ DWORD os_minor, | |
+ WORD service_pack_major, | |
+ WORD service_pack_minor) { | |
OSVERSIONINFOEX osvi; | |
DWORDLONG condition_mask = 0; | |
int op = VER_GREATER_EQUAL; | |
@@ -802,10 +802,10 @@ static int is_windows_version_or_greater(DWORD os_major, | |
/* Perform the test. */ | |
return (int) VerifyVersionInfo( | |
- &osvi, | |
- VER_MAJORVERSION | VER_MINORVERSION | | |
- VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR, | |
- condition_mask); | |
+ &osvi, | |
+ VER_MAJORVERSION | VER_MINORVERSION | | |
+ VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR, | |
+ condition_mask); | |
} | |
@@ -837,14 +837,14 @@ static int address_prefix_match(int family, | |
if (prefix_len % 8) | |
return prefix_address_data[i] == | |
- (address_data[i] & (0xff << (8 - prefix_len % 8))); | |
+ (address_data[i] & (0xff << (8 - prefix_len % 8))); | |
return 1; | |
} | |
int uv_interface_addresses(uv_interface_address_t** addresses_ptr, | |
- int* count_ptr) { | |
+ int* count_ptr) { | |
IP_ADAPTER_ADDRESSES* win_address_buf; | |
ULONG win_address_buf_size; | |
IP_ADAPTER_ADDRESSES* adapter; | |
@@ -862,16 +862,16 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, | |
is_vista_or_greater = is_windows_version_or_greater(6, 0, 0, 0); | |
if (is_vista_or_greater) { | |
flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | | |
- GAA_FLAG_SKIP_DNS_SERVER; | |
+ GAA_FLAG_SKIP_DNS_SERVER; | |
} else { | |
/* We need at least XP SP1. */ | |
if (!is_windows_version_or_greater(5, 1, 1, 0)) | |
return UV_ENOTSUP; | |
flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | | |
- GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX; | |
+ GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX; | |
} | |
- | |
+ | |
/* Fetch the size of the adapters reported by windows, and then get the */ | |
/* list itself. */ | |
@@ -1054,14 +1054,14 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, | |
prefix->PrefixLength <= prefix_len) | |
continue; | |
- if (address_prefix_match(sa->sa_family, sa, | |
- prefix->Address.lpSockaddr, prefix->PrefixLength)) { | |
+ if (address_prefix_match(sa->sa_family, sa, | |
+ prefix->Address.lpSockaddr, prefix->PrefixLength)) { | |
prefix_len = prefix->PrefixLength; | |
} | |
} | |
/* If there is no matching prefix information, return a single-host | |
- * subnet mask (e.g. 255.255.255.255 for IPv4). | |
+ * subnet mask (e.g. 255.255.255.255 for IPv4). | |
*/ | |
if (!prefix_len) | |
prefix_len = (sa->sa_family == AF_INET6) ? 128 : 32; | |
@@ -1078,7 +1078,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, | |
} | |
uv_address->is_internal = | |
- (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK); | |
+ (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK); | |
if (sa->sa_family == AF_INET6) { | |
uv_address->address.address6 = *((struct sockaddr_in6 *) sa); | |
@@ -1088,7 +1088,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, | |
/* This check ensures that we don't write past the size of the data. */ | |
if (prefix_len % 8) { | |
uv_address->netmask.netmask6.sin6_addr.s6_addr[prefix_len >> 3] = | |
- 0xff << (8 - prefix_len % 8); | |
+ 0xff << (8 - prefix_len % 8); | |
} | |
} else { | |
@@ -1115,7 +1115,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr, | |
void uv_free_interface_addresses(uv_interface_address_t* addresses, | |
- int count) { | |
+ int count) { | |
free(addresses); | |
} | |
diff --git a/src/win/winapi.c b/src/win/winapi.c | |
index 84ce73e..d1ab2ca 100644 | |
--- a/src/win/winapi.c | |
+++ b/src/win/winapi.c | |
@@ -64,42 +64,42 @@ void uv_winapi_init() { | |
} | |
pRtlNtStatusToDosError = (sRtlNtStatusToDosError) GetProcAddress( | |
- ntdll_module, | |
- "RtlNtStatusToDosError"); | |
+ ntdll_module, | |
+ "RtlNtStatusToDosError"); | |
if (pRtlNtStatusToDosError == NULL) { | |
uv_fatal_error(GetLastError(), "GetProcAddress"); | |
} | |
pNtDeviceIoControlFile = (sNtDeviceIoControlFile) GetProcAddress( | |
- ntdll_module, | |
- "NtDeviceIoControlFile"); | |
+ ntdll_module, | |
+ "NtDeviceIoControlFile"); | |
if (pNtDeviceIoControlFile == NULL) { | |
uv_fatal_error(GetLastError(), "GetProcAddress"); | |
} | |
pNtQueryInformationFile = (sNtQueryInformationFile) GetProcAddress( | |
- ntdll_module, | |
- "NtQueryInformationFile"); | |
+ ntdll_module, | |
+ "NtQueryInformationFile"); | |
if (pNtQueryInformationFile == NULL) { | |
uv_fatal_error(GetLastError(), "GetProcAddress"); | |
} | |
pNtSetInformationFile = (sNtSetInformationFile) GetProcAddress( | |
- ntdll_module, | |
- "NtSetInformationFile"); | |
+ ntdll_module, | |
+ "NtSetInformationFile"); | |
if (pNtSetInformationFile == NULL) { | |
uv_fatal_error(GetLastError(), "GetProcAddress"); | |
} | |
pNtQueryVolumeInformationFile = (sNtQueryVolumeInformationFile) | |
- GetProcAddress(ntdll_module, "NtQueryVolumeInformationFile"); | |
+ GetProcAddress(ntdll_module, "NtQueryVolumeInformationFile"); | |
if (pNtQueryVolumeInformationFile == NULL) { | |
uv_fatal_error(GetLastError(), "GetProcAddress"); | |
} | |
pNtQuerySystemInformation = (sNtQuerySystemInformation) GetProcAddress( | |
- ntdll_module, | |
- "NtQuerySystemInformation"); | |
+ ntdll_module, | |
+ "NtQuerySystemInformation"); | |
if (pNtQuerySystemInformation == NULL) { | |
uv_fatal_error(GetLastError(), "GetProcAddress"); | |
} | |
@@ -110,54 +110,54 @@ void uv_winapi_init() { | |
} | |
pGetQueuedCompletionStatusEx = (sGetQueuedCompletionStatusEx) GetProcAddress( | |
- kernel32_module, | |
- "GetQueuedCompletionStatusEx"); | |
+ kernel32_module, | |
+ "GetQueuedCompletionStatusEx"); | |
pSetFileCompletionNotificationModes = (sSetFileCompletionNotificationModes) | |
- GetProcAddress(kernel32_module, "SetFileCompletionNotificationModes"); | |
+ GetProcAddress(kernel32_module, "SetFileCompletionNotificationModes"); | |
pCreateSymbolicLinkW = (sCreateSymbolicLinkW) | |
- GetProcAddress(kernel32_module, "CreateSymbolicLinkW"); | |
+ GetProcAddress(kernel32_module, "CreateSymbolicLinkW"); | |
pCancelIoEx = (sCancelIoEx) | |
- GetProcAddress(kernel32_module, "CancelIoEx"); | |
+ GetProcAddress(kernel32_module, "CancelIoEx"); | |
pInitializeSRWLock = (sInitializeSRWLock) | |
- GetProcAddress(kernel32_module, "InitializeSRWLock"); | |
+ GetProcAddress(kernel32_module, "InitializeSRWLock"); | |
pAcquireSRWLockShared = (sAcquireSRWLockShared) | |
- GetProcAddress(kernel32_module, "AcquireSRWLockShared"); | |
+ GetProcAddress(kernel32_module, "AcquireSRWLockShared"); | |
pAcquireSRWLockExclusive = (sAcquireSRWLockExclusive) | |
- GetProcAddress(kernel32_module, "AcquireSRWLockExclusive"); | |
+ GetProcAddress(kernel32_module, "AcquireSRWLockExclusive"); | |
pTryAcquireSRWLockShared = (sTryAcquireSRWLockShared) | |
- GetProcAddress(kernel32_module, "TryAcquireSRWLockShared"); | |
+ GetProcAddress(kernel32_module, "TryAcquireSRWLockShared"); | |
pTryAcquireSRWLockExclusive = (sTryAcquireSRWLockExclusive) | |
- GetProcAddress(kernel32_module, "TryAcquireSRWLockExclusive"); | |
+ GetProcAddress(kernel32_module, "TryAcquireSRWLockExclusive"); | |
pReleaseSRWLockShared = (sReleaseSRWLockShared) | |
- GetProcAddress(kernel32_module, "ReleaseSRWLockShared"); | |
+ GetProcAddress(kernel32_module, "ReleaseSRWLockShared"); | |
pReleaseSRWLockExclusive = (sReleaseSRWLockExclusive) | |
- GetProcAddress(kernel32_module, "ReleaseSRWLockExclusive"); | |
+ GetProcAddress(kernel32_module, "ReleaseSRWLockExclusive"); | |
pInitializeConditionVariable = (sInitializeConditionVariable) | |
- GetProcAddress(kernel32_module, "InitializeConditionVariable"); | |
+ GetProcAddress(kernel32_module, "InitializeConditionVariable"); | |
pSleepConditionVariableCS = (sSleepConditionVariableCS) | |
- GetProcAddress(kernel32_module, "SleepConditionVariableCS"); | |
+ GetProcAddress(kernel32_module, "SleepConditionVariableCS"); | |
pSleepConditionVariableSRW = (sSleepConditionVariableSRW) | |
- GetProcAddress(kernel32_module, "SleepConditionVariableSRW"); | |
+ GetProcAddress(kernel32_module, "SleepConditionVariableSRW"); | |
pWakeAllConditionVariable = (sWakeAllConditionVariable) | |
- GetProcAddress(kernel32_module, "WakeAllConditionVariable"); | |
+ GetProcAddress(kernel32_module, "WakeAllConditionVariable"); | |
pWakeConditionVariable = (sWakeConditionVariable) | |
- GetProcAddress(kernel32_module, "WakeConditionVariable"); | |
+ GetProcAddress(kernel32_module, "WakeConditionVariable"); | |
pCancelSynchronousIo = (sCancelSynchronousIo) | |
- GetProcAddress(kernel32_module, "CancelSynchronousIo"); | |
+ GetProcAddress(kernel32_module, "CancelSynchronousIo"); | |
} | |
diff --git a/src/win/winapi.h b/src/win/winapi.h | |
index 1bb0e9a..e5e216f 100644 | |
--- a/src/win/winapi.h | |
+++ b/src/win/winapi.h | |
@@ -4111,31 +4111,31 @@ | |
/* from ntifs.h */ | |
/* MinGW already has it, mingw-w64 does not. */ | |
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) | |
- typedef struct _REPARSE_DATA_BUFFER { | |
- ULONG ReparseTag; | |
- USHORT ReparseDataLength; | |
- USHORT Reserved; | |
- union { | |
- struct { | |
- USHORT SubstituteNameOffset; | |
- USHORT SubstituteNameLength; | |
- USHORT PrintNameOffset; | |
- USHORT PrintNameLength; | |
- ULONG Flags; | |
- WCHAR PathBuffer[1]; | |
- } SymbolicLinkReparseBuffer; | |
- struct { | |
- USHORT SubstituteNameOffset; | |
- USHORT SubstituteNameLength; | |
- USHORT PrintNameOffset; | |
- USHORT PrintNameLength; | |
- WCHAR PathBuffer[1]; | |
- } MountPointReparseBuffer; | |
- struct { | |
- UCHAR DataBuffer[1]; | |
- } GenericReparseBuffer; | |
- } DUMMYUNIONNAME; | |
- } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; | |
+typedef struct _REPARSE_DATA_BUFFER { | |
+ ULONG ReparseTag; | |
+ USHORT ReparseDataLength; | |
+ USHORT Reserved; | |
+ union { | |
+ struct { | |
+ USHORT SubstituteNameOffset; | |
+ USHORT SubstituteNameLength; | |
+ USHORT PrintNameOffset; | |
+ USHORT PrintNameLength; | |
+ ULONG Flags; | |
+ WCHAR PathBuffer[1]; | |
+ } SymbolicLinkReparseBuffer; | |
+ struct { | |
+ USHORT SubstituteNameOffset; | |
+ USHORT SubstituteNameLength; | |
+ USHORT PrintNameOffset; | |
+ USHORT PrintNameLength; | |
+ WCHAR PathBuffer[1]; | |
+ } MountPointReparseBuffer; | |
+ struct { | |
+ UCHAR DataBuffer[1]; | |
+ } GenericReparseBuffer; | |
+ } DUMMYUNIONNAME; | |
+} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; | |
#endif | |
typedef struct _IO_STATUS_BLOCK { | |
@@ -4375,12 +4375,12 @@ typedef struct _FILE_FS_SECTOR_SIZE_INFORMATION { | |
} FILE_FS_SECTOR_SIZE_INFORMATION, *PFILE_FS_SECTOR_SIZE_INFORMATION; | |
typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { | |
- LARGE_INTEGER IdleTime; | |
- LARGE_INTEGER KernelTime; | |
- LARGE_INTEGER UserTime; | |
- LARGE_INTEGER DpcTime; | |
- LARGE_INTEGER InterruptTime; | |
- ULONG InterruptCount; | |
+ LARGE_INTEGER IdleTime; | |
+ LARGE_INTEGER KernelTime; | |
+ LARGE_INTEGER UserTime; | |
+ LARGE_INTEGER DpcTime; | |
+ LARGE_INTEGER InterruptTime; | |
+ ULONG InterruptCount; | |
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | |
#ifndef SystemProcessorPerformanceInformation | |
@@ -4466,51 +4466,51 @@ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { | |
#endif | |
typedef VOID (NTAPI *PIO_APC_ROUTINE) | |
- (PVOID ApcContext, | |
- PIO_STATUS_BLOCK IoStatusBlock, | |
- ULONG Reserved); | |
+(PVOID ApcContext, | |
+ PIO_STATUS_BLOCK IoStatusBlock, | |
+ ULONG Reserved); | |
typedef ULONG (NTAPI *sRtlNtStatusToDosError) | |
- (NTSTATUS Status); | |
+(NTSTATUS Status); | |
typedef NTSTATUS (NTAPI *sNtDeviceIoControlFile) | |
- (HANDLE FileHandle, | |
- HANDLE Event, | |
- PIO_APC_ROUTINE ApcRoutine, | |
- PVOID ApcContext, | |
- PIO_STATUS_BLOCK IoStatusBlock, | |
- ULONG IoControlCode, | |
- PVOID InputBuffer, | |
- ULONG InputBufferLength, | |
- PVOID OutputBuffer, | |
- ULONG OutputBufferLength); | |
+(HANDLE FileHandle, | |
+ HANDLE Event, | |
+ PIO_APC_ROUTINE ApcRoutine, | |
+ PVOID ApcContext, | |
+ PIO_STATUS_BLOCK IoStatusBlock, | |
+ ULONG IoControlCode, | |
+ PVOID InputBuffer, | |
+ ULONG InputBufferLength, | |
+ PVOID OutputBuffer, | |
+ ULONG OutputBufferLength); | |
typedef NTSTATUS (NTAPI *sNtQueryInformationFile) | |
- (HANDLE FileHandle, | |
- PIO_STATUS_BLOCK IoStatusBlock, | |
- PVOID FileInformation, | |
- ULONG Length, | |
- FILE_INFORMATION_CLASS FileInformationClass); | |
+(HANDLE FileHandle, | |
+ PIO_STATUS_BLOCK IoStatusBlock, | |
+ PVOID FileInformation, | |
+ ULONG Length, | |
+ FILE_INFORMATION_CLASS FileInformationClass); | |
typedef NTSTATUS (NTAPI *sNtSetInformationFile) | |
- (HANDLE FileHandle, | |
- PIO_STATUS_BLOCK IoStatusBlock, | |
- PVOID FileInformation, | |
- ULONG Length, | |
- FILE_INFORMATION_CLASS FileInformationClass); | |
+(HANDLE FileHandle, | |
+ PIO_STATUS_BLOCK IoStatusBlock, | |
+ PVOID FileInformation, | |
+ ULONG Length, | |
+ FILE_INFORMATION_CLASS FileInformationClass); | |
typedef NTSTATUS (NTAPI *sNtQueryVolumeInformationFile) | |
- (HANDLE FileHandle, | |
- PIO_STATUS_BLOCK IoStatusBlock, | |
- PVOID FsInformation, | |
- ULONG Length, | |
- FS_INFORMATION_CLASS FsInformationClass); | |
+(HANDLE FileHandle, | |
+ PIO_STATUS_BLOCK IoStatusBlock, | |
+ PVOID FsInformation, | |
+ ULONG Length, | |
+ FS_INFORMATION_CLASS FsInformationClass); | |
typedef NTSTATUS (NTAPI *sNtQuerySystemInformation) | |
- (UINT SystemInformationClass, | |
- PVOID SystemInformation, | |
- ULONG SystemInformationLength, | |
- PULONG ReturnLength); | |
+(UINT SystemInformationClass, | |
+ PVOID SystemInformation, | |
+ ULONG SystemInformationLength, | |
+ PULONG ReturnLength); | |
/* | |
@@ -4529,12 +4529,12 @@ typedef NTSTATUS (NTAPI *sNtQuerySystemInformation) | |
#endif | |
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) | |
- typedef struct _OVERLAPPED_ENTRY { | |
- ULONG_PTR lpCompletionKey; | |
- LPOVERLAPPED lpOverlapped; | |
- ULONG_PTR Internal; | |
- DWORD dwNumberOfBytesTransferred; | |
- } OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; | |
+typedef struct _OVERLAPPED_ENTRY { | |
+ ULONG_PTR lpCompletionKey; | |
+ LPOVERLAPPED lpOverlapped; | |
+ ULONG_PTR Internal; | |
+ DWORD dwNumberOfBytesTransferred; | |
+} OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; | |
#endif | |
/* from wincon.h */ | |
@@ -4556,69 +4556,69 @@ typedef NTSTATUS (NTAPI *sNtQuerySystemInformation) | |
#endif | |
typedef BOOL (WINAPI *sGetQueuedCompletionStatusEx) | |
- (HANDLE CompletionPort, | |
- LPOVERLAPPED_ENTRY lpCompletionPortEntries, | |
- ULONG ulCount, | |
- PULONG ulNumEntriesRemoved, | |
- DWORD dwMilliseconds, | |
- BOOL fAlertable); | |
+(HANDLE CompletionPort, | |
+ LPOVERLAPPED_ENTRY lpCompletionPortEntries, | |
+ ULONG ulCount, | |
+ PULONG ulNumEntriesRemoved, | |
+ DWORD dwMilliseconds, | |
+ BOOL fAlertable); | |
typedef BOOL (WINAPI* sSetFileCompletionNotificationModes) | |
- (HANDLE FileHandle, | |
- UCHAR Flags); | |
+(HANDLE FileHandle, | |
+ UCHAR Flags); | |
typedef BOOLEAN (WINAPI* sCreateSymbolicLinkW) | |
- (LPCWSTR lpSymlinkFileName, | |
- LPCWSTR lpTargetFileName, | |
- DWORD dwFlags); | |
+(LPCWSTR lpSymlinkFileName, | |
+ LPCWSTR lpTargetFileName, | |
+ DWORD dwFlags); | |
typedef BOOL (WINAPI* sCancelIoEx) | |
- (HANDLE hFile, | |
- LPOVERLAPPED lpOverlapped); | |
+(HANDLE hFile, | |
+ LPOVERLAPPED lpOverlapped); | |
typedef VOID (WINAPI* sInitializeSRWLock) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef VOID (WINAPI* sAcquireSRWLockShared) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef VOID (WINAPI* sAcquireSRWLockExclusive) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef BOOL (WINAPI* sTryAcquireSRWLockShared) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef BOOL (WINAPI* sTryAcquireSRWLockExclusive) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef VOID (WINAPI* sReleaseSRWLockShared) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef VOID (WINAPI* sReleaseSRWLockExclusive) | |
- (PSRWLOCK SRWLock); | |
+(PSRWLOCK SRWLock); | |
typedef VOID (WINAPI* sInitializeConditionVariable) | |
- (PCONDITION_VARIABLE ConditionVariable); | |
+(PCONDITION_VARIABLE ConditionVariable); | |
typedef BOOL (WINAPI* sSleepConditionVariableCS) | |
- (PCONDITION_VARIABLE ConditionVariable, | |
- PCRITICAL_SECTION CriticalSection, | |
- DWORD dwMilliseconds); | |
+(PCONDITION_VARIABLE ConditionVariable, | |
+ PCRITICAL_SECTION CriticalSection, | |
+ DWORD dwMilliseconds); | |
typedef BOOL (WINAPI* sSleepConditionVariableSRW) | |
- (PCONDITION_VARIABLE ConditionVariable, | |
- PSRWLOCK SRWLock, | |
- DWORD dwMilliseconds, | |
- ULONG Flags); | |
+(PCONDITION_VARIABLE ConditionVariable, | |
+ PSRWLOCK SRWLock, | |
+ DWORD dwMilliseconds, | |
+ ULONG Flags); | |
typedef VOID (WINAPI* sWakeAllConditionVariable) | |
- (PCONDITION_VARIABLE ConditionVariable); | |
+(PCONDITION_VARIABLE ConditionVariable); | |
typedef VOID (WINAPI* sWakeConditionVariable) | |
- (PCONDITION_VARIABLE ConditionVariable); | |
+(PCONDITION_VARIABLE ConditionVariable); | |
typedef BOOL (WINAPI* sCancelSynchronousIo) | |
- (HANDLE hThread); | |
+(HANDLE hThread); | |
/* Ntdll function pointers */ | |
extern sRtlNtStatusToDosError pRtlNtStatusToDosError; | |
diff --git a/src/win/winsock.c b/src/win/winsock.c | |
index d2e667e..f14fba8 100644 | |
--- a/src/win/winsock.c | |
+++ b/src/win/winsock.c | |
@@ -39,7 +39,7 @@ struct sockaddr_in6 uv_addr_ip6_any_; | |
* Retrieves the pointer to a winsock extension function. | |
*/ | |
static BOOL uv_get_extension_function(SOCKET socket, GUID guid, | |
- void **target) { | |
+ void **target) { | |
int result; | |
DWORD bytes; | |
@@ -284,8 +284,8 @@ int uv_ntstatus_to_winsock_error(NTSTATUS status) { | |
* stacked on top of it. | |
*/ | |
int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers, | |
- DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, | |
- LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine) { | |
+ DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped, | |
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine) { | |
NTSTATUS status; | |
void* apc_context; | |
IO_STATUS_BLOCK* iosb = (IO_STATUS_BLOCK*) &overlapped->Internal; | |
@@ -378,9 +378,9 @@ int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers, | |
/* See description of uv_wsarecv_workaround. */ | |
int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers, | |
- DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, | |
- int* addr_len, WSAOVERLAPPED *overlapped, | |
- LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine) { | |
+ DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr, | |
+ int* addr_len, WSAOVERLAPPED *overlapped, | |
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine) { | |
NTSTATUS status; | |
void* apc_context; | |
IO_STATUS_BLOCK* iosb = (IO_STATUS_BLOCK*) &overlapped->Internal; | |
@@ -475,7 +475,7 @@ int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers, | |
int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info_in, | |
- AFD_POLL_INFO* info_out, OVERLAPPED* overlapped) { | |
+ AFD_POLL_INFO* info_out, OVERLAPPED* overlapped) { | |
IO_STATUS_BLOCK iosb; | |
IO_STATUS_BLOCK* iosb_ptr; | |
HANDLE event = NULL; | |
diff --git a/src/win/winsock.h b/src/win/winsock.h | |
index 7c007ab..9b94e42 100644 | |
--- a/src/win/winsock.h | |
+++ b/src/win/winsock.h | |
@@ -59,19 +59,19 @@ | |
* We only need receive flags so far. | |
*/ | |
#ifndef TDI_RECEIVE_NORMAL | |
- #define TDI_RECEIVE_BROADCAST 0x00000004 | |
- #define TDI_RECEIVE_MULTICAST 0x00000008 | |
- #define TDI_RECEIVE_PARTIAL 0x00000010 | |
- #define TDI_RECEIVE_NORMAL 0x00000020 | |
- #define TDI_RECEIVE_EXPEDITED 0x00000040 | |
- #define TDI_RECEIVE_PEEK 0x00000080 | |
- #define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100 | |
- #define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200 | |
- #define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400 | |
- #define TDI_RECEIVE_AT_DISPATCH_LEVEL 0x00000800 | |
- #define TDI_RECEIVE_CONTROL_INFO 0x00001000 | |
- #define TDI_RECEIVE_FORCE_INDICATION 0x00002000 | |
- #define TDI_RECEIVE_NO_PUSH 0x00004000 | |
+#define TDI_RECEIVE_BROADCAST 0x00000004 | |
+#define TDI_RECEIVE_MULTICAST 0x00000008 | |
+#define TDI_RECEIVE_PARTIAL 0x00000010 | |
+#define TDI_RECEIVE_NORMAL 0x00000020 | |
+#define TDI_RECEIVE_EXPEDITED 0x00000040 | |
+#define TDI_RECEIVE_PEEK 0x00000080 | |
+#define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100 | |
+#define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200 | |
+#define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400 | |
+#define TDI_RECEIVE_AT_DISPATCH_LEVEL 0x00000800 | |
+#define TDI_RECEIVE_CONTROL_INFO 0x00001000 | |
+#define TDI_RECEIVE_FORCE_INDICATION 0x00002000 | |
+#define TDI_RECEIVE_NO_PUSH 0x00004000 | |
#endif | |
/* | |
@@ -112,19 +112,19 @@ | |
#define AFD_POLL_ALL ((1 << AFD_NUM_POLL_EVENTS) - 1) | |
typedef struct _AFD_RECV_DATAGRAM_INFO { | |
- LPWSABUF BufferArray; | |
- ULONG BufferCount; | |
- ULONG AfdFlags; | |
- ULONG TdiFlags; | |
- struct sockaddr* Address; | |
- int* AddressLength; | |
+ LPWSABUF BufferArray; | |
+ ULONG BufferCount; | |
+ ULONG AfdFlags; | |
+ ULONG TdiFlags; | |
+ struct sockaddr* Address; | |
+ int* AddressLength; | |
} AFD_RECV_DATAGRAM_INFO, *PAFD_RECV_DATAGRAM_INFO; | |
typedef struct _AFD_RECV_INFO { | |
- LPWSABUF BufferArray; | |
- ULONG BufferCount; | |
- ULONG AfdFlags; | |
- ULONG TdiFlags; | |
+ LPWSABUF BufferArray; | |
+ ULONG BufferCount; | |
+ ULONG AfdFlags; | |
+ ULONG TdiFlags; | |
} AFD_RECV_INFO, *PAFD_RECV_INFO; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment