1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

better zip processing

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1311 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Nikolay Pultsin 2010-04-30 04:26:10 +00:00
parent dabac4421a
commit 9ebd823406
13 changed files with 688 additions and 711 deletions

View file

@ -39,9 +39,9 @@ void Java_org_amse_ys_zip_NativeDeflatingDecompressor_endInflating(JNIEnv *env,
}
}
// returns ((used inLength) << 16) + utLength
// returns (endFlag << 32) + ((used inLength) << 16) + outLength
extern "C"
jint Java_org_amse_ys_zip_NativeDeflatingDecompressor_inflate(JNIEnv *env, jobject thiz, jbyteArray in, jint inOffset, jint inLength, jbyteArray out) {
jlong Java_org_amse_ys_zip_NativeDeflatingDecompressor_inflate(JNIEnv *env, jobject thiz, jbyteArray in, jint inOffset, jint inLength, jbyteArray out) {
int i;
z_stream *stream = 0;
for (i = 0; i < SIZE; ++i) {
@ -64,8 +64,12 @@ jint Java_org_amse_ys_zip_NativeDeflatingDecompressor_inflate(JNIEnv *env, jobje
const int code = inflate(stream, Z_SYNC_FLUSH);
env->ReleaseByteArrayElements(in, inStart, 0);
env->ReleaseByteArrayElements(out, outStart, 0);
if ((code == Z_OK) || (code == Z_STREAM_END)) {
return ((inLength - stream->avail_in) << 16) + outLength - stream->avail_out;
if (code == Z_OK || code == Z_STREAM_END) {
jlong result = ((inLength - stream->avail_in) << 16) + outLength - stream->avail_out;
if (code == Z_STREAM_END) {
result |= ((jlong)1) << 32;
}
return result;
}
return 0;
}