From 0aa3c5d33c5faa8902fa638c36314deae45460f3 Mon Sep 17 00:00:00 2001 From: Tim Ruehsen Date: Sat, 5 May 2012 15:24:35 +0200 Subject: [PATCH] Fix some compiler warnings. --- src/ChangeLog | 32 ++++++++++++++++++++++++++++++++ src/convert.c | 2 +- src/cookies.c | 11 ++++------- src/css-url.c | 3 ++- src/css-url.h | 1 + src/gnutls.c | 2 +- src/html-parse.c | 6 +++--- src/html-url.c | 2 +- src/progress.c | 4 ++-- src/retr.h | 2 -- src/spider.c | 2 +- src/utils.h | 1 + src/warc.c | 22 +++++++++++----------- src/warc.h | 6 +++--- 14 files changed, 63 insertions(+), 33 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c7675e88..a1d2c2a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,35 @@ +2012-03-30 Tim Ruehsen + + * convert.c (convert_links_in_hashtable): Mmake it static. + * cookies.c (parse_set_cookie): Remove empty else branches. + * css-url.c: Include "css-url.h". + (get_uri_string): Make it static. + * css-url.h (get_urls_css): Add protoype. + * gnutls.c (ssl_init): Add prototype. + * html-parse.c (tagstack_push): Make it static. + * html-parse.c (tagstack_pop): Make it static. + * html-parse.c (tagstack_find): Make it static. + * html-url.c (cleanup_html_url): Make it static. + * progress.c (count_cols): Make it static. + * progress.c (get_eta): Make it static. + * retr.h (convert_to_bits): Remove prototype. + * util.h (convert_to_bits): Add prototype. + * spider.c (spider_cleanup): Make it static. + * warc.c (warc_write_start_record): Add prototype. + * warc.c (warc_write_end_record): Add prototype. + * warc.c (warc_start_cdx_file): Add prototype. + * warc.c (warc_init): Add prototype. + * warc.c (warc_load_cdx_dedup_file): Add prototype. + * warc.c (warc_write_metadata): Add prototype. + * warc.c (warc_close): Add prototype. + * warc.c (warc_tempfile): Add prototype. + * warc.c (warc_write_warcinfo_record): Make it static. + * warc.c (warc_load_cdx_dedup_file): Make it static. + * warc.c (warc_write_metadata): Make it static. + * warc.h (warc_init): Fix prototype. + * warc.h (warc_close): Fix prototype. + * warc.h (warc_tempfile): Fix prototype. + 2012-03-30 Tim Ruehsen * url.c: Use empty query in local filenames. diff --git a/src/convert.c b/src/convert.c index c6ccf534..6cf6f272 100644 --- a/src/convert.c +++ b/src/convert.c @@ -58,7 +58,7 @@ struct hash_table *downloaded_css_set; static void convert_links (const char *, struct urlpos *); -void +static void convert_links_in_hashtable (struct hash_table *downloaded_set, int is_css, int *file_count) diff --git a/src/cookies.c b/src/cookies.c index 7c3fb1cb..a10971ca 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -391,6 +391,9 @@ parse_set_cookie (const char *set_cookie, bool silent) goto error; BOUNDED_TO_ALLOCA (value.b, value.e, value_copy); + /* Check if expiration spec is valid. + If not, assume default (cookie doesn't expire, but valid only for + this session.) */ expires = http_atotm (value_copy); if (expires != (time_t) -1) { @@ -402,10 +405,6 @@ parse_set_cookie (const char *set_cookie, bool silent) if (cookie->expiry_time < cookies_now) cookie->discard_requested = 1; } - else - /* Error in expiration spec. Assume default (cookie doesn't - expire, but valid only for this session.) */ - ; } else if (TOKEN_IS (name, "max-age")) { @@ -433,9 +432,7 @@ parse_set_cookie (const char *set_cookie, bool silent) /* ignore value completely */ cookie->secure = 1; } - else - /* Ignore unrecognized attribute. */ - ; + /* else: Ignore unrecognized attribute. */ } if (*ptr) /* extract_param has encountered a syntax error */ diff --git a/src/css-url.c b/src/css-url.c index de1caad9..f97690d6 100644 --- a/src/css-url.c +++ b/src/css-url.c @@ -55,6 +55,7 @@ as that of the covered work. */ #include "convert.h" #include "html-url.h" #include "css-tokens.h" +#include "css-url.h" /* from lex.yy.c */ extern char *yytext; @@ -107,7 +108,7 @@ const char *token_names[] = { whitespace after the opening parenthesis and before the closing parenthesis. */ -char * +static char * get_uri_string (const char *at, int *pos, int *length) { char *uri; diff --git a/src/css-url.h b/src/css-url.h index 8d32c34f..7f940e69 100644 --- a/src/css-url.h +++ b/src/css-url.h @@ -30,6 +30,7 @@ as that of the covered work. */ #ifndef CSS_URL_H #define CSS_URL_H +void get_urls_css (struct map_context *, int, int); void get_urls_css (struct map_context *, int, int); struct urlpos *get_urls_css_file (const char *, const char *); diff --git a/src/gnutls.c b/src/gnutls.c index cbd5e1da..7cc2e718 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -77,7 +77,7 @@ key_type_to_gnutls_type (enum keyfile_type type) static gnutls_certificate_credentials credentials; bool -ssl_init () +ssl_init (void) { /* Becomes true if GnuTLS is initialized. */ static bool ssl_initialized = false; diff --git a/src/html-parse.c b/src/html-parse.c index 9fafd8f5..20791cd8 100644 --- a/src/html-parse.c +++ b/src/html-parse.c @@ -280,7 +280,7 @@ struct tagstack_item { struct tagstack_item *next; }; -struct tagstack_item * +static struct tagstack_item * tagstack_push (struct tagstack_item **head, struct tagstack_item **tail) { struct tagstack_item *ts = xmalloc(sizeof(struct tagstack_item)); @@ -301,7 +301,7 @@ tagstack_push (struct tagstack_item **head, struct tagstack_item **tail) } /* remove ts and everything after it from the stack */ -void +static void tagstack_pop (struct tagstack_item **head, struct tagstack_item **tail, struct tagstack_item *ts) { @@ -343,7 +343,7 @@ tagstack_pop (struct tagstack_item **head, struct tagstack_item **tail, } } -struct tagstack_item * +static struct tagstack_item * tagstack_find (struct tagstack_item *tail, const char *tagname_begin, const char *tagname_end) { diff --git a/src/html-url.c b/src/html-url.c index 855393a7..55563e2d 100644 --- a/src/html-url.c +++ b/src/html-url.c @@ -830,7 +830,7 @@ get_urls_file (const char *file) return head; } -void +static void cleanup_html_url (void) { /* Destroy the hash tables. The hash table keys and values are not diff --git a/src/progress.c b/src/progress.c index 799d6e37..f61c95e5 100644 --- a/src/progress.c +++ b/src/progress.c @@ -766,7 +766,7 @@ update_speed_ring (struct bar_progress *bp, wgint howmuch, double dltime) } #if USE_NLS_PROGRESS_BAR -int +static int count_cols (const char *mbs) { wchar_t wc; @@ -795,7 +795,7 @@ count_cols (const char *mbs) # define count_cols(mbs) ((int)(strlen(mbs))) #endif -const char * +static const char * get_eta (int *bcd) { /* TRANSLATORS: "ETA" is English-centric, but this must diff --git a/src/retr.h b/src/retr.h index 776238b1..22ab9ecd 100644 --- a/src/retr.h +++ b/src/retr.h @@ -75,6 +75,4 @@ void set_local_file (const char **, const char *); bool input_file_url (const char *); -wgint convert_to_bits (wgint num); - #endif /* RETR_H */ diff --git a/src/spider.c b/src/spider.c index ae2f392c..dad9a23d 100644 --- a/src/spider.c +++ b/src/spider.c @@ -45,7 +45,7 @@ static struct hash_table *nonexisting_urls_set; /* Cleanup the data structures associated with this file. */ -void +static void spider_cleanup (void) { if (nonexisting_urls_set) diff --git a/src/utils.h b/src/utils.h index 8b1a8a11..514c5f26 100644 --- a/src/utils.h +++ b/src/utils.h @@ -127,6 +127,7 @@ char *human_readable (HR_NUMTYPE); int numdigit (wgint); char *number_to_string (char *, wgint); char *number_to_static_string (wgint); +wgint convert_to_bits (wgint); int determine_screen_width (void); int random_number (int); diff --git a/src/warc.c b/src/warc.c index 911cebd7..fa0830dc 100644 --- a/src/warc.c +++ b/src/warc.c @@ -180,7 +180,7 @@ warc_write_string (const char *str) Returns false and set warc_write_ok to false if there is an error. */ static bool -warc_write_start_record () +warc_write_start_record (void) { if (!warc_write_ok) return false; @@ -279,7 +279,7 @@ warc_write_block_from_file (FILE *data_in) with the uncompressed and compressed length of the record. */ static bool -warc_write_end_record () +warc_write_end_record (void) { warc_write_buffer ("\r\n\r\n", 4); @@ -633,7 +633,7 @@ warc_uuid_str (char *urn_str) /* Write a warcinfo record to the current file. Updates warc_current_warcinfo_uuid_str. */ -bool +static bool warc_write_warcinfo_record (char *filename) { /* Write warc-info record as the first record of the file. */ @@ -760,7 +760,7 @@ warc_start_new_file (bool meta) /* Opens the CDX file for output. */ static bool -warc_start_cdx_file () +warc_start_cdx_file (void) { int filename_length = strlen (opt.warc_filename); char *cdx_filename = alloca (filename_length + 4 + 1); @@ -899,8 +899,8 @@ warc_process_cdx_line (char *lineptr, int field_num_original_url, int field_num_ /* Loads the CDX file from opt.warc_cdx_dedup_filename and fills the warc_cdx_dedup_table. */ -bool -warc_load_cdx_dedup_file () +static bool +warc_load_cdx_dedup_file (void) { FILE *f = fopen (opt.warc_cdx_dedup_filename, "r"); if (f == NULL) @@ -985,7 +985,7 @@ warc_find_duplicate_cdx_record (char *url, char *sha1_digest_payload) /* Initializes the WARC writer (if opt.warc_filename is set). This should be called before any WARC record is written. */ void -warc_init () +warc_init (void) { warc_write_ok = true; @@ -1039,8 +1039,8 @@ warc_init () } /* Writes metadata (manifest, configuration, log file) to the WARC file. */ -void -warc_write_metadata () +static void +warc_write_metadata (void) { /* If there are multiple WARC files, the metadata should be written to a separate file. */ if (opt.warc_maxsize > 0) @@ -1087,7 +1087,7 @@ warc_write_metadata () /* Finishes the WARC writing. This should be called at the end of the program. */ void -warc_close () +warc_close (void) { if (warc_current_file != NULL) { @@ -1108,7 +1108,7 @@ warc_close () The temporary file will be created in opt.warc_tempdir. Returns the pointer to the temporary file, or NULL. */ FILE * -warc_tempfile () +warc_tempfile (void) { char filename[100]; if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1) diff --git a/src/warc.h b/src/warc.h index 84daad4c..41829d12 100644 --- a/src/warc.h +++ b/src/warc.h @@ -4,12 +4,12 @@ #include "host.h" -void warc_init (); -void warc_close (); +void warc_init (void); +void warc_close (void); void warc_timestamp (char *timestamp); void warc_uuid_str (char *id_str); -FILE * warc_tempfile (); +FILE * warc_tempfile (void); bool warc_write_request_record (char *url, char *timestamp_str, char *concurrent_to_uuid, ip_address *ip, FILE *body, off_t payload_offset); bool warc_write_response_record (char *url, char *timestamp_str, char *concurrent_to_uuid, ip_address *ip, FILE *body, off_t payload_offset, char *mime_type, int response_code, char *redirect_location); -- 2.39.2