]> sjero.net Git - wget/commitdiff
removed 'const' warnings.
authorTim Ruehsen <tim.ruehsen@gmx.de>
Mon, 14 May 2012 15:32:55 +0000 (17:32 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Mon, 14 May 2012 21:20:10 +0000 (23:20 +0200)
* 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.

src/ChangeLog
src/hash.c
src/hash.h
src/http.c
src/url.c
src/warc.c
src/warc.h

index 8c6f4c8086457114225d7318670b17bbfa5912cf..68df65bb17f174004d6f422c61a72206a79ec9f8 100644 (file)
@@ -1,7 +1,23 @@
 2012-05-14  Tim Ruehsen  <tim.ruehsen@gmx.de>
 
 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>
 
 
 2012-05-13  Tim Ruehsen  <tim.ruehsen@gmx.de>
 
index 6c40801fe8b43a21777f5dfa1d9bf5fa3be08904..129ead1a830b478ec8f27c8cc662611068d1a971 100644 (file)
@@ -423,14 +423,14 @@ grow_hash_table (struct hash_table *ht)
    table if necessary.  */
 
 void
    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? */
 {
   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;
     }
 
       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? */
   /* 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
 }
 
 /* Remove KEY->value mapping from HT.  Return 0 if there was no such
index 1dadf0930cbab9c60d3071d986f92c8963543008..85767609294928d72e90d3021a7aaeae2b7fb414 100644 (file)
@@ -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 *, 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 *);
 
 int hash_table_remove (struct hash_table *, const void *);
 void hash_table_clear (struct hash_table *);
 
index cf901929435679d914345745f41c040e792dd600..8d4edba5ba3852b0cd2219fbb0f6d07539c7a406 100644 (file)
@@ -231,7 +231,7 @@ release_header (struct request_header *hdr)
    */
 
 static void
    */
 
 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;
                     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)
       /* 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;
     }
 
       return;
     }
 
@@ -253,8 +253,8 @@ request_set_header (struct request *req, char *name, char *value,
         {
           /* Replace existing header. */
           release_header (hdr);
         {
           /* 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;
         }
           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++];
       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;
 }
 
   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
    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++)
 {
   int i;
   for (i = 0; i < req->hcount; i++)
index ddde798c681eff0a64482e03cbf57c5c10d6bb8b..e44dfcd2313282426d68e5b5e8591682d7296df7 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1504,7 +1504,7 @@ url_file_name (const struct url *u, char *replaced_filename)
 
   const char *u_file;
   char *fname, *unique;
 
   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;
 
   fnres.base = NULL;
   fnres.size = 0;
index fa0830dce4f431c3b1dcf7f9ab3c59f5890931af..a2cf102af09f55d83643bb78f573f0d9ac006a30 100644 (file)
@@ -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
    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)
     {
 {
   if (timestamp == NULL)
     {
@@ -725,9 +725,9 @@ warc_start_new_file (bool meta)
   warc_current_filename = new_filename;
 
 #ifdef HAVE_LIBZ
   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
 #else
-  char *extension = "warc";
+  const char *extension = "warc";
 #endif
 
   /* If max size is enabled, we add a serial number to the file names. */
 #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
    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];
 {
   /* 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. */
   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
   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
    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)
     {
 {
   if (resource_uuid == NULL)
     {
index 41829d1244ed560d700723c4e1637a303ae6e552..ecfff6008a198951c76a2c344ac54a7bd46dafae 100644 (file)
@@ -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_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 */
 
 
 #endif /* WARC_H */