mirror of
https://github.com/curl/curl.git
synced 2026-08-10 17:30:52 +03:00
tidy-up: result code variable names in tests and examples
Sync outliers with the rest of the code. Also: - return error in some failed init cases, instead of `CURLE_OK`: 1908, 1910, 1913, 2082, 3010 - lib1541: delete unused struct member. Closes #19515
This commit is contained in:
parent
e3e0559ed2
commit
96500f466e
40 changed files with 342 additions and 348 deletions
|
|
@ -53,7 +53,7 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
|
|||
CURL *curl = curl_easy_init();
|
||||
|
||||
if(curl) {
|
||||
CURLcode result;
|
||||
CURLcode res;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
|
|
@ -63,12 +63,11 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
|
|||
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
result = curl_easy_getinfo(curl,
|
||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&remoteFileSizeByte);
|
||||
if(result)
|
||||
res = curl_easy_perform(curl);
|
||||
if(CURLE_OK == res) {
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&remoteFileSizeByte);
|
||||
if(res)
|
||||
return -1;
|
||||
printf("filesize: %" CURL_FORMAT_CURL_OFF_T "\n", remoteFileSizeByte);
|
||||
}
|
||||
|
|
@ -83,7 +82,7 @@ static int sftpResumeUpload(CURL *curl, const char *remotepath,
|
|||
const char *localpath)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
CURLcode result = CURLE_GOT_NOTHING;
|
||||
CURLcode res = CURLE_GOT_NOTHING;
|
||||
|
||||
curl_off_t remoteFileSizeByte = sftpGetRemoteFileSize(remotepath);
|
||||
if(remoteFileSizeByte == -1) {
|
||||
|
|
@ -110,14 +109,14 @@ static int sftpResumeUpload(CURL *curl, const char *remotepath,
|
|||
fseek(f, (long)remoteFileSizeByte, SEEK_SET);
|
||||
#endif
|
||||
curl_easy_setopt(curl, CURLOPT_APPEND, 1L);
|
||||
result = curl_easy_perform(curl);
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
fclose(f);
|
||||
|
||||
if(result == CURLE_OK)
|
||||
if(res == CURLE_OK)
|
||||
return 1;
|
||||
else {
|
||||
fprintf(stderr, "%s\n", curl_easy_strerror(result));
|
||||
fprintf(stderr, "%s\n", curl_easy_strerror(res));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,15 +60,14 @@ static size_t read_cb(char *buf, size_t nitems, size_t buflen, void *p)
|
|||
struct read_ctx *ctx = p;
|
||||
size_t len = nitems * buflen;
|
||||
size_t left = ctx->blen - ctx->nsent;
|
||||
CURLcode result;
|
||||
CURLcode res;
|
||||
|
||||
if(!ctx->nsent) {
|
||||
/* On first call, set the FRAME information to be used (it defaults
|
||||
* to CURLWS_BINARY otherwise). */
|
||||
result = curl_ws_start_frame(ctx->curl, CURLWS_TEXT,
|
||||
(curl_off_t)ctx->blen);
|
||||
if(result) {
|
||||
fprintf(stderr, "error starting frame: %d\n", result);
|
||||
res = curl_ws_start_frame(ctx->curl, CURLWS_TEXT, (curl_off_t)ctx->blen);
|
||||
if(res) {
|
||||
fprintf(stderr, "error starting frame: %d\n", res);
|
||||
return CURL_READFUNC_ABORT;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue