[jffi-next] 30/49: Swap parameters on memmove due to a bug in the stub lib, and fixup off-by-one error in copyMemory()

Tim Potter tpot-guest at moszumanska.debian.org
Wed Mar 4 04:51:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

tpot-guest pushed a commit to annotated tag upstream/1.0.10
in repository jffi-next.

commit 221509eb8264220f7211f9d1059a426beb51eaa1
Author: Wayne Meissner <wmeissner at gmail.com>
Date:   Thu Mar 31 00:26:03 2011 +1000

    Swap parameters on memmove due to a bug in the stub lib, and fixup off-by-one error in copyMemory()
---
 src/com/kenai/jffi/MemoryIO.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/com/kenai/jffi/MemoryIO.java b/src/com/kenai/jffi/MemoryIO.java
index eb1c2e4..93337c7 100644
--- a/src/com/kenai/jffi/MemoryIO.java
+++ b/src/com/kenai/jffi/MemoryIO.java
@@ -246,11 +246,11 @@ public abstract class MemoryIO {
      * @param size The number of bytes to copy.
      */
     public final void copyMemory(long src, long dst, long size) {
-        if (dst + size < src || src + size < dst) {
+        if (dst + size <= src || src + size <= dst) {
             // Use intrinsic copyMemory if regions do not overlap
             _copyMemory(src, dst, size);
         } else {
-            foreign.memmove(dst, src, size);
+            memmove(dst, src, size);
         }
     }
 
@@ -294,7 +294,8 @@ public abstract class MemoryIO {
      * @param size The number of bytes to copy.
      */
     public final void memmove(long dst, long src, long size) {
-        foreign.memmove(dst, src, size);
+        // FIXME: the order of the arguments in the native code is wrong
+        foreign.memmove(src, dst, size);
     }
 
     /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jffi-next.git



More information about the pkg-java-commits mailing list