mirror of
https://github.com/curl/curl.git
synced 2026-08-25 16:33:38 +03:00
code: style updates
This commit is contained in:
parent
9d194a1143
commit
a71012c03e
85 changed files with 249 additions and 248 deletions
18
lib/tftp.c
18
lib/tftp.c
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -312,14 +312,14 @@ static const char *tftp_option_get(const char *buf, size_t len,
|
|||
{
|
||||
size_t loc;
|
||||
|
||||
loc = Curl_strnlen( buf, len );
|
||||
loc = Curl_strnlen(buf, len);
|
||||
loc++; /* NULL term */
|
||||
|
||||
if(loc >= len)
|
||||
return NULL;
|
||||
*option = buf;
|
||||
|
||||
loc += Curl_strnlen( buf+loc, len-loc );
|
||||
loc += Curl_strnlen(buf+loc, len-loc);
|
||||
loc++; /* NULL term */
|
||||
|
||||
if(loc > len)
|
||||
|
|
@ -352,7 +352,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
|
|||
if(checkprefix(option, TFTP_OPTION_BLKSIZE)) {
|
||||
long blksize;
|
||||
|
||||
blksize = strtol( value, NULL, 10 );
|
||||
blksize = strtol(value, NULL, 10);
|
||||
|
||||
if(!blksize) {
|
||||
failf(data, "invalid blocksize value in OACK packet");
|
||||
|
|
@ -384,7 +384,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
|
|||
else if(checkprefix(option, TFTP_OPTION_TSIZE)) {
|
||||
long tsize = 0;
|
||||
|
||||
tsize = strtol( value, NULL, 10 );
|
||||
tsize = strtol(value, NULL, 10);
|
||||
infof(data, "%s (%ld)\n", "tsize parsed from OACK", tsize);
|
||||
|
||||
/* tsize should be ignored on upload: Who cares about the size of the
|
||||
|
|
@ -405,7 +405,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
|
|||
static size_t tftp_option_add(tftp_state_data_t *state, size_t csize,
|
||||
char *buf, const char *option)
|
||||
{
|
||||
if(( strlen(option) + csize + 1 ) > (size_t)state->blksize)
|
||||
if(( strlen(option) + csize + 1) > (size_t)state->blksize)
|
||||
return 0;
|
||||
strcpy(buf, option);
|
||||
return strlen(option) + 1;
|
||||
|
|
@ -514,7 +514,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
|
|||
(char *)state->spacket.data+sbytes,
|
||||
TFTP_OPTION_BLKSIZE);
|
||||
sbytes += tftp_option_add(state, sbytes,
|
||||
(char *)state->spacket.data+sbytes, buf );
|
||||
(char *)state->spacket.data+sbytes, buf);
|
||||
|
||||
/* add timeout option */
|
||||
snprintf(buf, sizeof(buf), "%d", state->retry_time);
|
||||
|
|
@ -522,7 +522,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
|
|||
(char *)state->spacket.data+sbytes,
|
||||
TFTP_OPTION_INTERVAL);
|
||||
sbytes += tftp_option_add(state, sbytes,
|
||||
(char *)state->spacket.data+sbytes, buf );
|
||||
(char *)state->spacket.data+sbytes, buf);
|
||||
}
|
||||
|
||||
/* the typecase for the 3rd argument is mostly for systems that do
|
||||
|
|
@ -960,7 +960,7 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done)
|
|||
/* alloc pkt buffers based on specified blksize */
|
||||
if(conn->data->set.tftp_blksize) {
|
||||
blksize = (int)conn->data->set.tftp_blksize;
|
||||
if(blksize > TFTP_BLKSIZE_MAX || blksize < TFTP_BLKSIZE_MIN )
|
||||
if(blksize > TFTP_BLKSIZE_MAX || blksize < TFTP_BLKSIZE_MIN)
|
||||
return CURLE_TFTP_ILLEGAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue