Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.h?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.h Thu Sep 14 19:40:33 2006
@@ -1,63 +1,63 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(inflater_h)
-#define inflater_h
-
-#include "zlib.h"
-typedef struct JCLZipStream
-{
- U_8 *inaddr;
- U_8 *dict;
- z_stream *stream;
-} JCLZipStream;
-
-void zfree PROTOTYPE ((void *opaque, void *address));
-void *zalloc PROTOTYPE ((void *opaque, U_32 items, U_32 size));
-void JNICALL Java_java_util_zip_Inflater_endImpl (JNIEnv * env, jobject recv,
- jlong handle);
-void JNICALL Java_java_util_zip_Inflater_setInputImpl (JNIEnv * env,
- jobject recv,
- jbyteArray buf,
- jint off, jint len,
- jlong handle);
-jint JNICALL Java_java_util_zip_Inflater_inflateImpl (JNIEnv * env,
- jobject recv,
- jbyteArray buf, int off,
- int len, jlong handle);
-void JNICALL Java_java_util_zip_Inflater_setDictionaryImpl (JNIEnv * env,
- jobject recv,
- jbyteArray dict,
- int off, int len,
- jlong handle);
-void JNICALL Java_java_util_zip_Inflater_oneTimeInitialization (JNIEnv * env,
- jclass clazz);
-void JNICALL Java_java_util_zip_Inflater_resetImpl (JNIEnv * env,
- jobject recv,
- jlong handle);
-jlong JNICALL Java_java_util_zip_Inflater_getTotalOutImpl (JNIEnv * env,
- jobject recv,
- jlong handle);
-jlong JNICALL Java_java_util_zip_Inflater_createStream (JNIEnv * env,
- jobject recv,
- jboolean noHeader);
-jlong JNICALL Java_java_util_zip_Inflater_getTotalInImpl (JNIEnv * env,
- jobject recv,
- jlong handle);
-jint JNICALL Java_java_util_zip_Inflater_getAdlerImpl (JNIEnv * env,
- jobject recv,
- jlong handle);
-
-#endif /* inflater_h */
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(inflater_h)
+#define inflater_h
+
+#include "zlib.h"
+typedef struct JCLZipStream
+{
+ U_8 *inaddr;
+ U_8 *dict;
+ z_stream *stream;
+} JCLZipStream;
+
+void zfree PROTOTYPE ((void *opaque, void *address));
+void *zalloc PROTOTYPE ((void *opaque, U_32 items, U_32 size));
+void JNICALL Java_java_util_zip_Inflater_endImpl (JNIEnv * env, jobject recv,
+ jlong handle);
+void JNICALL Java_java_util_zip_Inflater_setInputImpl (JNIEnv * env,
+ jobject recv,
+ jbyteArray buf,
+ jint off, jint len,
+ jlong handle);
+jint JNICALL Java_java_util_zip_Inflater_inflateImpl (JNIEnv * env,
+ jobject recv,
+ jbyteArray buf, int off,
+ int len, jlong handle);
+void JNICALL Java_java_util_zip_Inflater_setDictionaryImpl (JNIEnv * env,
+ jobject recv,
+ jbyteArray dict,
+ int off, int len,
+ jlong handle);
+void JNICALL Java_java_util_zip_Inflater_oneTimeInitialization (JNIEnv * env,
+ jclass clazz);
+void JNICALL Java_java_util_zip_Inflater_resetImpl (JNIEnv * env,
+ jobject recv,
+ jlong handle);
+jlong JNICALL Java_java_util_zip_Inflater_getTotalOutImpl (JNIEnv * env,
+ jobject recv,
+ jlong handle);
+jlong JNICALL Java_java_util_zip_Inflater_createStream (JNIEnv * env,
+ jobject recv,
+ jboolean noHeader);
+jlong JNICALL Java_java_util_zip_Inflater_getTotalInImpl (JNIEnv * env,
+ jobject recv,
+ jlong handle);
+jint JNICALL Java_java_util_zip_Inflater_getAdlerImpl (JNIEnv * env,
+ jobject recv,
+ jlong handle);
+
+#endif /* inflater_h */
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c Thu Sep 14 19:40:33 2006
@@ -1,173 +1,173 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "vmi.h"
-#include "iohelp.h"
-#include "exceptions.h"
-#include "jclglob.h"
-#include "jclprots.h"
-
-#include "zipsup.h"
-
-/* Build a new ZipEntry from the C struct */
-jobject
-createZipEntry (JNIEnv * env, HyZipFile * zipFile, HyZipEntry * zipEntry)
-{
- PORT_ACCESS_FROM_ENV (env);
- jclass javaClass;
- jobject java_ZipEntry, extra, entryName;
- jmethodID mid;
-
- /* Build a new ZipEntry from the C struct */
- entryName = ((*env)->NewStringUTF (env, zipEntry->filename));
- if (((*env)->ExceptionCheck (env)))
- return NULL;
-
- extra = NULL;
- if (zipEntry->extraFieldLength > 0)
- {
- zip_getZipEntryExtraField (PORTLIB, zipFile, zipEntry, NULL,
- zipEntry->extraFieldLength);
- if (zipEntry->extraField == NULL)
- return NULL;
- extra = ((*env)->NewByteArray (env, zipEntry->extraFieldLength));
- if (((*env)->ExceptionCheck (env)))
- return NULL;
- ((*env)->
- SetByteArrayRegion (env, extra, 0, zipEntry->extraFieldLength,
- zipEntry->extraField));
- jclmem_free_memory (env, zipEntry->extraField);
- zipEntry->extraField = NULL;
- }
-
- javaClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
- mid = JCL_CACHE_GET (env, MID_java_util_zip_ZipEntry_init);
- java_ZipEntry = ((*env)->NewObject (env, javaClass, mid, entryName, NULL,
- extra,
- (jlong) zipEntry->lastModTime,
- (jlong) zipEntry->uncompressedSize,
- (jlong) zipEntry->compressedSize,
- (jlong) zipEntry->crc32,
- zipEntry->compressionMethod,
- (jlong) zipEntry->lastModDate,
- (jlong) zipEntry->dataPointer));
- return java_ZipEntry;
-}
-
-jarray JNICALL
-Java_java_util_jar_JarFile_getMetaEntriesImpl (JNIEnv * env, jobject recv,
- jbyteArray zipName)
-{
-#define MAX_PATH 1024
-#define RESULT_BUF_SIZE 256
-
- PORT_ACCESS_FROM_ENV (env);
-
- JCLZipFile *jclZipFile;
- HyZipFile *zipFile;
- HyZipEntry zipEntry;
- jobject current;
- jclass javaClass;
- jobject resultArray[RESULT_BUF_SIZE];
- UDATA resultCount = 0, offset, i;
- void *scanPtr;
- char metaInfName[10]; /* 10 == strlen("META-INF/") + 1 */
- const UDATA metaInfSize = 10; /* 10 == strlen("META-INF/") + 1 */
- jobjectArray result = NULL;
- char *nameBuf, *newNameBuf, *oldNameBuf = NULL;
- char startNameBuf[MAX_PATH];
- UDATA nameBufSize = MAX_PATH;
- IDATA rc;
-
- nameBuf = (char *) &startNameBuf;
-
- jclZipFile =
- (JCLZipFile *) (IDATA) (*env)->GetLongField (env, recv,
- JCL_CACHE_GET (env,
- FID_java_util_zip_ZipFile_descriptor));
- if (jclZipFile == (void *) -1)
- {
- throwNewIllegalStateException (env, "");
- return NULL;
- }
- zipFile = &(jclZipFile->hyZipFile);
-
- if (zipFile->cache)
- {
- if (zipCache_enumNew (zipFile->cache, "META-INF/", &scanPtr))
- return NULL;
-
- if (0 !=
- zipCache_enumGetDirName (scanPtr, (char *) &metaInfName,
- sizeof (metaInfName)))
- return NULL;
-
- for (;;)
- {
- rc = zipCache_enumElement (scanPtr, nameBuf, nameBufSize, &offset);
- if (rc < 0)
- {
- break; /* we're done, leave the loop */
- }
- else if (rc > 0)
- {
- /* the buffer wasn't big enough, grow it */
- newNameBuf = jclmem_allocate_memory (env, rc);
- nameBufSize = rc;
- if (oldNameBuf)
- {
- jclmem_free_memory (env, oldNameBuf); /* free old before checking result so we clean up on fail */
- oldNameBuf = NULL;
- }
- if (!newNameBuf)
- goto cleanup;
- nameBuf = oldNameBuf = newNameBuf;
- continue; /* go to the top of the loop again */
- }
-
- zip_initZipEntry (PORTLIB, &zipEntry);
- if (zip_getZipEntryFromOffset (PORTLIB, zipFile, &zipEntry, offset))
- goto cleanup;
- current = createZipEntry (env, zipFile, &zipEntry);
- zip_freeZipEntry (PORTLIB, &zipEntry);
- if (resultCount == RESULT_BUF_SIZE)
- goto cleanup; /* fail - should fix. */
- if (current)
- resultArray[resultCount++] = current;
- else
- goto cleanup;
- }
- javaClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
- result = ((*env)->NewObjectArray (env, resultCount, javaClass, NULL));
- if (((*env)->ExceptionCheck (env)))
- {
- result = NULL;
- goto cleanup;
- }
- for (i = 0; i < resultCount; i++)
- {
- (*env)->SetObjectArrayElement (env, result, i, resultArray[i]);
- }
- cleanup:
- zipCache_enumKill (scanPtr);
- if (oldNameBuf)
- jclmem_free_memory (env, oldNameBuf); /* free old before checking result so we clean up on fail */
- return result;
- }
- return NULL;
-
-#undef MAX_PATH
-#undef RESULT_BUF_SIZE
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "vmi.h"
+#include "iohelp.h"
+#include "exceptions.h"
+#include "jclglob.h"
+#include "jclprots.h"
+
+#include "zipsup.h"
+
+/* Build a new ZipEntry from the C struct */
+jobject
+createZipEntry (JNIEnv * env, HyZipFile * zipFile, HyZipEntry * zipEntry)
+{
+ PORT_ACCESS_FROM_ENV (env);
+ jclass javaClass;
+ jobject java_ZipEntry, extra, entryName;
+ jmethodID mid;
+
+ /* Build a new ZipEntry from the C struct */
+ entryName = ((*env)->NewStringUTF (env, zipEntry->filename));
+ if (((*env)->ExceptionCheck (env)))
+ return NULL;
+
+ extra = NULL;
+ if (zipEntry->extraFieldLength > 0)
+ {
+ zip_getZipEntryExtraField (PORTLIB, zipFile, zipEntry, NULL,
+ zipEntry->extraFieldLength);
+ if (zipEntry->extraField == NULL)
+ return NULL;
+ extra = ((*env)->NewByteArray (env, zipEntry->extraFieldLength));
+ if (((*env)->ExceptionCheck (env)))
+ return NULL;
+ ((*env)->
+ SetByteArrayRegion (env, extra, 0, zipEntry->extraFieldLength,
+ zipEntry->extraField));
+ jclmem_free_memory (env, zipEntry->extraField);
+ zipEntry->extraField = NULL;
+ }
+
+ javaClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
+ mid = JCL_CACHE_GET (env, MID_java_util_zip_ZipEntry_init);
+ java_ZipEntry = ((*env)->NewObject (env, javaClass, mid, entryName, NULL,
+ extra,
+ (jlong) zipEntry->lastModTime,
+ (jlong) zipEntry->uncompressedSize,
+ (jlong) zipEntry->compressedSize,
+ (jlong) zipEntry->crc32,
+ zipEntry->compressionMethod,
+ (jlong) zipEntry->lastModDate,
+ (jlong) zipEntry->dataPointer));
+ return java_ZipEntry;
+}
+
+jarray JNICALL
+Java_java_util_jar_JarFile_getMetaEntriesImpl (JNIEnv * env, jobject recv,
+ jbyteArray zipName)
+{
+#define MAX_PATH 1024
+#define RESULT_BUF_SIZE 256
+
+ PORT_ACCESS_FROM_ENV (env);
+
+ JCLZipFile *jclZipFile;
+ HyZipFile *zipFile;
+ HyZipEntry zipEntry;
+ jobject current;
+ jclass javaClass;
+ jobject resultArray[RESULT_BUF_SIZE];
+ UDATA resultCount = 0, offset, i;
+ void *scanPtr;
+ char metaInfName[10]; /* 10 == strlen("META-INF/") + 1 */
+ const UDATA metaInfSize = 10; /* 10 == strlen("META-INF/") + 1 */
+ jobjectArray result = NULL;
+ char *nameBuf, *newNameBuf, *oldNameBuf = NULL;
+ char startNameBuf[MAX_PATH];
+ UDATA nameBufSize = MAX_PATH;
+ IDATA rc;
+
+ nameBuf = (char *) &startNameBuf;
+
+ jclZipFile =
+ (JCLZipFile *) (IDATA) (*env)->GetLongField (env, recv,
+ JCL_CACHE_GET (env,
+ FID_java_util_zip_ZipFile_descriptor));
+ if (jclZipFile == (void *) -1)
+ {
+ throwNewIllegalStateException (env, "");
+ return NULL;
+ }
+ zipFile = &(jclZipFile->hyZipFile);
+
+ if (zipFile->cache)
+ {
+ if (zipCache_enumNew (zipFile->cache, "META-INF/", &scanPtr))
+ return NULL;
+
+ if (0 !=
+ zipCache_enumGetDirName (scanPtr, (char *) &metaInfName,
+ sizeof (metaInfName)))
+ return NULL;
+
+ for (;;)
+ {
+ rc = zipCache_enumElement (scanPtr, nameBuf, nameBufSize, &offset);
+ if (rc < 0)
+ {
+ break; /* we're done, leave the loop */
+ }
+ else if (rc > 0)
+ {
+ /* the buffer wasn't big enough, grow it */
+ newNameBuf = jclmem_allocate_memory (env, rc);
+ nameBufSize = rc;
+ if (oldNameBuf)
+ {
+ jclmem_free_memory (env, oldNameBuf); /* free old before checking result so we clean up on fail */
+ oldNameBuf = NULL;
+ }
+ if (!newNameBuf)
+ goto cleanup;
+ nameBuf = oldNameBuf = newNameBuf;
+ continue; /* go to the top of the loop again */
+ }
+
+ zip_initZipEntry (PORTLIB, &zipEntry);
+ if (zip_getZipEntryFromOffset (PORTLIB, zipFile, &zipEntry, offset))
+ goto cleanup;
+ current = createZipEntry (env, zipFile, &zipEntry);
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ if (resultCount == RESULT_BUF_SIZE)
+ goto cleanup; /* fail - should fix. */
+ if (current)
+ resultArray[resultCount++] = current;
+ else
+ goto cleanup;
+ }
+ javaClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
+ result = ((*env)->NewObjectArray (env, resultCount, javaClass, NULL));
+ if (((*env)->ExceptionCheck (env)))
+ {
+ result = NULL;
+ goto cleanup;
+ }
+ for (i = 0; i < resultCount; i++)
+ {
+ (*env)->SetObjectArrayElement (env, result, i, resultArray[i]);
+ }
+ cleanup:
+ zipCache_enumKill (scanPtr);
+ if (oldNameBuf)
+ jclmem_free_memory (env, oldNameBuf); /* free old before checking result so we clean up on fail */
+ return result;
+ }
+ return NULL;
+
+#undef MAX_PATH
+#undef RESULT_BUF_SIZE
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c Thu Sep 14 19:40:33 2006
@@ -1,42 +1,42 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "vmi.h"
-#include "zconf.h"
-
-uLong crc32 PROTOTYPE ((uLong crc, const Bytef * buf, uInt size));
-
-jlong JNICALL
-Java_java_util_zip_CRC32_updateImpl (JNIEnv * env, jobject recv,
- jbyteArray buf, int off, int len,
- jlong crc)
-{
- jbyte *b;
- jlong result;
-
- b = ((*env)->GetPrimitiveArrayCritical (env, buf, 0));
- if (b == NULL)
- return -1;
- result = crc32 ((uLong) crc, (Bytef *) (b + off), (uInt) len);
- ((*env)->ReleasePrimitiveArrayCritical (env, buf, b, JNI_ABORT));
- return result;
-}
-
-jlong JNICALL
-Java_java_util_zip_CRC32_updateByteImpl (JNIEnv * env, jobject recv,
- jbyte val, jlong crc)
-{
- return crc32 ((uLong) crc, (Bytef *) (&val), 1);
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "vmi.h"
+#include "zconf.h"
+
+uLong crc32 PROTOTYPE ((uLong crc, const Bytef * buf, uInt size));
+
+jlong JNICALL
+Java_java_util_zip_CRC32_updateImpl (JNIEnv * env, jobject recv,
+ jbyteArray buf, int off, int len,
+ jlong crc)
+{
+ jbyte *b;
+ jlong result;
+
+ b = ((*env)->GetPrimitiveArrayCritical (env, buf, 0));
+ if (b == NULL)
+ return -1;
+ result = crc32 ((uLong) crc, (Bytef *) (b + off), (uInt) len);
+ ((*env)->ReleasePrimitiveArrayCritical (env, buf, b, JNI_ABORT));
+ return result;
+}
+
+jlong JNICALL
+Java_java_util_zip_CRC32_updateByteImpl (JNIEnv * env, jobject recv,
+ jbyte val, jlong crc)
+{
+ return crc32 ((uLong) crc, (Bytef *) (&val), 1);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclcrc32.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclglob.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclglob.h?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclglob.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclglob.h Thu Sep 14 19:40:33 2006
@@ -1,46 +1,46 @@
-/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(jclglob_h)
-#define jclglob_h
-
-#include "vmi.h"
-#include "zip.h"
-
-extern void *Archive_JCL_ID_CACHE;
-
-#define JCL_ID_CACHE Archive_JCL_ID_CACHE
-
-typedef struct ArchiveJniIDCache
-{
- jfieldID FID_java_util_zip_ZipFile_descriptor;
- jfieldID FID_java_util_zip_ZipFile_nextEntryPointer;
- jfieldID FID_java_util_zip_Deflater_inRead;
- jfieldID FID_java_util_zip_Deflater_finished;
- jfieldID FID_java_util_zip_Inflater_inRead;
- jfieldID FID_java_util_zip_Inflater_finished;
- jfieldID FID_java_util_zip_Inflater_needsDictionary;
- jmethodID MID_java_util_zip_ZipEntry_init;
-
- jclass CLS_java_util_zip_ZipEntry;
- JCLZipFileLink *zipfile_handles;
-} ArchiveJniIDCache;
-
-#define JniIDCache ArchiveJniIDCache
-
-/* Now that the module-specific defines are in place, include the shared file */
-#include "libglob.h"
-
-#endif /* jclglob_h */
+/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(jclglob_h)
+#define jclglob_h
+
+#include "vmi.h"
+#include "zip.h"
+
+extern void *Archive_JCL_ID_CACHE;
+
+#define JCL_ID_CACHE Archive_JCL_ID_CACHE
+
+typedef struct ArchiveJniIDCache
+{
+ jfieldID FID_java_util_zip_ZipFile_descriptor;
+ jfieldID FID_java_util_zip_ZipFile_nextEntryPointer;
+ jfieldID FID_java_util_zip_Deflater_inRead;
+ jfieldID FID_java_util_zip_Deflater_finished;
+ jfieldID FID_java_util_zip_Inflater_inRead;
+ jfieldID FID_java_util_zip_Inflater_finished;
+ jfieldID FID_java_util_zip_Inflater_needsDictionary;
+ jmethodID MID_java_util_zip_ZipEntry_init;
+
+ jclass CLS_java_util_zip_ZipEntry;
+ JCLZipFileLink *zipfile_handles;
+} ArchiveJniIDCache;
+
+#define JniIDCache ArchiveJniIDCache
+
+/* Now that the module-specific defines are in place, include the shared file */
+#include "libglob.h"
+
+#endif /* jclglob_h */
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jclglob.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c Thu Sep 14 19:40:33 2006
@@ -1,430 +1,430 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "iohelp.h"
-#include "exceptions.h"
-#include "jclglob.h"
-#include "jclprots.h"
-#include "zip.h"
-
-void zfree PROTOTYPE ((void *opaque, void *address));
-void *zalloc PROTOTYPE ((void *opaque, U_32 items, U_32 size));
-
-/**
- * Throw java.lang.InternalError
- */
-void
-throwNewInternalError (JNIEnv * env, const char *message)
-{
- throwNewExceptionByName(env, "java/lang/InternalError", message);
-}
-
-/**
- * Throw java.util.zip.ZipException with the message provided
- */
-void
-throwJavaZIOException (JNIEnv * env, const char *message)
-{
- throwNewExceptionByName(env, "java/util/zip/ZipException", message);
-}
-
-jint JNICALL
-Java_java_util_zip_ZipFile_openZipImpl (JNIEnv * env, jobject recv,
- jbyteArray zipName)
-{
- VMI_ACCESS_FROM_ENV (env);
- PORT_ACCESS_FROM_ENV (env);
-
- I_32 retval;
- JCLZipFile *jclZipFile;
- JCLZipFileLink *zipfileHandles;
- jsize length;
- char pathCopy[HyMaxPath];
- HyZipCachePool *zipCachePool;
-
- jclZipFile = jclmem_allocate_memory (env, sizeof (*jclZipFile));
- if (!jclZipFile)
- return 3;
-
- length = (*env)->GetArrayLength (env, zipName);
- length = length < HyMaxPath - 1 ? length : HyMaxPath - 1;
- ((*env)->GetByteArrayRegion (env, zipName, 0, length, pathCopy));
- pathCopy[length++] = '\0';
- ioh_convertToPlatform (pathCopy);
-
- /* Open the zip file (caching will be managed automatically by zipsup) */
- zipCachePool = (*VMI)->GetZipCachePool (VMI);
- retval =
- zip_openZipFile (privatePortLibrary, pathCopy, &(jclZipFile->hyZipFile),
- zipCachePool);
-
- if (retval)
- {
- jclmem_free_memory (env, jclZipFile); /* free on fail */
-
- if (retval == ZIP_ERR_FILE_OPEN_ERROR)
- return 1;
- else
- return 2;
- }
-
- /* Add the zipFile we just allocated to the list of zip files -- we will
- * free this on UnLoad if its not already free'd.
- */
- zipfileHandles = JCL_CACHE_GET (env, zipfile_handles);
- jclZipFile->last = (JCLZipFile *) zipfileHandles;
- jclZipFile->next = zipfileHandles->next;
- if (zipfileHandles->next != NULL)
- zipfileHandles->next->last = jclZipFile;
- zipfileHandles->next = jclZipFile;
-
- (*env)->SetLongField (env, recv,
- JCL_CACHE_GET (env,
- FID_java_util_zip_ZipFile_descriptor),
- ((IDATA) jclZipFile));
- return 0;
-}
-
-jobject JNICALL
-Java_java_util_zip_ZipFile_getEntryImpl (JNIEnv * env, jobject recv,
- jlong zipPointer, jstring entryName)
-{
- PORT_ACCESS_FROM_ENV (env);
-
- I_32 retval;
- HyZipFile *zipFile;
- HyZipEntry zipEntry;
- jobject java_ZipEntry, extra;
- jclass entryClass;
- jmethodID mid;
- const char *entryCopy;
- JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) zipPointer;
-
- if (jclZipFile == (void *) -1)
- {
- throwNewIllegalStateException (env, "");
- return NULL;
- }
- zipFile = &(jclZipFile->hyZipFile);
- entryCopy = (*env)->GetStringUTFChars (env, entryName, NULL);
- if (entryCopy == NULL)
- return (jobject) NULL;
-
- zip_initZipEntry (PORTLIB, &zipEntry);
- retval = zip_getZipEntry (PORTLIB, zipFile, &zipEntry, entryCopy, TRUE);
- (*env)->ReleaseStringUTFChars (env, entryName, entryCopy);
- if (retval)
- {
- zip_freeZipEntry (PORTLIB, &zipEntry);
- return (jobject) NULL;
- }
-
- extra = NULL;
- if (zipEntry.extraFieldLength > 0)
- {
- zip_getZipEntryExtraField (PORTLIB, zipFile, &zipEntry, NULL,
- zipEntry.extraFieldLength);
- if (zipEntry.extraField == NULL)
- {
- zip_freeZipEntry (PORTLIB, &zipEntry);
- return (jobject) NULL;
- }
- extra = ((*env)->NewByteArray (env, zipEntry.extraFieldLength));
- if (((*env)->ExceptionCheck (env)))
- {
- zip_freeZipEntry (PORTLIB, &zipEntry);
- return (jobject) NULL;
- }
- ((*env)->
- SetByteArrayRegion (env, extra, 0, zipEntry.extraFieldLength,
- zipEntry.extraField));
- }
-
- entryClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
- mid = JCL_CACHE_GET (env, MID_java_util_zip_ZipEntry_init);
- /* Build a new ZipEntry from the C struct */
- java_ZipEntry = ((*env)->NewObject (env, entryClass, mid, entryName, NULL,
- extra,
- (jlong) zipEntry.lastModTime,
- (jlong) zipEntry.uncompressedSize,
- (jlong) zipEntry.compressedSize,
- (jlong) zipEntry.crc32,
- zipEntry.compressionMethod,
- (jlong) zipEntry.lastModDate,
- (jlong) zipEntry.dataPointer));
- zip_freeZipEntry (PORTLIB, &zipEntry);
- return java_ZipEntry;
-}
-
-void JNICALL
-Java_java_util_zip_ZipFile_closeZipImpl (JNIEnv * env, jobject recv)
-{
- PORT_ACCESS_FROM_ENV (env);
-
- I_32 retval = 0;
- JCLZipFile *jclZipFile;
- jfieldID descriptorFID =
- JCL_CACHE_GET (env, FID_java_util_zip_ZipFile_descriptor);
-
- jclZipFile = (JCLZipFile *) (IDATA) (*env)->GetLongField (env, recv, descriptorFID);
- if (jclZipFile != (void *) -1)
- {
- retval =
- zip_closeZipFile (privatePortLibrary, &(jclZipFile->hyZipFile));
- (*env)->SetLongField (env, recv, descriptorFID, -1);
-
- /* Free the zip struct */
- if (jclZipFile->last != NULL)
- jclZipFile->last->next = jclZipFile->next;
- if (jclZipFile->next != NULL)
- jclZipFile->next->last = jclZipFile->last;
-
- jclmem_free_memory (env, jclZipFile);
- if (retval)
- {
- throwJavaZIOException (env, "");
- return;
- }
- }
-}
-
-/**
- * Throw java.lang.IllegalStateException
- */
-void
-throwNewIllegalStateException (JNIEnv * env, const char *message)
-{
- throwNewExceptionByName(env, "java/lang/IllegalStateException", message);
-}
-
-/**
- * Throw java.lang.IllegalArgumentException
- */
-void
-throwNewIllegalArgumentException (JNIEnv * env, const char *message)
-{
- throwNewExceptionByName(env, "java/lang/IllegalArgumentException", message);
-}
-
-void JNICALL
-Java_java_util_zip_ZipFile_ntvinit (JNIEnv * env, jclass cls)
-{
- PORT_ACCESS_FROM_ENV (env);
- jmethodID mid;
- jfieldID descriptorFID;
- jclass javaClass;
- JCLZipFileLink *zipfileHandles;
-
- javaClass = (*env)->FindClass (env, "java/util/zip/ZipEntry");
- javaClass = (*env)->NewWeakGlobalRef (env, javaClass);
- if (!javaClass)
- return;
- mid =
- ((*env)->
- GetMethodID (env, javaClass, "<init>",
- "(Ljava/lang/String;Ljava/lang/String;[BJJJJIJJ)V"));
- if (!mid)
- return;
- JCL_CACHE_SET (env, CLS_java_util_zip_ZipEntry, javaClass);
- JCL_CACHE_SET (env, MID_java_util_zip_ZipEntry_init, mid);
-
- descriptorFID = (*env)->GetFieldID (env, cls, "descriptor", "J");
- if (!descriptorFID)
- return;
- JCL_CACHE_SET (env, FID_java_util_zip_ZipFile_descriptor, descriptorFID);
-
- javaClass = (*env)->FindClass (env, "java/util/zip/ZipFile$ZFEnum");
- if (!javaClass)
- return;
- descriptorFID =
- (*env)->GetFieldID (env, javaClass, "nextEntryPointer", "J");
- if (!descriptorFID)
- return;
- JCL_CACHE_SET (env, FID_java_util_zip_ZipFile_nextEntryPointer,
- descriptorFID);
-
- zipfileHandles = jclmem_allocate_memory (env, sizeof (JCLZipFileLink));
- if (!zipfileHandles)
- return;
- zipfileHandles->last = NULL;
- zipfileHandles->next = NULL;
- JCL_CACHE_SET (env, zipfile_handles, zipfileHandles);
-}
-
-jlong JNICALL
-Java_java_util_zip_ZipFile_00024ZFEnum_resetZip (JNIEnv * env, jobject recv,
- jlong descriptor)
-{
- PORT_ACCESS_FROM_ENV (env);
-
- IDATA nextEntryPointer;
- JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
-
- if (jclZipFile == (void *) -1)
- {
- throwNewIllegalStateException (env, "");
- return 0;
- }
- zip_resetZipFile (privatePortLibrary,
- &(jclZipFile->hyZipFile),
- &nextEntryPointer);
- return nextEntryPointer;
-}
-
-jobject JNICALL
-Java_java_util_zip_ZipFile_00024ZFEnum_getNextEntry (JNIEnv * env,
- jobject recv,
- jlong descriptor,
- jlong nextEntry)
-{
- PORT_ACCESS_FROM_ENV (env);
-
- I_32 retval;
- HyZipFile *zipFile;
- HyZipEntry zipEntry;
- jobject java_ZipEntry, extra;
- jclass javaClass;
- jmethodID mid;
- jstring entryName = NULL;
- IDATA nextEntryPointer;
- JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
-
- if (jclZipFile == (void *) -1)
- {
- throwNewIllegalStateException (env, "");
- return NULL;
- }
- zipFile = &(jclZipFile->hyZipFile);
- zip_initZipEntry (PORTLIB, &zipEntry);
-
- nextEntryPointer = (IDATA) nextEntry;
- retval =
- zip_getNextZipEntry (PORTLIB, zipFile, &zipEntry, &nextEntryPointer);
- if (retval)
- {
- if (retval != ZIP_ERR_NO_MORE_ENTRIES)
- {
- char buf[40];
- sprintf (buf, "Error %d getting next zip entry", retval);
- throwNewInternalError (env, buf);
- }
- return (jobject) NULL;
- }
-
- /* Build a new ZipEntry from the C struct */
- entryName = ((*env)->NewStringUTF (env, zipEntry.filename));
-
- if (((*env)->ExceptionCheck (env)))
- return NULL;
-
- extra = NULL;
- if (zipEntry.extraFieldLength > 0)
- {
- zip_getZipEntryExtraField (PORTLIB, zipFile, &zipEntry, NULL,
- zipEntry.extraFieldLength);
- extra = ((*env)->NewByteArray (env, zipEntry.extraFieldLength));
- if (((*env)->ExceptionCheck (env)))
- {
- /* free the extraField entry */
- zip_freeZipEntry (PORTLIB, &zipEntry);
- return NULL;
- }
- ((*env)->
- SetByteArrayRegion (env, extra, 0, zipEntry.extraFieldLength,
- zipEntry.extraField));
- jclmem_free_memory (env, zipEntry.extraField);
- zipEntry.extraField = NULL;
- }
-
- javaClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
- mid = JCL_CACHE_GET (env, MID_java_util_zip_ZipEntry_init);
- java_ZipEntry = ((*env)->NewObject (env, javaClass, mid, entryName, NULL, /* comment */
- extra,
- (jlong) zipEntry.lastModTime,
- (jlong) zipEntry.uncompressedSize,
- (jlong) zipEntry.compressedSize,
- (jlong) zipEntry.crc32,
- zipEntry.compressionMethod,
- (jlong) zipEntry.lastModDate,
- (jlong) zipEntry.dataPointer));
- zip_freeZipEntry (PORTLIB, &zipEntry);
- (*env)->SetLongField (env, recv,
- JCL_CACHE_GET (env,
- FID_java_util_zip_ZipFile_nextEntryPointer),
- nextEntryPointer);
- return java_ZipEntry;
-}
-
-jbyteArray JNICALL
-Java_java_util_zip_ZipFile_inflateEntryImpl2 (JNIEnv * env, jobject recv,
- jlong descriptor,
- jstring entryName)
-{
- PORT_ACCESS_FROM_ENV (env);
-
- I_32 retval;
- HyZipFile *zipFile;
- HyZipEntry zipEntry;
- const char *entryCopy;
- jbyteArray buf;
- JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
-
- /* Build the zipFile */
- if (jclZipFile == (void *) -1)
- {
- throwNewIllegalStateException (env, "");
- return NULL;
- }
- zipFile = &(jclZipFile->hyZipFile);
- entryCopy = (*env)->GetStringUTFChars (env, entryName, NULL);
- if (entryCopy == NULL)
- return NULL;
-
- zip_initZipEntry (privatePortLibrary, &zipEntry);
- retval =
- zip_getZipEntry (privatePortLibrary, zipFile, &zipEntry, entryCopy, TRUE);
- (*env)->ReleaseStringUTFChars (env, entryName, entryCopy);
- if (retval)
- {
- zip_freeZipEntry (privatePortLibrary, &zipEntry);
- if (retval == ZIP_ERR_OUT_OF_MEMORY)
- throwNewOutOfMemoryError (env, "");
- return NULL;
- }
-
- buf = (*env)->NewByteArray (env, zipEntry.uncompressedSize);
- if (!buf)
- {
- throwNewOutOfMemoryError (env, "");
- return NULL;
- }
-
- retval =
- zip_getZipEntryData (privatePortLibrary, zipFile, &zipEntry, NULL,
- zipEntry.uncompressedSize);
- if (retval == 0)
- (*env)->SetByteArrayRegion (env, buf, 0, zipEntry.uncompressedSize,
- zipEntry.data);
- zip_freeZipEntry (privatePortLibrary, &zipEntry);
- if (!retval)
- return buf;
-
- if (retval == ZIP_ERR_OUT_OF_MEMORY)
- throwNewOutOfMemoryError (env, "");
- else
- throwJavaZIOException (env, "");
-
- return NULL;
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "iohelp.h"
+#include "exceptions.h"
+#include "jclglob.h"
+#include "jclprots.h"
+#include "zip.h"
+
+void zfree PROTOTYPE ((void *opaque, void *address));
+void *zalloc PROTOTYPE ((void *opaque, U_32 items, U_32 size));
+
+/**
+ * Throw java.lang.InternalError
+ */
+void
+throwNewInternalError (JNIEnv * env, const char *message)
+{
+ throwNewExceptionByName(env, "java/lang/InternalError", message);
+}
+
+/**
+ * Throw java.util.zip.ZipException with the message provided
+ */
+void
+throwJavaZIOException (JNIEnv * env, const char *message)
+{
+ throwNewExceptionByName(env, "java/util/zip/ZipException", message);
+}
+
+jint JNICALL
+Java_java_util_zip_ZipFile_openZipImpl (JNIEnv * env, jobject recv,
+ jbyteArray zipName)
+{
+ VMI_ACCESS_FROM_ENV (env);
+ PORT_ACCESS_FROM_ENV (env);
+
+ I_32 retval;
+ JCLZipFile *jclZipFile;
+ JCLZipFileLink *zipfileHandles;
+ jsize length;
+ char pathCopy[HyMaxPath];
+ HyZipCachePool *zipCachePool;
+
+ jclZipFile = jclmem_allocate_memory (env, sizeof (*jclZipFile));
+ if (!jclZipFile)
+ return 3;
+
+ length = (*env)->GetArrayLength (env, zipName);
+ length = length < HyMaxPath - 1 ? length : HyMaxPath - 1;
+ ((*env)->GetByteArrayRegion (env, zipName, 0, length, pathCopy));
+ pathCopy[length++] = '\0';
+ ioh_convertToPlatform (pathCopy);
+
+ /* Open the zip file (caching will be managed automatically by zipsup) */
+ zipCachePool = (*VMI)->GetZipCachePool (VMI);
+ retval =
+ zip_openZipFile (privatePortLibrary, pathCopy, &(jclZipFile->hyZipFile),
+ zipCachePool);
+
+ if (retval)
+ {
+ jclmem_free_memory (env, jclZipFile); /* free on fail */
+
+ if (retval == ZIP_ERR_FILE_OPEN_ERROR)
+ return 1;
+ else
+ return 2;
+ }
+
+ /* Add the zipFile we just allocated to the list of zip files -- we will
+ * free this on UnLoad if its not already free'd.
+ */
+ zipfileHandles = JCL_CACHE_GET (env, zipfile_handles);
+ jclZipFile->last = (JCLZipFile *) zipfileHandles;
+ jclZipFile->next = zipfileHandles->next;
+ if (zipfileHandles->next != NULL)
+ zipfileHandles->next->last = jclZipFile;
+ zipfileHandles->next = jclZipFile;
+
+ (*env)->SetLongField (env, recv,
+ JCL_CACHE_GET (env,
+ FID_java_util_zip_ZipFile_descriptor),
+ ((IDATA) jclZipFile));
+ return 0;
+}
+
+jobject JNICALL
+Java_java_util_zip_ZipFile_getEntryImpl (JNIEnv * env, jobject recv,
+ jlong zipPointer, jstring entryName)
+{
+ PORT_ACCESS_FROM_ENV (env);
+
+ I_32 retval;
+ HyZipFile *zipFile;
+ HyZipEntry zipEntry;
+ jobject java_ZipEntry, extra;
+ jclass entryClass;
+ jmethodID mid;
+ const char *entryCopy;
+ JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) zipPointer;
+
+ if (jclZipFile == (void *) -1)
+ {
+ throwNewIllegalStateException (env, "");
+ return NULL;
+ }
+ zipFile = &(jclZipFile->hyZipFile);
+ entryCopy = (*env)->GetStringUTFChars (env, entryName, NULL);
+ if (entryCopy == NULL)
+ return (jobject) NULL;
+
+ zip_initZipEntry (PORTLIB, &zipEntry);
+ retval = zip_getZipEntry (PORTLIB, zipFile, &zipEntry, entryCopy, TRUE);
+ (*env)->ReleaseStringUTFChars (env, entryName, entryCopy);
+ if (retval)
+ {
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ return (jobject) NULL;
+ }
+
+ extra = NULL;
+ if (zipEntry.extraFieldLength > 0)
+ {
+ zip_getZipEntryExtraField (PORTLIB, zipFile, &zipEntry, NULL,
+ zipEntry.extraFieldLength);
+ if (zipEntry.extraField == NULL)
+ {
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ return (jobject) NULL;
+ }
+ extra = ((*env)->NewByteArray (env, zipEntry.extraFieldLength));
+ if (((*env)->ExceptionCheck (env)))
+ {
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ return (jobject) NULL;
+ }
+ ((*env)->
+ SetByteArrayRegion (env, extra, 0, zipEntry.extraFieldLength,
+ zipEntry.extraField));
+ }
+
+ entryClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
+ mid = JCL_CACHE_GET (env, MID_java_util_zip_ZipEntry_init);
+ /* Build a new ZipEntry from the C struct */
+ java_ZipEntry = ((*env)->NewObject (env, entryClass, mid, entryName, NULL,
+ extra,
+ (jlong) zipEntry.lastModTime,
+ (jlong) zipEntry.uncompressedSize,
+ (jlong) zipEntry.compressedSize,
+ (jlong) zipEntry.crc32,
+ zipEntry.compressionMethod,
+ (jlong) zipEntry.lastModDate,
+ (jlong) zipEntry.dataPointer));
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ return java_ZipEntry;
+}
+
+void JNICALL
+Java_java_util_zip_ZipFile_closeZipImpl (JNIEnv * env, jobject recv)
+{
+ PORT_ACCESS_FROM_ENV (env);
+
+ I_32 retval = 0;
+ JCLZipFile *jclZipFile;
+ jfieldID descriptorFID =
+ JCL_CACHE_GET (env, FID_java_util_zip_ZipFile_descriptor);
+
+ jclZipFile = (JCLZipFile *) (IDATA) (*env)->GetLongField (env, recv, descriptorFID);
+ if (jclZipFile != (void *) -1)
+ {
+ retval =
+ zip_closeZipFile (privatePortLibrary, &(jclZipFile->hyZipFile));
+ (*env)->SetLongField (env, recv, descriptorFID, -1);
+
+ /* Free the zip struct */
+ if (jclZipFile->last != NULL)
+ jclZipFile->last->next = jclZipFile->next;
+ if (jclZipFile->next != NULL)
+ jclZipFile->next->last = jclZipFile->last;
+
+ jclmem_free_memory (env, jclZipFile);
+ if (retval)
+ {
+ throwJavaZIOException (env, "");
+ return;
+ }
+ }
+}
+
+/**
+ * Throw java.lang.IllegalStateException
+ */
+void
+throwNewIllegalStateException (JNIEnv * env, const char *message)
+{
+ throwNewExceptionByName(env, "java/lang/IllegalStateException", message);
+}
+
+/**
+ * Throw java.lang.IllegalArgumentException
+ */
+void
+throwNewIllegalArgumentException (JNIEnv * env, const char *message)
+{
+ throwNewExceptionByName(env, "java/lang/IllegalArgumentException", message);
+}
+
+void JNICALL
+Java_java_util_zip_ZipFile_ntvinit (JNIEnv * env, jclass cls)
+{
+ PORT_ACCESS_FROM_ENV (env);
+ jmethodID mid;
+ jfieldID descriptorFID;
+ jclass javaClass;
+ JCLZipFileLink *zipfileHandles;
+
+ javaClass = (*env)->FindClass (env, "java/util/zip/ZipEntry");
+ javaClass = (*env)->NewWeakGlobalRef (env, javaClass);
+ if (!javaClass)
+ return;
+ mid =
+ ((*env)->
+ GetMethodID (env, javaClass, "<init>",
+ "(Ljava/lang/String;Ljava/lang/String;[BJJJJIJJ)V"));
+ if (!mid)
+ return;
+ JCL_CACHE_SET (env, CLS_java_util_zip_ZipEntry, javaClass);
+ JCL_CACHE_SET (env, MID_java_util_zip_ZipEntry_init, mid);
+
+ descriptorFID = (*env)->GetFieldID (env, cls, "descriptor", "J");
+ if (!descriptorFID)
+ return;
+ JCL_CACHE_SET (env, FID_java_util_zip_ZipFile_descriptor, descriptorFID);
+
+ javaClass = (*env)->FindClass (env, "java/util/zip/ZipFile$ZFEnum");
+ if (!javaClass)
+ return;
+ descriptorFID =
+ (*env)->GetFieldID (env, javaClass, "nextEntryPointer", "J");
+ if (!descriptorFID)
+ return;
+ JCL_CACHE_SET (env, FID_java_util_zip_ZipFile_nextEntryPointer,
+ descriptorFID);
+
+ zipfileHandles = jclmem_allocate_memory (env, sizeof (JCLZipFileLink));
+ if (!zipfileHandles)
+ return;
+ zipfileHandles->last = NULL;
+ zipfileHandles->next = NULL;
+ JCL_CACHE_SET (env, zipfile_handles, zipfileHandles);
+}
+
+jlong JNICALL
+Java_java_util_zip_ZipFile_00024ZFEnum_resetZip (JNIEnv * env, jobject recv,
+ jlong descriptor)
+{
+ PORT_ACCESS_FROM_ENV (env);
+
+ IDATA nextEntryPointer;
+ JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
+
+ if (jclZipFile == (void *) -1)
+ {
+ throwNewIllegalStateException (env, "");
+ return 0;
+ }
+ zip_resetZipFile (privatePortLibrary,
+ &(jclZipFile->hyZipFile),
+ &nextEntryPointer);
+ return nextEntryPointer;
+}
+
+jobject JNICALL
+Java_java_util_zip_ZipFile_00024ZFEnum_getNextEntry (JNIEnv * env,
+ jobject recv,
+ jlong descriptor,
+ jlong nextEntry)
+{
+ PORT_ACCESS_FROM_ENV (env);
+
+ I_32 retval;
+ HyZipFile *zipFile;
+ HyZipEntry zipEntry;
+ jobject java_ZipEntry, extra;
+ jclass javaClass;
+ jmethodID mid;
+ jstring entryName = NULL;
+ IDATA nextEntryPointer;
+ JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
+
+ if (jclZipFile == (void *) -1)
+ {
+ throwNewIllegalStateException (env, "");
+ return NULL;
+ }
+ zipFile = &(jclZipFile->hyZipFile);
+ zip_initZipEntry (PORTLIB, &zipEntry);
+
+ nextEntryPointer = (IDATA) nextEntry;
+ retval =
+ zip_getNextZipEntry (PORTLIB, zipFile, &zipEntry, &nextEntryPointer);
+ if (retval)
+ {
+ if (retval != ZIP_ERR_NO_MORE_ENTRIES)
+ {
+ char buf[40];
+ sprintf (buf, "Error %d getting next zip entry", retval);
+ throwNewInternalError (env, buf);
+ }
+ return (jobject) NULL;
+ }
+
+ /* Build a new ZipEntry from the C struct */
+ entryName = ((*env)->NewStringUTF (env, zipEntry.filename));
+
+ if (((*env)->ExceptionCheck (env)))
+ return NULL;
+
+ extra = NULL;
+ if (zipEntry.extraFieldLength > 0)
+ {
+ zip_getZipEntryExtraField (PORTLIB, zipFile, &zipEntry, NULL,
+ zipEntry.extraFieldLength);
+ extra = ((*env)->NewByteArray (env, zipEntry.extraFieldLength));
+ if (((*env)->ExceptionCheck (env)))
+ {
+ /* free the extraField entry */
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ return NULL;
+ }
+ ((*env)->
+ SetByteArrayRegion (env, extra, 0, zipEntry.extraFieldLength,
+ zipEntry.extraField));
+ jclmem_free_memory (env, zipEntry.extraField);
+ zipEntry.extraField = NULL;
+ }
+
+ javaClass = JCL_CACHE_GET (env, CLS_java_util_zip_ZipEntry);
+ mid = JCL_CACHE_GET (env, MID_java_util_zip_ZipEntry_init);
+ java_ZipEntry = ((*env)->NewObject (env, javaClass, mid, entryName, NULL, /* comment */
+ extra,
+ (jlong) zipEntry.lastModTime,
+ (jlong) zipEntry.uncompressedSize,
+ (jlong) zipEntry.compressedSize,
+ (jlong) zipEntry.crc32,
+ zipEntry.compressionMethod,
+ (jlong) zipEntry.lastModDate,
+ (jlong) zipEntry.dataPointer));
+ zip_freeZipEntry (PORTLIB, &zipEntry);
+ (*env)->SetLongField (env, recv,
+ JCL_CACHE_GET (env,
+ FID_java_util_zip_ZipFile_nextEntryPointer),
+ nextEntryPointer);
+ return java_ZipEntry;
+}
+
+jbyteArray JNICALL
+Java_java_util_zip_ZipFile_inflateEntryImpl2 (JNIEnv * env, jobject recv,
+ jlong descriptor,
+ jstring entryName)
+{
+ PORT_ACCESS_FROM_ENV (env);
+
+ I_32 retval;
+ HyZipFile *zipFile;
+ HyZipEntry zipEntry;
+ const char *entryCopy;
+ jbyteArray buf;
+ JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
+
+ /* Build the zipFile */
+ if (jclZipFile == (void *) -1)
+ {
+ throwNewIllegalStateException (env, "");
+ return NULL;
+ }
+ zipFile = &(jclZipFile->hyZipFile);
+ entryCopy = (*env)->GetStringUTFChars (env, entryName, NULL);
+ if (entryCopy == NULL)
+ return NULL;
+
+ zip_initZipEntry (privatePortLibrary, &zipEntry);
+ retval =
+ zip_getZipEntry (privatePortLibrary, zipFile, &zipEntry, entryCopy, TRUE);
+ (*env)->ReleaseStringUTFChars (env, entryName, entryCopy);
+ if (retval)
+ {
+ zip_freeZipEntry (privatePortLibrary, &zipEntry);
+ if (retval == ZIP_ERR_OUT_OF_MEMORY)
+ throwNewOutOfMemoryError (env, "");
+ return NULL;
+ }
+
+ buf = (*env)->NewByteArray (env, zipEntry.uncompressedSize);
+ if (!buf)
+ {
+ throwNewOutOfMemoryError (env, "");
+ return NULL;
+ }
+
+ retval =
+ zip_getZipEntryData (privatePortLibrary, zipFile, &zipEntry, NULL,
+ zipEntry.uncompressedSize);
+ if (retval == 0)
+ (*env)->SetByteArrayRegion (env, buf, 0, zipEntry.uncompressedSize,
+ zipEntry.data);
+ zip_freeZipEntry (privatePortLibrary, &zipEntry);
+ if (!retval)
+ return buf;
+
+ if (retval == ZIP_ERR_OUT_OF_MEMORY)
+ throwNewOutOfMemoryError (env, "");
+ else
+ throwJavaZIOException (env, "");
+
+ return NULL;
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h Thu Sep 14 19:40:33 2006
@@ -1,35 +1,35 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(zip_h)
-#define zip_h
-
-#include "zipsup.h"
-
-typedef struct JCLZipFile
-{
- struct JCLZipFile *last;
- struct JCLZipFile *next;
- HyZipFile hyZipFile;
-} JCLZipFile;
-
-/* Fake JCLZipFile entry. last, next must be in the same position as JCLZipFile */
-typedef struct JCLZipFileLink
-{
- JCLZipFile *last;
- JCLZipFile *next;
-} JCLZipFileLink;
-
-#endif /* zip_h */
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(zip_h)
+#define zip_h
+
+#include "zipsup.h"
+
+typedef struct JCLZipFile
+{
+ struct JCLZipFile *last;
+ struct JCLZipFile *next;
+ HyZipFile hyZipFile;
+} JCLZipFile;
+
+/* Fake JCLZipFile entry. last, next must be in the same position as JCLZipFile */
+typedef struct JCLZipFileLink
+{
+ JCLZipFile *last;
+ JCLZipFile *next;
+} JCLZipFileLink;
+
+#endif /* zip_h */
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/windows/DoxygenSupport.txt
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/windows/DoxygenSupport.txt?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/windows/DoxygenSupport.txt (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/windows/DoxygenSupport.txt Thu Sep 14 19:40:33 2006
@@ -1,24 +1,24 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * This file provides the group definitions required to create the Doxygen generated
- * output for compounds.
- */
-
-/**
- * @defgroup HarmonyNatives Harmony JCL Natives
- * @brief Native support for the Harmony JCL
- */
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file provides the group definitions required to create the Doxygen generated
+ * output for compounds.
+ */
+
+/**
+ * @defgroup HarmonyNatives Harmony JCL Natives
+ * @brief Native support for the Harmony JCL
+ */
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/windows/DoxygenSupport.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/include/shared/zipsup.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/include/shared/zipsup.h?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/include/shared/zipsup.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/include/shared/zipsup.h Thu Sep 14 19:40:33 2006
@@ -1,203 +1,203 @@
-/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* Zip Support Header
-*/
-
-#if !defined(ZIPSUP_H)
-#define ZIPSUP_H
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-#include "hyport.h"
- typedef struct HyZipCachePool HyZipCachePool;
-
-#define HY_ZIP_DLL_NAME "hyzlib"
-
-#define ZIP_INTERNAL_MAX 80
-#define ZIP_CM_Reduced1 2
-#define ZIP_Unknown 0
-#define ZIP_GZIP 2
-#define ZIP_ERR_OUT_OF_MEMORY -3
-#define ZIP_ERR_FILE_CORRUPT -6
-#define ZIP_ERR_INTERNAL_ERROR -11
-#define ZIP_CM_Imploded 6
-#define ZIP_CM_Reduced4 5
-#define ZIP_CM_Shrunk 1
-#define ZIP_CM_Reduced2 3
-#define ZIP_ERR_FILE_READ_ERROR -1
-#define ZIP_CentralHeader 0x2014B50
-#define ZIP_ERR_FILE_CLOSE_ERROR -10
-#define ZIP_ERR_BUFFER_TOO_SMALL -7
-#define ZIP_CM_Reduced3 4
-#define ZIP_CM_Deflated 8
-#define ZIP_LocalHeader 0x4034B50
-#define ZIP_CM_Tokenized 7
-#define ZIP_PKZIP 1
-#define ZIP_CM_Stored 0
-#define ZIP_ERR_UNSUPPORTED_FILE_TYPE -5
-#define ZIP_ERR_NO_MORE_ENTRIES -2
-#define ZIP_CentralEnd 0x6054B50
-#define ZIP_ERR_FILE_OPEN_ERROR -9
-#define ZIP_ERR_UNKNOWN_FILE_TYPE -4
-#define ZIP_ERR_ENTRY_NOT_FOUND -8
-#define ZIP_DataDescriptor 0x8074B50
-
- typedef struct HyZipCache
- {
- U_8 *zipFileName;
- IDATA zipFileSize;
- I_64 zipTimeStamp;
- IDATA startCentralDir;
- struct HyPortLibrary *portLib;
- void *cachePool;
- void *cachePoolEntry;
- } HyZipCache;
-
-
- typedef struct HyZipCentralEnd
- {
- U_16 diskNumber;
- U_16 dirStartDisk;
- U_16 thisDiskEntries;
- U_16 totalEntries;
- U_32 dirSize;
- U_32 dirOffset;
- U_16 commentLength;
- char _hypadding0012[2]; /* 2 bytes of automatic padding */
- U_8 *comment;
- } HyZipCentralEnd;
-
-
- typedef struct HyZipDataDescriptor
- {
- U_32 crc32;
- U_32 compressedSize;
- U_32 uncompressedSize;
- } HyZipDataDescriptor;
-
-
- typedef struct HyZipEntry
- {
- U_8 *data;
- U_8 *filename;
- U_8 *extraField;
- U_8 *fileComment;
- I_32 dataPointer;
- I_32 filenamePointer;
- I_32 extraFieldPointer;
- I_32 fileCommentPointer;
- U_32 compressedSize;
- U_32 uncompressedSize;
- U_32 crc32;
- U_16 filenameLength;
- U_16 extraFieldLength;
- U_16 fileCommentLength;
- U_16 internalAttributes;
- U_16 versionCreated;
- U_16 versionNeeded;
- U_16 flags;
- U_16 compressionMethod;
- U_16 lastModTime;
- U_16 lastModDate;
- U_8 internalFilename[80];
- } HyZipEntry;
-
-
- typedef struct HyZipFile
- {
- U_8 *filename;
- struct HyZipCache *cache;
- void *cachePool;
- I_32 fd;
- I_32 pointer;
- U_8 internalFilename[80];
- U_8 type;
- char _hypadding0065[3]; /* 3 bytes of automatic padding */
- } HyZipFile;
-
-/* HySourceZipSupport*/
- extern HY_CFUNC I_32 zip_getZipEntryData
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
- extern HY_CFUNC I_32 zip_getZipEntryFromOffset
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- HyZipEntry * entry, IDATA offset));
- extern HY_CFUNC I_32 zip_establishCache
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile));
- extern HY_CFUNC void zip_resetZipFile
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- IDATA * nextEntryPointer));
- extern HY_CFUNC I_32 zip_getNextZipEntry
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- HyZipEntry * zipEntry, IDATA * nextEntryPointer));
- extern HY_CFUNC I_32 zip_getZipEntry
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- HyZipEntry * entry, const char *filename,
- BOOLEAN findDirectory));
- extern HY_CFUNC I_32 zip_getZipEntryExtraField
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
- extern HY_CFUNC void zip_initZipEntry
- PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
- extern HY_CFUNC I_32 zip_openZipFile
- PROTOTYPE ((HyPortLibrary * portLib, char *filename, HyZipFile * zipFile,
- HyZipCachePool * cachePool));
- extern HY_CFUNC void zip_freeZipEntry
- PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
- struct HyZipFile;
- extern HY_CFUNC I_32 VMCALL zip_closeZipFile
- PROTOTYPE ((HyPortLibrary * portLib, struct HyZipFile * zipFile));
- extern HY_CFUNC I_32 zip_getZipEntryComment
- PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
- HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
-/* HySourceZipCache*/
- extern HY_CFUNC UDATA zipCache_findElement
- PROTOTYPE ((HyZipCache * zipCache, const char *elementName,
- BOOLEAN searchDirList));
- extern HY_CFUNC void zipCache_kill PROTOTYPE ((HyZipCache * zipCache));
- extern HY_CFUNC IDATA zipCache_enumGetDirName
- PROTOTYPE ((void *handle, char *nameBuf, UDATA nameBufSize));
- extern HY_CFUNC HyZipCache *zipCache_new
- PROTOTYPE ((HyPortLibrary * portLib, char *zipName, IDATA zipNameLength));
- extern HY_CFUNC IDATA zipCache_enumNew
- PROTOTYPE ((HyZipCache * zipCache, char *directoryName, void **handle));
- extern HY_CFUNC IDATA zipCache_enumElement
- PROTOTYPE ((void *handle, char *nameBuf, UDATA nameBufSize,
- UDATA * offset));
- extern HY_CFUNC void zipCache_enumKill PROTOTYPE ((void *handle));
- extern HY_CFUNC BOOLEAN zipCache_addElement
- PROTOTYPE ((HyZipCache * zipCache, char *elementName,
- UDATA elementOffset));
-/* HySourceZipCachePool*/
- extern HY_CFUNC BOOLEAN zipCachePool_release
- PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));
- extern HY_CFUNC void zipCachePool_kill PROTOTYPE ((HyZipCachePool * zcp));
- extern HY_CFUNC HyZipCache *zipCachePool_findCache
- PROTOTYPE ((HyZipCachePool * zcp, char const *zipFileName,
- IDATA zipFileNameLength, IDATA zipFileSize,
- I_64 zipTimeStamp));
- extern HY_CFUNC HyZipCachePool *zipCachePool_new
- PROTOTYPE ((HyPortLibrary * portLib));
- extern HY_CFUNC BOOLEAN zipCachePool_addCache
- PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));
- extern HY_CFUNC BOOLEAN zipCachePool_addRef
- PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));
-#if defined(__cplusplus)
-}
-#endif
-#endif /* ZIPSUP_H */
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* Zip Support Header
+*/
+
+#if !defined(ZIPSUP_H)
+#define ZIPSUP_H
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+#include "hyport.h"
+ typedef struct HyZipCachePool HyZipCachePool;
+
+#define HY_ZIP_DLL_NAME "hyzlib"
+
+#define ZIP_INTERNAL_MAX 80
+#define ZIP_CM_Reduced1 2
+#define ZIP_Unknown 0
+#define ZIP_GZIP 2
+#define ZIP_ERR_OUT_OF_MEMORY -3
+#define ZIP_ERR_FILE_CORRUPT -6
+#define ZIP_ERR_INTERNAL_ERROR -11
+#define ZIP_CM_Imploded 6
+#define ZIP_CM_Reduced4 5
+#define ZIP_CM_Shrunk 1
+#define ZIP_CM_Reduced2 3
+#define ZIP_ERR_FILE_READ_ERROR -1
+#define ZIP_CentralHeader 0x2014B50
+#define ZIP_ERR_FILE_CLOSE_ERROR -10
+#define ZIP_ERR_BUFFER_TOO_SMALL -7
+#define ZIP_CM_Reduced3 4
+#define ZIP_CM_Deflated 8
+#define ZIP_LocalHeader 0x4034B50
+#define ZIP_CM_Tokenized 7
+#define ZIP_PKZIP 1
+#define ZIP_CM_Stored 0
+#define ZIP_ERR_UNSUPPORTED_FILE_TYPE -5
+#define ZIP_ERR_NO_MORE_ENTRIES -2
+#define ZIP_CentralEnd 0x6054B50
+#define ZIP_ERR_FILE_OPEN_ERROR -9
+#define ZIP_ERR_UNKNOWN_FILE_TYPE -4
+#define ZIP_ERR_ENTRY_NOT_FOUND -8
+#define ZIP_DataDescriptor 0x8074B50
+
+ typedef struct HyZipCache
+ {
+ U_8 *zipFileName;
+ IDATA zipFileSize;
+ I_64 zipTimeStamp;
+ IDATA startCentralDir;
+ struct HyPortLibrary *portLib;
+ void *cachePool;
+ void *cachePoolEntry;
+ } HyZipCache;
+
+
+ typedef struct HyZipCentralEnd
+ {
+ U_16 diskNumber;
+ U_16 dirStartDisk;
+ U_16 thisDiskEntries;
+ U_16 totalEntries;
+ U_32 dirSize;
+ U_32 dirOffset;
+ U_16 commentLength;
+ char _hypadding0012[2]; /* 2 bytes of automatic padding */
+ U_8 *comment;
+ } HyZipCentralEnd;
+
+
+ typedef struct HyZipDataDescriptor
+ {
+ U_32 crc32;
+ U_32 compressedSize;
+ U_32 uncompressedSize;
+ } HyZipDataDescriptor;
+
+
+ typedef struct HyZipEntry
+ {
+ U_8 *data;
+ U_8 *filename;
+ U_8 *extraField;
+ U_8 *fileComment;
+ I_32 dataPointer;
+ I_32 filenamePointer;
+ I_32 extraFieldPointer;
+ I_32 fileCommentPointer;
+ U_32 compressedSize;
+ U_32 uncompressedSize;
+ U_32 crc32;
+ U_16 filenameLength;
+ U_16 extraFieldLength;
+ U_16 fileCommentLength;
+ U_16 internalAttributes;
+ U_16 versionCreated;
+ U_16 versionNeeded;
+ U_16 flags;
+ U_16 compressionMethod;
+ U_16 lastModTime;
+ U_16 lastModDate;
+ U_8 internalFilename[80];
+ } HyZipEntry;
+
+
+ typedef struct HyZipFile
+ {
+ U_8 *filename;
+ struct HyZipCache *cache;
+ void *cachePool;
+ I_32 fd;
+ I_32 pointer;
+ U_8 internalFilename[80];
+ U_8 type;
+ char _hypadding0065[3]; /* 3 bytes of automatic padding */
+ } HyZipFile;
+
+/* HySourceZipSupport*/
+ extern HY_CFUNC I_32 zip_getZipEntryData
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
+ extern HY_CFUNC I_32 zip_getZipEntryFromOffset
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ HyZipEntry * entry, IDATA offset));
+ extern HY_CFUNC I_32 zip_establishCache
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile));
+ extern HY_CFUNC void zip_resetZipFile
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ IDATA * nextEntryPointer));
+ extern HY_CFUNC I_32 zip_getNextZipEntry
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ HyZipEntry * zipEntry, IDATA * nextEntryPointer));
+ extern HY_CFUNC I_32 zip_getZipEntry
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ HyZipEntry * entry, const char *filename,
+ BOOLEAN findDirectory));
+ extern HY_CFUNC I_32 zip_getZipEntryExtraField
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
+ extern HY_CFUNC void zip_initZipEntry
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
+ extern HY_CFUNC I_32 zip_openZipFile
+ PROTOTYPE ((HyPortLibrary * portLib, char *filename, HyZipFile * zipFile,
+ HyZipCachePool * cachePool));
+ extern HY_CFUNC void zip_freeZipEntry
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
+ struct HyZipFile;
+ extern HY_CFUNC I_32 VMCALL zip_closeZipFile
+ PROTOTYPE ((HyPortLibrary * portLib, struct HyZipFile * zipFile));
+ extern HY_CFUNC I_32 zip_getZipEntryComment
+ PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+ HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
+/* HySourceZipCache*/
+ extern HY_CFUNC UDATA zipCache_findElement
+ PROTOTYPE ((HyZipCache * zipCache, const char *elementName,
+ BOOLEAN searchDirList));
+ extern HY_CFUNC void zipCache_kill PROTOTYPE ((HyZipCache * zipCache));
+ extern HY_CFUNC IDATA zipCache_enumGetDirName
+ PROTOTYPE ((void *handle, char *nameBuf, UDATA nameBufSize));
+ extern HY_CFUNC HyZipCache *zipCache_new
+ PROTOTYPE ((HyPortLibrary * portLib, char *zipName, IDATA zipNameLength));
+ extern HY_CFUNC IDATA zipCache_enumNew
+ PROTOTYPE ((HyZipCache * zipCache, char *directoryName, void **handle));
+ extern HY_CFUNC IDATA zipCache_enumElement
+ PROTOTYPE ((void *handle, char *nameBuf, UDATA nameBufSize,
+ UDATA * offset));
+ extern HY_CFUNC void zipCache_enumKill PROTOTYPE ((void *handle));
+ extern HY_CFUNC BOOLEAN zipCache_addElement
+ PROTOTYPE ((HyZipCache * zipCache, char *elementName,
+ UDATA elementOffset));
+/* HySourceZipCachePool*/
+ extern HY_CFUNC BOOLEAN zipCachePool_release
+ PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));
+ extern HY_CFUNC void zipCachePool_kill PROTOTYPE ((HyZipCachePool * zcp));
+ extern HY_CFUNC HyZipCache *zipCachePool_findCache
+ PROTOTYPE ((HyZipCachePool * zcp, char const *zipFileName,
+ IDATA zipFileNameLength, IDATA zipFileSize,
+ I_64 zipTimeStamp));
+ extern HY_CFUNC HyZipCachePool *zipCachePool_new
+ PROTOTYPE ((HyPortLibrary * portLib));
+ extern HY_CFUNC BOOLEAN zipCachePool_addCache
+ PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));
+ extern HY_CFUNC BOOLEAN zipCachePool_addRef
+ PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));
+#if defined(__cplusplus)
+}
+#endif
+#endif /* ZIPSUP_H */
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/include/shared/zipsup.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/linux/DoxygenSupport.txt
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/linux/DoxygenSupport.txt?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/linux/DoxygenSupport.txt (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/linux/DoxygenSupport.txt Thu Sep 14 19:40:33 2006
@@ -1,26 +1,26 @@
-/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * This file provides the group definitions required to create the Doxygen generated
- * output for compounds. There is one group per directory (port, pool, thread, etc.).
- */
-
-/**
- * @defgroup ZipSupport Zip Support
- * @brief Zip file support for the Java VM.
- */
-
-
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file provides the group definitions required to create the Doxygen generated
+ * output for compounds. There is one group per directory (port, pool, thread, etc.).
+ */
+
+/**
+ * @defgroup ZipSupport Zip Support
+ * @brief Zip file support for the Java VM.
+ */
+
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/linux/DoxygenSupport.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip.nls
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip.nls?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip.nls (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip.nls Thu Sep 14 19:40:33 2006
@@ -1,46 +1,46 @@
-#
-# Copyright 2005 The Apache Software Foundation or its licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Externalised messages for the VM components of the JCL module.
-#
-# Note to developers:
-#
-# New messages MUST be added at the end of this file.
-# DO NOT delete messages from this file, as it will change their indices.
-# If you wish to remove a message, delete its text, but leave the key in place
-#
-# Note to translators:
-#
-# This file uses printf style substitutions. Sequences such as %s, %.*s, %10d
-# etc. will be subsituted at runtime. The special case of %% is not a substitution.
-# It indicates a single percent sign. Please do not modify the format specifiers, or
-# change their order. For instance, in a message like "from %d to %s", %d
-# MUST appear before %s in any translated message, or a run-time crash
-# could occur. This is a known limitation of the product.
-#
-# NLS_MESSAGEFORMAT_NONE
-#
-
-HYNLS.MODULE=ZIPS
-HYNLS.HEADER=hyzipnls.h
-
-# first argument is the name of the zip DLL
-# second argument is a platform error message
-HYNLS_ZIP_UNABLE_TO_OPEN_ZIP_DLL=Unable to open %1$s (%2$s)
-
-HYNLS_ZIP_MISSING_EXPORT=Unable to open %s (Missing export)
-
-
+#
+# Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Externalised messages for the VM components of the JCL module.
+#
+# Note to developers:
+#
+# New messages MUST be added at the end of this file.
+# DO NOT delete messages from this file, as it will change their indices.
+# If you wish to remove a message, delete its text, but leave the key in place
+#
+# Note to translators:
+#
+# This file uses printf style substitutions. Sequences such as %s, %.*s, %10d
+# etc. will be subsituted at runtime. The special case of %% is not a substitution.
+# It indicates a single percent sign. Please do not modify the format specifiers, or
+# change their order. For instance, in a message like "from %d to %s", %d
+# MUST appear before %s in any translated message, or a run-time crash
+# could occur. This is a known limitation of the product.
+#
+# NLS_MESSAGEFORMAT_NONE
+#
+
+HYNLS.MODULE=ZIPS
+HYNLS.HEADER=hyzipnls.h
+
+# first argument is the name of the zip DLL
+# second argument is a platform error message
+HYNLS_ZIP_UNABLE_TO_OPEN_ZIP_DLL=Unable to open %1$s (%2$s)
+
+HYNLS_ZIP_MISSING_EXPORT=Unable to open %s (Missing export)
+
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip.nls
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip_ca.nls
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip_ca.nls?view=diff&rev=446478&r1=446477&r2=446478
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip_ca.nls (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip_ca.nls Thu Sep 14 19:40:33 2006
@@ -1,33 +1,33 @@
-#
-# Copyright 2005 The Apache Software Foundation or its licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Externalised messages for the VM components of the JCL module.
-# New messages MUST be added at the end of this file.
-# DO NOT delete messages from this file, as it will change their indices.
-# If you wish to remove a message, delete its text, but leave the key in place
-# NLS_MESSAGEFORMAT_NONE
-
-HYNLS.MODULE=ZIPS
-HYNLS.HEADER=hyzipnls.h
-
-# first argument is the name of the zip DLL
-# second argument is a platform error message
-HYNLS_ZIP_UNABLE_TO_OPEN_ZIP_DLL=No es pot obrir %1$s (%2$s)
-
-HYNLS_ZIP_MISSING_EXPORT=No es pot obrir %s (falta l'exportaci\u00f3)
-
-
-
+#
+# Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Externalised messages for the VM components of the JCL module.
+# New messages MUST be added at the end of this file.
+# DO NOT delete messages from this file, as it will change their indices.
+# If you wish to remove a message, delete its text, but leave the key in place
+# NLS_MESSAGEFORMAT_NONE
+
+HYNLS.MODULE=ZIPS
+HYNLS.HEADER=hyzipnls.h
+
+# first argument is the name of the zip DLL
+# second argument is a platform error message
+HYNLS_ZIP_UNABLE_TO_OPEN_ZIP_DLL=No es pot obrir %1$s (%2$s)
+
+HYNLS_ZIP_MISSING_EXPORT=No es pot obrir %s (falta l'exportaci\u00f3)
+
+
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/zip/shared/hyzip_ca.nls
------------------------------------------------------------------------------
svn:eol-style = native
|