X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Furl.c;h=6d940018d2165acbb27124bb094a16ff958bcc0a;hb=92b3bd34e6024ec20c67e3c1285f3a442fe6f326;hp=4b0ddeaa0be11ee6a9b8d7ddf8269f5922e07ae1;hpb=a4fe009d3366b0a3e119713b0ecc7fc0070efdfa;p=libucw.git diff --git a/ucw/url.c b/ucw/url.c index 4b0ddeaa..6d940018 100644 --- a/ucw/url.c +++ b/ucw/url.c @@ -10,11 +10,11 @@ * XXX: The buffer handling in this module is really horrible, but it works. */ -#include "ucw/lib.h" -#include "ucw/url.h" -#include "ucw/chartype.h" -#include "ucw/conf.h" -#include "ucw/prime.h" +#include +#include +#include +#include +#include #include #include @@ -92,14 +92,12 @@ url_deescape(const char *s, char *d) val = NCC_AND; break; case '#': val = NCC_HASH; break; -#ifndef CONFIG_URL_ESCAPE_COMPAT case '$': val = NCC_DOLLAR; break; case '+': val = NCC_PLUS; break; case ',': val = NCC_COMMA; break; -#endif } *d++ = val; s += 3; @@ -142,15 +140,12 @@ url_enescape(const char *s, char *d) c == '!' || c == '*' || c == '\'' || c == '(' || c == ')' || /* ... and some exceptions and reserved chars */ c == '$' || c == '-' || c == '_' || c == '.' || c == '+' || c == ',' || c == '=' || c == '&' || c == '#' || c == ';' || - c == '/' || c == '?' || c == ':' || c == '@' -#ifndef CONFIG_URL_ESCAPE_COMPAT - || c == '~' -#endif + c == '/' || c == '?' || c == ':' || c == '@' || c == '~' ) *d++ = *s++; else { - uns val = ((byte)*s < NCC_MAX) ? NCC_CHARS[(byte)*s] : *s; + uns val = (byte)(((byte)*s < NCC_MAX) ? NCC_CHARS[(byte)*s] : *s); *d++ = '%'; *d++ = enhex(val >> 4); *d++ = enhex(val & 0x0f); @@ -170,14 +165,14 @@ url_enescape_friendly(const char *src, char *dest) { if (dest >= end) return URL_ERR_TOO_LONG; - if (*srcb < NCC_MAX) + if ((byte)*srcb < NCC_MAX) *dest++ = NCC_CHARS[*srcb++]; else if (*srcb >= 0x20 && *srcb < 0x7f) *dest++ = *srcb++; else { *dest++ = '%'; - *dest++ = enhex(*srcb >> 4); + *dest++ = enhex((byte)*srcb >> 4); *dest++ = enhex(*srcb++ & 0x0f); } }