1
0
mirror of synced 2025-04-19 00:24:02 +03:00

Fix remaining test warnings (#1001)

* Use portable way to encode ESC

'\e' is a GNU extension

* Use length specifier for size_t
This commit is contained in:
Gregor Jasny 2021-07-20 03:17:18 +02:00 committed by GitHub
parent e3750d9ddf
commit 9f2064a8ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3293,14 +3293,14 @@ TEST(ServerRequestParsingTest, TrimWhitespaceFromHeaderValues) {
// Only space and horizontal tab are whitespace. Make sure other whitespace-
// like characters are not treated the same - use vertical tab and escape.
const std::string req = "GET /validate-ws-in-headers HTTP/1.1\r\n"
"foo: \t \v bar \e\t \r\n"
"foo: \t \v bar \x1B\t \r\n"
"Connection: close\r\n"
"\r\n";
ASSERT_TRUE(send_request(5, req));
svr.stop();
t.join();
EXPECT_EQ(header_value, "\v bar \e");
EXPECT_EQ(header_value, "\v bar \x1B");
}
// Sends a raw request and verifies that there isn't a crash or exception.
@ -3452,7 +3452,7 @@ TEST(ServerStopTest, StopServerWithChunkedTransmission) {
res.set_chunked_content_provider("text/event-stream", [](size_t offset,
DataSink &sink) {
char buffer[27];
auto size = static_cast<size_t>(sprintf(buffer, "data:%ld\n\n", offset));
auto size = static_cast<size_t>(sprintf(buffer, "data:%zd\n\n", offset));
auto ret = sink.write(buffer, size);
EXPECT_TRUE(ret);
std::this_thread::sleep_for(std::chrono::seconds(1));