1 |
aballier 10/05/02 07:54:00 |
2 |
|
3 |
Added: silgraphite-2.3.1-aligned_access.patch |
4 |
Log: |
5 |
fix unaligned reads; bug #304921 |
6 |
(Portage version: 2.2_rc67/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: silgraphite-2.3.1-aligned_access.patch |
15 |
=================================================================== |
16 |
Fix unaligned reads. |
17 |
https://bugs.gentoo.org/show_bug.cgi?id=304921 |
18 |
|
19 |
Upstream: |
20 |
https://sourceforge.net/tracker/?func=detail&aid=2995413&group_id=66144&atid=513479 |
21 |
|
22 |
Index: silgraphite-2.3.1/engine/src/segment/FileInput.cpp |
23 |
=================================================================== |
24 |
--- silgraphite-2.3.1.orig/engine/src/segment/FileInput.cpp |
25 |
+++ silgraphite-2.3.1/engine/src/segment/FileInput.cpp |
26 |
@@ -41,6 +41,10 @@ DEFINE_THIS_FILE |
27 |
|
28 |
//:End Ignore |
29 |
|
30 |
+#define RAW_READ(var,size,buf) \ |
31 |
+ for(int i = 0; i < isizeof(size);i++){\ |
32 |
+ var |= buf[i]<<8*(isizeof(size)-i-1);\ |
33 |
+ } |
34 |
//:>******************************************************************************************** |
35 |
//:> Forward declarations |
36 |
//:>******************************************************************************************** |
37 |
@@ -133,11 +137,11 @@ byte GrBufferIStream::ReadByteFromFont() |
38 |
----------------------------------------------------------------------------------------------*/ |
39 |
short GrBufferIStream::ReadShortFromFont() |
40 |
{ |
41 |
- short snInput = *(short *)m_pbNext; |
42 |
+ short snInput = 0; |
43 |
+ RAW_READ(snInput,short,m_pbNext); |
44 |
m_pbNext += isizeof(short); |
45 |
if (m_pbLim && m_pbNext > m_pbLim) |
46 |
THROW(kresReadFault); |
47 |
- snInput = lsbf(snInput); |
48 |
return snInput; |
49 |
} |
50 |
|
51 |
@@ -147,11 +151,11 @@ short GrBufferIStream::ReadShortFromFont |
52 |
----------------------------------------------------------------------------------------------*/ |
53 |
utf16 GrBufferIStream::ReadUShortFromFont() |
54 |
{ |
55 |
- utf16 chwInput = *(utf16 *)m_pbNext; |
56 |
+ utf16 chwInput = 0; |
57 |
+ RAW_READ(chwInput,utf16,m_pbNext); |
58 |
m_pbNext += isizeof(utf16); |
59 |
if (m_pbLim && m_pbNext > m_pbLim) |
60 |
THROW(kresReadFault); |
61 |
- chwInput = lsbf(chwInput); |
62 |
return chwInput; |
63 |
} |
64 |
|
65 |
@@ -161,11 +165,11 @@ utf16 GrBufferIStream::ReadUShortFromFon |
66 |
----------------------------------------------------------------------------------------------*/ |
67 |
int GrBufferIStream::ReadIntFromFont() |
68 |
{ |
69 |
- int nInput = *(int *)m_pbNext; |
70 |
+ int nInput = 0; |
71 |
+ RAW_READ(nInput,int,m_pbNext); |
72 |
m_pbNext += isizeof(int); |
73 |
if (m_pbLim && m_pbNext > m_pbLim) |
74 |
THROW(kresReadFault); |
75 |
- nInput = lsbf(nInput); |
76 |
return nInput; |
77 |
} |