Mercurial > hg > Applications > TreeVNC
changeset 580:c7527f24e344
fix deflatr
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 07 Feb 2020 22:56:41 +0900 |
parents | 5bc128c8e6aa |
children | aef7d24b430d |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java |
diffstat | 2 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Fri Feb 07 19:22:30 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Fri Feb 07 22:56:41 2020 +0900 @@ -157,25 +157,26 @@ int span = offset - prevoffset; deflater.setInput(bytes, prevoffset, span); do { - deflater.deflate(c1, Deflater.SYNC_FLUSH); - long bytesRead = deflater.getBytesRead(); + deflater.deflate(c1, Deflater. SYNC_FLUSH); + int bytesRead = (int)deflater.getBytesRead(); if (!deflater.needsInput()) { // compression failed - flushDeflator(bytes); - prevoffset = flushOffset+(int)bytesRead; + flushDeflator(); + prevoffset = flushOffset+(int)deflater.getBytesRead(); flushRectangle(rect); flushMuticast(rfb, bytes); if (last && bytesRead == span) { return; } else { newMulticastPacket(rfb, rect); + deflater.setInput(bytes,prevoffset,offset - prevoffset); deflater.deflate(c1, Deflater.NO_FLUSH); } } } while (! deflater.needsInput()); prevoffset = offset; if (last) { - flushDeflator(bytes); + flushDeflator(); flushRectangle(rect); flushMuticast(rfb, bytes); } @@ -196,10 +197,8 @@ } } - private void flushDeflator(byte[] bytes) { - byte [] n = {}; + private void flushDeflator() { c1.limit(c1.limit() + MARGIN); - deflater.setInput(n); deflater.deflate(c1, Deflater.FULL_FLUSH); if (c1.remaining()==0) { System.out.println("Multicast packet overrun.");
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Fri Feb 07 19:22:30 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Fri Feb 07 22:56:41 2020 +0900 @@ -414,7 +414,7 @@ if (buf.remaining() == span) { }else { - System.out.println("Bytes is not equal length "+buf.remaining()+" != "+span); + System.out.println("Bytes is not equal length "+buf.remaining()+" != "+span + " " + (buf.remaining() - span)); } }