/[pkgs]/devel/MagicPoint/magicpoint-1.10a-longline.patch
ViewVC logotype

Contents of /devel/MagicPoint/magicpoint-1.10a-longline.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download) (as text)
Sun Sep 7 12:27:10 2008 UTC (14 months, 2 weeks ago) by jwrdegoede
Branch: MAIN
CVS Tags: MagicPoint-1_11b-9_fc12, F-12-split, MagicPoint-1_11b-10_fc12, F-10-split, MagicPoint-1_11b-7_fc10, F-11-split, MagicPoint-1_11b-8_fc11, HEAD
Changes since 1.3: +9 -9 lines
File MIME type: text/x-patch
* Sun Sep  7 2008 Hans de Goede <hdegoede@redhat.com> 1.11b-7
- Fix patch fuzz build failure
1 diff -up magicpoint-1.11b/draw.c.foo magicpoint-1.11b/draw.c
2 --- magicpoint-1.11b/draw.c.foo 2008-09-07 14:22:22.000000000 +0200
3 +++ magicpoint-1.11b/draw.c 2008-09-07 14:22:33.000000000 +0200
4 @@ -4691,6 +4691,7 @@ xft_draw_fragment(state, p, len, registr
5 char buf16[1024], *p16;
6 char out16[1024], *o16;
7 int ileft, oleft;
8 + int forcefolding = 0;
9 #ifdef HAVE_ICONV
10 static iconv_t icv[3];
11 #endif
12 @@ -4759,6 +4760,29 @@ xft_draw_fragment(state, p, len, registr
13 if (isspace(*(p + len -1))) {
14 XftTextExtents8(display, xft_font, (XftChar8 *)p, len -1, &extents);
15 if (state->width - state->leftfillpos / 2 - state->linewidth >= extents.xOff) goto nofolding;
16 + } else {
17 + /* the specified line might be too long. enforce to split the line in order to avoid the freeze. */
18 + wchar_t *wcstr;
19 + char *mbstr;
20 + int wclength, mblength, i;
21 +
22 + /* converting the strings to wchar to handle the multibyte characters correctly */
23 + wcstr = (wchar_t *) malloc (sizeof (wchar_t) * (strlen (p) + 1));
24 + wclength = mbstowcs (wcstr, p, len);
25 + for (i = wclength - 1; i >= 1; i--) {
26 + mbstr = (char *) malloc (sizeof (char) * (i + 1));
27 + mblength = wcstombs (mbstr, wcstr, i);
28 + XftTextExtents8 (display, xft_font, (XftChar8 *)p, mblength, &extents);
29 + if (state->width - state->leftfillpos / 2 - state->linewidth < extents.xOff) {
30 + free (mbstr);
31 + free (wcstr);
32 + len = mblength;
33 + forcefolding = 1;
34 + goto nofolding;
35 + }
36 + free (mbstr);
37 + }
38 + free (wcstr);
39 }
40
41 draw_line_end(state);
42 @@ -4778,9 +4802,20 @@ nofolding:
43 if (obj_new_xftfont(state, state->linewidth, state->charoff, p, len, fontname,
44 registry, char_size[caching], charset16, xft_font)) {
45 state->linewidth += extents.xOff;
46 + if (forcefolding == 1) {
47 + draw_line_end (state);
48 + draw_line_start (state);
49 + state->linewidth = state->leftfillpos;
50 + }
51 return p + len;
52 - } else
53 + } else {
54 + if (forcefolding == 1) {
55 + draw_line_end (state);
56 + draw_line_start (state);
57 + state->linewidth = state->leftfillpos;
58 + }
59 return NULL;
60 + }
61 }
62
63 static int

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2