From: Henning S. <hen...@fu...> - 2009-12-16 09:39:57
|
+1 nothing to complain. Regards, Henning Am 13.12.2009 um 16:46 schrieb Sandor Szücs: > Hi, > > [FIX] BinaryChannel::getData() returned byte Array padded with NUL > bytes. > > regards, Sandor Szücs > -- > > Index: src/de/fu_berlin/inf/dpp/net/jingle/protocol/BinaryChannel.java > =================================================================== > --- src/de/fu_berlin/inf/dpp/net/jingle/protocol/BinaryChannel.java > (revision 1883) > +++ src/de/fu_berlin/inf/dpp/net/jingle/protocol/BinaryChannel.java > (working copy) > @@ -204,9 +204,16 @@ > * Returns the byte Array for the given List of BinaryPacket. > */ > public static byte[] getData(List<BinaryPacket> list) { > - ByteBuffer buf = ByteBuffer.allocate(list.size() * > CHUNKSIZE); > + int size = 0; > + > + for (BinaryPacket packet : list) { > + size += packet.getSize(); > + } > + > + ByteBuffer buf = ByteBuffer.allocate(size); > for (BinaryPacket packet : list) > buf.put(packet.body); > + > return buf.array(); > } > > > > > > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Dpp-devel mailing list > Dpp...@li... > https://lists.sourceforge.net/lists/listinfo/dpp-devel |