Reformat the WebRTC code base
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
diff --git a/examples/peerconnection/server/data_socket.cc b/examples/peerconnection/server/data_socket.cc
index 7a92431..4369117 100644
--- a/examples/peerconnection/server/data_socket.cc
+++ b/examples/peerconnection/server/data_socket.cc
@@ -29,7 +29,7 @@
"Access-Control-Allow-Credentials: true\r\n"
"Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n"
"Access-Control-Allow-Headers: Content-Type, "
- "Content-Length, Connection, Cache-Control\r\n"
+ "Content-Length, Connection, Cache-Control\r\n"
"Access-Control-Expose-Headers: Content-Length, X-Peer-Id\r\n";
#if defined(WIN32)
@@ -116,10 +116,11 @@
bool DataSocket::Send(const std::string& data) const {
return send(socket_, data.data(), static_cast<int>(data.length()), 0) !=
- SOCKET_ERROR;
+ SOCKET_ERROR;
}
-bool DataSocket::Send(const std::string& status, bool connection_close,
+bool DataSocket::Send(const std::string& status,
+ bool connection_close,
const std::string& content_type,
const std::string& extra_headers,
const std::string& data) const {
@@ -127,8 +128,9 @@
assert(!status.empty());
std::string buffer("HTTP/1.1 " + status + "\r\n");
- buffer += "Server: PeerConnectionTestServer/0.1\r\n"
- "Cache-Control: no-cache\r\n";
+ buffer +=
+ "Server: PeerConnectionTestServer/0.1\r\n"
+ "Cache-Control: no-cache\r\n";
if (connection_close)
buffer += "Connection: close\r\n";
@@ -136,8 +138,8 @@
if (!content_type.empty())
buffer += "Content-Type: " + content_type + "\r\n";
- buffer += "Content-Length: " + int2str(static_cast<int>(data.size())) +
- "\r\n";
+ buffer +=
+ "Content-Length: " + int2str(static_cast<int>(data.size())) + "\r\n";
if (!extra_headers.empty()) {
buffer += extra_headers;
@@ -190,9 +192,7 @@
size_t method_name_len;
RequestMethod id;
} supported_methods[] = {
- { "GET", 3, GET },
- { "POST", 4, POST },
- { "OPTIONS", 7, OPTIONS },
+ {"GET", 3, GET}, {"POST", 4, POST}, {"OPTIONS", 7, OPTIONS},
};
const char* path = NULL;
@@ -231,15 +231,15 @@
static const char kContentLength[] = "Content-Length:";
static const char kContentType[] = "Content-Type:";
if ((headers + ARRAYSIZE(kContentLength)) < end &&
- strncmp(headers, kContentLength,
- ARRAYSIZE(kContentLength) - 1) == 0) {
+ strncmp(headers, kContentLength, ARRAYSIZE(kContentLength) - 1) ==
+ 0) {
headers += ARRAYSIZE(kContentLength) - 1;
while (headers[0] == ' ')
++headers;
content_length_ = atoi(headers);
} else if ((headers + ARRAYSIZE(kContentType)) < end &&
- strncmp(headers, kContentType,
- ARRAYSIZE(kContentType) - 1) == 0) {
+ strncmp(headers, kContentType, ARRAYSIZE(kContentType) - 1) ==
+ 0) {
headers += ARRAYSIZE(kContentType) - 1;
while (headers[0] == ' ')
++headers;
@@ -267,13 +267,13 @@
assert(valid());
int enabled = 1;
setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR,
- reinterpret_cast<const char*>(&enabled), sizeof(enabled));
+ reinterpret_cast<const char*>(&enabled), sizeof(enabled));
struct sockaddr_in addr = {0};
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_ANY);
addr.sin_port = htons(port);
- if (bind(socket_, reinterpret_cast<const sockaddr*>(&addr),
- sizeof(addr)) == SOCKET_ERROR) {
+ if (bind(socket_, reinterpret_cast<const sockaddr*>(&addr), sizeof(addr)) ==
+ SOCKET_ERROR) {
printf("bind failed\n");
return false;
}