slackware-current/source/l/gtk+/gtk+-1.2.10-ctext.patch
Patrick J Volkerding 646a5c1cbf Mon May 28 19:12:29 UTC 2018
a/pkgtools-15.0-noarch-13.txz:  Rebuilt.
  installpkg: default line length for --terselength is the number of columns.
  removepkg: added --terse mode.
  upgradepkg: default line length for --terselength is the number of columns.
  upgradepkg: accept -option in addition to --option.
ap/vim-8.1.0026-x86_64-1.txz:  Upgraded.
d/bison-3.0.5-x86_64-1.txz:  Upgraded.
e/emacs-26.1-x86_64-1.txz:  Upgraded.
kde/kopete-4.14.3-x86_64-8.txz:  Rebuilt.
  Recompiled against libidn-1.35.
n/conntrack-tools-1.4.5-x86_64-1.txz:  Upgraded.
n/libnetfilter_conntrack-1.0.7-x86_64-1.txz:  Upgraded.
n/libnftnl-1.1.0-x86_64-1.txz:  Upgraded.
n/links-2.16-x86_64-2.txz:  Rebuilt.
  Rebuilt to enable X driver for -g mode.
n/lynx-2.8.9dev.19-x86_64-1.txz:  Upgraded.
n/nftables-0.8.5-x86_64-1.txz:  Upgraded.
n/p11-kit-0.23.11-x86_64-1.txz:  Upgraded.
n/ulogd-2.0.7-x86_64-1.txz:  Upgraded.
n/whois-5.3.1-x86_64-1.txz:  Upgraded.
xap/network-manager-applet-1.8.12-x86_64-1.txz:  Upgraded.
xap/vim-gvim-8.1.0026-x86_64-1.txz:  Upgraded.
2018-05-31 23:39:35 +02:00

140 lines
3.6 KiB
Diff

--- gtk+-1.2.10/gdk/gdkselection.c.ctext Thu Jul 5 12:41:42 2001
+++ gtk+-1.2.10/gdk/gdkselection.c Thu Jul 5 12:45:25 2001
@@ -191,73 +191,6 @@
gdk_send_xevent (requestor, False, NoEventMask, (XEvent*) &xevent);
}
-
-/* The output of XmbTextPropertyToTextList may include stuff not valid
- * for COMPOUND_TEXT. This routine tries to correct this by:
- *
- * a) Canonicalizing CR LF and CR to LF
- * b) Stripping out all other non-allowed control characters
- *
- * See the COMPOUND_TEXT spec distributed with X for explanations
- * what is allowed.
- */
-static gchar *
-sanitize_ctext (const char *str,
- gint *length)
-{
- gchar *result = g_malloc (*length + 1);
- gint out_length = 0;
- gint i;
- const guchar *ustr = (const guchar *)str;
-
- for (i=0; i < *length; i++)
- {
- guchar c = ustr[i];
-
- if (c == '\r')
- {
- result[out_length++] = '\n';
- if (i + 1 < *length && ustr[i + 1] == '\n')
- i++;
- }
- else if (c == 27 /* ESC */)
- {
- /* Check for "extended segments, which can contain arbitrary
- * octets. See CTEXT spec, section 6.
- */
-
- if (i + 5 < *length &&
- ustr[i + 1] == '%' &&
- ustr[i + 2] == '/' &&
- (ustr[i + 3] >= 48 && ustr[i + 3] <= 52) &&
- ustr[i + 4] >= 128 &&
- ustr[i + 5] >= 128)
- {
- int extra_len = 6 + (ustr[i + 4] - 128) * 128 + ustr[i + 5] - 128;
- extra_len = MAX (extra_len, *length - i);
-
- memcpy (result + out_length, ustr + i, extra_len);
- out_length += extra_len;
- i += extra_len - 1;
- }
- else
- result[out_length++] = c;
- }
- else if (c == '\n' || c == '\t' || c == 27 /* ESC */ ||
- (c >= 32 && c <= 127) || /* GL */
- c == 155 /* CONTROL SEQUENCE INTRODUCER */ ||
- (c >= 160 && c <= 255)) /* GR */
- {
- result[out_length++] = c;
- }
- }
-
- result[out_length] = '\0';
- *length = out_length;
-
- return result;
-}
-
gint
gdk_text_property_to_text_list (GdkAtom encoding, gint format,
guchar *text, gint length,
@@ -266,32 +199,16 @@
XTextProperty property;
gint count = 0;
gint res;
- gchar *sanitized_text = NULL;
if (!list)
return 0;
property.encoding = encoding;
property.format = format;
-
- if (encoding == gdk_atom_intern ("COMPOUND_TEXT", FALSE) && format == 8)
- {
- gint sanitized_text_length = length;
-
- property.value = sanitized_text = sanitize_ctext (text, &sanitized_text_length);
- property.nitems = sanitized_text_length;
- }
- else
- {
- property.value = text;
- property.nitems = length;
- }
-
+ property.value = text;
+ property.nitems = length;
res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
- if (sanitized_text)
- g_free (sanitized_text);
-
if (res == XNoMemory || res == XLocaleNotSupported ||
res == XConverterNotFound)
return 0;
@@ -314,8 +231,6 @@
{
gint res;
XTextProperty property;
- gint sanitized_text_length;
- gchar *sanitized_text;
res = XmbTextListToTextProperty (GDK_DISPLAY(),
(char **)&str, 1, XCompoundTextStyle,
@@ -334,17 +249,10 @@
*encoding = property.encoding;
if (format)
*format = property.format;
-
- sanitized_text_length = property.nitems;
- sanitized_text = sanitize_ctext (property.value, &sanitized_text_length);
-
if (ctext)
- *ctext = sanitized_text;
- else
- g_free (sanitized_text);
-
+ *ctext = g_strdup (property.value);
if (length)
- *length = sanitized_text_length;
+ *length = property.nitems;
if (property.value)
XFree (property.value);