1 |
armin76 07/12/31 14:57:33 |
2 |
|
3 |
Added: 003_unaligned.patch |
4 |
Removed: 003_firefox-bus-error.patch |
5 |
Log: |
6 |
Replace bus error patch with a better one |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 src/patchsets/mozilla-firefox/2.0.0.11/003_unaligned.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/mozilla-firefox/2.0.0.11/003_unaligned.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/mozilla-firefox/2.0.0.11/003_unaligned.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: 003_unaligned.patch |
15 |
=================================================================== |
16 |
# Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=161826 |
17 |
# Fix unaligned access |
18 |
diff -ur mozilla.orig/intl/unicharutil/util/nsUnicharUtils.cpp mozilla/intl/unicharutil/util/nsUnicharUtils.cpp |
19 |
--- mozilla.orig/intl/unicharutil/util/nsUnicharUtils.cpp 2007-12-29 12:43:10.000000000 +0000 |
20 |
+++ mozilla/intl/unicharutil/util/nsUnicharUtils.cpp 2007-12-29 12:44:08.000000000 +0000 |
21 |
@@ -348,3 +348,15 @@ |
22 |
return result; |
23 |
} |
24 |
|
25 |
+void |
26 |
+SetUnichar(void *ptr, PRUnichar aChar) |
27 |
+{ |
28 |
+#if NEED_STRICT_ALIGNMENT |
29 |
+ *((char *) ptr) = *((char *) &aChar); |
30 |
+ *((char *) ptr + 1) = *((char *) &aChar + 1); |
31 |
+#else |
32 |
+ *((PRUnichar *) ptr) = aChar; |
33 |
+#endif |
34 |
+} |
35 |
+ |
36 |
+ |
37 |
diff -ur mozilla.orig/intl/unicharutil/util/nsUnicharUtils.h mozilla/intl/unicharutil/util/nsUnicharUtils.h |
38 |
--- mozilla.orig/intl/unicharutil/util/nsUnicharUtils.h 2007-12-29 12:43:10.000000000 +0000 |
39 |
+++ mozilla/intl/unicharutil/util/nsUnicharUtils.h 2007-12-29 12:44:31.000000000 +0000 |
40 |
@@ -82,6 +82,10 @@ |
41 |
PRUnichar ToUpperCase(PRUnichar); |
42 |
PRUnichar ToLowerCase(PRUnichar); |
43 |
|
44 |
+#define NEED_STRICT_ALIGNMENT defined(__sparc__) || defined(__alpha__) || defined(__mips__) |
45 |
+ |
46 |
+void SetUnichar(void *, PRUnichar); |
47 |
+ |
48 |
inline PRBool IsUpperCase(PRUnichar c) { |
49 |
return ToLowerCase(c) != c; |
50 |
} |
51 |
diff -ur mozilla.orig/layout/generic/nsTextFrame.cpp mozilla/layout/generic/nsTextFrame.cpp |
52 |
--- mozilla.orig/layout/generic/nsTextFrame.cpp 2007-12-29 12:43:02.000000000 +0000 |
53 |
+++ mozilla/layout/generic/nsTextFrame.cpp 2007-12-29 12:46:16.000000000 +0000 |
54 |
@@ -5123,18 +5123,27 @@ |
55 |
}; |
56 |
|
57 |
// Transforms characters in place from ascii to Unicode |
58 |
-static void |
59 |
+static PRUnichar * |
60 |
TransformTextToUnicode(char* aText, PRInt32 aNumChars) |
61 |
{ |
62 |
// Go backwards over the characters and convert them. |
63 |
unsigned char* cp1 = (unsigned char*)aText + aNumChars - 1; |
64 |
- PRUnichar* cp2 = (PRUnichar*)aText + (aNumChars - 1); |
65 |
+ PRUnichar* cp2; |
66 |
+ PRUnichar* ret; |
67 |
+ |
68 |
+ if ((unsigned long) aText & 0x1) |
69 |
+ cp2 = ((PRUnichar*)(aText + 1)); |
70 |
+ else |
71 |
+ cp2 = (PRUnichar*)aText; |
72 |
|
73 |
- while (aNumChars-- > 0) { |
74 |
- // XXX: If you crash here then you may see the issue described |
75 |
- // in http://bugzilla.mozilla.org/show_bug.cgi?id=36146#c44 |
76 |
- *cp2-- = PRUnichar(*cp1--); |
77 |
- } |
78 |
+ ret = cp2; |
79 |
+ |
80 |
+ cp2 += (aNumChars - 1); |
81 |
+ |
82 |
+ while (aNumChars-- > 0) |
83 |
+ SetUnichar(cp2--, PRUnichar(*cp1--)); |
84 |
+ |
85 |
+ return ret; |
86 |
} |
87 |
|
88 |
PRUint32 |
89 |
@@ -5702,7 +5711,7 @@ |
90 |
// The text transform buffer contains ascii characters, so |
91 |
// transform it to Unicode |
92 |
NS_ASSERTION(wordBufLen >= PRUint32(lastWordLen), "no room to transform in place"); |
93 |
- TransformTextToUnicode((char*)lastWordPtr, lastWordLen); |
94 |
+ pWordBuf = TransformTextToUnicode((char*)lastWordPtr, lastWordLen); |
95 |
} |
96 |
|
97 |
// Look ahead in the text-run and compute the final word |
98 |
@@ -6232,7 +6241,7 @@ |
99 |
for (; aBuffer < end; aBuffer++) { |
100 |
PRUnichar ch = *aBuffer; |
101 |
if (ch == ' ') { |
102 |
- *aBuffer = CH_NBSP; |
103 |
+ SetUnichar(aBuffer, CH_NBSP); |
104 |
} |
105 |
} |
106 |
} |
107 |
|
108 |
|
109 |
|
110 |
-- |
111 |
gentoo-commits@g.o mailing list |