[Commits] SDL: fcitx: removed incompatibly-licensed code.

libsdl.org revision control commits-owner at libsdl.org
Mon May 29 00:05:49 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/0b19d98c9a9d
changeset: 11050:0b19d98c9a9d
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Mon May 29 00:54:08 2017 -0400
description:
fcitx: removed incompatibly-licensed code.

diffstat:

 src/core/linux/SDL_fcitx.c |  69 +--------------------------------------------
 1 files changed, 2 insertions(+), 67 deletions(-)

diffs (86 lines):

diff -r 6e24dc7c67c6 -r 0b19d98c9a9d src/core/linux/SDL_fcitx.c
--- a/src/core/linux/SDL_fcitx.c	Mon May 29 03:01:05 2017 -0400
+++ b/src/core/linux/SDL_fcitx.c	Mon May 29 00:54:08 2017 -0400
@@ -118,71 +118,6 @@
     return SDL_strdup("SDL_App");
 }
 
-/*
- * Copied from fcitx source
- */
-#define CONT(i)   ISUTF8_CB(in[i])
-#define VAL(i, s) ((in[i]&0x3f) << s)
-
-static char *
-_fcitx_utf8_get_char(const char *i, uint32_t *chr)
-{
-    const unsigned char* in = (const unsigned char *)i;
-    if (!(in[0] & 0x80)) {
-        *(chr) = *(in);
-        return (char *)in + 1;
-    }
-
-    /* 2-byte, 0x80-0x7ff */
-    if ((in[0] & 0xe0) == 0xc0 && CONT(1)) {
-        *chr = ((in[0] & 0x1f) << 6) | VAL(1, 0);
-        return (char *)in + 2;
-    }
-
-    /* 3-byte, 0x800-0xffff */
-    if ((in[0] & 0xf0) == 0xe0 && CONT(1) && CONT(2)) {
-        *chr = ((in[0] & 0xf) << 12) | VAL(1, 6) | VAL(2, 0);
-        return (char *)in + 3;
-    }
-
-    /* 4-byte, 0x10000-0x1FFFFF */
-    if ((in[0] & 0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3)) {
-        *chr = ((in[0] & 0x7) << 18) | VAL(1, 12) | VAL(2, 6) | VAL(3, 0);
-        return (char *)in + 4;
-    }
-
-    /* 5-byte, 0x200000-0x3FFFFFF */
-    if ((in[0] & 0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4)) {
-        *chr = ((in[0] & 0x3) << 24) | VAL(1, 18) | VAL(2, 12) | VAL(3, 6) | VAL(4, 0);
-        return (char *)in + 5;
-    }
-
-    /* 6-byte, 0x400000-0x7FFFFFF */
-    if ((in[0] & 0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5)) {
-        *chr = ((in[0] & 0x1) << 30) | VAL(1, 24) | VAL(2, 18) | VAL(3, 12) | VAL(4, 6) | VAL(5, 0);
-        return (char *)in + 6;
-    }
-
-    *chr = *in;
-
-    return (char *)in + 1;
-}
-
-static size_t
-_fcitx_utf8_strlen(const char *s)
-{
-    unsigned int l = 0;
-
-    while (*s) {
-        uint32_t chr;
-
-        s = _fcitx_utf8_get_char(s, &chr);
-        l++;
-    }
-
-    return l;
-}
-
 static DBusHandlerResult
 DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
 {
@@ -214,8 +149,8 @@
             size_t cursor = 0;
 
             while (i < text_bytes) {
-                size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
-                size_t chars = _fcitx_utf8_strlen(buf);
+                const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
+                const size_t chars = SDL_utf8strlen(buf);
 
                 SDL_SendEditingText(buf, cursor, chars);
 


More information about the commits mailing list