MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / WriteCallback

Method WriteCallback

common/HTTPDownloaderCurl.cpp:72–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72size_t HTTPDownloaderCurl::WriteCallback(char* ptr, size_t size, size_t nmemb, void* userdata)
73{
74 Request* req = static_cast<Request*>(userdata);
75 const size_t current_size = req->data.size();
76 const size_t transfer_size = size * nmemb;
77 const size_t new_size = current_size + transfer_size;
78 req->data.resize(new_size);
79 req->start_time = Common::Timer::GetCurrentValue();
80 std::memcpy(&req->data[current_size], ptr, transfer_size);
81
82 if (req->content_length == 0)
83 {
84 curl_off_t length;
85 if (curl_easy_getinfo(req->handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &length) == CURLE_OK)
86 req->content_length = static_cast<u32>(length);
87 }
88
89 return nmemb;
90}
91
92HTTPDownloader::Request* HTTPDownloaderCurl::InternalCreateRequest()
93{

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected