changeset 503:0f9160194a04

fix writeupdaterectanglewithheader
author oshiro
date Mon, 18 Feb 2019 17:33:49 +0900
parents b9e73589202c
children d409e89ec8ec
files src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Mon Feb 18 17:08:34 2019 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Mon Feb 18 17:33:49 2019 +0900
@@ -767,6 +767,7 @@
             CheckDelay.checkDelay(c1, rect.x, rect.y, rect.width, rect.height, System.currentTimeMillis(), EncodingType.CHECK_DELAY);
         c1headerPos = c1.position();
         c1.put(header);
+        c1.putInt(0);
         c1rect = new FramebufferUpdateRectangle(rect.x, rect.y, 0, 0);
         return;
     }
@@ -794,6 +795,7 @@
                 c1.putLong(counter++);
             c1headerPos = c1.position();
             c1.put(header);
+            c1.putInt(0);
         } else {
             deflater.deflate(c1, Deflater.SYNC_FLUSH);
         }
@@ -803,11 +805,12 @@
     private void writeUpdateRectangleWithHeader(ByteBuffer c1, int headerPos, int len2, int x, int y, int w, int h) throws InterruptedException {
         deflater.reset();
 
-        c1.putInt(len2);
+        c1.putInt(headerPos + 16, len2);
         c1.putShort(headerPos + 4,(short) x);
         c1.putShort(headerPos + 6,(short) y);
         c1.putShort(headerPos + 8,(short) w);
         c1.putShort(headerPos + 10,(short) h);
+        c1.flip();
         LinkedList<ByteBuffer> bufs = new LinkedList<ByteBuffer>();
         bufs.add(c1);
         multicastqueue.waitput(bufs);