+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
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;
# 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