From b08e7198dc0141b8074d8fdff681019d86655a38 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Tue, 12 Apr 2011 16:49:43 +0200 Subject: [PATCH] Use memmove instead of memcpy in fbblt.c when memory regions overlap. Signed-off-by: Adam Tkac --- 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