Mercurial > hg > Members > nobuyasu > tightVNCProxy
changeset 91:4116c19cd76e
unzip/zip test passed.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Aug 2011 10:52:19 +0900 |
parents | 462bca4c8cec |
children | aa7df396e04d |
files | src/myVncProxy/MyRfbProto.java |
diffstat | 1 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java Wed Aug 03 10:30:45 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Wed Aug 03 10:52:19 2011 +0900 @@ -525,10 +525,8 @@ * gzip byte arrays * @param deflater * @param inputs - * byte len[4] total byte length * byte data[] * @param outputs - * byte len[4] total byte length * byte data[] * @return byte length in last byte array * @throws IOException @@ -550,10 +548,8 @@ outputs.addLast(c1); len += len1; } - } while (len1 > 0); + } while (len1==INFLATE_BUFSIZE); } while(inputs.size()>0); - ByteBuffer blen = ByteBuffer.wrap(castIntByte(len)); - outputs.addFirst(blen); return len; } @@ -561,11 +557,10 @@ * gunzip byte arrays * @param inflater * @param inputs - * byte len[4] total byte length * byte data[] * @param outputs - * byte len[4] total byte length * byte data[] + *@return number of total bytes * @throws IOException */ public int unzip(Inflater inflater, LinkedList<ByteBuffer> inputs, LinkedList<ByteBuffer> outputs) @@ -579,8 +574,10 @@ len0 = inflater.inflate(buf.array(),0,buf.capacity()); buf.limit(len0); len += len0; - outputs.addLast(buf); - } while (len0 ==INFLATE_BUFSIZE); + if (len0>0) { + outputs.addLast(buf); + } + } while (len0>0); } while (!inputs.isEmpty()); return len; } @@ -695,7 +692,7 @@ Deflater deflater = new Deflater(); zip(deflater, in,out); unzip(inflater, out, out2); - for(ByteBuffer b:out) { + for(ByteBuffer b:in) { ByteBuffer c = out2.poll(); assertEquals(b,c); }