mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
removed 'const' warnings.
* hash.h (hash_table_put): Make argument "value" const. * hash.c (hash_table_put): Make argument value const. Cast `value' to void. * http.c (request_set_header): Make argument `name' const. Cast `value' and `name' to void*. (request_remove_header): Make argument `name' const. * url.c (url_file_name): Make `index_filename' static. * warc.h (warc_write_cdx_record): Make `url', `timestamp', `mime_type', `payload_digest', `redirect_location', `warc_filename', response_uuid' arguments const. Make `checksum' const. * warc.c (warc_write_date_header): Make the `timestamp' argument const. Make `extension' const. (warc_write_cdx_record): Make `url', `timestamp', `mime_type', `payload_digest', `redirect_location', `warc_filename', response_uuid' arguments const. Make `checksum' const.
This commit is contained in:
parent
d19cc259cb
commit
2e86829809
@ -1,7 +1,23 @@
|
||||
2012-05-14 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* gnutls.c: wgnutls_read_timeout (wgnutls_read_timeout): removed
|
||||
warnings, moved fcntl stuff outside loop.
|
||||
* gnutls.c (wgnutls_read_timeout): removed warnings, moved fcntl stuff
|
||||
outside loop.
|
||||
|
||||
* hash.h (hash_table_put): Make argument "value" const.
|
||||
* hash.c (hash_table_put): Make argument value const. Cast `value' to
|
||||
void.
|
||||
* http.c (request_set_header): Make argument `name' const. Cast `value'
|
||||
and `name' to void*.
|
||||
(request_remove_header): Make argument `name' const.
|
||||
* url.c (url_file_name): Make `index_filename' static.
|
||||
* warc.h (warc_write_cdx_record): Make `url', `timestamp', `mime_type',
|
||||
`payload_digest', `redirect_location', `warc_filename', response_uuid'
|
||||
arguments const. Make `checksum' const.
|
||||
* warc.c (warc_write_date_header): Make the `timestamp' argument const.
|
||||
Make `extension' const.
|
||||
(warc_write_cdx_record): Make `url', `timestamp', `mime_type',
|
||||
`payload_digest', `redirect_location', `warc_filename', response_uuid'
|
||||
arguments const. Make `checksum' const.
|
||||
|
||||
2012-05-13 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
|
@ -423,14 +423,14 @@ grow_hash_table (struct hash_table *ht)
|
||||
table if necessary. */
|
||||
|
||||
void
|
||||
hash_table_put (struct hash_table *ht, const void *key, void *value)
|
||||
hash_table_put (struct hash_table *ht, const void *key, const void *value)
|
||||
{
|
||||
struct cell *c = find_cell (ht, key);
|
||||
if (CELL_OCCUPIED (c))
|
||||
{
|
||||
/* update existing item */
|
||||
c->key = (void *)key; /* const? */
|
||||
c->value = value;
|
||||
c->value = (void *)value;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -445,7 +445,7 @@ hash_table_put (struct hash_table *ht, const void *key, void *value)
|
||||
/* add new item */
|
||||
++ht->count;
|
||||
c->key = (void *)key; /* const? */
|
||||
c->value = value;
|
||||
c->value = (void *)value;
|
||||
}
|
||||
|
||||
/* Remove KEY->value mapping from HT. Return 0 if there was no such
|
||||
|
@ -42,7 +42,7 @@ int hash_table_get_pair (const struct hash_table *, const void *,
|
||||
void *, void *);
|
||||
int hash_table_contains (const struct hash_table *, const void *);
|
||||
|
||||
void hash_table_put (struct hash_table *, const void *, void *);
|
||||
void hash_table_put (struct hash_table *, const void *, const void *);
|
||||
int hash_table_remove (struct hash_table *, const void *);
|
||||
void hash_table_clear (struct hash_table *);
|
||||
|
||||
|
14
src/http.c
14
src/http.c
@ -231,7 +231,7 @@ release_header (struct request_header *hdr)
|
||||
*/
|
||||
|
||||
static void
|
||||
request_set_header (struct request *req, char *name, char *value,
|
||||
request_set_header (struct request *req, const char *name, const char *value,
|
||||
enum rp release_policy)
|
||||
{
|
||||
struct request_header *hdr;
|
||||
@ -242,7 +242,7 @@ request_set_header (struct request *req, char *name, char *value,
|
||||
/* A NULL value is a no-op; if freeing the name is requested,
|
||||
free it now to avoid leaks. */
|
||||
if (release_policy == rel_name || release_policy == rel_both)
|
||||
xfree (name);
|
||||
xfree ((void *)name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -253,8 +253,8 @@ request_set_header (struct request *req, char *name, char *value,
|
||||
{
|
||||
/* Replace existing header. */
|
||||
release_header (hdr);
|
||||
hdr->name = name;
|
||||
hdr->value = value;
|
||||
hdr->name = (void *)name;
|
||||
hdr->value = (void *)value;
|
||||
hdr->release_policy = release_policy;
|
||||
return;
|
||||
}
|
||||
@ -268,8 +268,8 @@ request_set_header (struct request *req, char *name, char *value,
|
||||
req->headers = xrealloc (req->headers, req->hcapacity * sizeof (*hdr));
|
||||
}
|
||||
hdr = &req->headers[req->hcount++];
|
||||
hdr->name = name;
|
||||
hdr->value = value;
|
||||
hdr->name = (void *)name;
|
||||
hdr->value = (void *)value;
|
||||
hdr->release_policy = release_policy;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ request_set_user_header (struct request *req, const char *header)
|
||||
the header was actually removed, false otherwise. */
|
||||
|
||||
static bool
|
||||
request_remove_header (struct request *req, char *name)
|
||||
request_remove_header (struct request *req, const char *name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < req->hcount; i++)
|
||||
|
@ -1504,7 +1504,7 @@ url_file_name (const struct url *u, char *replaced_filename)
|
||||
|
||||
const char *u_file;
|
||||
char *fname, *unique;
|
||||
char *index_filename = "index.html"; /* The default index file is index.html */
|
||||
const char *index_filename = "index.html"; /* The default index file is index.html */
|
||||
|
||||
fnres.base = NULL;
|
||||
fnres.size = 0;
|
||||
|
12
src/warc.c
12
src/warc.c
@ -372,7 +372,7 @@ warc_write_end_record (void)
|
||||
the current WARC record.
|
||||
If timestamp is NULL, the current time will be used. */
|
||||
static bool
|
||||
warc_write_date_header (char *timestamp)
|
||||
warc_write_date_header (const char *timestamp)
|
||||
{
|
||||
if (timestamp == NULL)
|
||||
{
|
||||
@ -725,9 +725,9 @@ warc_start_new_file (bool meta)
|
||||
warc_current_filename = new_filename;
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
char *extension = (opt.warc_compression_enabled ? "warc.gz" : "warc");
|
||||
const char *extension = (opt.warc_compression_enabled ? "warc.gz" : "warc");
|
||||
#else
|
||||
char *extension = "warc";
|
||||
const char *extension = "warc";
|
||||
#endif
|
||||
|
||||
/* If max size is enabled, we add a serial number to the file names. */
|
||||
@ -1166,7 +1166,7 @@ warc_write_request_record (char *url, char *timestamp_str, char *record_uuid, ip
|
||||
response_uuid is the uuid of the response.
|
||||
Returns true on success, false on error. */
|
||||
static bool
|
||||
warc_write_cdx_record (char *url, char *timestamp_str, char *mime_type, int response_code, char *payload_digest, char *redirect_location, off_t offset, char *warc_filename, char *response_uuid)
|
||||
warc_write_cdx_record (const char *url, const char *timestamp_str, const char *mime_type, int response_code, const char *payload_digest, const char *redirect_location, off_t offset, const char *warc_filename, const char *response_uuid)
|
||||
{
|
||||
/* Transform the timestamp. */
|
||||
char timestamp_str_cdx [15];
|
||||
@ -1179,7 +1179,7 @@ warc_write_cdx_record (char *url, char *timestamp_str, char *mime_type, int resp
|
||||
timestamp_str_cdx[14] = '\0';
|
||||
|
||||
/* Rewrite the checksum. */
|
||||
char *checksum;
|
||||
const char *checksum;
|
||||
if (payload_digest != NULL)
|
||||
checksum = payload_digest + 5; /* Skip the "sha1:" */
|
||||
else
|
||||
@ -1349,7 +1349,7 @@ warc_write_response_record (char *url, char *timestamp_str, char *concurrent_to_
|
||||
Calling this function will close body.
|
||||
Returns true on success, false on error. */
|
||||
bool
|
||||
warc_write_resource_record (char *resource_uuid, char *url, char *timestamp_str, char *concurrent_to_uuid, ip_address *ip, char *content_type, FILE *body, off_t payload_offset)
|
||||
warc_write_resource_record (char *resource_uuid, const char *url, const char *timestamp_str, const char *concurrent_to_uuid, ip_address *ip, const char *content_type, FILE *body, off_t payload_offset)
|
||||
{
|
||||
if (resource_uuid == NULL)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ 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);
|
||||
bool warc_write_resource_record (char *resource_uuid, char *url, char *timestamp_str, char *concurrent_to_uuid, ip_address *ip, char *content_type, FILE *body, off_t payload_offset);
|
||||
bool warc_write_resource_record (char *resource_uuid, const char *url, const char *timestamp_str, const char *concurrent_to_uuid, ip_address *ip, const char *content_type, FILE *body, off_t payload_offset);
|
||||
|
||||
#endif /* WARC_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user