diff options
author | John Tytgat <joty@netsurf-browser.org> | 2008-05-25 15:04:22 +0000 |
---|---|---|
committer | John Tytgat <joty@netsurf-browser.org> | 2008-05-25 15:04:22 +0000 |
commit | 3f6d2a9f0c89f42fccff3b9bd8c79ed96ef0e5b8 (patch) | |
tree | 41de812a917e7b227cac0c8a374328506ec7ecb9 /utils/utils.h | |
parent | 497372c2574b3458f6344892887dc0857f40d7ce (diff) | |
download | netsurf-3f6d2a9f0c89f42fccff3b9bd8c79ed96ef0e5b8.tar.gz netsurf-3f6d2a9f0c89f42fccff3b9bd8c79ed96ef0e5b8.tar.bz2 |
Contribution from Philip Boulain <prb@ecs.soton.ac.uk>:
This makes url_normalize take care of whitespace in a fairly useful way,
consistent with other browsers:
- Leading and trailing whitespace is trimmed
- Internal whitespace is urlescaped
For example,
" http://www.google.co.uk/search?q=hello world "
becomes
"http://www.google.co.uk/search?q=hello%20world"
Explicit trailing whitespace, e.g. "...hello world%20", is left alone.
The upshot is that if you sloppily copy-paste a URL from IRC or whatnot
into the address bar, NetSurf no longer silently ignores you if you
caught some adjacent whitespace.
svn path=/trunk/netsurf/; revision=4198
Diffstat (limited to 'utils/utils.h')
-rw-r--r-- | utils/utils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/utils.h b/utils/utils.h index 3a0417008..8f3516e1d 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -25,6 +25,7 @@ #include <stdlib.h> #include <sys/types.h> #include <regex.h> +#include <assert.h> #ifndef NOF_ELEMENTS #define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array))) @@ -71,6 +72,17 @@ char *strcasestr(const char *haystack, const char *needle); #endif unsigned int wallclock(void); +/** + * Return a hex digit for the given numerical value. + * + * \return character in range 0-9a-f + */ +inline static char digit2lowcase_hex(unsigned char digit) { + assert(digit < 16); + return "0123456789abcdef"[digit]; +} + + /* Platform specific functions */ void die(const char * const error); void warn_user(const char *warning, const char *detail); |