From 01d455744e3710884b71feebfd4726841213af42 Mon Sep 17 00:00:00 2001 From: Tim Ruehsen
Date: Sun, 11 May 2014 23:20:49 +0200 Subject: [PATCH] Fix compiler warnings --- src/ChangeLog | 55 +++++++++++++++++++++++++++++++++++++ src/css-url.c | 35 ------------------------ src/ftp-ls.c | 3 +- src/ftp.c | 8 ++---- src/html-url.c | 8 +++--- src/html-url.h | 1 + src/http-ntlm.c | 85 +++++++++++++++++++-------------------------------------- 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, 261 insertions(+), 266 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c0b4f73..f07ddc5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,58 @@ +2014-05-03 Tim Ruehsen + + * 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 (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 Benjamin Goose * http.c: Fix small memory leak diff --git a/src/css-url.c b/src/css-url.c index f97690d..e8c4989 100644 --- a/src/css-url.c +++ b/src/css-url.c @@ -64,41 +64,6 @@ 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[] = { - "CSSEOF", - "S", - "CDO", - "CDC", - "INCLUDES", - "DASHMATCH", - "LBRACE", - "PLUS", - "GREATER", - "COMMA", - "STRING", - "INVALID", - "IDENT", - "HASH", - "IMPORT_SYM", - "PAGE_SYM", - "MEDIA_SYM", - "CHARSET_SYM", - "IMPORTANT_SYM", - "EMS", - "EXS", - "LENGTH", - "ANGLE", - "TIME", - "FREQ", - "DIMENSION", - "PERCENTAGE", - "NUMBER", - "URI", - "FUNCTION" -}; -#endif - /* Given a detected URI token, get only the URI specified within. Also adjust the starting position and length of the string. 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