| 77 | int lastPct = -1; |
| 78 | }; |
| 79 | int uploadProgress(void* p, curl_off_t, curl_off_t, curl_off_t ultotal, curl_off_t ulnow) |
| 80 | { |
| 81 | if (ckpt_script_abort_requested()) { |
| 82 | return 1; |
| 83 | } |
| 84 | UploadProgress* up = (UploadProgress*)p; |
| 85 | if (up && ultotal > 0) { |
| 86 | const int pct = (int)((ulnow * 100) / ultotal); |
| 87 | if (pct != up->lastPct) { |
| 88 | if (up->lastPct < 0) { |
| 89 | // First callback: the total is only known once curl has it. |
| 90 | // The label names the *phase*, never the script's status |
| 91 | // text: a script that also drives an item bar would |
| 92 | // otherwise show the same string on two stacked bars and |
| 93 | // read as a duplicate. "zip" / "unzip" in zip_api.cpp are |
| 94 | // the same convention. |
| 95 | ScriptConsole::get().beginIo("upload", (long long)ultotal); |
| 96 | } |
| 97 | up->lastPct = pct; |
| 98 | ScriptConsole::get().setIo((long long)ulnow); |
| 99 | } |
| 100 | } |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | // "\n"-separated "Key: Value" lines into a curl slist (nullptr => none). |
| 105 | struct curl_slist* headerSlist(const char* headers) |
nothing calls this directly
no test coverage detected