mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[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.
This commit is contained in:
parent
1c083869b0
commit
1ecfed1e10
@ -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
|
||||
|
15
src/host.c
15
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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user