| 226 | } |
| 227 | |
| 228 | std::string encode(const char* s) |
| 229 | { |
| 230 | CURL* curl = curlReady() ? curl_easy_init() : nullptr; |
| 231 | if (!curl) { |
| 232 | return std::string(); |
| 233 | } |
| 234 | char* enc = curl_easy_escape(curl, s ? s : "", 0); |
| 235 | std::string out; |
| 236 | if (enc) { |
| 237 | try { |
| 238 | out.assign(enc); |
| 239 | } |
| 240 | catch (...) { |
| 241 | out.clear(); |
| 242 | } |
| 243 | curl_free(enc); |
| 244 | } |
| 245 | curl_easy_cleanup(curl); |
| 246 | return out; |
| 247 | } |
| 248 | |
| 249 | const char* strerror(int code) |
| 250 | { |
no test coverage detected