fcitx: removed incompatibly-licensed code.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 29 May 2017 00:54:08 -0400
changeset 110500b19d98c9a9d
parent 11049 6e24dc7c67c6
child 11051 241410389057
fcitx: removed incompatibly-licensed code.
src/core/linux/SDL_fcitx.c
     1.1 --- a/src/core/linux/SDL_fcitx.c	Mon May 29 03:01:05 2017 -0400
     1.2 +++ b/src/core/linux/SDL_fcitx.c	Mon May 29 00:54:08 2017 -0400
     1.3 @@ -118,71 +118,6 @@
     1.4      return SDL_strdup("SDL_App");
     1.5  }
     1.6  
     1.7 -/*
     1.8 - * Copied from fcitx source
     1.9 - */
    1.10 -#define CONT(i)   ISUTF8_CB(in[i])
    1.11 -#define VAL(i, s) ((in[i]&0x3f) << s)
    1.12 -
    1.13 -static char *
    1.14 -_fcitx_utf8_get_char(const char *i, uint32_t *chr)
    1.15 -{
    1.16 -    const unsigned char* in = (const unsigned char *)i;
    1.17 -    if (!(in[0] & 0x80)) {
    1.18 -        *(chr) = *(in);
    1.19 -        return (char *)in + 1;
    1.20 -    }
    1.21 -
    1.22 -    /* 2-byte, 0x80-0x7ff */
    1.23 -    if ((in[0] & 0xe0) == 0xc0 && CONT(1)) {
    1.24 -        *chr = ((in[0] & 0x1f) << 6) | VAL(1, 0);
    1.25 -        return (char *)in + 2;
    1.26 -    }
    1.27 -
    1.28 -    /* 3-byte, 0x800-0xffff */
    1.29 -    if ((in[0] & 0xf0) == 0xe0 && CONT(1) && CONT(2)) {
    1.30 -        *chr = ((in[0] & 0xf) << 12) | VAL(1, 6) | VAL(2, 0);
    1.31 -        return (char *)in + 3;
    1.32 -    }
    1.33 -
    1.34 -    /* 4-byte, 0x10000-0x1FFFFF */
    1.35 -    if ((in[0] & 0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3)) {
    1.36 -        *chr = ((in[0] & 0x7) << 18) | VAL(1, 12) | VAL(2, 6) | VAL(3, 0);
    1.37 -        return (char *)in + 4;
    1.38 -    }
    1.39 -
    1.40 -    /* 5-byte, 0x200000-0x3FFFFFF */
    1.41 -    if ((in[0] & 0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4)) {
    1.42 -        *chr = ((in[0] & 0x3) << 24) | VAL(1, 18) | VAL(2, 12) | VAL(3, 6) | VAL(4, 0);
    1.43 -        return (char *)in + 5;
    1.44 -    }
    1.45 -
    1.46 -    /* 6-byte, 0x400000-0x7FFFFFF */
    1.47 -    if ((in[0] & 0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5)) {
    1.48 -        *chr = ((in[0] & 0x1) << 30) | VAL(1, 24) | VAL(2, 18) | VAL(3, 12) | VAL(4, 6) | VAL(5, 0);
    1.49 -        return (char *)in + 6;
    1.50 -    }
    1.51 -
    1.52 -    *chr = *in;
    1.53 -
    1.54 -    return (char *)in + 1;
    1.55 -}
    1.56 -
    1.57 -static size_t
    1.58 -_fcitx_utf8_strlen(const char *s)
    1.59 -{
    1.60 -    unsigned int l = 0;
    1.61 -
    1.62 -    while (*s) {
    1.63 -        uint32_t chr;
    1.64 -
    1.65 -        s = _fcitx_utf8_get_char(s, &chr);
    1.66 -        l++;
    1.67 -    }
    1.68 -
    1.69 -    return l;
    1.70 -}
    1.71 -
    1.72  static DBusHandlerResult
    1.73  DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data)
    1.74  {
    1.75 @@ -214,8 +149,8 @@
    1.76              size_t cursor = 0;
    1.77  
    1.78              while (i < text_bytes) {
    1.79 -                size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
    1.80 -                size_t chars = _fcitx_utf8_strlen(buf);
    1.81 +                const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf));
    1.82 +                const size_t chars = SDL_utf8strlen(buf);
    1.83  
    1.84                  SDL_SendEditingText(buf, cursor, chars);
    1.85