diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/BoostHttpOnlySslClient.cpp | 4 | ||||
-rw-r--r-- | src/net/CurlHttpClient.cpp | 4 | ||||
-rw-r--r-- | src/net/HttpParser.cpp | 15 | ||||
-rw-r--r-- | src/net/TgLongPoll.cpp | 6 | ||||
-rw-r--r-- | src/net/Url.cpp | 4 |
5 files changed, 22 insertions, 11 deletions
diff --git a/src/net/BoostHttpOnlySslClient.cpp b/src/net/BoostHttpOnlySslClient.cpp index d0fde8e..836b06a 100644 --- a/src/net/BoostHttpOnlySslClient.cpp +++ b/src/net/BoostHttpOnlySslClient.cpp @@ -1,5 +1,7 @@ #include "tgbot/net/BoostHttpOnlySslClient.h" +#include <cstddef> + #include <boost/asio/ssl.hpp> using namespace std; @@ -59,7 +61,7 @@ string BoostHttpOnlySslClient::makeRequest(const Url& url, const vector<HttpReqA boost::system::error_code error; while (!error) { - size_t bytes = read(socket, buffer(buff), error); + std::size_t bytes = read(socket, buffer(buff), error); response += string(buff, bytes); } diff --git a/src/net/CurlHttpClient.cpp b/src/net/CurlHttpClient.cpp index 01115e6..5bd9313 100644 --- a/src/net/CurlHttpClient.cpp +++ b/src/net/CurlHttpClient.cpp @@ -2,6 +2,8 @@ #include "tgbot/net/CurlHttpClient.h" +#include <cstddef> + #include <boost/asio/ssl.hpp> namespace TgBot { @@ -14,7 +16,7 @@ CurlHttpClient::~CurlHttpClient() { curl_easy_cleanup(curlSettings); } -static size_t curlWriteString(char* ptr, size_t size, size_t nmemb, void* userdata) { +static std::size_t curlWriteString(char* ptr, std::size_t size, std::size_t nmemb, void* userdata) { static_cast<std::string *>(userdata)->append(ptr, size * nmemb); return size * nmemb; }; diff --git a/src/net/HttpParser.cpp b/src/net/HttpParser.cpp index b83ddf0..8006c85 100644 --- a/src/net/HttpParser.cpp +++ b/src/net/HttpParser.cpp @@ -1,5 +1,8 @@ #include "tgbot/net/HttpParser.h" +#include <cstddef> +#include <cstdint> + #include <boost/algorithm/string.hpp> #include "tgbot/tools/StringTools.h" @@ -78,7 +81,7 @@ string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, con string HttpParser::generateMultipartBoundary(const vector<HttpReqArg>& args) const { string result; - srand((uint32_t) time(nullptr)); + srand((std::uint32_t) time(nullptr)); for (const HttpReqArg& item : args) { if (item.isFile) { while (result.empty() || item.value.find(result) != string::npos) { @@ -131,10 +134,10 @@ string HttpParser::generateResponse(const string& data, const string& mimeType, unordered_map<string, string> HttpParser::parseHeader(const string& data, bool isRequest) const { unordered_map<string, string> headers; - size_t lineStart = 0; - size_t lineEnd = 0; - size_t lineSepPos = 0; - size_t lastLineEnd = string::npos; + std::size_t lineStart = 0; + std::size_t lineEnd = 0; + std::size_t lineSepPos = 0; + std::size_t lastLineEnd = string::npos; while (lastLineEnd != lineEnd) { lastLineEnd = lineEnd; bool isFirstLine = lineEnd == 0; @@ -165,7 +168,7 @@ unordered_map<string, string> HttpParser::parseHeader(const string& data, bool i } string HttpParser::extractBody(const string& data) const { - size_t headerEnd = data.find("\r\n\r\n"); + std::size_t headerEnd = data.find("\r\n\r\n"); if (headerEnd == string::npos) { return data; } diff --git a/src/net/TgLongPoll.cpp b/src/net/TgLongPoll.cpp index 913ffdf..0138620 100644 --- a/src/net/TgLongPoll.cpp +++ b/src/net/TgLongPoll.cpp @@ -1,12 +1,14 @@ #include "tgbot/net/TgLongPoll.h" +#include <cstdint> + namespace TgBot { -TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler, int32_t limit, int32_t timeout, const std::shared_ptr<std::vector<std::string>>& allowupdates) +TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t limit, std::int32_t timeout, const std::shared_ptr<std::vector<std::string>>& allowupdates) : _api(api), _eventHandler(eventHandler), _limit(limit), _timeout(timeout), _allowupdates(allowupdates) { } -TgLongPoll::TgLongPoll(const Bot& bot, int32_t limit, int32_t timeout, const std::shared_ptr<std::vector<std::string>>& allowupdates) : +TgLongPoll::TgLongPoll(const Bot& bot, std::int32_t limit, std::int32_t timeout, const std::shared_ptr<std::vector<std::string>>& allowupdates) : TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, allowupdates) { } diff --git a/src/net/Url.cpp b/src/net/Url.cpp index c767b47..016a97f 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -1,5 +1,7 @@ #include "tgbot/net/Url.h" +#include <cstddef> + #include "tgbot/tools/StringTools.h" using namespace std; @@ -12,7 +14,7 @@ Url::Url(const string& url) { bool isPathParsed = false; bool isQueryParsed = false; - for (size_t i = 0, count = url.length(); i < count; ++i) { + for (std::size_t i = 0, count = url.length(); i < count; ++i) { char c = url[i]; if (!isProtocolParsed) { |