Commit cf5a5980 authored by Mike Gabriel's avatar Mike Gabriel

Fix patch: 109_nxagent_locale-utf8-compound-text.patch, fix crashes reported…

Fix patch: 109_nxagent_locale-utf8-compound-text.patch, fix crashes reported from Stefan Baur. Thanks for reporting and testing!!!
parent 5027f1e8
...@@ -7,6 +7,8 @@ nx-libs (2:3.5.0.8-0) UNRELEASED; urgency=low ...@@ -7,6 +7,8 @@ nx-libs (2:3.5.0.8-0) UNRELEASED; urgency=low
* Package x2goagent is an ,,all'' package, not ,,any''. * Package x2goagent is an ,,all'' package, not ,,any''.
* Add folder /debian/patches-pending-evaluation with two newly discovered * Add folder /debian/patches-pending-evaluation with two newly discovered
patches from git.etersoft.ru (AltLinux packaging repository for NX). patches from git.etersoft.ru (AltLinux packaging repository for NX).
* Fix patch: 109_nxagent_locale-utf8-compound-text.patch, fix crashes
reported from Stefan Baur. Thanks for reporting and testing!!!
-- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 16 Jan 2012 22:28:13 +0100 -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 16 Jan 2012 22:28:13 +0100
......
...@@ -26,7 +26,7 @@ Last-Update: 2011-12-31 ...@@ -26,7 +26,7 @@ Last-Update: 2011-12-31
+ char *locale = setlocale(LC_ALL, ""); + char *locale = setlocale(LC_ALL, "");
+ if (!locale) + if (!locale)
+ fprintf(stderr, "InitOutput: failed to set locale, reverting to \"C\"\n"); + fprintf(stderr, "InitOutput: failed to set locale, reverting to \"C\"\n");
+ else + else
+ { + {
+ if (!XSupportsLocale()) + if (!XSupportsLocale())
+ fprintf(stderr, "InitOutput: Locale %s not supported by X\n",locale); + fprintf(stderr, "InitOutput: Locale %s not supported by X\n",locale);
...@@ -51,23 +51,12 @@ Last-Update: 2011-12-31 ...@@ -51,23 +51,12 @@ Last-Update: 2011-12-31
/* /*
* Set here the required log level. * Set here the required log level.
*/ */
@@ -100,6 +104,10 @@ @@ -419,6 +423,28 @@
static void nxagentRemovePropertyFromList(void);
+/* by dimbor */
+static char szAgentUTF8_STRING[] = "UTF8_STRING";
+static Atom agentUTF8_STRING;
+
/*
* This is currently unused.
*/
@@ -419,6 +427,28 @@
} }
} }
+/* by dimbor */ +/* by dimbor */
+char *textToUTF8String(char *text, int nitems) +char *textToUTF8String(char *text, int nitems)
+{ +{
+ XTextProperty t_prop; + XTextProperty t_prop;
+ char *ret=NULL; + char *ret=NULL;
...@@ -79,7 +68,7 @@ Last-Update: 2011-12-31 ...@@ -79,7 +68,7 @@ Last-Update: 2011-12-31
+ t_prop.encoding=XInternAtom(nxagentDisplay, "COMPOUND_TEXT", 0); + t_prop.encoding=XInternAtom(nxagentDisplay, "COMPOUND_TEXT", 0);
+ char **list; + char **list;
+ int num; + int num;
+ int r = XmbTextPropertyToTextList(nxagentDisplay, &t_prop,&list, &num); + int r = Xutf8TextPropertyToTextList(nxagentDisplay, &t_prop,&list, &num);
+ if ((r == Success || r > 0) && num > 0 && *list) + if ((r == Success || r > 0) && num > 0 && *list)
+ { + {
+ ret=(char *)strdup (*list); + ret=(char *)strdup (*list);
...@@ -91,7 +80,7 @@ Last-Update: 2011-12-31 ...@@ -91,7 +80,7 @@ Last-Update: 2011-12-31
int nxagentExportAllProperty(pWin) int nxagentExportAllProperty(pWin)
WindowPtr pWin; WindowPtr pWin;
{ {
@@ -464,6 +494,7 @@ @@ -464,6 +490,7 @@
if (strncmp(propertyS, "WM_", 3) != 0 && if (strncmp(propertyS, "WM_", 3) != 0 &&
strncmp(propertyS, "_NET_", 5) != 0 && strncmp(propertyS, "_NET_", 5) != 0 &&
...@@ -99,7 +88,7 @@ Last-Update: 2011-12-31 ...@@ -99,7 +88,7 @@ Last-Update: 2011-12-31
strcmp(propertyS, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR") != 0) strcmp(propertyS, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR") != 0)
{ {
#ifdef TEST #ifdef TEST
@@ -474,6 +505,7 @@ @@ -474,6 +501,7 @@
#endif #endif
} }
else if (strcmp(typeS, "STRING") == 0 || else if (strcmp(typeS, "STRING") == 0 ||
...@@ -107,18 +96,20 @@ Last-Update: 2011-12-31 ...@@ -107,18 +96,20 @@ Last-Update: 2011-12-31
#ifndef _XSERVER64 #ifndef _XSERVER64
strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "CARDINAL") == 0 ||
strcmp(typeS, "WM_SIZE_HINTS") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0 ||
@@ -483,6 +515,15 @@ @@ -483,6 +511,17 @@
output = value; output = value;
export = True; export = True;
} }
+ /* add by dimbor */ + /* add by dimbor, modified by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> */
+ else if (strcmp(typeS, "COMPOUND_TEXT") == 0) + else if (strcmp(typeS, "COMPOUND_TEXT") == 0)
+ { + {
+ output = textToUTF8String(value, nUnits); + output = textToUTF8String(value, nUnits);
+ nUnits = strlen((char *) output); + if ( output != NULL ) {
+ type = MakeAtom(szAgentUTF8_STRING, strlen(szAgentUTF8_STRING), True); + nUnits = strlen((char *) output);
+ freeMem = True; + type = MakeAtom("UTF8_STRING", strlen("UTF8_STRING"), True);
+ export = True; + freeMem = True;
+ export = True;
+ }
+ } + }
#ifdef _XSERVER64 #ifdef _XSERVER64
else if (strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0) else if (strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment