diff options
author | Matthew Johnson <mjj29@qadesh.matthew.ath.cx> | 2008-11-16 12:47:38 +0000 |
---|---|---|
committer | Matthew Johnson <mjj29@qadesh.matthew.ath.cx> | 2008-11-16 12:47:38 +0000 |
commit | 4e3a820a8d75baa68d6e4de844a10612e95fd0ec (patch) | |
tree | 1490aca75bcb803ba9f726d725a04511ec0fd530 /org | |
parent | 1e2aeb7f4289de80599b4187d627bfd6b2abd576 (diff) |
* Fix array mmarshalling bug (Fixes: #13291)
Diffstat (limited to 'org')
-rw-r--r-- | org/freedesktop/dbus/Marshalling.java | 2 | ||||
-rw-r--r-- | org/freedesktop/dbus/Message.java | 1 | ||||
-rw-r--r-- | org/freedesktop/dbus/test/TestRemoteInterface.java | 2 | ||||
-rw-r--r-- | org/freedesktop/dbus/test/test.java | 13 | ||||
-rw-r--r-- | org/freedesktop/dbus/test/test_p2p_server.java | 3 |
5 files changed, 19 insertions, 2 deletions
diff --git a/org/freedesktop/dbus/Marshalling.java b/org/freedesktop/dbus/Marshalling.java index c5177f1..7116248 100644 --- a/org/freedesktop/dbus/Marshalling.java +++ b/org/freedesktop/dbus/Marshalling.java @@ -95,7 +95,7 @@ public class Marshalling out = newout; } if (null == out[level]) out[level] = new StringBuffer(); - else out[level].delete(0, out[level].length); + else out[level].delete(0, out[level].length()); if (basic && !(c instanceof Class)) throw new DBusException(c+_(" is not a basic type")); diff --git a/org/freedesktop/dbus/Message.java b/org/freedesktop/dbus/Message.java index 405b202..f0eb80a 100644 --- a/org/freedesktop/dbus/Message.java +++ b/org/freedesktop/dbus/Message.java @@ -621,7 +621,6 @@ public class Message throw new MarshallingException(_("Primative array being sent as non-primative array.")); } appendBytes(primbuf); - i++; } else if (data instanceof List) { Object[] contents = ((List) data).toArray(); int diff = i; diff --git a/org/freedesktop/dbus/test/TestRemoteInterface.java b/org/freedesktop/dbus/test/TestRemoteInterface.java index fab14bb..0379d4e 100644 --- a/org/freedesktop/dbus/test/TestRemoteInterface.java +++ b/org/freedesktop/dbus/test/TestRemoteInterface.java @@ -47,4 +47,6 @@ public interface TestRemoteInterface extends DBusInterface public float testfloat(float[] f); @Description("Testing structs of structs") public int[][] teststructstruct(TestStruct3 in); + @Description("Regression test for #13291") + public void reg13291(byte[] as, byte[] bs); } diff --git a/org/freedesktop/dbus/test/test.java b/org/freedesktop/dbus/test/test.java index 10ee173..1bb433f 100644 --- a/org/freedesktop/dbus/test/test.java +++ b/org/freedesktop/dbus/test/test.java @@ -292,6 +292,12 @@ class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignal || !"moo".equals(((Map<Object,Object>) v.getValue()).get("cow"))) test.fail("Didn't send variant correctly"); } + public void reg13291(byte[] as, byte[] bs) + { + if (as.length != bs.length) test.fail("didn't receive identical byte arrays"); + for (int i = 0; i < as.length; i++) + if (as[i] != bs[i]) test.fail("didn't receive identical byte arrays"); + } } /** @@ -739,6 +745,13 @@ public class test if (4 != tri.overload()) test.fail("wrong overloaded method called"); System.out.println("done"); + System.out.print("reg13291..."); + byte[] as = new byte[10]; + for (int i = 0; i < 10; i++) + as[i] = (byte) (100-i); + tri.reg13291(as, as); + System.out.println("done"); + System.out.print("Testing nested lists..."); lli = new Vector<List<Integer>>(); li = new Vector<Integer>(); diff --git a/org/freedesktop/dbus/test/test_p2p_server.java b/org/freedesktop/dbus/test/test_p2p_server.java index a8365fe..1025bda 100644 --- a/org/freedesktop/dbus/test/test_p2p_server.java +++ b/org/freedesktop/dbus/test/test_p2p_server.java @@ -62,6 +62,9 @@ public class test_p2p_server implements TestRemoteInterface public void newpathtest(Path p) { } + public void reg13291(byte[] as, byte[] bs) + { + } public boolean isRemote() { return false; } public float testfloat(float[] f) { |