diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 3341686d9..8cb92d76e 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -421,7 +421,7 @@ static bool init_resolve_thread (struct connectdata *conn, socket error string function can be used for this pupose. */ static const char *gai_strerror(int ecode) { - switch (ecode){ + switch (ecode) { case EAI_AGAIN: return "The name could not be resolved at this time"; case EAI_BADFLAGS: diff --git a/lib/axtls.c b/lib/axtls.c index ffbd1d4f3..990264b93 100644 --- a/lib/axtls.c +++ b/lib/axtls.c @@ -58,7 +58,7 @@ static int SSL_read(SSL *ssl, void *buf, int num) while((ret = ssl_read(ssl, &read_buf)) == SSL_OK); - if(ret > SSL_OK){ + if(ret > SSL_OK) { memcpy(buf, read_buf, ret > num ? num : ret); } @@ -187,10 +187,10 @@ Curl_axtls_connect(struct connectdata *conn, /* Load the trusted CA cert bundle file */ if(data->set.ssl.CAfile) { if(ssl_obj_load(ssl_ctx, SSL_OBJ_X509_CACERT, data->set.ssl.CAfile, NULL) - != SSL_OK){ + != SSL_OK) { infof(data, "error reading ca cert file %s \n", data->set.ssl.CAfile); - if(data->set.ssl.verifypeer){ + if(data->set.ssl.verifypeer) { Curl_axtls_close(conn, sockindex); return CURLE_SSL_CACERT_BADFILE; } @@ -208,13 +208,13 @@ Curl_axtls_connect(struct connectdata *conn, */ /* Load client certificate */ - if(data->set.str[STRING_CERT]){ + if(data->set.str[STRING_CERT]) { i=0; /* Instead of trying to analyze cert type here, let axTLS try them all. */ - while(cert_types[i] != 0){ + while(cert_types[i] != 0) { ssl_fcn_return = ssl_obj_load(ssl_ctx, cert_types[i], data->set.str[STRING_CERT], NULL); - if(ssl_fcn_return == SSL_OK){ + if(ssl_fcn_return == SSL_OK) { infof(data, "successfully read cert file %s \n", data->set.str[STRING_CERT]); break; @@ -222,7 +222,7 @@ Curl_axtls_connect(struct connectdata *conn, i++; } /* Tried all cert types, none worked. */ - if(cert_types[i] == 0){ + if(cert_types[i] == 0) { failf(data, "%s is not x509 or pkcs12 format", data->set.str[STRING_CERT]); Curl_axtls_close(conn, sockindex); @@ -233,13 +233,13 @@ Curl_axtls_connect(struct connectdata *conn, /* Load client key. If a pkcs12 file successfully loaded a cert, then there's nothing to do because the key has already been loaded. */ - if(data->set.str[STRING_KEY] && cert_types[i] != SSL_OBJ_PKCS12){ + if(data->set.str[STRING_KEY] && cert_types[i] != SSL_OBJ_PKCS12) { i=0; /* Instead of trying to analyze key type here, let axTLS try them all. */ - while(key_types[i] != 0){ + while(key_types[i] != 0) { ssl_fcn_return = ssl_obj_load(ssl_ctx, key_types[i], data->set.str[STRING_KEY], NULL); - if(ssl_fcn_return == SSL_OK){ + if(ssl_fcn_return == SSL_OK) { infof(data, "successfully read key file %s \n", data->set.str[STRING_KEY]); break; @@ -247,7 +247,7 @@ Curl_axtls_connect(struct connectdata *conn, i++; } /* Tried all key types, none worked. */ - if(key_types[i] == 0){ + if(key_types[i] == 0) { failf(data, "Failure: %s is not a supported key file", data->set.str[STRING_KEY]); Curl_axtls_close(conn, sockindex); @@ -273,7 +273,7 @@ Curl_axtls_connect(struct connectdata *conn, /* Check to make sure handshake was ok. */ ssl_fcn_return = ssl_handshake_status(ssl); - if(ssl_fcn_return != SSL_OK){ + if(ssl_fcn_return != SSL_OK) { Curl_axtls_close(conn, sockindex); ssl_display_error(ssl_fcn_return); /* goes to stdout. */ return map_error_to_curl(ssl_fcn_return); @@ -285,8 +285,8 @@ Curl_axtls_connect(struct connectdata *conn, */ /* Verify server's certificate */ - if(data->set.ssl.verifypeer){ - if(ssl_verify_cert(ssl) != SSL_OK){ + if(data->set.ssl.verifypeer) { + if(ssl_verify_cert(ssl) != SSL_OK) { Curl_axtls_close(conn, sockindex); failf(data, "server cert verify failed"); return CURLE_SSL_CONNECT_ERROR; @@ -415,7 +415,7 @@ int Curl_axtls_shutdown(struct connectdata *conn, int sockindex) nread = (ssize_t)SSL_read(conn->ssl[sockindex].ssl, buf, sizeof(buf)); - if(nread < SSL_OK){ + if(nread < SSL_OK) { failf(data, "close notify alert not received during shutdown"); retval = -1; } @@ -447,13 +447,13 @@ static ssize_t axtls_recv(struct connectdata *conn, /* connection data */ infof(conn->data, " axtls_recv\n"); - if(connssl){ + if(connssl) { ret = (ssize_t)SSL_read(conn->ssl[num].ssl, buf, (int)buffersize); /* axTLS isn't terribly generous about error reporting */ /* With patched axTLS, SSL_CLOSE_NOTIFY=-3. Hard-coding until axTLS team approves proposed fix. */ - if(ret == -3 ){ + if(ret == -3 ) { Curl_axtls_close(conn, num); } else if(ret < 0) { diff --git a/lib/fileinfo.c b/lib/fileinfo.c index 5495f560d..dbae7da51 100644 --- a/lib/fileinfo.c +++ b/lib/fileinfo.c @@ -49,9 +49,8 @@ void Curl_fileinfo_dtor(void *user, void *element) if(!finfo) return; - if(finfo->b_data){ + if(finfo->b_data) free(finfo->b_data); - } free(finfo); } diff --git a/lib/ftp.c b/lib/ftp.c index d758301f5..bfc0a78a1 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -279,7 +279,7 @@ static void freedirs(struct ftp_conn *ftpc) { int i; if(ftpc->dirs) { - for(i=0; i < ftpc->dirdepth; i++){ + for(i=0; i < ftpc->dirdepth; i++) { if(ftpc->dirs[i]) { free(ftpc->dirs[i]); ftpc->dirs[i]=NULL; diff --git a/lib/krb4.c b/lib/krb4.c index 7da47f31f..0915b0248 100644 --- a/lib/krb4.c +++ b/lib/krb4.c @@ -264,7 +264,7 @@ krb4_auth(void *app_data, struct connectdata *conn) if(Curl_GetFTPResponse(&nread, conn, NULL)) return -1; - if(data->state.buffer[0] != '2'){ + if(data->state.buffer[0] != '2') { Curl_failf(data, "Server didn't accept auth data"); return AUTH_ERROR; } @@ -349,7 +349,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn) if(result) return result; - if(conn->data->state.buffer[0] != '3'){ + if(conn->data->state.buffer[0] != '3') { krb4_set_command_prot(conn, save); return CURLE_FTP_WEIRD_SERVER_REPLY; } diff --git a/lib/krb5.c b/lib/krb5.c index f128d515f..0233b9373 100644 --- a/lib/krb5.c +++ b/lib/krb5.c @@ -289,7 +289,7 @@ krb5_auth(void *app_data, struct connectdata *conn) break; } - if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3'){ + if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3') { Curl_infof(data, "Server didn't accept auth data\n"); ret = AUTH_ERROR; break; diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index 6d42af3a5..5e1bcba8e 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -283,7 +283,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } if(check_sspi_err(data,sspi_major_status,sspi_minor_status, - "InitializeSecurityContextA") ){ + "InitializeSecurityContextA") ) { free(service_name); service_name=NULL; s_pSecFn->FreeCredentialsHandle(&cred_handle); @@ -416,7 +416,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, &names); s_pSecFn->FreeCredentialsHandle(&cred_handle); if(check_sspi_err(data,sspi_major_status,sspi_minor_status, - "QueryCredentialAttributes") ){ + "QueryCredentialAttributes") ) { s_pSecFn->DeleteSecurityContext(&sspi_context); s_pSecFn->FreeContextBuffer(names.sUserName); failf(data, "Failed to determine user name."); @@ -499,7 +499,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, sspi_w_token[1].cbBuffer = 1; sspi_w_token[1].pvBuffer = malloc(1); - if(!sspi_w_token[1].pvBuffer){ + if(!sspi_w_token[1].pvBuffer) { s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_OUT_OF_MEMORY; diff --git a/lib/ssh.c b/lib/ssh.c index 1c14b34d5..89bed4527 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -1581,7 +1581,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) SEEK_SET); } - if(seekerr != CURL_SEEKFUNC_OK){ + if(seekerr != CURL_SEEKFUNC_OK) { if(seekerr != CURL_SEEKFUNC_CANTSEEK) { failf(data, "Could not seek stream"); diff --git a/lib/tftp.c b/lib/tftp.c index 46b3ecfcb..24068fccb 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -627,7 +627,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) } /* Check if completed (That is, a less than full packet is received) */ - if(state->rbytes < (ssize_t)state->blksize+4){ + if(state->rbytes < (ssize_t)state->blksize+4) { state->state = TFTP_STATE_FIN; } else {