try to decode the image header as soon as some data is available
This commit is contained in:
@@ -179,9 +179,8 @@ bool Asset::open_url(const std::string& url, std::function<bool(float)> progress
|
||||
close();
|
||||
LOG("download %s", url.c_str());
|
||||
m_current_url = url;
|
||||
std::vector<uint8_t> data;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &tmp_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler_asset);
|
||||
#ifdef __ANDROID__
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
@@ -200,9 +199,10 @@ bool Asset::open_url(const std::string& url, std::function<bool(float)> progress
|
||||
{
|
||||
if (m_data)
|
||||
delete m_data;
|
||||
m_data = new uint8_t[data.size()];
|
||||
std::copy(data.begin(), data.end(), m_data);
|
||||
m_len = data.size();
|
||||
m_data = new uint8_t[tmp_data.size()];
|
||||
std::copy(tmp_data.begin(), tmp_data.end(), m_data);
|
||||
m_len = tmp_data.size();
|
||||
tmp_data.clear();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user