| 27 | #endif |
| 28 | |
| 29 | size_t |
| 30 | TLEDownloaderTask::curl_save_data( |
| 31 | void *ptr, |
| 32 | size_t size, |
| 33 | size_t nmemb, |
| 34 | TLEDownloaderTask *self) |
| 35 | { |
| 36 | size_t chunksize = size * nmemb; |
| 37 | |
| 38 | if (self->data.size() + chunksize > TLE_DOWNLOADER_MAX_MEMORY_SIZE) |
| 39 | chunksize = TLE_DOWNLOADER_MAX_MEMORY_SIZE - self->data.size(); |
| 40 | |
| 41 | if (chunksize > 0) { |
| 42 | const char *asStr = reinterpret_cast<const char *>(ptr); |
| 43 | self->data.append(asStr, chunksize); |
| 44 | } |
| 45 | |
| 46 | return nmemb; |
| 47 | } |
| 48 | |
| 49 | int |
| 50 | TLEDownloaderTask::curl_progress( |