Mesa (master): swrast: use memmove() instead of memcpy() in the SHIFT_ARRAY macro

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 5 19:51:39 UTC 2012


Module: Mesa
Branch: master
Commit: a44d715d2b19dc2f8f48b01144cc38e4e2c5015a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a44d715d2b19dc2f8f48b01144cc38e4e2c5015a

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Jan  5 11:59:30 2012 -0700

swrast: use memmove() instead of memcpy() in the SHIFT_ARRAY macro

The src/dst arrays would overlap but dst was less than src so a simple
version of memcpy() would do the right thing.  But this isn't guaranteed
when memcpy() is optimized.

Fixes demos/copypix when the dest region was clipped by the left side of
the window.

Reviewed-by: Adam Jackson <ajax at redhat.com>

---

 src/mesa/swrast/s_span.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 4124e44..8f02eea 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -776,7 +776,7 @@ clip_span( struct gl_context *ctx, SWspan *span )
          span->intTex[1] += leftClip * span->intTexStep[1];
 
 #define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
-         memcpy(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
+         memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
 
          for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
             if (span->arrayAttribs & (1 << i)) {




More information about the mesa-commit mailing list