From c3cd40dfe22f4b28823c65be7f230152f875e3a8 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Thu, 18 Jan 2024 17:51:23 +0800 Subject: [PATCH] Fix compile error on MSVC --- http_client.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/http_client.cpp b/http_client.cpp index 31f081a..753274f 100644 --- a/http_client.cpp +++ b/http_client.cpp @@ -428,7 +428,11 @@ void HttpFullBody::pull() { size_t HttpFullBody::pullData(char* buf, size_t len) { this->pull(); +#ifdef min + size_t rlen = min(this->buff.length(), len); +#else size_t rlen = std::min(this->buff.length(), len); +#endif memcpy(buf, this->buff.c_str(), rlen); this->buff = this->buff.substr(rlen); return rlen; @@ -620,7 +624,11 @@ std::string Response::read() { size_t osize = size; while (size > 0) { if (this->pullData()) break; +#ifdef min + size_t len = min(this->buff.length(), size); +#else auto len = std::min(this->buff.length(), size); +#endif data += this->buff.substr(0, len); this->buff = this->buff.substr(len); size -= len;