From ef389b6ec90e8ae8812933caec8ad5021c9d886f Mon Sep 17 00:00:00 2001 From: an-tao Date: Mon, 21 Jan 2019 22:25:20 +0800 Subject: [PATCH] Organize code style --- drogon_ctl/create_model.cc | 3 +-- lib/inc/drogon/HttpSimpleController.h | 18 ++++++++---------- lib/inc/drogon/WebSocketController.h | 16 ++++++++-------- lib/src/HttpAppFrameworkImpl.cc | 2 +- lib/src/HttpControllersRouter.cc | 2 +- lib/src/HttpResponseImpl.h | 1 - lib/src/SharedLibManager.cc | 2 +- orm_lib/inc/drogon/orm/Mapper.h | 1 - orm_lib/src/mysql_impl/MysqlConnection.cc | 6 +----- orm_lib/src/postgresql_impl/PgConnection.cc | 2 +- trantor | 2 +- 11 files changed, 23 insertions(+), 32 deletions(-) diff --git a/drogon_ctl/create_model.cc b/drogon_ctl/create_model.cc index fc34ea19..d16432eb 100644 --- a/drogon_ctl/create_model.cc +++ b/drogon_ctl/create_model.cc @@ -108,7 +108,7 @@ void create_model::createModelClassFromPG(const std::string &path, const DbClien info._colType = "int32_t"; info._colLength = 4; } - else if (type == "bigint" || type == "numeric") //FIXME:Use int64 to represent numeric type? + else if (type == "bigint" || type == "numeric") ///TODO:Use int64 to represent numeric type? { info._colType = "int64_t"; info._colLength = 8; @@ -149,7 +149,6 @@ void create_model::createModelClassFromPG(const std::string &path, const DbClien else { info._colType = "std::string"; - //FIXME add more type such as hstore... } auto defaultVal = row["column_default"].as(); diff --git a/lib/inc/drogon/HttpSimpleController.h b/lib/inc/drogon/HttpSimpleController.h index 3605241e..0df3cf9b 100755 --- a/lib/inc/drogon/HttpSimpleController.h +++ b/lib/inc/drogon/HttpSimpleController.h @@ -59,16 +59,14 @@ class HttpSimpleController : public DrObject, public HttpSimpleControllerBase { T::___paths___(); } - - protected: - ///FIXME!!! - void _register(const std::string &className, const std::vector &paths) - { - for (auto const &reqPath : paths) - { - std::cout << "register controller class " << className << " on path " << reqPath << std::endl; - } - } + // protected: + // void _register(const std::string &className, const std::vector &paths) + // { + // for (auto const &reqPath : paths) + // { + // std::cout << "register controller class " << className << " on path " << reqPath << std::endl; + // } + // } }; friend pathRegister; static pathRegister _register; diff --git a/lib/inc/drogon/WebSocketController.h b/lib/inc/drogon/WebSocketController.h index 3693c32d..2ee0f856 100644 --- a/lib/inc/drogon/WebSocketController.h +++ b/lib/inc/drogon/WebSocketController.h @@ -77,14 +77,14 @@ class WebSocketController : public DrObject, public WebSocketControllerBase } } - protected: - void _register(const std::string &className, const std::vector &paths) - { - for (auto const &reqPath : paths) - { - std::cout << "register controller class " << className << " on path " << reqPath << std::endl; - } - } + // protected: + // void _register(const std::string &className, const std::vector &paths) + // { + // for (auto const &reqPath : paths) + // { + // std::cout << "register controller class " << className << " on path " << reqPath << std::endl; + // } + // } }; friend pathRegister; static pathRegister _register; diff --git a/lib/src/HttpAppFrameworkImpl.cc b/lib/src/HttpAppFrameworkImpl.cc index 59b2e0c6..9ac5aeea 100755 --- a/lib/src/HttpAppFrameworkImpl.cc +++ b/lib/src/HttpAppFrameworkImpl.cc @@ -810,7 +810,7 @@ void HttpAppFrameworkImpl::readSendFile(const std::string &filePath, const HttpR if (_useSendfile && filesize > 1024 * 200) - //FIXME : Is 200k an appropriate value? Or set it to be configurable + //TODO : Is 200k an appropriate value? Or set it to be configurable { //The advantages of sendfile() can only be reflected in sending large files. std::dynamic_pointer_cast(resp)->setSendfile(filePath); diff --git a/lib/src/HttpControllersRouter.cc b/lib/src/HttpControllersRouter.cc index f957c0b1..9b4e3db9 100644 --- a/lib/src/HttpControllersRouter.cc +++ b/lib/src/HttpControllersRouter.cc @@ -150,7 +150,7 @@ void HttpControllersRouter::route(const HttpRequestImplPtr &req, { for (size_t i = 1; i < result.size(); i++) { - //FIXME:Is there any better way to find the sub-match index without using loop? + //TODO: Is there any better way to find the sub-match index without using loop? if (!result[i].matched) continue; if (result[i].str() == req->path() && i <= _ctrlVector.size()) diff --git a/lib/src/HttpResponseImpl.h b/lib/src/HttpResponseImpl.h index 45d025d3..de7eb16d 100755 --- a/lib/src/HttpResponseImpl.h +++ b/lib/src/HttpResponseImpl.h @@ -373,7 +373,6 @@ class HttpResponseImpl : public HttpResponse std::unordered_map _cookies; HttpStatusCode _statusCode; trantor::Date _createDate; - // FIXME: add http version Version _v; std::string _statusMessage; bool _closeConnection; diff --git a/lib/src/SharedLibManager.cc b/lib/src/SharedLibManager.cc index fee8c848..be36870d 100755 --- a/lib/src/SharedLibManager.cc +++ b/lib/src/SharedLibManager.cc @@ -117,7 +117,7 @@ void SharedLibManager::managerLibs() cmd.append(filename).append(" -o ").append(libPath); LOG_TRACE << cmd; auto r = system(cmd.c_str()); - //FIXME:handle r + //TODO:handle r (void)(r); auto srcFile = filename.substr(0, pos); srcFile.append(".cc"); diff --git a/orm_lib/inc/drogon/orm/Mapper.h b/orm_lib/inc/drogon/orm/Mapper.h index 25e0fcf5..e7fdea00 100644 --- a/orm_lib/inc/drogon/orm/Mapper.h +++ b/orm_lib/inc/drogon/orm/Mapper.h @@ -1078,7 +1078,6 @@ inline Mapper &Mapper::forUpdate() template inline std::string Mapper::replaceSqlPlaceHolder(const std::string &sqlStr, const std::string &holderStr) const { - ///FIXME add mysql support if (_client->type() == ClientType::PostgreSQL) { std::string::size_type startPos = 0; diff --git a/orm_lib/src/mysql_impl/MysqlConnection.cc b/orm_lib/src/mysql_impl/MysqlConnection.cc index 522c2ea2..e58951a5 100644 --- a/orm_lib/src/mysql_impl/MysqlConnection.cc +++ b/orm_lib/src/mysql_impl/MysqlConnection.cc @@ -126,7 +126,6 @@ void MysqlConnection::setChannel() if (_channelPtr->isWriting()) _channelPtr->disableWriting(); } - //(status & MYSQL_WAIT_EXCEPT) ///FIXME if (_waitStatus & MYSQL_WAIT_TIMEOUT) { auto timeout = mysql_get_timeout_value(_mysqlPtr.get()); @@ -242,7 +241,6 @@ void MysqlConnection::handleEvent() { _execStatus = ExecStatus_None; outputError(); - //FIXME exception callback; return; } _execStatus = ExecStatus_StoreResult; @@ -255,7 +253,6 @@ void MysqlConnection::handleEvent() if (err) { outputError(); - //FIXME exception callback; return; } getResult(ret); @@ -275,7 +272,6 @@ void MysqlConnection::handleEvent() { _execStatus = ExecStatus_None; outputError(); - //FIXME exception callback; return; } getResult(ret); @@ -423,7 +419,7 @@ void MysqlConnection::outputError() try { - //FIXME exception type + //TODO exception type throw SqlError(mysql_error(_mysqlPtr.get()), _sql); } diff --git a/orm_lib/src/postgresql_impl/PgConnection.cc b/orm_lib/src/postgresql_impl/PgConnection.cc index 91ec3bb5..5ae6446e 100644 --- a/orm_lib/src/postgresql_impl/PgConnection.cc +++ b/orm_lib/src/postgresql_impl/PgConnection.cc @@ -238,7 +238,7 @@ void PgConnection::handleRead() { try { - //FIXME exception type + //TODO exception type throw SqlError(PQerrorMessage(_connPtr.get()), _sql); } diff --git a/trantor b/trantor index fd0920b8..aca0bec4 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit fd0920b8b63f22decdf029d7e612f3170df68908 +Subproject commit aca0bec46a1ae85a059a7af7bc9d705a00e1c789