]> mj.ucw.cz Git - libucw.git/blobdiff - charset/unicode.h
Export functions for explicit locking.
[libucw.git] / charset / unicode.h
index f12fff1add89fb3843bb99492358cacc224a84be..c0afc17abc9da1cb5c2e172385f7a272cd92de19 100644 (file)
@@ -1,7 +1,10 @@
 /*
  *     The UniCode Library
  *
- *     (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
 #ifndef _UNICODE_H
@@ -102,10 +105,11 @@ static inline word Uunaccent(word x)
     else                               \
       u = *p++
 
-#define UTF8_SKIP(p) do {              \
-    if (*p++ >= 0xc0)                  \
-      while (*p >= 0x80 && *p < 0xc0)  \
-        p++;                           \
+#define UTF8_SKIP(p) do {                              \
+    uns c = *p++;                                      \
+    if (c >= 0xc0)                                     \
+      while (c & 0x40 && *p >= 0x80 && *p < 0xc0)      \
+        p++, c <<= 1;                                  \
   } while (0)
 
 #define UTF8_SPACE(u) ((u) < 0x80 ? 1 : (u) < 0x800 ? 2 : 3)