mirror of
https://github.com/drogonframework/drogon.git
synced 2025-09-16 00:00:48 -04:00
Fix some compilation warnings (#257)
This commit is contained in:
parent
795079531a
commit
eed9c06250
@ -4,6 +4,12 @@ project(drogon CXX)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
|
||||
#if(MSVC)
|
||||
# target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
|
||||
#else()
|
||||
# target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic)
|
||||
#endif()
|
||||
|
||||
set(DROGON_MAJOR_VERSION 1)
|
||||
set(DROGON_MINOR_VERSION 0)
|
||||
set(DROGON_PATCH_VERSION 0)
|
||||
|
@ -223,7 +223,7 @@ class HttpBinder : public HttpBinderBase
|
||||
}
|
||||
template <typename... Values, std::size_t Boundary = argument_count>
|
||||
typename std::enable_if<(sizeof...(Values) == Boundary), void>::type run(
|
||||
std::list<std::string> &pathArguments,
|
||||
std::list<std::string> &,
|
||||
const HttpRequestPtr &req,
|
||||
std::function<void(const HttpResponsePtr &)> &&callback,
|
||||
Values &&... values)
|
||||
|
@ -56,7 +56,7 @@ class Session
|
||||
}
|
||||
}
|
||||
return nullVal;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the 'any' object identified by the given key
|
||||
@ -65,7 +65,7 @@ class Session
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(_mutex);
|
||||
return _sessionMap[key];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Insert a key-value pair
|
||||
@ -78,7 +78,7 @@ class Session
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(_mutex);
|
||||
_sessionMap[key] = obj;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Insert a key-value pair
|
||||
|
@ -112,11 +112,11 @@ struct IsPlugin
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type
|
||||
TYPE;
|
||||
|
||||
static int test(void *p)
|
||||
static int test(void *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static char test(PluginBase *p)
|
||||
static char test(PluginBase *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -415,6 +415,9 @@ void HttpAppFrameworkImpl::run()
|
||||
{
|
||||
_pluginsManagerPtr->initializeAllPlugins(pluginConfig,
|
||||
[](PluginBase *plugin) {
|
||||
LOG_TRACE
|
||||
<< "new plugin:"
|
||||
<< plugin->className();
|
||||
// TODO: new plugin
|
||||
});
|
||||
}
|
||||
|
@ -270,7 +270,6 @@ void HttpClientImpl::sendRequestInLoop(const drogon::HttpRequestPtr &req,
|
||||
thisPtr->_loop->runInLoop([thisPtr,
|
||||
addr,
|
||||
hasIpv6Address]() {
|
||||
struct sockaddr_in ad;
|
||||
auto port = thisPtr->_server.portNetEndian();
|
||||
thisPtr->_server = addr;
|
||||
thisPtr->_server.setPortNetEndian(port);
|
||||
|
@ -95,14 +95,14 @@ static void defaultHttpAsyncCallback(
|
||||
static void defaultWebSockAsyncCallback(
|
||||
const HttpRequestPtr &,
|
||||
std::function<void(const HttpResponsePtr &resp)> &&callback,
|
||||
const WebSocketConnectionImplPtr &wsConnPtr)
|
||||
const WebSocketConnectionImplPtr &)
|
||||
{
|
||||
auto resp = HttpResponse::newNotFoundResponse();
|
||||
resp->setCloseConnection(true);
|
||||
callback(resp);
|
||||
}
|
||||
|
||||
static void defaultConnectionCallback(const trantor::TcpConnectionPtr &conn)
|
||||
static void defaultConnectionCallback(const trantor::TcpConnectionPtr &)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -188,7 +188,6 @@ void HttpSimpleControllersRouter::route(
|
||||
|
||||
void HttpSimpleControllersRouter::doControllerHandler(
|
||||
const CtrlBinderPtr &ctrlBinderPtr,
|
||||
const SimpleControllerRouterItem &routerItem,
|
||||
const HttpRequestImplPtr &req,
|
||||
std::function<void(const HttpResponsePtr &)> &&callback)
|
||||
{
|
||||
@ -348,10 +347,7 @@ void HttpSimpleControllersRouter::doPreHandlingAdvices(
|
||||
}
|
||||
if (_preHandlingAdvices.empty())
|
||||
{
|
||||
doControllerHandler(ctrlBinderPtr,
|
||||
routerItem,
|
||||
req,
|
||||
std::move(callback));
|
||||
doControllerHandler(ctrlBinderPtr, req, std::move(callback));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -368,9 +364,8 @@ void HttpSimpleControllersRouter::doPreHandlingAdvices(
|
||||
resp,
|
||||
*callbackPtr);
|
||||
}),
|
||||
[this, ctrlBinderPtr, &routerItem, req, callbackPtr]() {
|
||||
[this, ctrlBinderPtr, req, callbackPtr]() {
|
||||
doControllerHandler(ctrlBinderPtr,
|
||||
routerItem,
|
||||
req,
|
||||
std::move(*callbackPtr));
|
||||
});
|
||||
|
@ -116,7 +116,6 @@ class HttpSimpleControllersRouter : public trantor::NonCopyable
|
||||
std::function<void(const HttpResponsePtr &)> &&callback);
|
||||
void doControllerHandler(
|
||||
const CtrlBinderPtr &ctrlBinderPtr,
|
||||
const SimpleControllerRouterItem &routerItem,
|
||||
const HttpRequestImplPtr &req,
|
||||
std::function<void(const HttpResponsePtr &)> &&callback);
|
||||
void invokeCallback(
|
||||
|
@ -66,7 +66,7 @@ void PluginsManager::initializeAllPlugins(
|
||||
}
|
||||
}
|
||||
pluginPtr->setInitializedCallback([this](PluginBase *p) {
|
||||
LOG_DEBUG << "Plugin " << p->className() << " initialized!";
|
||||
LOG_TRACE << "Plugin " << p->className() << " initialized!";
|
||||
_initializedPlugins.push_back(p);
|
||||
});
|
||||
plugins.push_back(pluginPtr);
|
||||
@ -75,6 +75,7 @@ void PluginsManager::initializeAllPlugins(
|
||||
for (auto plugin : plugins)
|
||||
{
|
||||
plugin->initialize();
|
||||
forEachCallback(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,6 @@ void WebSocketClientImpl::connectToServerInLoop()
|
||||
[thisPtr = shared_from_this(),
|
||||
hasIpv6Address](const trantor::InetAddress &addr) {
|
||||
thisPtr->_loop->runInLoop([thisPtr, addr, hasIpv6Address]() {
|
||||
struct sockaddr_in ad;
|
||||
auto port = thisPtr->_server.portNetEndian();
|
||||
thisPtr->_server = addr;
|
||||
thisPtr->_server.setPortNetEndian(port);
|
||||
@ -241,7 +240,7 @@ void WebSocketClientImpl::onRecvMessage(
|
||||
auto thisPtr = shared_from_this();
|
||||
_websockConnPtr->setMessageCallback(
|
||||
[thisPtr](std::string &&message,
|
||||
const WebSocketConnectionImplPtr &connPtr,
|
||||
const WebSocketConnectionImplPtr &,
|
||||
const WebSocketMessageType &type) {
|
||||
thisPtr->_messageCallback(std::move(message), thisPtr, type);
|
||||
});
|
||||
|
@ -77,10 +77,10 @@ class WebSocketClientImpl
|
||||
std::string _wsAccept;
|
||||
|
||||
HttpRequestPtr _upgradeRequest;
|
||||
std::function<void(std::string &&message,
|
||||
std::function<void(std::string &&,
|
||||
const WebSocketClientPtr &,
|
||||
const WebSocketMessageType &)>
|
||||
_messageCallback = [](std::string &&message,
|
||||
_messageCallback = [](std::string &&,
|
||||
const WebSocketClientPtr &,
|
||||
const WebSocketMessageType &) {};
|
||||
std::function<void(const WebSocketClientPtr &)> _connectionClosedCallback =
|
||||
|
@ -203,7 +203,7 @@ class CallbackHolder : public CallbackHolderBase
|
||||
}
|
||||
template <typename... Values, std::size_t Boundary = argumentCount>
|
||||
typename std::enable_if<(sizeof...(Values) == Boundary), void>::type run(
|
||||
const Row *const row,
|
||||
const Row *const,
|
||||
bool isNull,
|
||||
Values &&... values)
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ void DbClientLockFree::execSql(
|
||||
}
|
||||
|
||||
std::shared_ptr<Transaction> DbClientLockFree::newTransaction(
|
||||
const std::function<void(bool)> &commitCallback)
|
||||
const std::function<void(bool)> &)
|
||||
{
|
||||
// Don't support transaction;
|
||||
assert(0);
|
||||
|
@ -69,7 +69,9 @@ class DbClientLockFree : public DbClient,
|
||||
std::function<void(const std::shared_ptr<Transaction> &)> &&callback);
|
||||
|
||||
void handleNewTask(const DbConnectionPtr &conn);
|
||||
#if LIBPQ_SUPPORTS_BATCH_MODE
|
||||
size_t _connectionPos = 0; // Used for pg batch mode.
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace orm
|
||||
|
@ -45,6 +45,7 @@ class ResultImpl : public trantor::NonCopyable, public Result
|
||||
}
|
||||
virtual int oid(row_size_type column) const
|
||||
{
|
||||
(void)column;
|
||||
return 0;
|
||||
}
|
||||
virtual ~ResultImpl()
|
||||
|
@ -243,6 +243,7 @@ SqlBinder &SqlBinder::operator<<(double f)
|
||||
}
|
||||
SqlBinder &SqlBinder::operator<<(std::nullptr_t nullp)
|
||||
{
|
||||
(void)nullp;
|
||||
_paraNum++;
|
||||
_parameters.push_back(NULL);
|
||||
_length.push_back(0);
|
||||
@ -288,4 +289,4 @@ int SqlBinder::getMysqlTypeBySize(size_t size)
|
||||
exit(1);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ TransactionImpl::~TransactionImpl()
|
||||
std::vector<const char *>(),
|
||||
std::vector<int>(),
|
||||
std::vector<int>(),
|
||||
[commitCb](const Result &r) {
|
||||
[commitCb](const Result &) {
|
||||
LOG_TRACE << "Transaction commited!";
|
||||
if (commitCb)
|
||||
{
|
||||
@ -153,11 +153,11 @@ void TransactionImpl::rollback()
|
||||
SqlCmd cmd;
|
||||
cmd._sql = "rollback";
|
||||
cmd._paraNum = 0;
|
||||
cmd._cb = [thisPtr](const Result &r) {
|
||||
cmd._cb = [thisPtr](const Result &) {
|
||||
LOG_DEBUG << "Transaction roll back!";
|
||||
thisPtr->_isCommitedOrRolledback = true;
|
||||
};
|
||||
cmd._exceptCb = [thisPtr](const std::exception_ptr &ePtr) {
|
||||
cmd._exceptCb = [thisPtr](const std::exception_ptr &) {
|
||||
// clearupCb();
|
||||
thisPtr->_isCommitedOrRolledback = true;
|
||||
LOG_ERROR << "Transaction rool back error";
|
||||
@ -176,12 +176,12 @@ void TransactionImpl::rollback()
|
||||
std::vector<const char *>(),
|
||||
std::vector<int>(),
|
||||
std::vector<int>(),
|
||||
[thisPtr](const Result &r) {
|
||||
[thisPtr](const Result &) {
|
||||
LOG_TRACE << "Transaction roll back!";
|
||||
thisPtr->_isCommitedOrRolledback = true;
|
||||
// clearupCb();
|
||||
},
|
||||
[thisPtr](const std::exception_ptr &ePtr) {
|
||||
[thisPtr](const std::exception_ptr &) {
|
||||
// clearupCb();
|
||||
LOG_ERROR << "Transaction rool back error";
|
||||
thisPtr->_isCommitedOrRolledback = true;
|
||||
@ -279,8 +279,9 @@ void TransactionImpl::doBegin()
|
||||
std::vector<const char *>(),
|
||||
std::vector<int>(),
|
||||
std::vector<int>(),
|
||||
[](const Result &r) { LOG_TRACE << "Transaction begin!"; },
|
||||
[thisPtr](const std::exception_ptr &ePtr) {
|
||||
[](const Result &) { LOG_TRACE << "Transaction begin!"; },
|
||||
[thisPtr](const std::exception_ptr &) {
|
||||
LOG_ERROR << "Error occurred in transaction begin";
|
||||
thisPtr->_isCommitedOrRolledback = true;
|
||||
});
|
||||
});
|
||||
|
@ -80,8 +80,7 @@ class MysqlConnection : public DbConnection,
|
||||
});
|
||||
}
|
||||
}
|
||||
virtual void batchSql(
|
||||
std::deque<std::shared_ptr<SqlCmd>> &&sqlCommands) override
|
||||
virtual void batchSql(std::deque<std::shared_ptr<SqlCmd>> &&) override
|
||||
{
|
||||
LOG_FATAL << "The mysql library does not support batch mode";
|
||||
exit(1);
|
||||
|
@ -381,7 +381,7 @@ void PgConnection::handleFatalError()
|
||||
}
|
||||
}
|
||||
|
||||
void PgConnection::batchSql(std::deque<std::shared_ptr<SqlCmd>> &&sqlCommands)
|
||||
void PgConnection::batchSql(std::deque<std::shared_ptr<SqlCmd>> &&)
|
||||
{
|
||||
assert(false);
|
||||
}
|
@ -50,8 +50,7 @@ class Sqlite3Connection : public DbConnection,
|
||||
ResultCallback &&rcb,
|
||||
std::function<void(const std::exception_ptr &)>
|
||||
&&exceptCallback) override;
|
||||
virtual void batchSql(
|
||||
std::deque<std::shared_ptr<SqlCmd>> &&sqlCommands) override
|
||||
virtual void batchSql(std::deque<std::shared_ptr<SqlCmd>> &&) override
|
||||
{
|
||||
LOG_FATAL << "The mysql library does not support batch mode";
|
||||
exit(1);
|
||||
|
2
trantor
2
trantor
@ -1 +1 @@
|
||||
Subproject commit e4e5a4a0016ccc56abd832c6f03afac438eeed2c
|
||||
Subproject commit 1f4b6398e8c575341d4fbf6927d0b050d99fb05a
|
Loading…
x
Reference in New Issue
Block a user