Mercurial > gftp.yaz
changeset 516:fbb5a02beddb
2004-7-26 Brian Masney <masneyb@gftp.org>
* lib/config_file.c lib/local.c lib/ftps.c lib/gftp.h lib/httpcommon.h
lib/https.c lib/misc.c lib/protocols.c lib/pty.c lib/rfc2068.c
lib/rfc959.c lib/sshv2.c - various fixes found through a static code
analysis checker. (some signed/unsigned fixes, removed unneeded casts,
removed unneeded variables, more consistency, largefile fixes). Thanks
to Derek M Jones for running the static code analysis for me
* lib/cache.c - s/remove/del_entry/g
* lib/bookmark.c lib/protocols.c (gftp_parse_bookmark) - allow
the third parameter of this function to be a NULL pointer
author | masneyb |
---|---|
date | Tue, 27 Jul 2004 02:46:54 +0000 |
parents | cb78cf311d23 |
children | 648bf2825ea9 |
files | ChangeLog lib/bookmark.c lib/cache.c lib/config_file.c lib/ftps.c lib/gftp.h lib/httpcommon.h lib/https.c lib/local.c lib/misc.c lib/protocols.c lib/pty.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c |
diffstat | 15 files changed, 167 insertions(+), 149 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Jul 26 09:51:07 2004 +0000 +++ b/ChangeLog Tue Jul 27 02:46:54 2004 +0000 @@ -1,4 +1,16 @@ 2004-7-26 Brian Masney <masneyb@gftp.org> + * lib/config_file.c lib/local.c lib/ftps.c lib/gftp.h lib/httpcommon.h + lib/https.c lib/misc.c lib/protocols.c lib/pty.c lib/rfc2068.c + lib/rfc959.c lib/sshv2.c - various fixes found through a static code + analysis checker. (some signed/unsigned fixes, removed unneeded casts, + removed unneeded variables, more consistency, largefile fixes). Thanks + to Derek M Jones for running the static code analysis for me + + * lib/cache.c - s/remove/del_entry/g + + * lib/bookmark.c lib/protocols.c (gftp_parse_bookmark) - allow + the third parameter of this function to be a NULL pointer + * lib/pty.c - give the grantpt pty implementation more priority over using openpty() @@ -2639,7 +2651,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.293 2004/07/26 09:51:07 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.294 2004/07/27 02:46:54 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/bookmark.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/bookmark.c Tue Jul 27 02:46:54 2004 +0000 @@ -25,7 +25,6 @@ bookmark_parse_url (gftp_request * request, const char * url) { const char * pos; - int update_local; g_return_val_if_fail (request != NULL, GFTP_EFATAL); g_return_val_if_fail (url != NULL, GFTP_EFATAL); @@ -43,7 +42,7 @@ else pos = url; - return (gftp_parse_bookmark (request, NULL, pos, &update_local)); + return (gftp_parse_bookmark (request, NULL, pos, NULL)); }
--- a/lib/cache.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/cache.c Tue Jul 27 02:46:54 2004 +0000 @@ -296,12 +296,11 @@ int ignore_directory) { char *oldindexfile, *newindexfile, buf[BUFSIZ], description[BUFSIZ]; + int indexfd, newfd, del_entry; gftp_getline_buffer * rbuf; gftp_cache_entry centry; - int indexfd, newfd; size_t len; time_t now; - int remove; g_return_if_fail (request != NULL || descr != NULL); @@ -341,22 +340,22 @@ if (gftp_parse_cache_line (request, ¢ry, buf) < 0) continue; - remove = 0; + del_entry = 0; if (centry.expiration_date < now) - remove = 1; + del_entry = 1; else if (ignore_directory) { if (strncmp (centry.url, description, strlen (description)) == 0) - remove = 1; + del_entry = 1; } else { if (strcmp (centry.url, description) == 0) - remove = 1; + del_entry = 1; } - if (remove) + if (del_entry) unlink (centry.file); else {
--- a/lib/config_file.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/config_file.c Tue Jul 27 02:46:54 2004 +0000 @@ -203,15 +203,15 @@ { len = strlen (buf); if (len > 0 && buf[len - 1] == '\n') - buf[--len] = '\0'; + buf[--len] = '\0'; if (len > 0 && buf[len - 1] == '\r') - buf[--len] = '\0'; + buf[--len] = '\0'; line++; if (*buf == '[') { newentry = g_malloc0 (sizeof (*newentry)); - for (; buf[len - 1] == ' ' || buf[len - 1] == ']'; buf[--len] = '\0'); + for (; buf[len - 1] == ' ' || buf[len - 1] == ']'; buf[--len] = '\0'); newentry->path = g_strdup (buf + 1); newentry->isfolder = 0; gftp_add_bookmark (newentry); @@ -391,17 +391,14 @@ numargs--; } va_end (argp); - return (1); + return (ret); } static void * gftp_config_read_str (char *buf, int line) { - char *ret; - - ret = g_strdup (buf); - return (ret); + return (g_strdup (buf)); } @@ -493,7 +490,7 @@ } -gftp_config_list_vars gftp_config_list[] = { +static gftp_config_list_vars gftp_config_list[] = { {"dont_use_proxy", gftp_config_read_proxy, gftp_config_write_proxy, NULL, 0, N_("This section specifies which hosts are on the local subnet and won't need to go out the proxy server (if available). Syntax: dont_use_proxy=.domain or dont_use_proxy=network number/netmask")}, @@ -1323,10 +1320,10 @@ newconfigvar.value = nc_ptr; newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM; - ret = gftp_option_types[newconfigvar.otype].compare_function (&newconfigvar, tmpconfigvar); + ret = gftp_option_types[tmpconfigvar->otype].compare_function (&newconfigvar, tmpconfigvar); if (ret != 0) { - gftp_option_types[newconfigvar.otype].copy_function (&newconfigvar, tmpconfigvar); + gftp_option_types[tmpconfigvar->otype].copy_function (&newconfigvar, tmpconfigvar); gftp_configuration_changed = 1; } } @@ -1351,7 +1348,7 @@ newconfigvar.value = nc_ptr; newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM; - gftp_option_types[newconfigvar.otype].copy_function (&newconfigvar, cv); + gftp_option_types[cv->otype].copy_function (&newconfigvar, cv); } @@ -1417,7 +1414,7 @@ memcpy (&newconfigvar.value, &value, sizeof (newconfigvar.value)); newconfigvar.flags &= ~GFTP_CVARS_FLAGS_DYNMEM; - ret = gftp_option_types[newconfigvar.otype].compare_function (&newconfigvar, tmpconfigvar); + ret = gftp_option_types[tmpconfigvar->otype].compare_function (&newconfigvar, tmpconfigvar); if (ret == 0) return;
--- a/lib/ftps.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/ftps.c Tue Jul 27 02:46:54 2004 +0000 @@ -27,7 +27,8 @@ ftps_get_next_file (gftp_request * request, gftp_file * fle, int fd) { rfc959_parms * params; - int ret, resetptr; + int resetptr; + size_t ret; params = request->protocol_data; if (request->cached)
--- a/lib/gftp.h Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/gftp.h Tue Jul 27 02:46:54 2004 +0000 @@ -103,7 +103,7 @@ #ifdef HAVE_GETADDRINFO #define HAVE_IPV6 -#define GFTP_GET_AI_FAMILY(request) (request != NULL && request->hostp != NULL ? request->hostp->ai_family : -1) +#define GFTP_GET_AI_FAMILY(request) ((request) != NULL && (request)->hostp != NULL ? (request)->hostp->ai_family : -1) #else #define GFTP_GET_AI_FAMILY(request) AF_INET #endif @@ -157,6 +157,12 @@ # define GFTP_LOG_FUNCTION_ATTRIBUTES #endif +#if defined (_LARGEFILE_SOURCE) +#define GFTP_OFF_T_PRINTF_MOD "%'lld" +#else +#define GFTP_OFF_T_PRINTF_MOD "%'ld" +#endif + /* Server types (used by FTP protocol from SYST command) */ #define GFTP_DIRTYPE_UNIX 1 #define GFTP_DIRTYPE_EPLF 2 @@ -582,7 +588,7 @@ *filename, /* The xpm file to display */ *view_program, /* The program used to view this file */ *ascii_binary; /* Is this a ASCII transfer or a BINARY transfer */ - int stlen; /* How long is the file extension. */ + unsigned int stlen; /* How long is the file extension. */ } gftp_file_extensions; @@ -957,7 +963,7 @@ int gftp_connect_server ( gftp_request * request, char *service, char *proxy_hostname, - int proxy_port ); + unsigned int proxy_port ); #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR)
--- a/lib/httpcommon.h Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/httpcommon.h Tue Jul 27 02:46:54 2004 +0000 @@ -22,9 +22,9 @@ typedef struct rfc2068_params_tag { gftp_getline_buffer * rbuf; - unsigned long read_bytes, - content_length; - long chunk_size; + unsigned long read_bytes; + off_t chunk_size, + content_length; unsigned int chunked_transfer : 1, eof : 1; ssize_t (*real_read_function) ( gftp_request * request,
--- a/lib/https.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/https.c Tue Jul 27 02:46:54 2004 +0000 @@ -27,7 +27,8 @@ https_get_next_file (gftp_request * request, gftp_file * fle, int fd) { rfc2068_params * params; - int ret, resetptr; + int resetptr; + size_t ret; params = request->protocol_data; if (request->cached)
--- a/lib/local.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/local.c Tue Jul 27 02:46:54 2004 +0000 @@ -539,7 +539,8 @@ g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); g_return_val_if_fail (file != NULL, GFTP_EFATAL); - time_buf.modtime = time_buf.actime = datetime; + time_buf.modtime = datetime; + time_buf.actime = datetime; return (utime (file, &time_buf) == 0 ? 0 : GFTP_ERETRYABLE); }
--- a/lib/misc.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/misc.c Tue Jul 27 02:46:54 2004 +0000 @@ -17,10 +17,9 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ /*****************************************************************************/ -static const char cvsid[] = "$Id$"; - #include "gftp.h" #include "options.h" +static const char cvsid[] = "$Id$"; #ifdef HAVE_INTL_PRINTF @@ -28,21 +27,9 @@ insert_commas (off_t number, char *dest_str, size_t dest_len) { if (dest_str != NULL) - { -#if defined (_LARGEFILE_SOURCE) - g_snprintf (dest_str, dest_len, "%'lld", (long long) number); -#else - g_snprintf (dest_str, dest_len, "%'ld", number); -#endif - } + g_snprintf (dest_str, dest_len, GFTP_OFF_T_PRINTF_MOD, number); else - { -#if defined (_LARGEFILE_SOURCE) - dest_str = g_strdup_printf ("%'lld", (long long) number); -#else - dest_str = g_strdup_printf ("%'ld", number); -#endif - } + dest_str = g_strdup_printf (GFTP_OFF_T_PRINTF_MOD, number); return (dest_str); } @@ -56,11 +43,7 @@ size_t num, rem, srclen; int len, i; -#if defined (_LARGEFILE_SOURCE) - g_snprintf (src, sizeof (src), "%lld", (long long) number); -#else - g_snprintf (src, sizeof (src), "%ld", number); -#endif + g_snprintf (src, sizeof (src), GFTP_OFF_T_PRINTF_MOD, number); if (dest_str != NULL) *dest_str = '\0'; @@ -890,7 +873,7 @@ else { #if defined (_LARGEFILE_SOURCE) - tempstr2 = g_strdup_printf ("%11lld", (long long) fle->size); + tempstr2 = g_strdup_printf ("%11lld", fle->size); #else tempstr2 = g_strdup_printf ("%11ld", fle->size); #endif
--- a/lib/protocols.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/protocols.c Tue Jul 27 02:46:54 2004 +0000 @@ -643,14 +643,14 @@ gftp_set_directory (request, tempentry->remote_dir); gftp_set_port (request, tempentry->port); - if (local_request != NULL && - tempentry->local_dir != NULL && + if (local_request != NULL && tempentry->local_dir != NULL && *tempentry->local_dir != '\0') { gftp_set_directory (local_request, tempentry->local_dir); - *refresh_local = 1; + if (refresh_local != NULL) + *refresh_local = 1; } - else + else if (refresh_local != NULL) *refresh_local = 0; for (i = 0; gftp_protocols[i].name; i++) @@ -1053,7 +1053,8 @@ char *pos; #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) struct addrinfo hints; - int port, errnum; + unsigned int port; + int errnum; char serv[8]; #endif @@ -1128,7 +1129,7 @@ if (hostname->ipv4_network_address != 0) { - memcpy (addy, addr, sizeof (addy)); + memcpy (addy, addr, sizeof (*addy)); netaddr = (((addy[0] & 0xff) << 24) | ((addy[1] & 0xff) << 16) | ((addy[2] & 0xff) << 8) | (addy[3] & 0xff)) & @@ -1175,10 +1176,7 @@ while (*pos != ' ' && *pos != '\t' && *pos != '\0') pos++; - if (pos == '\0') - return (pos); - - while ((*pos == ' ' || *pos == '\t') && *pos != '\0') + while (*pos == ' ' || *pos == '\t') pos++; return (pos); @@ -1477,15 +1475,15 @@ startpos++; switch (*startpos) { - case '/': - isdir = 1; - break; - case 's': - fle->size = gftp_parse_file_size (startpos + 1); - break; - case 'm': - fle->datetime = strtol (startpos + 1, NULL, 10); - break; + case '/': + isdir = 1; + break; + case 's': + fle->size = gftp_parse_file_size (startpos + 1); + break; + case 'm': + fle->datetime = strtol (startpos + 1, NULL, 10); + break; } startpos = strchr (startpos, ','); } @@ -1774,9 +1772,9 @@ static GHashTable * gftp_gen_dir_hash (gftp_request * request, int *ret) { - unsigned long *newsize; GHashTable * dirhash; gftp_file * fle; + off_t *newsize; char * newname; dirhash = g_hash_table_new (string_hash_function, string_hash_compare); @@ -1787,7 +1785,7 @@ while (gftp_get_next_file (request, NULL, fle) > 0) { newname = fle->file; - newsize = g_malloc (sizeof (unsigned long)); + newsize = g_malloc (sizeof (*newsize)); *newsize = fle->size; g_hash_table_insert (dirhash, newname, newsize); fle->file = NULL; @@ -1826,10 +1824,10 @@ static GList * gftp_get_dir_listing (gftp_transfer * transfer, int getothdir, int *ret) { - unsigned long *newsize; GHashTable * dirhash; GList * templist; gftp_file * fle; + off_t *newsize; char *newname; if (getothdir && transfer->toreq) @@ -1897,9 +1895,9 @@ char *oldfromdir, *oldtodir, *newname, *pos; int forcecd, remotechanged, ret; GList * templist, * lastlist; - unsigned long *newsize; GHashTable * dirhash; gftp_file * curfle; + off_t *newsize; mode_t st_mode; g_return_val_if_fail (transfer != NULL, GFTP_EFATAL); @@ -2070,21 +2068,26 @@ int gftp_connect_server (gftp_request * request, char *service, - char *proxy_hostname, int proxy_port) + char *proxy_hostname, unsigned int proxy_port) { char *connect_host, *disphost; - int port, sock; + unsigned int port; + int sock = -1; #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) struct addrinfo hints, *res; intptr_t enable_ipv6; char serv[8]; int errnum; - if ((request->use_proxy = gftp_need_proxy (request, service, - proxy_hostname, proxy_port)) < 0) - return (request->use_proxy); - else if (request->use_proxy == 1) - request->hostp = NULL; + if ((errnum = gftp_need_proxy (request, service, proxy_hostname, + proxy_port)) < 0) + return (errnum); + else + { + request->use_proxy = errnum; + if (request->use_proxy) + request->hostp = NULL; + } gftp_lookup_request_option (request, "enable_ipv6", &enable_ipv6); @@ -2181,6 +2184,8 @@ else if (request->use_proxy == 1) request->hostp = NULL; + g_return_val_if_fail (sock != -1, GFTP_EFATAL); + if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { request->logging_function (gftp_logging_error, request, @@ -2317,7 +2322,7 @@ #if defined (_LARGEFILE_SOURCE) printf ("%s:%s:%lld:%lld:%s:%s:%s\n", tempfle->file, tempfle->destfile, - (long long) tempfle->size, (long long) tempfle->startsize, + tempfle->size, tempfle->startsize, tempfle->user, tempfle->group, attribs); #else printf ("%s:%s:%ld:%ld:%s:%s:%s\n", @@ -2340,7 +2345,7 @@ #if defined (_LARGEFILE_SOURCE) printf ("%s:%s:%lld:%lld:%s:%s:%s\n", tempfle->file, tempfle->destfile, - (long long) tempfle->size, (long long) tempfle->startsize, + tempfle->size, tempfle->startsize, tempfle->user, tempfle->group, attribs); #else printf ("%s:%s:%ld:%ld:%s:%s:%s\n", @@ -2370,11 +2375,12 @@ gftp_get_line (gftp_request * request, gftp_getline_buffer ** rbuf, char * str, size_t len, int fd) { - ssize_t ret, retval, rlen; - char *pos, *nextpos; ssize_t (*read_function) (gftp_request * request, void *ptr, size_t size, int fd); + char *pos, *nextpos; + size_t rlen, nslen; int end_of_buffer; + ssize_t ret; if (request == NULL || request->read_function == NULL) read_function = gftp_fd_read; @@ -2398,8 +2404,8 @@ (*rbuf)->curpos = (*rbuf)->buffer; } - retval = GFTP_ERETRYABLE; - do + ret = 0; + while (1) { pos = strchr ((*rbuf)->curpos, '\n'); end_of_buffer = (*rbuf)->curpos == (*rbuf)->buffer && @@ -2409,7 +2415,7 @@ { if (pos != NULL) { - retval = pos - (*rbuf)->curpos + 1; + nslen = pos - (*rbuf)->curpos + 1; nextpos = pos + 1; if (pos > (*rbuf)->curpos && *(pos - 1) == '\r') pos--; @@ -2417,22 +2423,24 @@ } else { - retval = (*rbuf)->cur_bufsize; + nslen = (*rbuf)->cur_bufsize; nextpos = NULL; /* This is not an overflow since we allocated one extra byte to buffer above */ - ((*rbuf)->curpos)[retval] = '\0'; + ((*rbuf)->curpos)[nslen] = '\0'; } strncpy (str, (*rbuf)->curpos, len); str[len - 1] = '\0'; - (*rbuf)->cur_bufsize -= retval; + (*rbuf)->cur_bufsize -= nslen; if (nextpos != NULL) (*rbuf)->curpos = nextpos; else (*rbuf)->cur_bufsize = 0; + + ret = nslen; break; } else @@ -2476,9 +2484,8 @@ (*rbuf)->curpos[(*rbuf)->cur_bufsize] = '\0'; } } - while (retval == GFTP_ERETRYABLE); - - return (retval); + + return (ret); } @@ -2559,7 +2566,7 @@ struct timeval tv; ssize_t w_ret; fd_set fset; - size_t ret; + int ret; gftp_lookup_request_option (request, "network_timeout", &network_timeout); @@ -2699,7 +2706,7 @@ #endif } - if (dest->swap_socks) + if (dest->swap_socks != NULL) dest->swap_socks (dest, source); } @@ -2711,7 +2718,6 @@ union { intptr_t i; float f; } maxkbs; unsigned long waitusecs; double start_difftime; - gftp_file * tempfle; struct timeval tv; int waited; @@ -2722,7 +2728,6 @@ gettimeofday (&tv, NULL); - tempfle = tdata->curfle->data; tdata->trans_bytes += num_read; tdata->curtrans += num_read; tdata->stalled = 0;
--- a/lib/pty.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/pty.c Tue Jul 27 02:46:54 2004 +0000 @@ -17,10 +17,9 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ /*****************************************************************************/ +#include "gftp.h" static const char cvsid[] = "$Id$"; -#include "gftp.h" - #ifdef __sgi char *
--- a/lib/rfc2068.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/rfc2068.c Tue Jul 27 02:46:54 2004 +0000 @@ -147,7 +147,13 @@ sizeof (tempstr), request->datafd)) < 0) return (ret); - if (sscanf ((char *) tempstr, "%lx", ¶ms->chunk_size) != 1) +#ifdef _LARGEFILE_SOURCE + ret = sscanf (tempstr, "%llx", ¶ms->chunk_size); +#else + ret = sscanf (tempstr, "%lx", ¶ms->chunk_size); +#endif + + if (ret != 1) { request->logging_function (gftp_logging_recv, request, _("Received wrong response from server, disconnecting\nInvalid chunk size '%s' returned by the remote server\n"), @@ -445,7 +451,6 @@ static off_t rfc2068_get_file_size (gftp_request * request, const char *filename) { - rfc2068_params *params; char *tempstr, *hf; intptr_t use_http11; off_t size; @@ -453,7 +458,6 @@ g_return_val_if_fail (request != NULL, GFTP_EFATAL); g_return_val_if_fail (filename != NULL, GFTP_EFATAL); - params = request->protocol_data; gftp_lookup_request_option (request, "use_http11", &use_http11); hf = gftp_build_path (request->hostname, filename, NULL); @@ -718,6 +722,8 @@ char *stpos, *crlfpos; void *read_ptr_pos; ssize_t retval; + size_t sret; + int ret; params = request->protocol_data; params->read_ref_cnt++; @@ -777,9 +783,8 @@ params->read_ref_cnt--; return (retval); } - else if (retval > 0) - params->read_bytes += retval; + params->read_bytes += retval; if (params->chunk_size > 0) { params->chunk_size -= retval; @@ -787,23 +792,23 @@ return (retval); } - retval += begin_ptr_len; + sret = retval + begin_ptr_len; } else - retval = begin_ptr_len; + sret = begin_ptr_len; - ((char *) ptr)[retval] = '\0'; + ((char *) ptr)[sret] = '\0'; if (!params->chunked_transfer) { params->read_ref_cnt--; - return (retval); + return (sret); } stpos = (char *) ptr; while (params->chunk_size == 0) { - current_size = retval - (stpos - (char *) ptr); + current_size = sret - (stpos - (char *) ptr); if (current_size == 0) break; @@ -821,9 +826,9 @@ memcpy (params->extra_read_buffer, stpos, current_size); params->extra_read_buffer[current_size] = '\0'; params->extra_read_buffer_len = current_size; - retval -= current_size; + sret -= current_size; - if (retval == 0) + if (sret == 0) { /* Don't let a hostile web server send us in an infinite recursive loop */ @@ -837,16 +842,26 @@ } retval = rfc2068_chunked_read (request, ptr, size, fd); + if (retval < 0) + return (retval); + + sret = retval; } params->read_ref_cnt--; - return (retval); + return (sret); } *crlfpos = '\0'; crlfpos++; /* advance to line feed */ - if (sscanf (stpos + 2, "%lx", ¶ms->chunk_size) != 1) +#ifdef _LARGEFILE_SOURCE + ret = sscanf (stpos + 2, "%llx", ¶ms->chunk_size); +#else + ret = sscanf (stpos + 2, "%lx", ¶ms->chunk_size); +#endif + + if (ret != 1) { request->logging_function (gftp_logging_recv, request, _("Received wrong response from server, disconnecting\nInvalid chunk size '%s' returned by the remote server\n"), @@ -856,8 +871,8 @@ return (GFTP_EFATAL); } - crlfsize = crlfpos - (char *) stpos + 1; - retval -= crlfsize; + crlfsize = crlfpos - stpos + 1; + sret -= crlfsize; current_size -= crlfsize; if (params->chunk_size == 0) @@ -870,7 +885,7 @@ params->eof = 1; params->read_ref_cnt--; - return (retval); + return (sret); } memmove (stpos, crlfpos + 1, current_size + 1); @@ -885,7 +900,7 @@ } params->read_ref_cnt--; - return (retval); + return (sret); }
--- a/lib/rfc959.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/rfc959.c Tue Jul 27 02:46:54 2004 +0000 @@ -1079,7 +1079,7 @@ if (startsize > 0) { #if defined (_LARGEFILE_SOURCE) - command = g_strdup_printf ("REST %lld\r\n", (long long) startsize); + command = g_strdup_printf ("REST %lld\r\n", startsize); #else command = g_strdup_printf ("REST %ld\r\n", startsize); #endif @@ -1157,7 +1157,7 @@ if (startsize > 0) { #if defined (_LARGEFILE_SOURCE) - command = g_strdup_printf ("REST %lld\r\n", (long long) startsize); + command = g_strdup_printf ("REST %lld\r\n", startsize); #else command = g_strdup_printf ("REST %ld\r\n", startsize); #endif @@ -1476,12 +1476,12 @@ return (len); } - int rfc959_get_next_file (gftp_request * request, gftp_file * fle, int fd) { rfc959_parms * parms; char tempstr[1024]; + size_t stlen; ssize_t len; g_return_val_if_fail (request != NULL, GFTP_EFATAL); @@ -1524,11 +1524,11 @@ } while (1); - len = strlen (tempstr); + stlen = strlen (tempstr); if (!request->cached) { request->last_dir_entry = g_strdup_printf ("%s\n", tempstr); - request->last_dir_entry_len = len + 1; + request->last_dir_entry_len = stlen + 1; } return (len); } @@ -1783,7 +1783,7 @@ } -void +static void rfc959_request_destroy (gftp_request * request) { rfc959_parms * parms; @@ -1798,7 +1798,7 @@ } -void +static void rfc959_copy_param_options (gftp_request * dest_request, gftp_request * src_request) {
--- a/lib/sshv2.c Mon Jul 26 09:51:07 2004 +0000 +++ b/lib/sshv2.c Tue Jul 27 02:46:54 2004 +0000 @@ -57,7 +57,7 @@ typedef struct sshv2_message_tag { - gint32 length; + guint32 length; char command; char *buffer, *pos, @@ -154,7 +154,7 @@ sshv2_initialize_string (gftp_request * request, size_t len) { sshv2_params * params; - gint32 num; + guint32 num; char *ret; params = request->protocol_data; @@ -170,7 +170,7 @@ static void sshv2_add_string_to_buf (char *buf, const char *str) { - gint32 num; + guint32 num; num = htonl (strlen (str)); memcpy (buf, &num, 4); @@ -511,7 +511,7 @@ sshv2_log_command (gftp_request * request, gftp_logging_level level, char type, char *message, size_t length) { - gint32 id, num, attr, stattype; + guint32 id, num, attr, stattype; char *descr, *pos, oldchar; sshv2_params * params; @@ -671,7 +671,7 @@ size_t len) { char buf[34000]; - gint32 clen; + guint32 clen; int ret; if (len > 33995) @@ -722,7 +722,7 @@ while (rem > 0) { if ((numread = gftp_fd_read (request, pos, rem, fd)) < 0) - return ((int) numread); + return (numread); rem -= numread; pos += numread; } @@ -774,7 +774,7 @@ while (rem > 0) { if ((numread = gftp_fd_read (request, pos, rem, fd)) < 0) - return ((int) numread); + return (numread); rem -= numread; pos += numread; } @@ -844,11 +844,11 @@ } -static gint32 +static gint32 /* FIXME - return value */ sshv2_buffer_get_int32 (gftp_request * request, sshv2_message * message, int expected_response) { - gint32 ret; + guint32 ret; if (message->end - message->pos < 4) return (sshv2_wrong_response (request, message)); @@ -950,10 +950,11 @@ static int sshv2_connect (gftp_request * request) { - int version, ret, fdm, ptymfd; struct servent serv_struct; sshv2_params * params; sshv2_message message; + int ret, fdm, ptymfd; + guint32 version; char **args; pid_t child; @@ -1076,7 +1077,7 @@ { sshv2_params * params; sshv2_message message; - gint32 len; + guint32 len; int ret; g_return_val_if_fail (request != NULL, GFTP_EFATAL); @@ -1124,7 +1125,7 @@ sshv2_params * params; sshv2_message message; char *tempstr; - gint32 len; + size_t len; int ret; g_return_val_if_fail (request != NULL, GFTP_EFATAL); @@ -1254,7 +1255,7 @@ static int sshv2_get_next_file (gftp_request * request, gftp_file * fle, int fd) { - gint32 len, longnamelen; + guint32 len, longnamelen; sshv2_params *params; int ret, retsize; char *longname; @@ -1489,7 +1490,7 @@ char *tempstr, *endpos, buf[10]; sshv2_params * params; sshv2_message message; - gint32 num; + guint32 num; size_t len; int ret; @@ -1633,7 +1634,7 @@ char *tempstr, *endpos; sshv2_params * params; sshv2_message message; - gint32 num; + guint32 num; size_t len; int ret; @@ -1679,7 +1680,7 @@ { sshv2_message message; char *tempstr; - gint32 len; + size_t len; int ret; g_return_val_if_fail (request != NULL, GFTP_EFATAL); @@ -1760,8 +1761,8 @@ char *tempstr, *endpos; sshv2_params * params; sshv2_message message; + guint32 num; size_t len; - gint32 num; int ret; g_return_val_if_fail (request != NULL, GFTP_EFATAL); @@ -1816,8 +1817,7 @@ char *tempstr, *endpos; sshv2_params * params; sshv2_message message; - size_t len; - gint32 num; + size_t len, num; int ret; g_return_val_if_fail (request != NULL, GFTP_EFATAL); @@ -1873,7 +1873,7 @@ { sshv2_params * params; sshv2_message message; - gint32 num; + guint32 num; int ret; #ifdef G_HAVE_GINT64 @@ -1960,7 +1960,7 @@ sshv2_params * params; sshv2_message message; char tempstr[32768]; - gint32 num; + guint32 num; size_t len; int ret;