[PATCH] Use memmove instead of memcpy in fbblt.c when memory regions overlap.
Adam Tkac
atkac at redhat.com
Tue Apr 12 07:49:43 PDT 2011
Signed-off-by: Adam Tkac <atkac at redhat.com>
---
fb/fb.h | 4 ++++
fb/fbblt.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fb/fb.h b/fb/fb.h
index eaa21ad..f68fe3b 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -66,6 +66,9 @@
} \
} while(0)
+/* XXX: Is this enough? */
+#define MEMMOVE_WRAPPED MEMCPY_WRAPPED
+
#else
#define FBPREFIX(x) fb##x
@@ -73,6 +76,7 @@
#define READ(ptr) (*(ptr))
#define MEMCPY_WRAPPED(dst, src, size) memcpy((dst), (src), (size))
#define MEMSET_WRAPPED(dst, val, size) memset((dst), (val), (size))
+#define MEMMOVE_WRAPPED(dst, src, size) memmove((dst), (src), (size))
#endif
diff --git a/fb/fbblt.c b/fb/fbblt.c
index a040298..e16c660 100644
--- a/fb/fbblt.c
+++ b/fb/fbblt.c
@@ -88,10 +88,10 @@ fbBlt (FbBits *srcLine,
if (!upsidedown)
for (i = 0; i < height; i++)
- MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
+ MEMMOVE_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
else
for (i = height - 1; i >= 0; i--)
- MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
+ MEMMOVE_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
return;
}
--
1.7.4.4
--------------030104080502020900080905--
More information about the xorg-devel
mailing list