summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAlexander Zaitsev <zamazan4ik@tut.by>2020-03-13 03:56:35 +0300
committerAlexander Zaitsev <zamazan4ik@tut.by>2020-03-13 03:56:35 +0300
commit26fac5bf7e87dd5704a967ee4c744228b93d20b7 (patch)
tree74e5daa9a58f3a97b417925a212ac2cd31487a5e /src/net
parent806e7e5a3edf4fdf2b9c48469a7bc23307b200b0 (diff)
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
Diffstat (limited to 'src/net')
-rw-r--r--src/net/BoostHttpOnlySslClient.cpp4
-rw-r--r--src/net/CurlHttpClient.cpp4
-rw-r--r--src/net/HttpParser.cpp11
-rw-r--r--src/net/Url.cpp4
4 files changed, 15 insertions, 8 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 386a4d9..8006c85 100644
--- a/src/net/HttpParser.cpp
+++ b/src/net/HttpParser.cpp
@@ -1,5 +1,6 @@
#include "tgbot/net/HttpParser.h"
+#include <cstddef>
#include <cstdint>
#include <boost/algorithm/string.hpp>
@@ -133,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;
@@ -167,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/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) {