]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
set the unicode value to 0 if no value exists, also changing u8_fromchar to not retur...
authorblub <blub@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 26 Dec 2009 13:42:27 +0000 (13:42 +0000)
committerblub <blub@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 26 Dec 2009 13:42:27 +0000 (13:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9698 d7cf8633-e32d-0410-b094-e92efae38249

utf8lib.c
vid_glx.c

index 3e1d62fa797b9898dcba309cef2ad73543417b43..c1e5a81000c635537687d7ed1edf858b6edc6d5b 100644 (file)
--- a/utf8lib.c
+++ b/utf8lib.c
@@ -486,10 +486,10 @@ Uchar u8_getnchar(const char *_s, const char **_end, size_t _maxlen)
 int u8_fromchar(Uchar w, char *to, size_t maxlen)
 {
        if (maxlen < 1)
-               return -2;
+               return 0;
 
        if (!w)
-               return -5;
+               return 0;
 
        if (w >= 0xE000 && !utf8_enable.integer)
                w -= 0xE000;
@@ -544,7 +544,7 @@ int u8_fromchar(Uchar w, char *to, size_t maxlen)
                to[0] = 0xE0 | w;
                return 4;
        }
-       return -1;
+       return 0;
 }
 
 /** uses u8_fromchar on a static buffer
@@ -602,10 +602,13 @@ size_t u8_wcstombs(char *mb, const Uchar *wcs, size_t maxlen)
                return 0;
        for (i = 0; wcs[i] && i < maxlen-1; ++i)
        {
+               /*
                int len;
                if ( (len = u8_fromchar(wcs[i], mb, maxlen - i)) < 0)
                        return (mb - start);
                mb += len;
+               */
+               mb += u8_fromchar(wcs[i], mb, maxlen - i);
        }
        *mb = 0;
        return (mb - start);
index e51daa153e49bda2281ccc4d6da554d209f6a093..0ed0c38bd11f9ab946c716936bd72a29003da261 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -154,6 +154,7 @@ void DP_Xutf8LookupString(XKeyEvent * ev,
                        *status_return = XLookupKeySym;
                        *keysym_return = keysym;
                }
+               *uch = 0;
                return;
        }