From c070a3056d245ba6977d1307f156d850a2e6d435 Mon Sep 17 00:00:00 2001 From: Tim Ruehsen
Date: Sat, 3 May 2014 21:14:38 +0200 Subject: [PATCH] Fix LOTS of compiler warnings --- src/ChangeLog | 56 +++++++++++++++++++++++++++++++++ src/css-url.c | 4 +-- src/ftp-ls.c | 3 +- src/ftp.c | 8 ++--- src/html-url.c | 8 ++--- src/html-url.h | 1 + src/http-ntlm.c | 98 ++++++++++++++++++++++++++++----------------------------- src/http.c | 34 ++++++++++---------- src/init.c | 82 ++++++++++++++++++++--------------------------- src/iri.c | 14 ++++----- src/main.c | 59 +++++++++++++++++----------------- src/netrc.c | 8 ++++- src/netrc.h | 1 + src/openssl.c | 8 ++--- src/options.h | 4 +-- src/progress.c | 4 +-- src/res.c | 10 +++--- src/retr.c | 3 +- src/spider.h | 1 + src/test.c | 2 +- src/test.h | 10 ++++++ src/url.c | 43 ++++++++++++------------- src/utils.c | 39 ++++++++++++----------- src/utils.h | 6 ++-- src/warc.c | 4 +-- 25 files changed, 285 insertions(+), 225 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 92942eb..6563dbd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,59 @@ +2014-05-03 Tim Ruehsen + + * css-url.c (struct token_names): Do not compile struct that's never used + * ftp-ls.c (ftp_parse_vms_ls): Explicitly typecast strlen's output + * ftp.c (getftp): Prevent declaration of shadow variable + * html-url.c (tag_handle_base, tag_handle_form, tag_handle_link, + tag_handle_meta): Compiler directive to ignore unused variable + * html-url.h (cleanup_html_url): Add function declaration + * http-ntlm.c (macros): Remove unused macros + (ntlm_input, mkhash): Use ssize_t to declare variables that store sizes + (mkhash): Explicitly typecast output of c_toupper + (short_pair): Add typecasts to prevent compiler warnings + (ntlm-output): Fix datatypes of various variables + * http.c (gethttp): Prevent declaration of shadow variable err + (gethttp): remove unreachable code + (test_parse_content_disposition): Fix variable declarations and use + countof() macro + * init.c (run_command): Prevent declaration of ghost variable + (cmd_string, cmd_string_uppercase, cmd_file, cnd_vector, + cmd_directory_vector, cmd_spec_dirstruct, cmd_spec_header, + cmd_spec_warc_header, cmd_spec_htmlify, cmd_spec_mirror, + cmd_spec_prefer_family, cmd_spec_progress, cmd_spec_recursive, + cmd_spec_regex_type, cmd_spec_restrict_file_names, cmd_spec_report_speed, + cmd_spec_timeout, cmd_spec_useragent, cmd_spec_verbose): Add compiler + directive to ignore unused variable + (cleanup_html_url, spider_cleanup): Remove declarations + (test_commands_sorted): Cleanup code + (test_cmd_spec_restrict_file_names): Use correct data types + * iri.c (remote_to_utf8): Use more verbose variable name + * main.c (init_switches): Prevent declaration of ghost variable + * netrc.c (netrc_cleanup): Create cleanup function on common naming scheme + * netrc.h (netrc_cleanup): Declare function + * openssl.c (openssl_write, openssl_errstr): Compiler directive to ignore + unused parameter + (openssl_errstr): Explcicitly typecasr output of ASN1_STRING_length + * options.h (struct options): Declare includes and excludes as const char ** + * progress.c (progress_interactive_p, progress_handle_sigwinch): Compiler + directive to ignore unused parameter + * res.c (test_is_robots_txt_url): Fix datatypes + * retr.c (line_terminator): Add compiler directive for ignoring unused + paramter. Remove unused variable. + * spider.h (spider_cleanup): Declare function + * test,c (main): declare unused paramter + * test.h (test_*): Declare functions + * url.c (url_string): Explicit typecast of password strings + (run_test): Declare *test, struct tests and *expected_result as const + (test_path_simplify, test_append_uri_pathl, test_are_urls_equal): Fix datatypes + * utls.c (fork_to_background): Be more verbose when errors occur + (dir_matches_p, test_dir_matches_p): Declare char * as const as required + (base64_encode, base64_decode, get_max_length): Set correct return type + (match_pcre_regex, match_posix_regex): Use correct datatypes and typecasts + (test_subdir_p): static const struct + * utils.h (base64_encode, base64_decode, get_max_length): Fix return type + * warc.c (ward_write_cdx_record): unused parameter + (struct hash_table *warc_cdx_dedup_table): Declare as static + 2014-05-01 Darshit Shah (tiny change) * progress.c (dot_finish): Do not print extra newlines when not in verbose diff --git a/src/css-url.c b/src/css-url.c index f97690d..51e43b4 100644 --- a/src/css-url.c +++ b/src/css-url.c @@ -64,8 +64,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; extern YY_BUFFER_STATE yy_scan_bytes (const char *bytes,int len ); extern int yylex (void); -#if 1 -const char *token_names[] = { +#if 0 +static const char *token_names[] = { "CSSEOF", "S", "CDO", diff --git a/src/ftp-ls.c b/src/ftp-ls.c index 1039a43..d9077a3 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -895,7 +895,8 @@ ftp_parse_vms_ls (const char *file) /* Protections (permissions). */ perms = 0; j = 0; - for (i = 0; i < strlen(tok); i++) + /*FIXME: Should not be using the variable like this. */ + for (i = 0; i < (int) strlen(tok); i++) { switch (tok[ i]) { diff --git a/src/ftp.c b/src/ftp.c index 2db98bb..25f05a4 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -990,15 +990,14 @@ Error in server response, closing control connection.\n")); if (opt.spider) { bool exists = false; - uerr_t res; struct fileinfo *f; - res = ftp_get_listing (u, con, &f); + uerr_t _res = ftp_get_listing (u, con, &f); /* Set the DO_RETR command flag again, because it gets unset when calling ftp_get_listing() and would otherwise cause an assertion failure earlier on when this function gets repeatedly called (e.g., when recursing). */ con->cmd |= DO_RETR; - if (res == RETROK) + if (_res == RETROK) { while (f) { @@ -1235,8 +1234,7 @@ Error in server response, closing control connection.\n")); { if (opt.unlink && file_exists_p (con->target)) { - int res = unlink (con->target); - if (res < 0) + if (unlink (con->target) < 0) { logprintf (LOG_NOTQUIET, "%s: %s\n", con->target, strerror (errno)); diff --git a/src/html-url.c b/src/html-url.c index 1bb44b4..3c6c9b9 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -472,7 +472,7 @@ tag_find_urls (int tagid, struct taginfo *tag, struct map_context *ctx) /* Handle the BASE tag, for