mirror of
https://github.com/moparisthebest/curl
synced 2025-01-10 21:48:10 -05:00
build: fix Codacy warnings
Reduce variable scopes and remove redundant variable stores. Closes https://github.com/curl/curl/pull/3975
This commit is contained in:
parent
04ac54e196
commit
e23c52b329
@ -125,6 +125,7 @@ int main(void)
|
|||||||
#if defined(HAVE_GETHOSTBYADDR_R_5) || \
|
#if defined(HAVE_GETHOSTBYADDR_R_5) || \
|
||||||
defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT)
|
defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT)
|
||||||
rc = gethostbyaddr_r(address, length, type, &h, &hdata);
|
rc = gethostbyaddr_r(address, length, type, &h, &hdata);
|
||||||
|
(void)rc;
|
||||||
#elif defined(HAVE_GETHOSTBYADDR_R_7) || \
|
#elif defined(HAVE_GETHOSTBYADDR_R_7) || \
|
||||||
defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT)
|
defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT)
|
||||||
hp = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &h_errnop);
|
hp = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &h_errnop);
|
||||||
@ -132,6 +133,7 @@ int main(void)
|
|||||||
#elif defined(HAVE_GETHOSTBYADDR_R_8) || \
|
#elif defined(HAVE_GETHOSTBYADDR_R_8) || \
|
||||||
defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT)
|
defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT)
|
||||||
rc = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &hp, &h_errnop);
|
rc = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &hp, &h_errnop);
|
||||||
|
(void)rc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_GETHOSTBYNAME_R_3) || \
|
#if defined(HAVE_GETHOSTBYNAME_R_3) || \
|
||||||
|
@ -41,8 +41,6 @@ static size_t write_it(char *buff, size_t size, size_t nmemb,
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc = CURLE_OK;
|
|
||||||
|
|
||||||
/* curl easy handle */
|
/* curl easy handle */
|
||||||
CURL *handle;
|
CURL *handle;
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ int main(int argc, char **argv)
|
|||||||
struct callback_data data = { 0 };
|
struct callback_data data = { 0 };
|
||||||
|
|
||||||
/* global initialization */
|
/* global initialization */
|
||||||
rc = curl_global_init(CURL_GLOBAL_ALL);
|
int rc = curl_global_init(CURL_GLOBAL_ALL);
|
||||||
if(rc)
|
if(rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@ size_t SyncTime_CURL_WriteOutput(void *ptr, size_t size, size_t nmemb,
|
|||||||
size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
||||||
void *stream)
|
void *stream)
|
||||||
{
|
{
|
||||||
int i, RetVal;
|
|
||||||
char TmpStr1[26], TmpStr2[26];
|
char TmpStr1[26], TmpStr2[26];
|
||||||
|
|
||||||
(void)stream;
|
(void)stream;
|
||||||
@ -156,11 +155,13 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
|||||||
TmpStr1 & 2? */
|
TmpStr1 & 2? */
|
||||||
AutoSyncTime = 0;
|
AutoSyncTime = 0;
|
||||||
else {
|
else {
|
||||||
RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
|
int RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
|
||||||
TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
|
TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
|
||||||
&SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond);
|
&SYSTime.wHour, &SYSTime.wMinute,
|
||||||
|
&SYSTime.wSecond);
|
||||||
|
|
||||||
if(RetVal == 7) {
|
if(RetVal == 7) {
|
||||||
|
int i;
|
||||||
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
|
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
|
||||||
for(i = 0; i<12; i++) {
|
for(i = 0; i<12; i++) {
|
||||||
if(strcmp(MthStr[i], TmpStr2) == 0) {
|
if(strcmp(MthStr[i], TmpStr2) == 0) {
|
||||||
|
@ -218,7 +218,6 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
|
|||||||
const unsigned char *key_56)
|
const unsigned char *key_56)
|
||||||
{
|
{
|
||||||
const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */
|
const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */
|
||||||
PK11SlotInfo *slot = NULL;
|
|
||||||
char key[8]; /* expanded 64 bit key */
|
char key[8]; /* expanded 64 bit key */
|
||||||
SECItem key_item;
|
SECItem key_item;
|
||||||
PK11SymKey *symkey = NULL;
|
PK11SymKey *symkey = NULL;
|
||||||
@ -228,7 +227,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
|
|||||||
bool rv = FALSE;
|
bool rv = FALSE;
|
||||||
|
|
||||||
/* use internal slot for DES encryption (requires NSS to be initialized) */
|
/* use internal slot for DES encryption (requires NSS to be initialized) */
|
||||||
slot = PK11_GetInternalKeySlot();
|
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
|
||||||
if(!slot)
|
if(!slot)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
18
lib/ftp.c
18
lib/ftp.c
@ -565,10 +565,8 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
|||||||
#ifdef HAVE_GSSAPI
|
#ifdef HAVE_GSSAPI
|
||||||
char * const buf = data->state.buffer;
|
char * const buf = data->state.buffer;
|
||||||
#endif
|
#endif
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
int code;
|
int code;
|
||||||
|
CURLcode result = Curl_pp_readresp(sockfd, pp, &code, size);
|
||||||
result = Curl_pp_readresp(sockfd, pp, &code, size);
|
|
||||||
|
|
||||||
#if defined(HAVE_GSSAPI)
|
#if defined(HAVE_GSSAPI)
|
||||||
/* handle the security-oriented responses 6xx ***/
|
/* handle the security-oriented responses 6xx ***/
|
||||||
@ -1499,24 +1497,14 @@ static CURLcode ftp_state_list(struct connectdata *conn)
|
|||||||
|
|
||||||
static CURLcode ftp_state_retr_prequote(struct connectdata *conn)
|
static CURLcode ftp_state_retr_prequote(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* We've sent the TYPE, now we must send the list of prequote strings */
|
/* We've sent the TYPE, now we must send the list of prequote strings */
|
||||||
|
return ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE);
|
||||||
result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURLcode ftp_state_stor_prequote(struct connectdata *conn)
|
static CURLcode ftp_state_stor_prequote(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* We've sent the TYPE, now we must send the list of prequote strings */
|
/* We've sent the TYPE, now we must send the list of prequote strings */
|
||||||
|
return ftp_state_quote(conn, TRUE, FTP_STOR_PREQUOTE);
|
||||||
result = ftp_state_quote(conn, TRUE, FTP_STOR_PREQUOTE);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURLcode ftp_state_type(struct connectdata *conn)
|
static CURLcode ftp_state_type(struct connectdata *conn)
|
||||||
|
15
lib/imap.c
15
lib/imap.c
@ -444,10 +444,8 @@ static CURLcode imap_perform_capability(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode imap_perform_starttls(struct connectdata *conn)
|
static CURLcode imap_perform_starttls(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* Send the STARTTLS command */
|
/* Send the STARTTLS command */
|
||||||
result = imap_sendf(conn, "STARTTLS");
|
CURLcode result = imap_sendf(conn, "STARTTLS");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, IMAP_STARTTLS);
|
state(conn, IMAP_STARTTLS);
|
||||||
@ -463,11 +461,10 @@ static CURLcode imap_perform_starttls(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode imap_perform_upgrade_tls(struct connectdata *conn)
|
static CURLcode imap_perform_upgrade_tls(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct imap_conn *imapc = &conn->proto.imapc;
|
|
||||||
|
|
||||||
/* Start the SSL connection */
|
/* Start the SSL connection */
|
||||||
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone);
|
struct imap_conn *imapc = &conn->proto.imapc;
|
||||||
|
CURLcode result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET,
|
||||||
|
&imapc->ssldone);
|
||||||
|
|
||||||
if(!result) {
|
if(!result) {
|
||||||
if(imapc->state != IMAP_UPGRADETLS)
|
if(imapc->state != IMAP_UPGRADETLS)
|
||||||
@ -826,10 +823,8 @@ static CURLcode imap_perform_search(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode imap_perform_logout(struct connectdata *conn)
|
static CURLcode imap_perform_logout(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* Send the LOGOUT command */
|
/* Send the LOGOUT command */
|
||||||
result = imap_sendf(conn, "LOGOUT");
|
CURLcode result = imap_sendf(conn, "LOGOUT");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, IMAP_LOGOUT);
|
state(conn, IMAP_LOGOUT);
|
||||||
|
15
lib/pop3.c
15
lib/pop3.c
@ -339,10 +339,8 @@ static CURLcode pop3_perform_capa(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode pop3_perform_starttls(struct connectdata *conn)
|
static CURLcode pop3_perform_starttls(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* Send the STLS command */
|
/* Send the STLS command */
|
||||||
result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "STLS");
|
CURLcode result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "STLS");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, POP3_STARTTLS);
|
state(conn, POP3_STARTTLS);
|
||||||
@ -358,11 +356,10 @@ static CURLcode pop3_perform_starttls(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode pop3_perform_upgrade_tls(struct connectdata *conn)
|
static CURLcode pop3_perform_upgrade_tls(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct pop3_conn *pop3c = &conn->proto.pop3c;
|
|
||||||
|
|
||||||
/* Start the SSL connection */
|
/* Start the SSL connection */
|
||||||
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone);
|
struct pop3_conn *pop3c = &conn->proto.pop3c;
|
||||||
|
CURLcode result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET,
|
||||||
|
&pop3c->ssldone);
|
||||||
|
|
||||||
if(!result) {
|
if(!result) {
|
||||||
if(pop3c->state != POP3_UPGRADETLS)
|
if(pop3c->state != POP3_UPGRADETLS)
|
||||||
@ -593,10 +590,8 @@ static CURLcode pop3_perform_command(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode pop3_perform_quit(struct connectdata *conn)
|
static CURLcode pop3_perform_quit(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* Send the QUIT command */
|
/* Send the QUIT command */
|
||||||
result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "QUIT");
|
CURLcode result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "QUIT");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, POP3_QUIT);
|
state(conn, POP3_QUIT);
|
||||||
|
@ -957,7 +957,6 @@ static CURLcode smb_do(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
static CURLcode smb_parse_url_path(struct connectdata *conn)
|
static CURLcode smb_parse_url_path(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct Curl_easy *data = conn->data;
|
struct Curl_easy *data = conn->data;
|
||||||
struct smb_request *req = data->req.protop;
|
struct smb_request *req = data->req.protop;
|
||||||
struct smb_conn *smbc = &conn->proto.smbc;
|
struct smb_conn *smbc = &conn->proto.smbc;
|
||||||
@ -965,7 +964,8 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
|
|||||||
char *slash;
|
char *slash;
|
||||||
|
|
||||||
/* URL decode the path */
|
/* URL decode the path */
|
||||||
result = Curl_urldecode(data, data->state.up.path, 0, &path, NULL, TRUE);
|
CURLcode result = Curl_urldecode(data, data->state.up.path, 0, &path, NULL,
|
||||||
|
TRUE);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
15
lib/smtp.c
15
lib/smtp.c
@ -359,10 +359,8 @@ static CURLcode smtp_perform_helo(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode smtp_perform_starttls(struct connectdata *conn)
|
static CURLcode smtp_perform_starttls(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* Send the STARTTLS command */
|
/* Send the STARTTLS command */
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "STARTTLS");
|
CURLcode result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "STARTTLS");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, SMTP_STARTTLS);
|
state(conn, SMTP_STARTTLS);
|
||||||
@ -378,11 +376,10 @@ static CURLcode smtp_perform_starttls(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode smtp_perform_upgrade_tls(struct connectdata *conn)
|
static CURLcode smtp_perform_upgrade_tls(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
|
||||||
|
|
||||||
/* Start the SSL connection */
|
/* Start the SSL connection */
|
||||||
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
|
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
||||||
|
CURLcode result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET,
|
||||||
|
&smtpc->ssldone);
|
||||||
|
|
||||||
if(!result) {
|
if(!result) {
|
||||||
if(smtpc->state != SMTP_UPGRADETLS)
|
if(smtpc->state != SMTP_UPGRADETLS)
|
||||||
@ -645,10 +642,8 @@ static CURLcode smtp_perform_rcpt_to(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
static CURLcode smtp_perform_quit(struct connectdata *conn)
|
static CURLcode smtp_perform_quit(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
|
|
||||||
/* Send the QUIT command */
|
/* Send the QUIT command */
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "QUIT");
|
CURLcode result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "QUIT");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, SMTP_QUIT);
|
state(conn, SMTP_QUIT);
|
||||||
|
@ -1968,11 +1968,10 @@ static CURLcode myssh_multi_statemach(struct connectdata *conn,
|
|||||||
bool *done)
|
bool *done)
|
||||||
{
|
{
|
||||||
struct ssh_conn *sshc = &conn->proto.sshc;
|
struct ssh_conn *sshc = &conn->proto.sshc;
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
bool block; /* we store the status and use that to provide a ssh_getsock()
|
bool block; /* we store the status and use that to provide a ssh_getsock()
|
||||||
implementation */
|
implementation */
|
||||||
|
CURLcode result = myssh_statemach_act(conn, &block);
|
||||||
|
|
||||||
result = myssh_statemach_act(conn, &block);
|
|
||||||
*done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
|
*done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
|
||||||
myssh_block2waitfor(conn, block);
|
myssh_block2waitfor(conn, block);
|
||||||
|
|
||||||
|
@ -357,7 +357,6 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
|
|||||||
const char *service,
|
const char *service,
|
||||||
char **outptr, size_t *outlen)
|
char **outptr, size_t *outlen)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
MD5_context *ctxt;
|
MD5_context *ctxt;
|
||||||
char *response = NULL;
|
char *response = NULL;
|
||||||
@ -377,10 +376,12 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
|
|||||||
char *spn = NULL;
|
char *spn = NULL;
|
||||||
|
|
||||||
/* Decode the challenge message */
|
/* Decode the challenge message */
|
||||||
result = auth_decode_digest_md5_message(chlg64, nonce, sizeof(nonce),
|
CURLcode result = auth_decode_digest_md5_message(chlg64, nonce,
|
||||||
realm, sizeof(realm),
|
sizeof(nonce), realm,
|
||||||
algorithm, sizeof(algorithm),
|
sizeof(realm), algorithm,
|
||||||
qop_options, sizeof(qop_options));
|
sizeof(algorithm),
|
||||||
|
qop_options,
|
||||||
|
sizeof(qop_options));
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -357,9 +357,8 @@ cyassl_connect_step1(struct connectdata *conn,
|
|||||||
|
|
||||||
/* give application a chance to interfere with SSL set up. */
|
/* give application a chance to interfere with SSL set up. */
|
||||||
if(data->set.ssl.fsslctx) {
|
if(data->set.ssl.fsslctx) {
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = (*data->set.ssl.fsslctx)(data, BACKEND->ctx,
|
||||||
result = (*data->set.ssl.fsslctx)(data, BACKEND->ctx,
|
data->set.ssl.fsslctxp);
|
||||||
data->set.ssl.fsslctxp);
|
|
||||||
if(result) {
|
if(result) {
|
||||||
failf(data, "error signaled by ssl ctx callback");
|
failf(data, "error signaled by ssl ctx callback");
|
||||||
return result;
|
return result;
|
||||||
|
@ -265,7 +265,6 @@ mesalink_connect_step2(struct connectdata *conn, int sockindex)
|
|||||||
|
|
||||||
ret = SSL_connect(BACKEND->handle);
|
ret = SSL_connect(BACKEND->handle);
|
||||||
if(ret != SSL_SUCCESS) {
|
if(ret != SSL_SUCCESS) {
|
||||||
char error_buffer[MESALINK_MAX_ERROR_SZ];
|
|
||||||
int detail = SSL_get_error(BACKEND->handle, ret);
|
int detail = SSL_get_error(BACKEND->handle, ret);
|
||||||
|
|
||||||
if(SSL_ERROR_WANT_CONNECT == detail || SSL_ERROR_WANT_READ == detail) {
|
if(SSL_ERROR_WANT_CONNECT == detail || SSL_ERROR_WANT_READ == detail) {
|
||||||
@ -273,6 +272,7 @@ mesalink_connect_step2(struct connectdata *conn, int sockindex)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
char error_buffer[MESALINK_MAX_ERROR_SZ];
|
||||||
failf(data,
|
failf(data,
|
||||||
"SSL_connect failed with error %d: %s",
|
"SSL_connect failed with error %d: %s",
|
||||||
detail,
|
detail,
|
||||||
|
@ -620,12 +620,7 @@ curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
|
|||||||
va_list arg;
|
va_list arg;
|
||||||
void *paramp;
|
void *paramp;
|
||||||
CURLcode ret;
|
CURLcode ret;
|
||||||
unsigned int ccsid;
|
|
||||||
char * * cpp;
|
|
||||||
struct Curl_easy * data;
|
struct Curl_easy * data;
|
||||||
struct curl_slist * * slp;
|
|
||||||
struct curl_certinfo * cipf;
|
|
||||||
struct curl_certinfo * cipt;
|
|
||||||
|
|
||||||
/* WARNING: unlike curl_easy_getinfo(), the strings returned by this
|
/* WARNING: unlike curl_easy_getinfo(), the strings returned by this
|
||||||
procedure have to be free'ed. */
|
procedure have to be free'ed. */
|
||||||
@ -635,7 +630,13 @@ curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
|
|||||||
paramp = va_arg(arg, void *);
|
paramp = va_arg(arg, void *);
|
||||||
ret = Curl_getinfo(data, info, paramp);
|
ret = Curl_getinfo(data, info, paramp);
|
||||||
|
|
||||||
if(ret == CURLE_OK)
|
if(ret == CURLE_OK) {
|
||||||
|
unsigned int ccsid;
|
||||||
|
char **cpp;
|
||||||
|
struct curl_slist **slp;
|
||||||
|
struct curl_certinfo *cipf;
|
||||||
|
struct curl_certinfo *cipt;
|
||||||
|
|
||||||
switch((int) info & CURLINFO_TYPEMASK) {
|
switch((int) info & CURLINFO_TYPEMASK) {
|
||||||
|
|
||||||
case CURLINFO_STRING:
|
case CURLINFO_STRING:
|
||||||
@ -706,6 +707,7 @@ curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
return ret;
|
return ret;
|
||||||
@ -1355,13 +1357,12 @@ curl_pushheader_byname_ccsid(struct curl_pushheaders *h, const char *header,
|
|||||||
|
|
||||||
{
|
{
|
||||||
char *d = (char *) NULL;
|
char *d = (char *) NULL;
|
||||||
char *s;
|
|
||||||
|
|
||||||
if(header) {
|
if(header) {
|
||||||
header = dynconvert(ASCII_CCSID, header, -1, ccsidin);
|
header = dynconvert(ASCII_CCSID, header, -1, ccsidin);
|
||||||
|
|
||||||
if(header) {
|
if(header) {
|
||||||
s = curl_pushheader_byname(h, header);
|
char *s = curl_pushheader_byname(h, header);
|
||||||
free((char *) header);
|
free((char *) header);
|
||||||
|
|
||||||
if(s)
|
if(s)
|
||||||
|
@ -268,13 +268,9 @@ Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen,
|
|||||||
int flags)
|
int flags)
|
||||||
|
|
||||||
{
|
{
|
||||||
char * enodename;
|
char *enodename = NULL;
|
||||||
char * eservname;
|
char *eservname = NULL;
|
||||||
int status;
|
int status;
|
||||||
int i;
|
|
||||||
|
|
||||||
enodename = (char *) NULL;
|
|
||||||
eservname = (char *) NULL;
|
|
||||||
|
|
||||||
if(nodename && nodenamelen) {
|
if(nodename && nodenamelen) {
|
||||||
enodename = malloc(nodenamelen);
|
enodename = malloc(nodenamelen);
|
||||||
@ -294,6 +290,7 @@ Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen,
|
|||||||
eservname, servnamelen, flags);
|
eservname, servnamelen, flags);
|
||||||
|
|
||||||
if(!status) {
|
if(!status) {
|
||||||
|
int i;
|
||||||
if(enodename) {
|
if(enodename) {
|
||||||
i = QadrtConvertE2A(nodename, enodename,
|
i = QadrtConvertE2A(nodename, enodename,
|
||||||
nodenamelen - 1, strlen(enodename));
|
nodenamelen - 1, strlen(enodename));
|
||||||
@ -766,16 +763,13 @@ static int
|
|||||||
Curl_gss_convert_in_place(OM_uint32 * minor_status, gss_buffer_t buf)
|
Curl_gss_convert_in_place(OM_uint32 * minor_status, gss_buffer_t buf)
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i = buf->length;
|
||||||
char * t;
|
|
||||||
|
|
||||||
/* Convert `buf' in place, from EBCDIC to ASCII.
|
/* Convert `buf' in place, from EBCDIC to ASCII.
|
||||||
If error, release the buffer and return -1. Else return 0. */
|
If error, release the buffer and return -1. Else return 0. */
|
||||||
|
|
||||||
i = buf->length;
|
|
||||||
|
|
||||||
if(i) {
|
if(i) {
|
||||||
t = malloc(i);
|
char *t = malloc(i);
|
||||||
if(!t) {
|
if(!t) {
|
||||||
gss_release_buffer(minor_status, buf);
|
gss_release_buffer(minor_status, buf);
|
||||||
|
|
||||||
@ -865,7 +859,6 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
|
|||||||
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned int i;
|
|
||||||
gss_buffer_desc in;
|
gss_buffer_desc in;
|
||||||
gss_buffer_t inp;
|
gss_buffer_t inp;
|
||||||
|
|
||||||
@ -874,7 +867,7 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
|
|||||||
|
|
||||||
if(inp) {
|
if(inp) {
|
||||||
if(inp->length && inp->value) {
|
if(inp->length && inp->value) {
|
||||||
i = inp->length;
|
unsigned int i = inp->length;
|
||||||
|
|
||||||
in.value = malloc(i + 1);
|
in.value = malloc(i + 1);
|
||||||
if(!in.value) {
|
if(!in.value) {
|
||||||
|
@ -93,7 +93,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
|||||||
if((sts & 1) && (iosb.iosb$w_status & 1))
|
if((sts & 1) && (iosb.iosb$w_status & 1))
|
||||||
buffer[iosb.iosb$w_bcnt] = '\0';
|
buffer[iosb.iosb$w_bcnt] = '\0';
|
||||||
|
|
||||||
sts = sys$dassgn(chan);
|
sys$dassgn(chan);
|
||||||
}
|
}
|
||||||
return buffer; /* we always return success */
|
return buffer; /* we always return success */
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ int test(char *URL)
|
|||||||
{
|
{
|
||||||
pthread_t tid[NUM_THREADS];
|
pthread_t tid[NUM_THREADS];
|
||||||
int i;
|
int i;
|
||||||
int error;
|
|
||||||
CURLSH *share;
|
CURLSH *share;
|
||||||
struct initurl url[NUM_THREADS];
|
struct initurl url[NUM_THREADS];
|
||||||
|
|
||||||
@ -119,6 +118,7 @@ int test(char *URL)
|
|||||||
init_locks();
|
init_locks();
|
||||||
|
|
||||||
for(i = 0; i< NUM_THREADS; i++) {
|
for(i = 0; i< NUM_THREADS; i++) {
|
||||||
|
int error;
|
||||||
url[i].url = URL;
|
url[i].url = URL;
|
||||||
url[i].share = share;
|
url[i].share = share;
|
||||||
url[i].threadno = i;
|
url[i].threadno = i;
|
||||||
@ -131,7 +131,7 @@ int test(char *URL)
|
|||||||
|
|
||||||
/* now wait for all threads to terminate */
|
/* now wait for all threads to terminate */
|
||||||
for(i = 0; i< NUM_THREADS; i++) {
|
for(i = 0; i< NUM_THREADS; i++) {
|
||||||
error = pthread_join(tid[i], NULL);
|
pthread_join(tid[i], NULL);
|
||||||
fprintf(stderr, "Thread %d terminated\n", i);
|
fprintf(stderr, "Thread %d terminated\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,13 +645,11 @@ static struct redircase set_url_list[] = {
|
|||||||
static int set_url(void)
|
static int set_url(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CURLUcode rc;
|
|
||||||
CURLU *urlp;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
for(i = 0; set_url_list[i].in && !error; i++) {
|
for(i = 0; set_url_list[i].in && !error; i++) {
|
||||||
char *url = NULL;
|
CURLUcode rc;
|
||||||
urlp = curl_url();
|
CURLU *urlp = curl_url();
|
||||||
if(!urlp)
|
if(!urlp)
|
||||||
break;
|
break;
|
||||||
rc = curl_url_set(urlp, CURLUPART_URL, set_url_list[i].in,
|
rc = curl_url_set(urlp, CURLUPART_URL, set_url_list[i].in,
|
||||||
@ -666,6 +664,7 @@ static int set_url(void)
|
|||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
char *url = NULL;
|
||||||
rc = curl_url_get(urlp, CURLUPART_URL, &url, 0);
|
rc = curl_url_get(urlp, CURLUPART_URL, &url, 0);
|
||||||
if(rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "%s:%d Get URL returned %d\n",
|
fprintf(stderr, "%s:%d Get URL returned %d\n",
|
||||||
@ -677,8 +676,8 @@ static int set_url(void)
|
|||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
curl_free(url);
|
||||||
}
|
}
|
||||||
curl_free(url);
|
|
||||||
}
|
}
|
||||||
else if(rc != set_url_list[i].ucode) {
|
else if(rc != set_url_list[i].ucode) {
|
||||||
fprintf(stderr, "Set URL\nin: %s\nreturned %d (expected %d)\n",
|
fprintf(stderr, "Set URL\nin: %s\nreturned %d (expected %d)\n",
|
||||||
@ -693,11 +692,10 @@ static int set_url(void)
|
|||||||
static int set_parts(void)
|
static int set_parts(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CURLUcode rc;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
for(i = 0; set_parts_list[i].set && !error; i++) {
|
for(i = 0; set_parts_list[i].set && !error; i++) {
|
||||||
char *url = NULL;
|
CURLUcode rc;
|
||||||
CURLU *urlp = curl_url();
|
CURLU *urlp = curl_url();
|
||||||
if(!urlp) {
|
if(!urlp) {
|
||||||
error++;
|
error++;
|
||||||
@ -709,6 +707,7 @@ static int set_parts(void)
|
|||||||
else
|
else
|
||||||
rc = CURLUE_OK;
|
rc = CURLUE_OK;
|
||||||
if(!rc) {
|
if(!rc) {
|
||||||
|
char *url = NULL;
|
||||||
CURLUcode uc = updateurl(urlp, set_parts_list[i].set,
|
CURLUcode uc = updateurl(urlp, set_parts_list[i].set,
|
||||||
set_parts_list[i].setflags);
|
set_parts_list[i].setflags);
|
||||||
|
|
||||||
@ -728,13 +727,13 @@ static int set_parts(void)
|
|||||||
else if(checkurl(url, set_parts_list[i].out)) {
|
else if(checkurl(url, set_parts_list[i].out)) {
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
curl_free(url);
|
||||||
}
|
}
|
||||||
else if(rc != set_parts_list[i].ucode) {
|
else if(rc != set_parts_list[i].ucode) {
|
||||||
fprintf(stderr, "Set parts\nin: %s\nreturned %d (expected %d)\n",
|
fprintf(stderr, "Set parts\nin: %s\nreturned %d (expected %d)\n",
|
||||||
set_parts_list[i].in, (int)rc, set_parts_list[i].ucode);
|
set_parts_list[i].in, (int)rc, set_parts_list[i].ucode);
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
curl_free(url);
|
|
||||||
curl_url_cleanup(urlp);
|
curl_url_cleanup(urlp);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -743,10 +742,9 @@ static int set_parts(void)
|
|||||||
static int get_url(void)
|
static int get_url(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CURLUcode rc;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
for(i = 0; get_url_list[i].in && !error; i++) {
|
for(i = 0; get_url_list[i].in && !error; i++) {
|
||||||
char *url = NULL;
|
CURLUcode rc;
|
||||||
CURLU *urlp = curl_url();
|
CURLU *urlp = curl_url();
|
||||||
if(!urlp) {
|
if(!urlp) {
|
||||||
error++;
|
error++;
|
||||||
@ -755,6 +753,7 @@ static int get_url(void)
|
|||||||
rc = curl_url_set(urlp, CURLUPART_URL, get_url_list[i].in,
|
rc = curl_url_set(urlp, CURLUPART_URL, get_url_list[i].in,
|
||||||
get_url_list[i].urlflags);
|
get_url_list[i].urlflags);
|
||||||
if(!rc) {
|
if(!rc) {
|
||||||
|
char *url = NULL;
|
||||||
rc = curl_url_get(urlp, CURLUPART_URL, &url, get_url_list[i].getflags);
|
rc = curl_url_get(urlp, CURLUPART_URL, &url, get_url_list[i].getflags);
|
||||||
|
|
||||||
if(rc) {
|
if(rc) {
|
||||||
@ -767,13 +766,13 @@ static int get_url(void)
|
|||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
curl_free(url);
|
||||||
}
|
}
|
||||||
else if(rc != get_url_list[i].ucode) {
|
else if(rc != get_url_list[i].ucode) {
|
||||||
fprintf(stderr, "Get URL\nin: %s\nreturned %d (expected %d)\n",
|
fprintf(stderr, "Get URL\nin: %s\nreturned %d (expected %d)\n",
|
||||||
get_url_list[i].in, (int)rc, get_url_list[i].ucode);
|
get_url_list[i].in, (int)rc, get_url_list[i].ucode);
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
curl_free(url);
|
|
||||||
curl_url_cleanup(urlp);
|
curl_url_cleanup(urlp);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -782,11 +781,10 @@ static int get_url(void)
|
|||||||
static int get_parts(void)
|
static int get_parts(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CURLUcode rc;
|
|
||||||
CURLU *urlp;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
for(i = 0; get_parts_list[i].in && !error; i++) {
|
for(i = 0; get_parts_list[i].in && !error; i++) {
|
||||||
urlp = curl_url();
|
CURLUcode rc;
|
||||||
|
CURLU *urlp = curl_url();
|
||||||
if(!urlp) {
|
if(!urlp) {
|
||||||
error++;
|
error++;
|
||||||
break;
|
break;
|
||||||
@ -831,11 +829,10 @@ static struct querycase append_list[] = {
|
|||||||
static int append(void)
|
static int append(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CURLUcode rc;
|
|
||||||
CURLU *urlp;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
for(i = 0; append_list[i].in && !error; i++) {
|
for(i = 0; append_list[i].in && !error; i++) {
|
||||||
urlp = curl_url();
|
CURLUcode rc;
|
||||||
|
CURLU *urlp = curl_url();
|
||||||
if(!urlp) {
|
if(!urlp) {
|
||||||
error++;
|
error++;
|
||||||
break;
|
break;
|
||||||
@ -881,12 +878,11 @@ static int append(void)
|
|||||||
|
|
||||||
static int scopeid(void)
|
static int scopeid(void)
|
||||||
{
|
{
|
||||||
CURLU *u;
|
CURLU *u = curl_url();
|
||||||
int error = 0;
|
int error = 0;
|
||||||
CURLUcode rc;
|
CURLUcode rc;
|
||||||
char *url;
|
char *url;
|
||||||
|
|
||||||
u = curl_url();
|
|
||||||
rc = curl_url_set(u, CURLUPART_URL,
|
rc = curl_url_set(u, CURLUPART_URL,
|
||||||
"https://[fe80::20c:29ff:fe9c:409b%25eth0]/hello.html", 0);
|
"https://[fe80::20c:29ff:fe9c:409b%25eth0]/hello.html", 0);
|
||||||
if(rc != CURLUE_OK) {
|
if(rc != CURLUE_OK) {
|
||||||
|
@ -27,12 +27,11 @@
|
|||||||
|
|
||||||
int test(char *URL)
|
int test(char *URL)
|
||||||
{
|
{
|
||||||
CURLM *cm = NULL;
|
|
||||||
CURLSH *sh = NULL;
|
CURLSH *sh = NULL;
|
||||||
CURL *ch = NULL;
|
CURL *ch = NULL;
|
||||||
int unfinished;
|
int unfinished;
|
||||||
|
|
||||||
cm = curl_multi_init();
|
CURLM *cm = curl_multi_init();
|
||||||
if(!cm)
|
if(!cm)
|
||||||
return 1;
|
return 1;
|
||||||
sh = curl_share_init();
|
sh = curl_share_init();
|
||||||
|
@ -97,7 +97,7 @@ int test(char *URL)
|
|||||||
test_setopt(curl, CURLOPT_READDATA, hd_src);
|
test_setopt(curl, CURLOPT_READDATA, hd_src);
|
||||||
|
|
||||||
/* Now run off and do what you've been told! */
|
/* Now run off and do what you've been told! */
|
||||||
res = curl_easy_perform(curl);
|
curl_easy_perform(curl);
|
||||||
|
|
||||||
/* and now upload the exact same again, but without rewinding so it already
|
/* and now upload the exact same again, but without rewinding so it already
|
||||||
is at end of file */
|
is at end of file */
|
||||||
|
@ -39,9 +39,8 @@ int test(char *URL)
|
|||||||
char *rtsp_session_id;
|
char *rtsp_session_id;
|
||||||
int request = 1;
|
int request = 1;
|
||||||
int i;
|
int i;
|
||||||
FILE *idfile = NULL;
|
|
||||||
|
|
||||||
idfile = fopen(libtest_arg2, "wb");
|
FILE *idfile = fopen(libtest_arg2, "wb");
|
||||||
if(idfile == NULL) {
|
if(idfile == NULL) {
|
||||||
fprintf(stderr, "couldn't open the Session ID File\n");
|
fprintf(stderr, "couldn't open the Session ID File\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
|
@ -104,9 +104,8 @@ int test(char *URL)
|
|||||||
CURL *curl;
|
CURL *curl;
|
||||||
char *stream_uri = NULL;
|
char *stream_uri = NULL;
|
||||||
int request = 1;
|
int request = 1;
|
||||||
FILE *protofile = NULL;
|
|
||||||
|
|
||||||
protofile = fopen(libtest_arg2, "wb");
|
FILE *protofile = fopen(libtest_arg2, "wb");
|
||||||
if(protofile == NULL) {
|
if(protofile == NULL) {
|
||||||
fprintf(stderr, "Couldn't open the protocol dump file\n");
|
fprintf(stderr, "Couldn't open the protocol dump file\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
|
@ -749,10 +749,6 @@ static bool incoming(curl_socket_t listenfd)
|
|||||||
fd_set fds_read;
|
fd_set fds_read;
|
||||||
fd_set fds_write;
|
fd_set fds_write;
|
||||||
fd_set fds_err;
|
fd_set fds_err;
|
||||||
curl_socket_t sockfd = CURL_SOCKET_BAD;
|
|
||||||
int maxfd = -99;
|
|
||||||
ssize_t rc;
|
|
||||||
int error = 0;
|
|
||||||
int clients = 0; /* connected clients */
|
int clients = 0; /* connected clients */
|
||||||
struct perclient c[2];
|
struct perclient c[2];
|
||||||
|
|
||||||
@ -772,15 +768,17 @@ static bool incoming(curl_socket_t listenfd)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
int i;
|
int i;
|
||||||
|
ssize_t rc;
|
||||||
|
int error = 0;
|
||||||
|
curl_socket_t sockfd = listenfd;
|
||||||
|
int maxfd = (int)sockfd;
|
||||||
|
|
||||||
FD_ZERO(&fds_read);
|
FD_ZERO(&fds_read);
|
||||||
FD_ZERO(&fds_write);
|
FD_ZERO(&fds_write);
|
||||||
FD_ZERO(&fds_err);
|
FD_ZERO(&fds_err);
|
||||||
|
|
||||||
sockfd = listenfd;
|
|
||||||
/* there's always a socket to wait for */
|
/* there's always a socket to wait for */
|
||||||
FD_SET(sockfd, &fds_read);
|
FD_SET(sockfd, &fds_read);
|
||||||
maxfd = (int)sockfd;
|
|
||||||
|
|
||||||
for(i = 0; i < 2; i++) {
|
for(i = 0; i < 2; i++) {
|
||||||
if(c[i].used) {
|
if(c[i].used) {
|
||||||
|
Loading…
Reference in New Issue
Block a user