diff src/misc.c @ 1221:f34b803b8639

Handle signed chars. Aadded dIsspace() and dIsalnum() to dlib
author Jorge Arellano Cid <jcid@dillo.org>
date Sun, 12 Jul 2009 16:53:16 -0400
parents 94bca98ac942
children 83a462cf5d02
line wrap: on
line diff
--- a/src/misc.c	Sat Jul 11 17:19:05 2009 +0200
+++ b/src/misc.c	Sun Jul 12 16:53:16 2009 -0400
@@ -128,7 +128,7 @@
    DetectedContentType Type = DT_OCTET_STREAM; /* default to binary */
 
    /* HTML try */
-   for (i = 0; i < Size && isspace(p[i]); ++i);
+   for (i = 0; i < Size && dIsspace(p[i]); ++i);
    if ((Size - i >= 5  && !dStrncasecmp(p+i, "<html", 5)) ||
        (Size - i >= 5  && !dStrncasecmp(p+i, "<head", 5)) ||
        (Size - i >= 6  && !dStrncasecmp(p+i, "<title", 6)) ||
@@ -166,7 +166,7 @@
       Size = MIN (Size, 256);
       for (i = 0; i < Size; i++) {
          int ch = (uchar_t) p[i];
-         if (ch < 32 && !isspace(ch))
+         if (ch < 32 && !dIsspace(ch))
             ++bin_chars;
          if (ch > 126)
             ++non_ascci;
@@ -208,13 +208,13 @@
    if (!str)
       return;
 
-   for (s = str; isalnum(*s) || (*s == '-'); s++);
+   for (s = str; dIsalnum(*s) || (*s == '-'); s++);
    if (major)
       *major = dStrndup(str, s - str);
    is_text = (s - str == 4) && !dStrncasecmp(str, "text", 4);
 
    if (*s == '/') {
-      for (str = ++s; isalnum(*s) || (*s == '-'); s++);
+      for (str = ++s; dIsalnum(*s) || (*s == '-'); s++);
       if (minor)
          *minor = dStrndup(str, s - str);
    }