1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-07 06:59:03 +00:00

Whitespace.

indent -kr -i4 -nut -l0 -ss -T size_t *.c
with manual adjustments.
This commit is contained in:
david
2012-06-19 00:21:27 +00:00
parent 7e47c6507d
commit 607b209fd4
12 changed files with 143 additions and 156 deletions

View File

@@ -118,22 +118,22 @@
/* safely add 2 size_t */
size_t sadd(size_t l, size_t r)
{
size_t t;
size_t t;
t = l + r;
if (t < l)
bye("integer overflow %lu + %lu.", (u_long)l, (u_long)r);
bye("integer overflow %lu + %lu.", (u_long) l, (u_long) r);
return t;
}
/* safely multiply 2 size_t */
size_t smul(size_t l, size_t r)
{
size_t t;
size_t t;
t = l * r;
if (l && t / l != r)
bye("integer overflow %lu * %lu.", (u_long)l, (u_long)r);
bye("integer overflow %lu * %lu.", (u_long) l, (u_long) r);
return t;
}
@@ -143,8 +143,8 @@ void windows_init()
WORD werd;
WSADATA data;
werd = MAKEWORD( 2, 2 );
if ( (WSAStartup(werd, &data)) !=0 )
werd = MAKEWORD(2, 2);
if ((WSAStartup(werd, &data)) != 0)
bye("Failed to start WinSock.");
}
#endif
@@ -217,7 +217,7 @@ int strbuf_append(char **buf, size_t *size, size_t *offset, const char *s, size_
if (n >= *size - *offset) {
*size += n + 1;
*buf = (char*) safe_realloc(*buf, *size);
*buf = (char *) safe_realloc(*buf, *size);
}
memcpy(*buf + *offset, s, n);
@@ -244,7 +244,7 @@ int strbuf_sprintf(char **buf, size_t *size, size_t *offset, const char *fmt, ..
if (*buf == NULL) {
*size = 1;
*buf = (char*) safe_malloc(*size);
*buf = (char *) safe_malloc(*size);
}
for (;;) {
@@ -257,7 +257,7 @@ int strbuf_sprintf(char **buf, size_t *size, size_t *offset, const char *fmt, ..
*size += n + 1;
else
break;
*buf = (char*) safe_realloc(*buf, *size);
*buf = (char *) safe_realloc(*buf, *size);
}
*offset += n;
@@ -334,7 +334,8 @@ int addr_is_local(const union sockaddr_u *su)
IPv6 IP address string. Since a static buffer is returned, this is
not thread-safe and can only be used once in calls like printf()
*/
const char *inet_socktop(const union sockaddr_u *su) {
const char *inet_socktop(const union sockaddr_u *su)
{
static char buf[INET6_ADDRSTRLEN + 1];
void *addr;
@@ -449,12 +450,12 @@ int do_connect(int type)
}
if (sock != -1) {
if (connect(sock, &targetss.sockaddr, (int) targetsslen)!= -1)
return sock;
else if (socket_errno()==EINPROGRESS||socket_errno()==EAGAIN)
return sock;
if (connect(sock, &targetss.sockaddr, (int) targetsslen) != -1)
return sock;
else if (socket_errno() == EINPROGRESS || socket_errno() == EAGAIN)
return sock;
}
return -1 ;
return -1;
}
unsigned char *buildsrcrte(struct in_addr dstaddr, struct in_addr routes[],
@@ -574,7 +575,7 @@ int rm_fd(fd_list_t *fdl, int fd)
/* find the max descriptor in our list */
int get_maxfd(fd_list_t *fdl)
{
int x = 0, max = -1, nfds = fdl->nfds;
int x = 0, max = -1, nfds = fdl->nfds;
for (x = 0; x < nfds; x++)
if (fdl->fds[x].fd > max)
@@ -627,7 +628,7 @@ void free_fdlist(fd_list_t *fdl)
int fix_line_endings(char *src, int *len, char **dst, int *state)
{
int fix_count;
int i,j;
int i, j;
int num_bytes = *len;
int prev_state = *state;
@@ -638,17 +639,18 @@ int fix_line_endings(char *src, int *len, char **dst, int *state)
/* get count of \n without matching \r */
fix_count = 0;
for (i = 0; i < num_bytes; i++) {
if (src[i] == '\n' && ((i == 0) ? !prev_state : src[i-1] != '\r'))
if (src[i] == '\n' && ((i == 0) ? !prev_state : src[i - 1] != '\r'))
fix_count++;
}
if (fix_count <= 0 ) return 0;
if (fix_count <= 0)
return 0;
/* now insert matching \r */
*dst = (char *) safe_malloc(num_bytes + fix_count);
j = 0;
for (i = 0; i < num_bytes; i++) {
if (src[i] == '\n' && ((i == 0) ? !prev_state : src[i-1] != '\r')) {
if (src[i] == '\n' && ((i == 0) ? !prev_state : src[i - 1] != '\r')) {
memcpy(*dst + j, "\r\n", 2);
j += 2;
} else {