6341887: Inflater can't handle ByteBuffer (original) (raw)
Ulf Zibis Ulf.Zibis at gmx.de
Sat Apr 14 21:09:56 UTC 2012
- Previous message: 6341887: Inflater can't handle ByteBuffer - first webrev
- Next message: 6341887: Inflater can't handle ByteBuffer - first webrev
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 14.04.2012 10:28, schrieb Martin Kirst:
WebRev here: http://dl.dropbox.com/u/52514330/6341887/webrev.00/index.html
Feedback is welcome.
Superfluous (will be addressed by bbuffer.position()) : 485 if (bbuffer == null) { 486 throw new NullPointerException(); 487 }
Can (pos < 0 || limit < 0 || pos > limit) ? I believe, all Bytebuffer implementations should ensure this already, so an assert operator would suffice.
Anyway, little simpler: 491 final int pos = bbuffer.position(); 492 final int rem = bbuffer.remaining(); 493 if (pos < 0 || rem < 0) { 494 throw new ArrayIndexOutOfBoundsException(); 495 } No need to check rem < 0, so simply: 497 if (rem == 0) return 0; // Z_OK = 0; ... 511 bbuffer.position(pos + rem); // maybe bbuffer.flip() ?
Can ByteBuffer not have array and not be instance of DirectBuffer ? Compare to different decision in sun.nio.ch.Xyz.De/Encoder.de/encodeLoop(...) methods !
It seems, variable "off" is never used: 190 JNIEXPORT jint JNICALL 191 Java_java_util_zip_Deflater_deflateByteBuffer(JNIEnv *env, jobject this, jlong zsaddr, 192 jlong bbaddr, jint off, jint len, jint flush) 193 ...
-Ulf
- Previous message: 6341887: Inflater can't handle ByteBuffer - first webrev
- Next message: 6341887: Inflater can't handle ByteBuffer - first webrev
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]