From 26fac5bf7e87dd5704a967ee4c744228b93d20b7 Mon Sep 17 00:00:00 2001 From: Alexander Zaitsev Date: Fri, 13 Mar 2020 03:56:35 +0300 Subject: fix: use std::size_t instead of size_t - use C++ size_t from std namespace instead of a version from global namespace Tested: - Local build - Unit-tests --- include/tgbot/net/HttpServer.h | 9 +++++---- include/tgbot/tools/StringTools.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'include') 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 #include #include #include @@ -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/tools/StringTools.h b/include/tgbot/tools/StringTools.h index d1bc094..cb26bb5 100644 --- a/include/tgbot/tools/StringTools.h +++ b/include/tgbot/tools/StringTools.h @@ -1,6 +1,7 @@ #ifndef TGBOT_CPP_STRINGTOOLS_H #define TGBOT_CPP_STRINGTOOLS_H +#include #include #include #include @@ -36,7 +37,7 @@ void split(const std::string& str, char delimiter, std::vector& des * Generates pseudo random string. It's recommended to call srand before this method. * @param length Length of resulting string. */ -std::string generateRandomString(size_t length); +std::string generateRandomString(std::size_t length); /** * Performs url encode. -- cgit v1.2.3