Fixed compiler warings (with -Wall and -Wextra)
This commit is contained in:
parent
28ba178fee
commit
e90244e992
@ -254,7 +254,7 @@ void split(const char* b, const char* e, char d, Fn fn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool socket_gets(Stream& strm, char* buf, int bufsiz)
|
inline bool socket_gets(Stream& strm, char* buf, size_t bufsiz)
|
||||||
{
|
{
|
||||||
// TODO: buffering for better performance
|
// TODO: buffering for better performance
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@ -299,7 +299,7 @@ inline void socket_printf(Stream& strm, const char* fmt, const Args& ...args)
|
|||||||
if (n >= BUFSIZ) {
|
if (n >= BUFSIZ) {
|
||||||
std::vector<char> glowable_buf(BUFSIZ);
|
std::vector<char> glowable_buf(BUFSIZ);
|
||||||
|
|
||||||
while (n >= glowable_buf.size()) {
|
while (n >= static_cast<int>(glowable_buf.size())) {
|
||||||
glowable_buf.resize(glowable_buf.size() * 2);
|
glowable_buf.resize(glowable_buf.size() * 2);
|
||||||
n = snprintf(&glowable_buf[0], glowable_buf.size(), fmt, args...);
|
n = snprintf(&glowable_buf[0], glowable_buf.size(), fmt, args...);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
CC = clang++
|
CC = clang++
|
||||||
CFLAGS = -std=c++14 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I.
|
CFLAGS = -std=c++14 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra
|
||||||
#OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto
|
#OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto
|
||||||
|
|
||||||
all : test
|
all : test
|
||||||
|
10
test/test.cc
10
test/test.cc
@ -121,10 +121,10 @@ protected:
|
|||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
svr_.set_base_dir("./www");
|
svr_.set_base_dir("./www");
|
||||||
|
|
||||||
svr_.get("/hi", [&](const Request& req, Response& res) {
|
svr_.get("/hi", [&](const Request& /*req*/, Response& res) {
|
||||||
res.set_content("Hello World!", "text/plain");
|
res.set_content("Hello World!", "text/plain");
|
||||||
})
|
})
|
||||||
.get("/", [&](const Request& req, Response& res) {
|
.get("/", [&](const Request& /*req*/, Response& res) {
|
||||||
res.set_redirect("/hi");
|
res.set_redirect("/hi");
|
||||||
})
|
})
|
||||||
.post("/person", [&](const Request& req, Response& res) {
|
.post("/person", [&](const Request& req, Response& res) {
|
||||||
@ -143,7 +143,7 @@ protected:
|
|||||||
res.status = 404;
|
res.status = 404;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.get("/stop", [&](const Request& req, Response& res) {
|
.get("/stop", [&](const Request& /*req*/, Response& /*res*/) {
|
||||||
svr_.stop();
|
svr_.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -410,11 +410,11 @@ protected:
|
|||||||
, up_(false) {}
|
, up_(false) {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
svr_.get("/hi", [&](const Request& req, Response& res) {
|
svr_.get("/hi", [&](const Request& /*req*/, Response& res) {
|
||||||
res.set_content("Hello World!", "text/plain");
|
res.set_content("Hello World!", "text/plain");
|
||||||
});
|
});
|
||||||
|
|
||||||
svr_.get("/stop", [&](const Request& req, Response& res) {
|
svr_.get("/stop", [&](const Request& /*req*/, Response& /*res*/) {
|
||||||
svr_.stop();
|
svr_.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user