Skip to content

Commit 60e5ead

Browse files
committed
Trying l120 cols instead of 112 cols.
1 parent 6f715e7 commit 60e5ead

File tree

117 files changed

+1316
-1952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1316
-1952
lines changed

.clang-format

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
BasedOnStyle: Google
2-
ColumnLimit: 112 # Calibrated by Dima&Alex for GitHub-based code reviews in 2014.
2+
ColumnLimit: 120
33
BinPackParameters: false # Allow either all parameters on one line or one parameter per line, no packing.
44
BinPackArguments: false # The same for function calls.

Blocks/HTTP/favicon.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ inline std::string CurrentFaviconPng() {
4747
return png;
4848
}
4949

50-
inline Response CurrentFaviconResponse() {
51-
return Response(CurrentFaviconPng(), HTTPResponseCode.OK, "image/png");
52-
}
50+
inline Response CurrentFaviconResponse() { return Response(CurrentFaviconPng(), HTTPResponseCode.OK, "image/png"); }
5351

5452
inline std::function<void(Request)> CurrentFaviconHandler() {
5553
return [](Request r) { r(CurrentFaviconResponse()); };

Blocks/HTTP/impl/java_client.h

+16-24
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,17 @@ class HTTPClientPlatformWrapper {
116116
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
117117
}
118118

119-
const static jfieldID contentTypeField =
120-
env->GetFieldID(JAVA.httpParamsClass, "contentType", "Ljava/lang/String;");
119+
const static jfieldID contentTypeField = env->GetFieldID(JAVA.httpParamsClass, "contentType", "Ljava/lang/String;");
121120
if (!content_type_.empty()) {
122-
const auto jniContentType =
123-
MakePointerScopeGuard(env->NewStringUTF(content_type_.c_str()), deleteLocalRef);
121+
const auto jniContentType = MakePointerScopeGuard(env->NewStringUTF(content_type_.c_str()), deleteLocalRef);
124122
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
125123

126124
env->SetObjectField(httpParamsObject.get(), contentTypeField, jniContentType.get());
127125
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
128126
}
129127

130128
if (!user_agent_.empty()) {
131-
const static jfieldID userAgentField =
132-
env->GetFieldID(JAVA.httpParamsClass, "userAgent", "Ljava/lang/String;");
129+
const static jfieldID userAgentField = env->GetFieldID(JAVA.httpParamsClass, "userAgent", "Ljava/lang/String;");
133130

134131
const auto jniUserAgent = MakePointerScopeGuard(env->NewStringUTF(user_agent_.c_str()), deleteLocalRef);
135132
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
@@ -142,8 +139,7 @@ class HTTPClientPlatformWrapper {
142139
const static jfieldID inputFilePathField =
143140
env->GetFieldID(JAVA.httpParamsClass, "inputFilePath", "Ljava/lang/String;");
144141

145-
const auto jniInputFilePath =
146-
MakePointerScopeGuard(env->NewStringUTF(post_file_.c_str()), deleteLocalRef);
142+
const auto jniInputFilePath = MakePointerScopeGuard(env->NewStringUTF(post_file_.c_str()), deleteLocalRef);
147143
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
148144

149145
env->SetObjectField(httpParamsObject.get(), inputFilePathField, jniInputFilePath.get());
@@ -154,8 +150,7 @@ class HTTPClientPlatformWrapper {
154150
const static jfieldID outputFilePathField =
155151
env->GetFieldID(JAVA.httpParamsClass, "outputFilePath", "Ljava/lang/String;");
156152

157-
const auto jniOutputFilePath =
158-
MakePointerScopeGuard(env->NewStringUTF(received_file_.c_str()), deleteLocalRef);
153+
const auto jniOutputFilePath = MakePointerScopeGuard(env->NewStringUTF(received_file_.c_str()), deleteLocalRef);
159154
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
160155

161156
env->SetObjectField(httpParamsObject.get(), outputFilePathField, jniOutputFilePath.get());
@@ -165,40 +160,38 @@ class HTTPClientPlatformWrapper {
165160
// DO ALL MAGIC!
166161
// Current Java implementation simply reuses input params instance, so we don't need to
167162
// DeleteLocalRef(response).
168-
const jobject response = env->CallStaticObjectMethod(
169-
JAVA.httpTransportClass, JAVA.httpTransportClass_run, httpParamsObject.get());
163+
const jobject response =
164+
env->CallStaticObjectMethod(JAVA.httpTransportClass, JAVA.httpTransportClass_run, httpParamsObject.get());
170165
if (env->ExceptionCheck()) {
171166
env->ExceptionDescribe();
172167
// TODO(AlexZ): think about rethrowing corresponding C++ exceptions.
173168
env->ExceptionClear();
174169
return false;
175170
}
176171

177-
const static jfieldID httpResponseCodeField =
178-
env->GetFieldID(JAVA.httpParamsClass, "httpResponseCode", "I");
172+
const static jfieldID httpResponseCodeField = env->GetFieldID(JAVA.httpParamsClass, "httpResponseCode", "I");
179173
error_code_ = env->GetIntField(response, httpResponseCodeField);
180174
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
181175

182-
const static jfieldID receivedUrlField =
183-
env->GetFieldID(JAVA.httpParamsClass, "receivedUrl", "Ljava/lang/String;");
184-
const auto jniReceivedUrl = MakePointerScopeGuard(
185-
static_cast<jstring>(env->GetObjectField(response, receivedUrlField)), deleteLocalRef);
176+
const static jfieldID receivedUrlField = env->GetFieldID(JAVA.httpParamsClass, "receivedUrl", "Ljava/lang/String;");
177+
const auto jniReceivedUrl =
178+
MakePointerScopeGuard(static_cast<jstring>(env->GetObjectField(response, receivedUrlField)), deleteLocalRef);
186179
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
187180
if (jniReceivedUrl) {
188181
url_received_ = std::move(ToStdString(env, jniReceivedUrl.get()));
189182
}
190183

191184
// contentTypeField is already cached above.
192-
const auto jniContentType = MakePointerScopeGuard(
193-
static_cast<jstring>(env->GetObjectField(response, contentTypeField)), deleteLocalRef);
185+
const auto jniContentType =
186+
MakePointerScopeGuard(static_cast<jstring>(env->GetObjectField(response, contentTypeField)), deleteLocalRef);
194187
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
195188
if (jniContentType) {
196189
content_type_ = std::move(ToStdString(env, jniContentType.get()));
197190
}
198191

199192
// dataField is already cached above.
200-
const auto jniData = MakePointerScopeGuard(
201-
static_cast<jbyteArray>(env->GetObjectField(response, dataField)), deleteLocalRef);
193+
const auto jniData =
194+
MakePointerScopeGuard(static_cast<jbyteArray>(env->GetObjectField(response, dataField)), deleteLocalRef);
202195
CLEAR_AND_RETURN_FALSE_ON_EXCEPTION
203196
if (jniData) {
204197
jbyte* buffer = env->GetByteArrayElements(jniData.get(), nullptr);
@@ -252,8 +245,7 @@ struct ImplWrapper<java_wrapper::HTTPClientPlatformWrapper> {
252245
client.post_body_ = request.body;
253246
client.content_type_ = request.content_type;
254247
}
255-
inline static void PrepareInput(const POSTFromFile& request,
256-
java_wrapper::HTTPClientPlatformWrapper& client) {
248+
inline static void PrepareInput(const POSTFromFile& request, java_wrapper::HTTPClientPlatformWrapper& client) {
257249
client.url_requested_ = request.url;
258250
if (!request.custom_user_agent.empty()) {
259251
client.user_agent_ = request.custom_user_agent;

Blocks/HTTP/impl/posix_client.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ class GenericHTTPClientPOSIX final {
101101
connection.BlockingWrite("Content-Type: " + request_body_content_type_ + "\r\n", true);
102102
}
103103
if (!request_body_contents_.empty()) {
104-
connection.BlockingWrite("Content-Length: " + std::to_string(request_body_contents_.length()) + "\r\n",
105-
true);
104+
connection.BlockingWrite("Content-Length: " + std::to_string(request_body_contents_.length()) + "\r\n", true);
106105
connection.BlockingWrite("\r\n", true);
107106
connection.BlockingWrite(request_body_contents_, false);
108107
} else {

Blocks/HTTP/impl/posix_server.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ class HTTPServerPOSIX final {
153153
const URLPathArgs::CountMask path_args_count_mask,
154154
F& handler) {
155155
std::lock_guard<std::mutex> lock(mutex_);
156-
return DoRegisterHandler(
157-
path, [&handler](Request r) { handler(std::move(r)); }, path_args_count_mask, POLICY);
156+
return DoRegisterHandler(path, [&handler](Request r) { handler(std::move(r)); }, path_args_count_mask, POLICY);
158157
}
159158

160159
template <ReRegisterRoute POLICY = ReRegisterRoute::ThrowOnAttempt>
@@ -391,8 +390,7 @@ class HTTPServerPOSIX final {
391390
if (policy == ReRegisterRoute::SilentlyUpdateExisting) {
392391
return HTTPRoutesScopeEntry();
393392
} else {
394-
return HTTPRoutesScopeEntry(
395-
[this, path, path_args_count_mask]() { UnRegister(path, path_args_count_mask); });
393+
return HTTPRoutesScopeEntry([this, path, path_args_count_mask]() { UnRegister(path, path_args_count_mask); });
396394
}
397395
}
398396

Blocks/HTTP/request.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ struct Request final {
9696

9797
// Support objects with user-defined HTTP response handlers.
9898
template <typename T>
99-
inline typename std::enable_if<HasRespondViaHTTP<current::decay<T>>(0)>::type operator()(
100-
T&& that_dude_over_there) {
99+
inline typename std::enable_if<HasRespondViaHTTP<current::decay<T>>(0)>::type operator()(T&& that_dude_over_there) {
101100
that_dude_over_there.RespondViaHTTP(std::move(*this));
102101
}
103102

Blocks/HTTP/response.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ struct Response {
7575
std::string content_type;
7676
current::net::http::Headers headers;
7777

78-
Response()
79-
: body(""), code(HTTPResponseCode.OK), content_type(current::net::constants::kDefaultContentType) {}
78+
Response() : body(""), code(HTTPResponseCode.OK), content_type(current::net::constants::kDefaultContentType) {}
8079

8180
Response(const Response&) = default;
8281
Response(Response&&) = default;
@@ -134,9 +133,7 @@ struct Response {
134133
}
135134

136135
template <typename T>
137-
void Construct(T&& object,
138-
current::net::HTTPResponseCodeValue code,
139-
const current::net::http::Headers& headers) {
136+
void Construct(T&& object, current::net::HTTPResponseCodeValue code, const current::net::http::Headers& headers) {
140137
using G = impl::StringBodyGenerator<current::strings::is_string_type<T>::value>;
141138
this->body = G::AsString(std::forward<T>(object));
142139
this->code = code;

0 commit comments

Comments
 (0)