From 3f6d2a9f0c89f42fccff3b9bd8c79ed96ef0e5b8 Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Sun, 25 May 2008 15:04:22 +0000 Subject: Contribution from Philip Boulain : 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 --- utils/utils.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'utils/utils.h') 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 #include #include +#include #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); -- cgit v1.2.3