]> mj.ucw.cz Git - libucw.git/commitdiff
URLs: Fixed some broken comparisons of possibly signed chars.
authorPavel Charvat <pchar@ucw.cz>
Wed, 28 Jan 2009 01:32:02 +0000 (02:32 +0100)
committerPavel Charvat <pchar@ucw.cz>
Wed, 28 Jan 2009 01:32:02 +0000 (02:32 +0100)
(It was causing failures in Shepherd.)

ucw/url.c

index 4b0ddeaa0be11ee6a9b8d7ddf8269f5922e07ae1..39e52946e2bd086cd3cbdaefa4985fe217b56fde 100644 (file)
--- a/ucw/url.c
+++ b/ucw/url.c
@@ -150,7 +150,7 @@ url_enescape(const char *s, char *d)
        *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 +170,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);
        }
     }