From: dan Date: Wed, 5 Apr 2000 03:08:10 +0000 (-0700) Subject: [svn] * host.c (store_hostaddress): R. K. Owen's patch introduces a "left shift count X-Git-Tag: v1.13~2494 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=1ecfed1e10c0bdbaca07ebab3cf5dea1b27adc23 [svn] * 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 14e580d0..044e7839 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2000-04-04 Dan Harkless + + * 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 * http.c (http_process_type): Removed needless strdup(), a memory diff --git a/src/host.c b/src/host.c index 03a56fe5..6f0e6b4d 100644 --- a/src/host.c +++ b/src/host.c @@ -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; diff --git a/src/url.c b/src/url.c index c42c1e64..a5ab4316 100644 --- 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