mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:23:33 +03:00
cppcheck: fix warnings
- Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
This commit is contained in:
parent
38203f1585
commit
c45360d463
61 changed files with 213 additions and 273 deletions
13
lib/ftp.c
13
lib/ftp.c
|
|
@ -239,8 +239,8 @@ static void close_secondarysocket(struct connectdata *conn)
|
|||
|
||||
static void freedirs(struct ftp_conn *ftpc)
|
||||
{
|
||||
int i;
|
||||
if(ftpc->dirs) {
|
||||
int i;
|
||||
for(i = 0; i < ftpc->dirdepth; i++) {
|
||||
free(ftpc->dirs[i]);
|
||||
ftpc->dirs[i] = NULL;
|
||||
|
|
@ -637,8 +637,6 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
|
|||
* line in a response or continue reading. */
|
||||
|
||||
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
|
||||
time_t timeout; /* timeout in milliseconds */
|
||||
time_t interval_ms;
|
||||
struct Curl_easy *data = conn->data;
|
||||
CURLcode result = CURLE_OK;
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
|
|
@ -657,7 +655,8 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
|
|||
|
||||
while(!*ftpcode && !result) {
|
||||
/* check and reset timeout value every lap */
|
||||
timeout = Curl_pp_state_timeout(pp);
|
||||
time_t timeout = Curl_pp_state_timeout(pp); /* timeout in milliseconds */
|
||||
time_t interval_ms;
|
||||
|
||||
if(timeout <= 0) {
|
||||
failf(data, "FTP response timeout");
|
||||
|
|
@ -1589,7 +1588,6 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
|
|||
struct FTP *ftp = conn->data->req.protop;
|
||||
struct Curl_easy *data = conn->data;
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
int seekerr = CURL_SEEKFUNC_OK;
|
||||
|
||||
if((data->state.resume_from && !sizechecked) ||
|
||||
((data->state.resume_from > 0) && sizechecked)) {
|
||||
|
|
@ -1605,6 +1603,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
|
|||
/* 3. pass file-size number of bytes in the source file */
|
||||
/* 4. lower the infilesize counter */
|
||||
/* => transfer as usual */
|
||||
int seekerr = CURL_SEEKFUNC_OK;
|
||||
|
||||
if(data->state.resume_from < 0) {
|
||||
/* Got no given size to start from, figure it out */
|
||||
|
|
@ -2782,7 +2781,6 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
|||
char *ptr = &data->state.buffer[4]; /* start on the first letter */
|
||||
const size_t buf_size = data->set.buffer_size;
|
||||
char *dir;
|
||||
char *store;
|
||||
bool entry_extracted = FALSE;
|
||||
|
||||
dir = malloc(nread + 1);
|
||||
|
|
@ -2805,6 +2803,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
|||
|
||||
if('\"' == *ptr) {
|
||||
/* it started good */
|
||||
char *store;
|
||||
ptr++;
|
||||
for(store = dir; *ptr;) {
|
||||
if('\"' == *ptr) {
|
||||
|
|
@ -4384,7 +4383,6 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
|
|||
{
|
||||
struct Curl_easy *data = conn->data;
|
||||
char *type;
|
||||
char command;
|
||||
struct FTP *ftp;
|
||||
|
||||
conn->data->req.protop = ftp = malloc(sizeof(struct FTP));
|
||||
|
|
@ -4402,6 +4400,7 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
|
|||
type = strstr(conn->host.rawalloc, ";type=");
|
||||
|
||||
if(type) {
|
||||
char command;
|
||||
*type = 0; /* it was in the middle of the hostname */
|
||||
command = Curl_raw_toupper(type[6]);
|
||||
conn->bits.type_set = TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue