diff options
author | Egor Pugin <egor.pugin@gmail.com> | 2020-03-13 13:45:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-13 13:45:37 +0300 |
commit | dee88d3099607d6fa49e2775aaa8a6cb2d77d710 (patch) | |
tree | 74e5daa9a58f3a97b417925a212ac2cd31487a5e /include/tgbot/net | |
parent | d1c6a8062577f5ce58105afff2d0a1887bfff957 (diff) | |
parent | 26fac5bf7e87dd5704a967ee4c744228b93d20b7 (diff) |
Merge pull request #129 from reo7sp/fix/use_proper_types
fix: use C++ fixed-width types instead of C types
Diffstat (limited to 'include/tgbot/net')
-rw-r--r-- | include/tgbot/net/HttpServer.h | 9 | ||||
-rw-r--r-- | include/tgbot/net/TgLongPoll.h | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/include/tgbot/net/HttpServer.h b/include/tgbot/net/HttpServer.h index 28ea5a3..ccee077 100644 --- a/include/tgbot/net/HttpServer.h +++ b/include/tgbot/net/HttpServer.h @@ -1,6 +1,7 @@ #ifndef TGBOT_HTTPSERVER_H #define TGBOT_HTTPSERVER_H +#include <cstddef> #include <iostream> #include <string> #include <utility> @@ -73,7 +74,7 @@ protected: _socket, *data, "\r\n\r\n", - [self, data](const boost::system::error_code& e, size_t n) { + [self, data](const boost::system::error_code& e, std::size_t n) { if (e) { std::cout << "error in HttpServer::Connection#_readHeader: " << e << std::endl; return; @@ -97,7 +98,7 @@ protected: boost::asio::async_write( self->_socket, boost::asio::buffer(answer), - [](const boost::system::error_code& e, size_t n) { }); + [](const boost::system::error_code& e, std::size_t n) { }); return; } @@ -114,7 +115,7 @@ protected: boost::asio::async_read(_socket, *data, boost::asio::transfer_exactly(size - data->size()), - [self, data, size, headers](const boost::system::error_code& e, size_t n) { + [self, data, size, headers](const boost::system::error_code& e, std::size_t n) { if (e) { std::cout << "error in HttpServer::Connection#_readBody: " << e << std::endl; return; @@ -133,7 +134,7 @@ protected: boost::asio::async_write( self->_socket, boost::asio::buffer(answer), - [](const boost::system::error_code& e, size_t n) { }); + [](const boost::system::error_code& e, std::size_t n) { }); self->_socket.close(); }); diff --git a/include/tgbot/net/TgLongPoll.h b/include/tgbot/net/TgLongPoll.h index 8e62cd1..2de9810 100644 --- a/include/tgbot/net/TgLongPoll.h +++ b/include/tgbot/net/TgLongPoll.h @@ -1,6 +1,8 @@ #ifndef TGBOT_TGLONGPOLL_H #define TGBOT_TGLONGPOLL_H +#include <cstdint> + #include "tgbot/Bot.h" #include "tgbot/Api.h" #include "tgbot/EventHandler.h" @@ -15,8 +17,8 @@ namespace TgBot { class TgLongPoll { public: - TgLongPoll(const Api* api, const EventHandler* eventHandler, int32_t, int32_t, const std::shared_ptr<std::vector<std::string>>&); - TgLongPoll(const Bot& bot, int32_t = 100, int32_t = 10, const std::shared_ptr<std::vector<std::string>>& = nullptr); + TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t, std::int32_t, const std::shared_ptr<std::vector<std::string>>&); + TgLongPoll(const Bot& bot, std::int32_t = 100, std::int32_t = 10, const std::shared_ptr<std::vector<std::string>>& = nullptr); /** * @brief Starts long poll. After new update will come, this method will parse it and send to EventHandler which invokes your listeners. Designed to be executed in a loop. @@ -26,9 +28,9 @@ public: private: const Api* _api; const EventHandler* _eventHandler; - int32_t _lastUpdateId = 0; - int32_t _limit; - int32_t _timeout; + std::int32_t _lastUpdateId = 0; + std::int32_t _limit; + std::int32_t _timeout; std::shared_ptr<std::vector<std::string>> _allowupdates; }; |