]> sjero.net Git - wget/commitdiff
[svn] * host.c (store_hostaddress): R. K. Owen's patch introduces a "left shift count
authordan <devnull@localhost>
Wed, 5 Apr 2000 03:08:10 +0000 (20:08 -0700)
committerdan <devnull@localhost>
Wed, 5 Apr 2000 03:08:10 +0000 (20:08 -0700)
  >= width of type" warning on 32-bit architectures.  Got rid of it by tricking
  the compiler w/ a variable.

* url.c (UNSAFE_CHAR): The macro didn't include all the illegal characters per
  RFC1738, namely everything above '~'.  It also generated a warning on OSes
  where char =~ unsigned char.  Fixed.

src/ChangeLog
src/host.c
src/url.c

index 14e580d0f249c4639d59d22341a951f803406c72..044e78399ae790ea9e32b9740caad6baac50e9b1 100644 (file)
@@ -1,3 +1,13 @@
+2000-04-04  Dan Harkless  <dan-wget@dilvish.speed.net>
+
+       * host.c (store_hostaddress): R. K. Owen's patch introduces a
+       "left shift count >= width of type" warning on 32-bit
+       architectures.  Got rid of it by tricking the compiler w/ a variable.
+       
+       * url.c (UNSAFE_CHAR): The macro didn't include all the illegal
+       characters per RFC1738, namely everything above '~'.  It also
+       generated a warning on OSes where char =~ unsigned char.  Fixed.
+       
 1998-10-17  Hrvoje Niksic  <hniksic@srce.hr>
 
        * http.c (http_process_type): Removed needless strdup(), a memory
index 03a56fe57cd07a46dee12da1b352363d0e56d75e..6f0e6b4d99e497293f55a421812f791114c1ff62 100644 (file)
@@ -148,7 +148,20 @@ store_hostaddress (unsigned char *where, const char *hostname)
         inet_addr returns the address in the proper order.  */
 #ifdef WORDS_BIGENDIAN
       if (sizeof (addr) == 8)
-       addr <<= 32;
+       {
+         /* We put the shift amount in a variable because it quiets gcc -Wall's
+            warning on 32-bit-address systems: "warning: left shift count >=
+            width of type".  The optimizer should constant-fold away this
+            variable (you'd think the warning would come back with maximum
+            optimization turned on, but it doesn't, on gcc 2.8.1, at least).
+            Not sure if there's a cleaner way to get rid of the warning -- can
+            this code be surrounded by an #ifdef that's never active on 32-bit
+            systems?  Is there no way to check at configure-time whether we'll
+            ever potentially encounter a 64-bit address? */
+         int  shift_amount = 32;
+
+         addr <<= shift_amount;
+       }
 #endif
       memcpy (where, &addr, 4);
       return 1;
index c42c1e6469cb1d325614e152dfbe1fc792f47623..a5ab4316cf01a5025f7f3f79c98d35c56b37e108 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -61,7 +61,8 @@ extern int errno;
 # define URL_UNSAFE_CHARS "<>\"%{}|\\^[]`"
 #endif /* WINDOWS */
 
-#define UNSAFE_CHAR(c) (((c) >= 0 && (c) <= 32)                        \
+#define UNSAFE_CHAR(c) (   ((unsigned char)(c) <= ' ')  /* ASCII 32  */  \
+                       || ((unsigned char)(c) >  '~')  /* ASCII 127 */  \
                        || strchr (URL_UNSAFE_CHARS, c))
 
 /* If S contains unsafe characters, free it and replace it with a