Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Oct 14, 2017
1 parent 56ee3d4 commit 5fa1938
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/memchunk.h
Expand Up @@ -31,8 +31,8 @@
#ifdef _WIN32
/* Structure for scatter/gather I/O. */
struct iovec {
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#else
#include <sys/uio.h>
Expand Down
21 changes: 10 additions & 11 deletions src/util.cc
Expand Up @@ -72,26 +72,24 @@ namespace util {

#ifdef _WIN32
// inet_pton-wrapper for Windows
static int inet_pton(int af, const char *src, void *dst)
{
static int inet_pton(int af, const char *src, void *dst) {
#if _WIN32_WINNT >= 0x0600
return InetPtonA(af, src, dst);
return InetPtonA(af, src, dst);
#else
// the function takes a 'char*', so we need to make a copy
char addr[INET6_ADDRSTRLEN + 1];
strncpy(addr, src, sizeof(addr));
addr[sizeof(addr)-1] = 0;
addr[sizeof(addr) - 1] = 0;

int size = sizeof(struct in6_addr);

if (WSAStringToAddress(addr, af, NULL, (LPSOCKADDR)dst, &size) == 0)
return 1;
return 1;
return 0;
#endif
}
#endif // _WIN32


const char UPPER_XDIGITS[] = "0123456789ABCDEF";

bool in_rfc3986_unreserved_chars(const char c) {
Expand Down Expand Up @@ -383,8 +381,9 @@ char *iso8601_date(char *res, int64_t ms) {
namespace bt = boost::posix_time;
// one-time definition of the locale that is used to parse UTC strings
// (note that the time_input_facet is ref-counted and deleted automatically)
static const std::locale ptime_locale(std::locale::classic(),
new bt::time_input_facet("%a, %d %b %Y %H:%M:%S GMT"));
static const std::locale
ptime_locale(std::locale::classic(),
new bt::time_input_facet("%a, %d %b %Y %H:%M:%S GMT"));
#endif //_WIN32

time_t parse_http_date(const StringRef &s) {
Expand All @@ -395,7 +394,7 @@ time_t parse_http_date(const StringRef &s) {
bt::ptime ltime;
sstr >> ltime;
if (!sstr)
return 0;
return 0;

return boost::posix_time::to_time_t(ltime);
#else
Expand Down Expand Up @@ -936,7 +935,7 @@ int create_nonblock_socket(int family) {
bool check_socket_connected(int fd) {
int error;
socklen_t len = sizeof(error);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) != 0) {
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&error, &len) != 0) {
return false;
}

Expand All @@ -946,7 +945,7 @@ bool check_socket_connected(int fd) {
int get_socket_error(int fd) {
int error;
socklen_t len = sizeof(error);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len) != 0) {
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&error, &len) != 0) {
return -1;
}

Expand Down

0 comments on commit 5fa1938

Please sign in to comment.