harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r619651 - /harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/adler32.c
Date Thu, 07 Feb 2008 21:42:46 GMT
Author: hindessm
Date: Thu Feb  7 13:42:44 2008
New Revision: 619651

URL: http://svn.apache.org/viewvc?rev=619651&view=rev
Log:
Use include file rather than ad hoc prototype.
Add memory error check.
Fix compiler warnings.

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/adler32.c

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/adler32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/adler32.c?rev=619651&r1=619650&r2=619651&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/adler32.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/adler32.c
Thu Feb  7 13:42:44 2008
@@ -18,20 +18,23 @@
 #include "jni.h"
 #include "vmi.h"
 #include "zconf.h"
-uLong adler32 PROTOTYPE ((uLong crc, const Bytef * buf, uInt size));
+#include "zlib.h"
+#include "exceptions.h"
 
 JNIEXPORT jlong JNICALL
 Java_java_util_zip_Adler32_updateImpl (JNIEnv * env, jobject recv,
                                        jbyteArray buf, int off, int len,
                                        jlong crc)
 {
-  PORT_ACCESS_FROM_ENV (env);
-
   jbyte *b;
   jboolean isCopy;
   jlong result;
 
   b = (*env)->GetPrimitiveArrayCritical (env, buf, &isCopy);
+  if (b == NULL) {
+    throwNewOutOfMemoryError(env, "");
+    return 0;
+  }
   result = (jlong) adler32 ((uLong) crc, (Bytef *) (b + off), (uInt) len);
   (*env)->ReleasePrimitiveArrayCritical (env, buf, b, JNI_ABORT);
 
@@ -42,7 +45,6 @@
 Java_java_util_zip_Adler32_updateByteImpl (JNIEnv * env, jobject recv,
                                            jint val, jlong crc)
 {
-  PORT_ACCESS_FROM_ENV (env);
   Bytef bytefVal = val;
   return adler32 ((uLong) crc, (Bytef *) (&bytefVal), 1);
 }



Mime
View raw message