/[gentoo]/src/patchsets/mozilla-firefox/2.0.0.11/003_firefox-bus-error.patch
Gentoo

Contents of /src/patchsets/mozilla-firefox/2.0.0.11/003_firefox-bus-error.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Dec 31 14:57:33 2007 UTC (10 years ago) by armin76
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Replace bus error patch with a better one

1 diff -aur a/gfx/src/gtk/nsFontMetricsPango.cpp b/gfx/src/gtk/nsFontMetricsPango.cpp
2 --- a/gfx/src/gtk/nsFontMetricsPango.cpp 2006-02-23 13:01:42.000000000 -0800
3 +++ b/gfx/src/gtk/nsFontMetricsPango.cpp 2006-05-20 20:27:50.000000000 -0700
4 @@ -535,8 +535,13 @@
5
6 PangoLayout *layout = pango_layout_new(mPangoContext);
7
8 - gchar *text = g_utf16_to_utf8(aString, aLength,
9 + // Just copy the aString to ensure the alignment,
10 + // it is not used anywhere else.
11 + PRUnichar* dummy = new PRUnichar[aLength];
12 + memcpy(dummy, aString, aLength*sizeof(PRUnichar));
13 + gchar *text = g_utf16_to_utf8(dummy, aLength,
14 NULL, NULL, NULL);
15 + delete [] dummy;
16
17 if (!text) {
18 #ifdef DEBUG
19 diff -aur a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp
20 --- a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp 2004-04-18 07:21:07.000000000 -0700
21 +++ b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp 2006-05-20 20:27:51.000000000 -0700
22 @@ -487,13 +487,13 @@
23 PRUint32 cur;
24 for (cur = aPos; cur < aLen; ++cur)
25 {
26 - if (IS_SPACE(aText[cur]))
27 + if (IS_SPACE(GetUnichar(&aText[cur])))
28 {
29 *oNext = cur;
30 *oNeedMoreText = PR_FALSE;
31 return NS_OK;
32 }
33 - if (IS_CJK_CHAR(aText[cur]))
34 + if (IS_CJK_CHAR(GetUnichar(&aText[cur])))
35 goto ROUTE_CJK_NEXT;
36 }
37 *oNext = aLen;
38 @@ -503,13 +503,13 @@
39 ROUTE_CJK_NEXT:
40 PRInt8 c1, c2;
41 cur = aPos;
42 - if(NEED_CONTEXTUAL_ANALYSIS(aText[cur]))
43 + if(NEED_CONTEXTUAL_ANALYSIS(GetUnichar(&aText[cur])))
44 {
45 - c1 = this->ContextualAnalysis((cur>0)?aText[cur-1]:0,
46 - aText[cur],
47 - (cur<(aLen-1)) ?aText[cur+1]:0);
48 + c1 = this->ContextualAnalysis((cur>0)?GetUnichar(&aText[cur-1]):0,
49 + GetUnichar(&aText[cur]),
50 + (cur<(aLen-1)) ?GetUnichar(&aText[cur+1]):0);
51 } else {
52 - c1 = this->GetClass(aText[cur]);
53 + c1 = this->GetClass(GetUnichar(&aText[cur]));
54 }
55
56 if(CLASS_THAI == c1)
57 @@ -521,13 +521,13 @@
58
59 for(cur++; cur <aLen; cur++)
60 {
61 - if(NEED_CONTEXTUAL_ANALYSIS(aText[cur]))
62 + if(NEED_CONTEXTUAL_ANALYSIS(GetUnichar(&aText[cur])))
63 {
64 - c2= this->ContextualAnalysis((cur>0)?aText[cur-1]:0,
65 - aText[cur],
66 - (cur<(aLen-1)) ?aText[cur+1]:0);
67 + c2= this->ContextualAnalysis((cur>0)?GetUnichar(&aText[cur-1]):0,
68 + GetUnichar(&aText[cur]),
69 + (cur<(aLen-1)) ?GetUnichar(&aText[cur+1]):0);
70 } else {
71 - c2 = this->GetClass(aText[cur]);
72 + c2 = this->GetClass(GetUnichar(&aText[cur]));
73 }
74
75 if(GetPair(c1, c2)) {
76 diff -aur a/intl/unicharutil/util/nsUnicharUtils.cpp b/intl/unicharutil/util/nsUnicharUtils.cpp
77 --- a/intl/unicharutil/util/nsUnicharUtils.cpp 2005-04-21 15:30:21.000000000 -0700
78 +++ b/intl/unicharutil/util/nsUnicharUtils.cpp 2006-05-20 20:27:50.000000000 -0700
79 @@ -340,3 +340,28 @@
80 return result;
81 }
82
83 +PRUnichar
84 +GetUnichar(const void *ptr)
85 +{
86 + PRUnichar result;
87 +#if defined(__sparc__) || defined(__alpha__)
88 + *((char *) &result) = *((char *) ptr);
89 + *((char *) &result + 1) = *((char *) ptr + 1);
90 +#else
91 + result = *((PRUnichar *) ptr);
92 +#endif
93 + return result;
94 +}
95 +
96 +void
97 +SetUnichar(void *ptr, PRUnichar aChar)
98 +{
99 +#if defined(__sparc__) || defined(__alpha__)
100 + *((char *) ptr) = *((char *) &aChar);
101 + *((char *) ptr + 1) = *((char *) &aChar + 1);
102 +#else
103 + *((PRUnichar *) ptr) = aChar;
104 +#endif
105 +}
106 +
107 +
108 diff -aur a/intl/unicharutil/util/nsUnicharUtils.h b/intl/unicharutil/util/nsUnicharUtils.h
109 --- a/intl/unicharutil/util/nsUnicharUtils.h 2005-02-24 07:50:57.000000000 -0800
110 +++ b/intl/unicharutil/util/nsUnicharUtils.h 2006-05-20 20:27:50.000000000 -0700
111 @@ -81,6 +81,8 @@
112
113 PRUnichar ToUpperCase(PRUnichar);
114 PRUnichar ToLowerCase(PRUnichar);
115 +PRUnichar GetUnichar(const void *);
116 +void SetUnichar(void *, PRUnichar);
117
118 inline PRBool IsUpperCase(PRUnichar c) {
119 return ToLowerCase(c) != c;
120 diff -aur a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
121 --- a/layout/generic/nsTextFrame.cpp 2006-02-13 18:05:07.000000000 -0800
122 +++ b/layout/generic/nsTextFrame.cpp 2006-05-20 20:27:50.000000000 -0700
123 @@ -5101,8 +5101,8 @@
124
125 while (aNumChars-- > 0) {
126 // XXX: If you crash here then you may see the issue described
127 - // in http://bugzilla.mozilla.org/show_bug.cgi?id=36146#c44
128 - *cp2-- = PRUnichar(*cp1--);
129 + // in http://bugzilla.mozilla.org/show_bug.cgi?id=161826
130 + SetUnichar(cp2--, PRUnichar(*cp1--));
131 }
132 }
133
134 @@ -6199,9 +6199,9 @@
135 {
136 PRUnichar* end = aBuffer + aWordLen;
137 for (; aBuffer < end; aBuffer++) {
138 - PRUnichar ch = *aBuffer;
139 + PRUnichar ch = GetUnichar(aBuffer);
140 if (ch == ' ') {
141 - *aBuffer = CH_NBSP;
142 + SetUnichar(aBuffer, CH_NBSP);
143 }
144 }
145 }

  ViewVC Help
Powered by ViewVC 1.1.20