summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-03-19 16:56:34 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-09-19 19:18:40 +0300
commite4a8d533daa74649fd43ad505ea7ec2ec7c680fa (patch)
treeb79f81ae7dd3da04e0fd40e28e541c1fec6c3a03 /src
parentd8a3db257418d5ebb99509e0bdcfa24d618e6b3d (diff)
sna/fb: Use memcpy() to avoid strict aliasing violations
Replace the cast+deref with memcpy() so that we don't upset the compiler's strict aliasing rules. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/sna/fb/fbspan.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sna/fb/fbspan.c b/src/sna/fb/fbspan.c
index 45cb7cc7..18136c20 100644
--- a/src/sna/fb/fbspan.c
+++ b/src/sna/fb/fbspan.c
@@ -39,12 +39,13 @@ fbFillSpans(DrawablePtr drawable, GCPtr gc,
while (n--) {
BoxRec box;
- *(DDXPointPtr)&box = *pt++;
+ memcpy(&box, pt, sizeof(box));
box.x2 = box.x1 + *width++;
box.y2 = box.y1 + 1;
/* XXX fSorted */
fbDrawableRun(drawable, gc, &box, fbFillSpan, NULL);
+ pt++;
}
}
@@ -91,7 +92,8 @@ fbSetSpans(DrawablePtr drawable, GCPtr gc,
while (n--) {
BoxRec box;
- *(DDXPointPtr)&box = data.pt = *pt;
+ memcpy(&box, pt, sizeof(box));
+ data.pt = *pt;
box.x2 = box.x1 + *width;
box.y2 = box.y1 + 1;