summaryrefslogtreecommitdiff
path: root/xc/lib/X11/lcPrTxt.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/X11/lcPrTxt.c')
-rw-r--r--xc/lib/X11/lcPrTxt.c83
1 files changed, 49 insertions, 34 deletions
diff --git a/xc/lib/X11/lcPrTxt.c b/xc/lib/X11/lcPrTxt.c
index effacff51..8ea448d42 100644
--- a/xc/lib/X11/lcPrTxt.c
+++ b/xc/lib/X11/lcPrTxt.c
@@ -23,7 +23,7 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
-/* $XFree86: xc/lib/X11/lcPrTxt.c,v 1.3 2000/01/30 18:35:19 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcPrTxt.c,v 1.4 2000/11/28 18:49:46 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
@@ -31,10 +31,10 @@
#include <X11/Xatom.h>
static XPointer *
-alloc_list(is_wide_char, count, nitems)
- Bool is_wide_char;
- int count;
- int nitems;
+alloc_list(
+ Bool is_wide_char,
+ int count,
+ int nitems)
{
if (is_wide_char) {
wchar_t **wstr_list;
@@ -68,11 +68,11 @@ alloc_list(is_wide_char, count, nitems)
}
static void
-copy_list(is_wide_char, text, list, count)
- Bool is_wide_char;
- XPointer text;
- XPointer *list;
- int count;
+copy_list(
+ Bool is_wide_char,
+ XPointer text,
+ XPointer *list,
+ int count)
{
int length;
@@ -106,16 +106,16 @@ copy_list(is_wide_char, text, list, count)
}
static int
-_XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
- XLCd lcd;
- Display *dpy;
- XTextProperty *text_prop;
- char *to_type;
- XPointer **list_ret;
- int *count_ret;
+_XTextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ const char *to_type,
+ XPointer **list_ret,
+ int *count_ret)
{
XlcConv conv;
- char *from_type;
+ const char *from_type;
XPointer from, to, buf;
char *str_ptr, *last_ptr;
Atom encoding;
@@ -138,6 +138,8 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
encoding = text_prop->encoding;
if (encoding == XA_STRING)
from_type = XlcNString;
+ else if (encoding == XInternAtom(dpy, "UTF8_STRING", False))
+ from_type = XlcNUtf8String;
else if (encoding == XInternAtom(dpy, "COMPOUND_TEXT", False))
from_type = XlcNCompoundText;
else if (encoding == XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False))
@@ -157,7 +159,8 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
to = buf;
to_left = buf_len;
- /* can be XlcNMultiByte to XlcNMultiByte */
+ /* can be XlcNMultiByte to XlcNMultiByte,
+ or XlcNUtf8String to XlcNUtf8String */
if (!strcmp(from_type, to_type)) {
do_strcpy = True;
} else {
@@ -233,33 +236,45 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
}
int
-_XmbTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret)
- XLCd lcd;
- Display *dpy;
- XTextProperty *text_prop;
- char ***list_ret;
- int *count_ret;
+_XmbTextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ char ***list_ret,
+ int *count_ret)
{
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte,
(XPointer **) list_ret, count_ret);
}
int
-_XwcTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret)
- XLCd lcd;
- Display *dpy;
- XTextProperty *text_prop;
- wchar_t ***list_ret;
- int *count_ret;
+_XwcTextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ wchar_t ***list_ret,
+ int *count_ret)
{
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar,
(XPointer **) list_ret, count_ret);
}
+int
+_Xutf8TextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ char ***list_ret,
+ int *count_ret)
+{
+ return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNUtf8String,
+ (XPointer **) list_ret, count_ret);
+}
+
void
-_XwcFreeStringList(lcd, list)
- XLCd lcd;
- wchar_t **list;
+_XwcFreeStringList(
+ XLCd lcd,
+ wchar_t **list)
{
if (list) {
if (*list)