harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r617092 - in /harmony/enhanced/classlib/trunk/modules: archive/src/main/native/archive/shared/ instrument/src/main/native/instrument/shared/ luni/ luni/src/main/native/hyzip/shared/ luni/src/main/native/include/shared/
Date Thu, 31 Jan 2008 10:32:28 GMT
Author: hindessm
Date: Thu Jan 31 02:32:25 2008
New Revision: 617092

URL: http://svn.apache.org/viewvc?rev=617092&view=rev
Log:
Applied patch from "[#HARMONY-5445] Enhance ZIP function table in VMI".

Added:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmizip.h
      - copied, changed from r614839, harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/hyzip.h
Removed:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/hyzip.h
Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/archiveglob.c
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
    harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h
    harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c
    harmony/enhanced/classlib/trunk/modules/luni/build.xml
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/hyzip.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipcache.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.h
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmi.h

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/archiveglob.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/archiveglob.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/archiveglob.c (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/archiveglob.c Thu Jan 31 02:32:25 2008
@@ -101,7 +101,7 @@
           PORT_ACCESS_FROM_ENV (env);
 #ifdef HY_ZIP_API
           VMI_ACCESS_FROM_ENV(env);
-          HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+          VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
           /* Detach from the common library */

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c Thu Jan 31 02:32:25 2008
@@ -100,7 +100,7 @@
   int wbits = 15;		/*Use MAX for fastest */
 #ifdef HY_ZIP_API
   VMI_ACCESS_FROM_ENV (env);
-  HyZipFunctionTable *zipFuncs;
+  VMIZipFunctionTable *zipFuncs;
   zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif
 
@@ -119,15 +119,9 @@
       throwNewOutOfMemoryError (env, "");
       return -1;
     }
-#ifndef HY_ZIP_API
   stream->opaque = (void *) privatePortLibrary;
   stream->zalloc = zalloc;
   stream->zfree = zfree;
-#else
-  stream->opaque = (void *) VMI;
-  stream->zalloc = zipFuncs->zip_zalloc;
-  stream->zfree =zipFuncs->zip_zfree;
-#endif
   jstream->stream = stream;
   jstream->dict = NULL;
   jstream->inaddr = NULL;

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c Thu Jan 31 02:32:25 2008
@@ -38,7 +38,7 @@
   int wbits = 15;               /*Use MAX for fastest */
 #ifdef HY_ZIP_API
   VMI_ACCESS_FROM_ENV (env);
-  HyZipFunctionTable *zipFuncs;
+  VMIZipFunctionTable *zipFuncs;
   zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif
 
@@ -58,15 +58,9 @@
       throwNewOutOfMemoryError (env, "");
       return -1;
     }
-#ifndef HY_ZIP_API
   stream->opaque = (void *) privatePortLibrary;
   stream->zalloc = zalloc;
   stream->zfree = zfree;
-#else
-  stream->opaque = (void *) VMI;
-  stream->zalloc = zipFuncs->zip_zalloc;
-  stream->zfree = zipFuncs->zip_zfree;
-#endif
   stream->adler = 1;
   jstream->stream = stream;
   jstream->dict = NULL;

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c Thu Jan 31 02:32:25 2008
@@ -20,16 +20,20 @@
 #include "exceptions.h"
 #include "jclglob.h"
 #include "jclprots.h"
-#ifndef HY_ZIP_API
 
+#ifndef HY_ZIP_API
 #include "zipsup.h"
 #else /* HY_ZIP_API */
-#include "hyzip.h"
+#include "vmizip.h"
 #endif /* HY_ZIP_API */
 
 /* Build a new ZipEntry from the C struct */
 jobject
+#ifndef HY_ZIP_API
 createZipEntry (JNIEnv * env, HyZipFile * zipFile, HyZipEntry * zipEntry)
+#else
+createZipEntry (JNIEnv * env, VMIZipFile * zipFile, VMIZipEntry * zipEntry)
+#endif
 {
   PORT_ACCESS_FROM_ENV (env);
 #ifdef HY_ZIP_API
@@ -39,7 +43,7 @@
   jobject java_ZipEntry, extra, entryName;
   jmethodID mid;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   /* Build a new ZipEntry from the C struct */
@@ -97,8 +101,13 @@
 #endif /* HY_ZIP_API */
 
   JCLZipFile *jclZipFile;
+#ifdef HY_ZIP_API
+  VMIZipFile *zipFile;
+  VMIZipEntry zipEntry;
+#else
   HyZipFile *zipFile;
   HyZipEntry zipEntry;
+#endif
   jobject current;
   jclass javaClass;
   jobject resultArray[RESULT_BUF_SIZE];
@@ -112,7 +121,7 @@
   UDATA nameBufSize = MAX_PATH_J;
   IDATA rc;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   nameBuf = (char *) &startNameBuf;
@@ -178,7 +187,7 @@
 	  if (zip_getZipEntryFromOffset (PORTLIB, zipFile, &zipEntry, offset))
 #else /* HY_ZIP_API */
 	  zipFuncs->zip_initZipEntry (VMI, &zipEntry);
-	  if (zipFuncs->zip_getZipEntryFromOffset (VMI, zipFile, &zipEntry, offset))
+	  if (zipFuncs->zip_getZipEntryFromOffset (VMI, zipFile, &zipEntry, offset, 0))
 #endif /* HY_ZIP_API */
 	    goto cleanup;
 	  current = createZipEntry (env, zipFile, &zipEntry);

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c Thu Jan 31 02:32:25 2008
@@ -24,6 +24,33 @@
 void zfree PROTOTYPE ((void *opaque, void *address));
 void *zalloc PROTOTYPE ((void *opaque, U_32 items, U_32 size));
 
+
+#ifdef HY_ZIP_API
+/*
+	ZLib interface to hymem_allocate_memory.
+*/
+void *
+zalloc (void *opaque, U_32 items, U_32 size)
+{
+  PORT_ACCESS_FROM_PORT (((HyPortLibrary *) opaque));
+
+  return hymem_allocate_memory (items * size);
+}
+
+
+/*
+	ZLib interface to hymem_free_memory.
+*/
+void
+zfree (void *opaque, void *address)
+{
+  PORT_ACCESS_FROM_PORT ((HyPortLibrary *) opaque);
+
+  hymem_free_memory (address);
+}
+
+#endif /* HY_ZIP_API */
+
 /**
   * Throw java.lang.InternalError
   */
@@ -57,7 +84,7 @@
 #ifndef HY_ZIP_API
   HyZipCachePool *zipCachePool;
 #else /* HY_ZIP_API */
-  HyZipFunctionTable *zipFuncs;
+  VMIZipFunctionTable *zipFuncs;
 #endif /* HY_ZIP_API */
 
   jclZipFile = jclmem_allocate_memory (env, sizeof (*jclZipFile));
@@ -79,7 +106,7 @@
 #else /* HY_ZIP_API */
   /* Open the zip file (caching will be managed automatically) */
   zipFuncs = (*VMI)->GetZipFunctions(VMI);
-  retval = zipFuncs->zip_openZipFile(VMI, pathCopy, &(jclZipFile->hyZipFile));
+  retval = zipFuncs->zip_openZipFile(VMI, pathCopy, &(jclZipFile->hyZipFile), ZIP_FLAG_OPEN_CACHE);
 #endif /* HY_ZIP_API */
 
   if (retval)
@@ -122,15 +149,20 @@
 
   I_32 retval;
   I_32 extraval;
+#ifdef HY_ZIP_API
+  VMIZipFile *zipFile;
+  VMIZipEntry zipEntry;
+#else
   HyZipFile *zipFile;
   HyZipEntry zipEntry;
+#endif
   jobject java_ZipEntry, extra;
   jclass entryClass;
   jmethodID mid;
   const char *entryCopy;
   JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) zipPointer;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   if (jclZipFile == (void *) -1)
@@ -148,7 +180,7 @@
   retval = zip_getZipEntry (PORTLIB, zipFile, &zipEntry, entryCopy, TRUE);
 #else /* HY_ZIP_API */
   zipFuncs->zip_initZipEntry (VMI, &zipEntry);
-  retval = zipFuncs->zip_getZipEntry (VMI, zipFile, &zipEntry, entryCopy, TRUE);
+  retval = zipFuncs->zip_getZipEntry (VMI, zipFile, &zipEntry, entryCopy, ZIP_FLAG_FIND_DIRECTORY|ZIP_FLAG_READ_DATA_POINTER);
 #endif /* HY_ZIP_API */
   (*env)->ReleaseStringUTFChars (env, entryName, entryCopy);
   if (retval)
@@ -243,7 +275,7 @@
   JCLZipFileLink *zipfileHandles;
   JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) zipPointer;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   if (jclZipFile != (void *) -1)
@@ -351,7 +383,7 @@
   IDATA nextEntryPointer;
   JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   if (jclZipFile == (void *) -1)
@@ -382,8 +414,13 @@
 
   I_32 retval;
   I_32 extraval;
+#ifdef HY_ZIP_API
+  VMIZipFile *zipFile;
+  VMIZipEntry zipEntry;
+#else
   HyZipFile *zipFile;
   HyZipEntry zipEntry;
+#endif
   jobject java_ZipEntry, extra;
   jclass javaClass;
   jmethodID mid;
@@ -391,7 +428,7 @@
   IDATA nextEntryPointer;
   JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   if (jclZipFile == (void *) -1)
@@ -411,7 +448,7 @@
 #ifndef HY_ZIP_API
     zip_getNextZipEntry (PORTLIB, zipFile, &zipEntry, &nextEntryPointer);
 #else /* HY_ZIP_API */
-    zipFuncs->zip_getNextZipEntry (VMI, zipFile, &zipEntry, &nextEntryPointer);
+    zipFuncs->zip_getNextZipEntry (VMI, zipFile, &zipEntry, &nextEntryPointer, ZIP_FLAG_READ_DATA_POINTER);
 #endif /* HY_ZIP_API */
   if (retval)
     {
@@ -507,13 +544,18 @@
 #endif /* HY_ZIP_API */
 
   I_32 retval;
+#ifdef HY_ZIP_API
+  VMIZipFile *zipFile;
+  VMIZipEntry zipEntry;
+#else
   HyZipFile *zipFile;
   HyZipEntry zipEntry;
+#endif
   const char *entryCopy;
   jbyteArray buf;
   JCLZipFile *jclZipFile = (JCLZipFile *) (IDATA) descriptor;
 #ifdef HY_ZIP_API
-  HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+  VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 #endif /* HY_ZIP_API */
 
   /* Build the zipFile */
@@ -536,7 +578,7 @@
 #ifndef HY_ZIP_API
     zip_getZipEntry (privatePortLibrary, zipFile, &zipEntry, entryCopy, TRUE);
 #else /* HY_ZIP_API */
-    zipFuncs->zip_getZipEntry (VMI, zipFile, &zipEntry, entryCopy, TRUE);
+    zipFuncs->zip_getZipEntry (VMI, zipFile, &zipEntry, entryCopy, ZIP_FLAG_FIND_DIRECTORY|ZIP_FLAG_READ_DATA_POINTER);
 #endif /* HY_ZIP_API */
   (*env)->ReleaseStringUTFChars (env, entryName, entryCopy);
   if (retval)

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.h Thu Jan 31 02:32:25 2008
@@ -21,7 +21,7 @@
 #ifndef HY_ZIP_API
 #include "zipsup.h"
 #else /* HY_ZIP_API */
-#include "hyzip.h"
+#include "vmizip.h"
 #endif /* HY_ZIP_API */
 
 #include "hymutex.h"
@@ -30,7 +30,11 @@
 {
   struct JCLZipFile *last;
   struct JCLZipFile *next;
+#ifndef HY_ZIP_API
   HyZipFile hyZipFile;
+#else
+  VMIZipFile hyZipFile;
+#endif
 } JCLZipFile;
 
 /* Fake JCLZipFile entry. last, next must be in the same position as JCLZipFile */

Modified: harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c (original)
+++ harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c Thu Jan 31 02:32:25 2008
@@ -24,7 +24,7 @@
 #ifndef HY_ZIP_API
 #include <zipsup.h>
 #else /* HY_ZIP_API */
-#include <hyzip.h>
+#include <vmizip.h>
 #endif /* HY_ZIP_API */
 #include <jni.h>
 #include <vmi.h>
@@ -154,8 +154,13 @@
 
 char* Read_Manifest(JavaVM *vm, JNIEnv *env,const char *jar_name){
 	I_32 retval;
+#ifndef HY_ZIP_API
 	HyZipFile zipFile;
 	HyZipEntry zipEntry;
+#else
+	VMIZipFile zipFile;
+	VMIZipEntry zipEntry;
+#endif
 	char *result;
 	int size = 0;
 	char errorMessage[1024];
@@ -165,14 +170,14 @@
 	PORT_ACCESS_FROM_JAVAVM(vm);
 
 #ifdef HY_ZIP_API
-	HyZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
+	VMIZipFunctionTable *zipFuncs = (*VMI)->GetZipFunctions(VMI);
 
 #endif /* HY_ZIP_API */
 	/* open zip file */
 #ifndef HY_ZIP_API
 	retval = zip_openZipFile(privatePortLibrary, (char *)jar_name, &zipFile, NULL);
 #else /* HY_ZIP_API */
-	retval = zipFuncs->zip_openZipFile(VMI, (char *)jar_name, &zipFile);
+	retval = zipFuncs->zip_openZipFile(VMI, (char *)jar_name, &zipFile, 0);
 #endif /* HY_ZIP_API */
 	if(retval){
 		sprintf(errorMessage,"failed to open file:%s, %d\n", jar_name, retval);

Modified: harmony/enhanced/classlib/trunk/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/build.xml?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/build.xml Thu Jan 31 02:32:25 2008
@@ -58,7 +58,7 @@
                 <include name="fdlibm.h" />
                 <include name="hymagic.h" />
                 <include name="jsig.h" />
-                <include name="hyzip.h"/>
+                <include name="vmizip.h"/>
             </fileset>
         </copy>
         <copy todir="${hy.jdk}/include" overwrite="yes">

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/hyzip.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/hyzip.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/hyzip.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/hyzip.c Thu Jan 31 02:32:25 2008
@@ -15,190 +15,142 @@
  *  limitations under the License.
  */
 
+#include "vmizip.h"
 #include "zipsup.h"
-#include "hyzip.h"
-#include "vmi.h"
 #include "hyport.h"
 
 I_32 VMCALL 
-hyzip_getZipEntryData(VMInterface * vmi, struct HyZipFile * zipFile, struct HyZipEntry * entry, U_8 * buffer, U_32 bufferSize) 
+vmizip_getZipEntryData(VMInterface * vmi, struct VMIZipFile * zipFile, struct VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) 
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	return zip_getZipEntryData(PORTLIB, zipFile, entry, buffer, bufferSize);
 }
 
 I_32 VMCALL
-hyzip_getZipEntryFromOffset(VMInterface * vmi, struct HyZipFile * zipFile, struct HyZipEntry * entry, IDATA offset) 
+vmizip_getZipEntryFromOffset(VMInterface * vmi, struct VMIZipFile * zipFile, struct VMIZipEntry * entry, IDATA offset, I_32 flags) 
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	return zip_getZipEntryFromOffset(PORTLIB, zipFile, entry, offset);
 }
 
-I_32 VMCALL 
-hyzip_establishCache(VMInterface * vmi, struct HyZipFile * zipFile)
-{
-	PORT_ACCESS_FROM_VMI(vmi);
-	return zip_establishCache(PORTLIB, zipFile);
-}
-
 void VMCALL
-hyzip_resetZipFile(VMInterface * vmi, struct HyZipFile * zipFile, IDATA * nextEntryPointer)
+vmizip_resetZipFile(VMInterface * vmi, struct VMIZipFile * zipFile, IDATA * nextEntryPointer)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	zip_resetZipFile(PORTLIB, zipFile, nextEntryPointer);
 }
 
 I_32 VMCALL 
-hyzip_getNextZipEntry(VMInterface * vmi, struct HyZipFile * zipFile, struct HyZipEntry * zipEntry, IDATA * nextEntryPointer)
+vmizip_getNextZipEntry(VMInterface * vmi, struct VMIZipFile * zipFile, struct VMIZipEntry * zipEntry, IDATA * nextEntryPointer, I_32 flags)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	return zip_getNextZipEntry(PORTLIB, zipFile, zipEntry, nextEntryPointer);
 }
 
 I_32 VMCALL 
-hyzip_getZipEntry(VMInterface * vmi, struct HyZipFile * zipFile, struct HyZipEntry * entry, const char *filename, BOOLEAN findDirectory)
+vmizip_getZipEntry(VMInterface * vmi, struct VMIZipFile * zipFile, struct VMIZipEntry * entry, const char *filename, I_32 flags)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
-	return zip_getZipEntry(PORTLIB, zipFile,entry, filename, findDirectory);
+	return zip_getZipEntry(PORTLIB, zipFile,entry, filename, flags);
 }
 
 I_32 VMCALL 
-hyzip_getZipEntryExtraField(VMInterface * vmi, struct HyZipFile * zipFile, struct HyZipEntry * entry, U_8 * buffer, U_32 bufferSize)
+vmizip_getZipEntryExtraField(VMInterface * vmi, struct VMIZipFile * zipFile, struct VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	return zip_getZipEntryExtraField(PORTLIB, zipFile, entry, buffer, bufferSize);
 }
 
+I_32 VMCALL
+vmizip_getZipEntryRawData(VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize, U_32 offset)
+{
+	PORT_ACCESS_FROM_VMI(vmi);
+	return zip_getZipEntryRawData(PORTLIB, zipFile, entry, buffer, bufferSize, offset);
+}
+
+
 void VMCALL
-hyzip_initZipEntry(VMInterface * vmi, struct HyZipEntry * entry)
+vmizip_initZipEntry(VMInterface * vmi, struct VMIZipEntry * entry)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	zip_initZipEntry(PORTLIB, entry);
 }
 
 I_32 VMCALL
-hyzip_openZipFile(VMInterface * vmi, char *filename, struct HyZipFile * zipFile)
+vmizip_openZipFile(VMInterface * vmi, char *filename, struct VMIZipFile * zipFile, I_32 flags)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	
-	HyZipFunctionTable *zipFuncs = (*vmi)->GetZipFunctions(vmi);
+	VMIZipFunctionTable *zipFuncs = (*vmi)->GetZipFunctions(vmi);
 	/* This is a synchonization hole, should probably add a mutex to control setting this variable. */
 	if ( zipFuncs->reserved == NULL ) {
 		zipFuncs->reserved = zipCachePool_new(PORTLIB);
 	}
 	
-	return zip_openZipFile(PORTLIB, filename, zipFile, (HyZipCachePool *)zipFuncs->reserved);
+	return zip_openZipFile(PORTLIB, filename, zipFile, (flags & ZIP_FLAG_OPEN_CACHE) ? (HyZipCachePool *)zipFuncs->reserved : NULL );
 }
 
 void VMCALL
-hyzip_freeZipEntry(VMInterface * vmi, struct HyZipEntry * entry)
+vmizip_freeZipEntry(VMInterface * vmi, struct VMIZipEntry * entry)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	zip_freeZipEntry(PORTLIB, entry);
 }
 
 I_32 VMCALL
-hyzip_closeZipFile(VMInterface * vmi, struct HyZipFile * zipFile)
+vmizip_closeZipFile(VMInterface * vmi, struct VMIZipFile * zipFile)
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	return zip_closeZipFile(PORTLIB, zipFile);
 }
 
 I_32 VMCALL
-hyzip_getZipEntryComment(VMInterface * vmi, struct HyZipFile * zipFile, struct HyZipEntry * entry, U_8 * buffer, U_32 bufferSize) 
+vmizip_getZipEntryComment(VMInterface * vmi, struct VMIZipFile * zipFile, struct VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) 
 {
 	PORT_ACCESS_FROM_VMI(vmi);
 	return zip_getZipEntryComment(PORTLIB, zipFile, entry, buffer, bufferSize);
 }
 
-UDATA VMCALL
-hyzipCache_findElement(struct HyZipCache * zipCache, const char *elementName, BOOLEAN searchDirList)
-{
-	return zipCache_findElement(zipCache, elementName, searchDirList);
-}
-
-void VMCALL
-hyzipCache_kill(struct HyZipCache * zipCache)
-{
-	zipCache_kill(zipCache);
-}
-
 IDATA VMCALL
-hyzipCache_enumGetDirName(void *handle, char *nameBuf, UDATA nameBufSize)
+vmizipCache_enumGetDirName(void *handle, char *nameBuf, UDATA nameBufSize)
 {
 	return zipCache_enumGetDirName(handle, nameBuf, nameBufSize);
 }
 
-struct HyZipCache *VMCALL 
-hyzipCache_new(VMInterface * vmi, char *zipName, IDATA zipNameLength)
-{
-	PORT_ACCESS_FROM_VMI(vmi);
-	return (struct HyZipCache *)zipCache_new(PORTLIB, zipName, zipNameLength);
-}
-
 IDATA VMCALL
-hyzipCache_enumNew(struct HyZipCache * zipCache, char *directoryName, void **handle)
+vmizipCache_enumNew(struct HyZipCache * zipCache, char *directoryName, void **handle)
 {
 	return zipCache_enumNew(zipCache, directoryName, handle);
 }
 	
 IDATA VMCALL 
-hyzipCache_enumElement(void *handle, char *nameBuf, UDATA nameBufSize, UDATA * offset)
+vmizipCache_enumElement(void *handle, char *nameBuf, UDATA nameBufSize, UDATA * offset)
 {
 	return zipCache_enumElement(handle, nameBuf, nameBufSize, offset);
 }
 
 void VMCALL
-hyzipCache_enumKill(void *handle)
+vmizipCache_enumKill(void *handle)
 {
 	zipCache_enumKill(handle);
 }
 
-BOOLEAN VMCALL
-hyzipCache_addElement(struct HyZipCache * zipCache, char *elementName, UDATA elementOffset)
-{
-	return zipCache_addElement(zipCache, elementName, elementOffset);
-}
-
-void * VMCALL
-hyzip_zalloc(void *opaque, U_32 items, U_32 size)
-{
-	PORT_ACCESS_FROM_VMI (((VMInterface *) opaque));
-
-	return hymem_allocate_memory (items * size);
-}
-
-void VMCALL 
-hyzip_zfree(void *opaque, void *address)
-{
-	PORT_ACCESS_FROM_VMI ((VMInterface *) opaque);
-
-	hymem_free_memory (address);
-
-}
-
-HyZipFunctionTable HyZipLibraryTable = {
-	hyzip_getZipEntryData,
-	hyzip_getZipEntryFromOffset,
-	hyzip_establishCache,
-	hyzip_resetZipFile,
-	hyzip_getNextZipEntry,
-	hyzip_getZipEntry,
-	hyzip_getZipEntryExtraField,
-	hyzip_initZipEntry,
-	hyzip_openZipFile,
-	hyzip_freeZipEntry,
-	hyzip_closeZipFile,
-	hyzip_getZipEntryComment,
-	hyzipCache_findElement,
-	hyzipCache_kill,
-	hyzipCache_enumGetDirName,
-	hyzipCache_new,
-	hyzipCache_enumNew,
-	hyzipCache_enumElement,
-	hyzipCache_enumKill,
-	hyzipCache_addElement,
-	hyzip_zalloc,
-	hyzip_zfree,
+VMIZipFunctionTable VMIZipLibraryTable = {
+	vmizip_closeZipFile,
+	vmizip_freeZipEntry,
+	vmizip_getNextZipEntry,
+	vmizip_getZipEntry,
+	vmizip_getZipEntryComment,
+	vmizip_getZipEntryData,
+	vmizip_getZipEntryExtraField,
+	vmizip_getZipEntryFromOffset,
+	vmizip_getZipEntryRawData,
+	vmizip_initZipEntry,
+	vmizip_openZipFile,
+	vmizip_resetZipFile,
+	vmizipCache_enumElement,
+	vmizipCache_enumGetDirName,
+	vmizipCache_enumKill,
+	vmizipCache_enumNew,
 	NULL
 };

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipcache.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipcache.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipcache.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipcache.c Thu Jan 31 02:32:25 2008
@@ -114,7 +114,7 @@
             const char *namePtr, IDATA nameSize, BOOLEAN isClass,
             UDATA elementOffset));
 UDATA *zipCache_reserveEntry
-PROTOTYPE ((HaZipChunkHeader * chunk, UDATA entryBytes, UDATA stringBytes));
+PROTOTYPE ((HyZipCacheEntry *zce, HaZipChunkHeader * chunk, UDATA entryBytes, UDATA stringBytes));
 HyZipFileEntry *zipCache_searchFileList
 PROTOTYPE ((HaZipDirEntry * dirEntry, const char *namePtr, UDATA nameSize,
             BOOLEAN isClass));
@@ -139,7 +139,7 @@
 */
 
 HyZipCache *
-zipCache_new (HyPortLibrary * portLib, char *zipName, IDATA zipNameLength)
+zipCache_new (HyPortLibrary * portLib, char *zipName, IDATA zipNameLength, IDATA zipFileSize, I_64 zipTimeStamp, IDATA startCentralDir)
 {
   HaZipChunkHeader *chunk;
   HyZipCacheEntry *zce;
@@ -150,9 +150,7 @@
   if (!chunk)
     return NULL;
 
-  zce =
-    (HyZipCacheEntry *) zipCache_reserveEntry (chunk,
-                                               sizeof (HyZipCacheEntry), 0);
+  zce = (HyZipCacheEntry *) zipCache_reserveEntry (NULL, chunk, sizeof (HyZipCacheEntry), 0);
   if (!zce)
     {
       /* ACTUAL_CHUNK_SIZE is so small it can't hold one HyZipCacheEntry?? */
@@ -164,7 +162,7 @@
   zce->currentChunk = chunk;
 
   /* Try to put the name string in this chunk.  If it won't fit, we'll allocate it separately */
-  if (zipCache_reserveEntry (chunk, 0, zipNameLength + 1))
+  if (zipCache_reserveEntry (zce, chunk, 0, zipNameLength + 1))
     {
       zce->info.zipFileName = chunk->endFree;
     }
@@ -179,8 +177,9 @@
     }
   memcpy (zce->info.zipFileName, zipName, zipNameLength);
   zce->info.zipFileName[zipNameLength] = '\0';
-  zce->info.zipFileSize = zce->info.startCentralDir = -1;
-  zce->info.zipTimeStamp = -1;
+  zce->info.zipFileSize = zipFileSize;
+  zce->info.startCentralDir = startCentralDir;
+  zce->info.zipTimeStamp = zipTimeStamp;
   /* zce->info.cachePool is already NULL */
   /* zce->info.cachePoolEntry is already NULL */
   zce->root.zipFileOffset = 1;
@@ -431,9 +430,7 @@
   HaZipChunkHeader *chunk = zce->currentChunk;
   zce->chunkActiveDir = NULL;
 
-  entry =
-    (HaZipDirEntry *) zipCache_reserveEntry (chunk, sizeof (*entry),
-                                             nameSize + 1);
+  entry = (HaZipDirEntry *) zipCache_reserveEntry (zce, chunk, sizeof (*entry), nameSize + 1);
   if (!entry)
     {
       if (!(chunk = zipCache_allocateChunk (zce->info.portLib)))
@@ -441,8 +438,7 @@
       chunk->next = zce->currentChunk;
       zce->currentChunk = chunk;
       entry =
-        (HaZipDirEntry *) zipCache_reserveEntry (chunk, sizeof (*entry),
-                                                 nameSize + 1);
+        (HaZipDirEntry *) zipCache_reserveEntry (zce, chunk, sizeof (*entry), nameSize + 1);
       if (!entry)
         {
           /* ACTUAL_CHUNK_SIZE is so small it can't hold one HaZipDirEntry?? */
@@ -473,9 +469,7 @@
 
   if (zce->chunkActiveDir == dirEntry)
     {
-      if (entry =
-          (HyZipFileEntry *) zipCache_reserveEntry (chunk, sizeof (*entry),
-                                                    nameSize + 1))
+      if (entry = (HyZipFileEntry *) zipCache_reserveEntry (zce, chunk, sizeof (*entry), nameSize + 1))
         {
           /* add to end of existing entry */
           zce->chunkActiveDir->fileList->entryCount++;
@@ -483,9 +477,7 @@
         }
     }
 
-  record =
-    (HyZipFileRecord *) zipCache_reserveEntry (chunk, sizeof (*record),
-                                               nameSize + 1);
+  record = (HyZipFileRecord *) zipCache_reserveEntry (zce, chunk, sizeof (*record), nameSize + 1);
   if (!record)
     {
       if (!(chunk = zipCache_allocateChunk (zce->info.portLib)))
@@ -493,9 +485,7 @@
       chunk->next = zce->currentChunk;
       zce->currentChunk = chunk;
       zce->chunkActiveDir = NULL;
-      record =
-        (HyZipFileRecord *) zipCache_reserveEntry (chunk, sizeof (*record),
-                                                   nameSize + 1);
+      record = (HyZipFileRecord *) zipCache_reserveEntry (zce, chunk, sizeof (*record), nameSize + 1);
       if (!record)
         {
           /* ACTUAL_CHUNK_SIZE is so small it can't hold one zipFileRecord?? */
@@ -553,7 +543,7 @@
 /* to the allocated stringBytes. */
 
 UDATA *
-zipCache_reserveEntry (HaZipChunkHeader * chunk, UDATA entryBytes,
+zipCache_reserveEntry (HyZipCacheEntry * zce, HaZipChunkHeader * chunk, UDATA entryBytes,
                        UDATA stringBytes)
 {
   UDATA *entry;
@@ -918,3 +908,25 @@
     }
   return 0;
 }
+
+/**
+ * Return the startCentralDir of the cache.
+ * 
+ * @param[in] zipCache the zip cache
+ * 
+ * @return the startCentralDir of the cache
+ */
+IDATA zipCache_getStartCentralDir(HyZipCache *zipCache) {
+	return zipCache->startCentralDir;
+}
+
+/**
+ * Whack the cache timestamp to keep other people from starting to use it.  Once all the current
+ * users of the cache have stopped using it, it will go away.
+ * 
+ * @param[in] zipCache the zip cache
+ */
+void zipCache_invalidateCache(HyZipCache * zipCache) {
+	zipCache->zipTimeStamp = -2;	
+}
+

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.c?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.c Thu Jan 31 02:32:25 2008
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+#include "vmi.h"
 #include "hyport.h"
 #include "zipsup.h"
 #include "hyzipnls.h"
@@ -54,7 +55,7 @@
 
 #define CDEV_CURRENT_FUNCTION _prototypes_private
 I_32 zip_populateCache
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile));
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile, HyZipCentralEnd *endEntry, IDATA startCentralDir));
 
 static I_32 inflateData
 PROTOTYPE ((struct workBuffer * workBuf, U_8 * inputBuffer,
@@ -63,16 +64,16 @@
 I_32 checkZipLibrary PROTOTYPE ((HyPortLibrary * portLib));
 
 I_32 scanForDataDescriptor
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-            HyZipEntry * zipEntry));
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+            VMIZipEntry * zipEntry));
 void zdatafree PROTOTYPE ((void *opaque, void *address));
 static I_32 readZipEntry
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-            HyZipEntry * zipEntry, const char *filename,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+            VMIZipEntry * zipEntry, const char *filename,
             IDATA * enumerationPointer, IDATA * entryStart,
             BOOLEAN findDirectory));
 I_32 scanForCentralEnd
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
             HyZipCentralEnd * endEntry));
 void *zdataalloc PROTOTYPE ((void *opaque, U_32 items, U_32 size));
 
@@ -80,36 +81,39 @@
 
 #define CDEV_CURRENT_FUNCTION _prototypes_public
 I_32 zip_getZipEntryData
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile, HyZipEntry * entry,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry,
             U_8 * buffer, U_32 bufferSize));
 I_32 zip_getZipEntryFromOffset
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile, HyZipEntry * entry,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry,
             IDATA offset));
 I_32 zip_establishCache
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile));
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile));
 void zip_resetZipFile
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
             IDATA * nextEntryPointer));
 I_32 zip_getNextZipEntry
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-            HyZipEntry * zipEntry, IDATA * nextEntryPointer));
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+            VMIZipEntry * zipEntry, IDATA * nextEntryPointer));
 I_32 zip_getZipEntry
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile, HyZipEntry * entry,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry,
             const char *filename, BOOLEAN findDirectory));
 I_32 zip_getZipEntryExtraField
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile, HyZipEntry * entry,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry,
             U_8 * buffer, U_32 bufferSize));
+I_32 zip_getZipEntryRawData
+PROTOTYPE((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry, 
+		U_8 * buffer, U_32 bufferSize, U_32 offset));
 void zip_initZipEntry
-PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipEntry * entry));
 I_32 zip_openZipFile
-PROTOTYPE ((HyPortLibrary * portLib, char *filename, HyZipFile * zipFile,
+PROTOTYPE ((HyPortLibrary * portLib, char *filename, VMIZipFile * zipFile,
             HyZipCachePool * cachePool));
 void zip_freeZipEntry
-PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipEntry * entry));
 I_32 VMCALL zip_closeZipFile
-PROTOTYPE ((HyPortLibrary * portLib, struct HyZipFile * zipFile));
+PROTOTYPE ((HyPortLibrary * portLib, struct VMIZipFile * zipFile));
 I_32 zip_getZipEntryComment
-PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile, HyZipEntry * entry,
+PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry,
             U_8 * buffer, U_32 bufferSize));
 
 #undef CDEV_CURRENT_FUNCTION
@@ -260,7 +264,7 @@
 			ZIP_ERR_FILE_CORRUPT
 */
 I_32
-scanForCentralEnd (HyPortLibrary * portLib, HyZipFile * zipFile,
+scanForCentralEnd (HyPortLibrary * portLib, VMIZipFile * zipFile,
                    HyZipCentralEnd * endEntry)
 {
   U_8 *current;
@@ -380,8 +384,8 @@
 			ZIP_ERR_FILE_CORRUPT
 */
 I_32
-scanForDataDescriptor (HyPortLibrary * portLib, HyZipFile * zipFile,
-                       HyZipEntry * zipEntry)
+scanForDataDescriptor (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                       VMIZipEntry * zipEntry)
 {
   U_8 *current;
   U_8 buffer[SCAN_CHUNK_SIZE], descriptor[16];
@@ -542,7 +546,7 @@
 			ZIP_ERR_INTERNAL_ERROR
 */
 I_32
-zip_populateCache (HyPortLibrary * portLib, HyZipFile * zipFile)
+zip_populateCache (HyPortLibrary * portLib, VMIZipFile * zipFile, HyZipCentralEnd *endEntry, IDATA startCentralDir)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 
@@ -552,32 +556,19 @@
   IDATA bufferedSize = 0;
   IDATA bytesToRead = 0;
   IDATA filenameCopied;
-  HyZipEntry entry;
-  HyZipCentralEnd endEntry;
+  VMIZipEntry entry;
   U_8 *buffer = NULL;
   U_8 *filename = NULL;
   IDATA filenameSize = 256;     /* Should be sufficient for most filenames */
   U_8 *current;
   U_32 sig;
   U_32 localHeaderOffset;
-  IDATA startCentralDir;
   I_64 seekResult;
 
   if (!zipFile->cache)
     return ZIP_ERR_INTERNAL_ERROR;
 
-  /* Find and read the end-of-central-dir record. */
-  result = scanForCentralEnd (portLib, zipFile, &endEntry);
-  if (result != 0)
-    return result;
-
-  unreadSize = endEntry.dirSize + 4 /* slop */ ;
-#ifndef HY_ZIP_API
-  zipFile->cache->startCentralDir = startCentralDir =
-#else /* HY_ZIP_API */
-  ((HyZipCache *)(zipFile->cache))->startCentralDir = startCentralDir =
-#endif /* HY_ZIP_API */
-    (IDATA) ((UDATA) endEntry.dirOffset);
+  unreadSize = endEntry->dirSize + 4 /* slop */ ;
 
   if (zipFile->pointer != startCentralDir)
     {
@@ -819,8 +810,8 @@
 			ZIP_ERR_NO_MORE_ENTRIES
 */
 static I_32
-readZipEntry (HyPortLibrary * portLib, HyZipFile * zipFile,
-              HyZipEntry * zipEntry, const char *filename,
+readZipEntry (HyPortLibrary * portLib, VMIZipFile * zipFile,
+              VMIZipEntry * zipEntry, const char *filename,
               IDATA * enumerationPointer, IDATA * entryStart,
               BOOLEAN findDirectory)
 {
@@ -843,11 +834,7 @@
   readBuffer = NULL;
   /* Guess how many bytes we'll need to read.  If we guess correctly we will do fewer I/O operations */
   headerSize = 30;              /* local zip header size */
-#ifndef HY_ZIP_API
-  if (zipFile->cache && (zipFile->pointer >= zipFile->cache->startCentralDir))
-#else /* HY_ZIP_API */
-  if (zipFile->cache && (zipFile->pointer >= ((HyZipCache *)(zipFile->cache))->startCentralDir))
-#endif /* HY_ZIP_API */
+  if (zipFile->cache && (zipFile->pointer >= zipCache_getStartCentralDir(zipFile->cache)))
     {
       headerSize = 46;          /* central zip header size */
     }
@@ -999,7 +986,7 @@
     }
   memcpy (zipEntry->filename, current, readLength);
 
-  /* Read the rest of the filename if necessary.  Allocate space in HyZipEntry for it! */
+  /* Read the rest of the filename if necessary.  Allocate space in VMIZipEntry for it! */
   if (readLength < zipEntry->filenameLength)
     {
       result =
@@ -1120,7 +1107,7 @@
  *
 */
 I_32 VMCALL
-zip_closeZipFile (HyPortLibrary * portLib, struct HyZipFile * zipFile)
+zip_closeZipFile (HyPortLibrary * portLib, struct VMIZipFile * zipFile)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 #if defined(HY_NO_THR)
@@ -1181,10 +1168,9 @@
 */
 
 I_32
-zip_establishCache (HyPortLibrary * portLib, HyZipFile * zipFile)
+zip_establishCache (HyPortLibrary * portLib, VMIZipFile * zipFile)
 {
   PORT_ACCESS_FROM_PORT (portLib);
-  I_32 result;
   I_64 timeStamp, actualFileSize;
   IDATA fileSize, filenameLength;
 
@@ -1192,13 +1178,9 @@
     {
       if (zipFile->cachePool)
         {
-          /* Whack cache timestamp to keep other people from starting to use it (we will create a new one for them
+          /* Invalidate the cache to keep other people from starting to use it (we will create a new one for them
              to start to use instead).  Once all the current users of the cache have stopped using it, it will go away */
-#ifndef HY_ZIP_API
-          zipFile->cache->zipTimeStamp = -2;
-#else /* HY_ZIP_API */
-    	  ((HyZipCache *)(zipFile->cache))->zipTimeStamp = -2;
-#endif /* HY_ZIP_API */
+    	  zipCache_invalidateCache(zipFile->cache);
           zipCachePool_release (zipFile->cachePool, zipFile->cache);
         }
       zipFile->cache = NULL;
@@ -1224,21 +1206,22 @@
                             fileSize, timeStamp);
   if (!zipFile->cache)
     {
+      I_32 result = 0;
+      HyZipCentralEnd endEntry;
+      IDATA startCentralDir;
+      /* Find and read the end-of-central-dir record. */
+      result = scanForCentralEnd(portLib, zipFile, &endEntry);
+      if ( result != 0) return result;
+      
+      startCentralDir = (IDATA)((UDATA)endEntry.dirOffset);
+      
       /* Build a new cache.  Because caller asked for a cache, fail if we can't provide one */
       zipFile->cache =
-        zipCache_new (portLib, (char *) zipFile->filename, filenameLength);
+        zipCache_new (portLib, (char *) zipFile->filename, filenameLength, fileSize, timeStamp, startCentralDir);
       if (!zipFile->cache)
         return ZIP_ERR_OUT_OF_MEMORY;
 
-#ifndef HY_ZIP_API
-      zipFile->cache->zipFileSize = fileSize;
-      zipFile->cache->zipTimeStamp = timeStamp;
-#else /* HY_ZIP_API */
-      ((HyZipCache *)(zipFile->cache))->zipFileSize = fileSize;
-      ((HyZipCache *)(zipFile->cache))->zipTimeStamp = timeStamp;
-#endif /* HY_ZIP_API */
-
-      result = zip_populateCache (portLib, zipFile);
+      result = zip_populateCache (portLib, zipFile, &endEntry, startCentralDir);
       if (result != 0)
         {
           zipCache_kill (zipFile->cache);
@@ -1270,7 +1253,7 @@
 */
 
 void
-zip_initZipEntry (HyPortLibrary * portLib, HyZipEntry * entry)
+zip_initZipEntry (HyPortLibrary * portLib, VMIZipEntry * entry)
 {
   memset (entry, 0, sizeof (*entry));
 }
@@ -1290,7 +1273,7 @@
 */
 
 void
-zip_freeZipEntry (HyPortLibrary * portLib, HyZipEntry * entry)
+zip_freeZipEntry (HyPortLibrary * portLib, VMIZipEntry * entry)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 
@@ -1340,8 +1323,8 @@
  *
 */
 I_32
-zip_getNextZipEntry (HyPortLibrary * portLib, HyZipFile * zipFile,
-                     HyZipEntry * zipEntry, IDATA * nextEntryPointer)
+zip_getNextZipEntry (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                     VMIZipEntry * zipEntry, IDATA * nextEntryPointer)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 #if defined(HY_NO_THR)
@@ -1404,11 +1387,7 @@
                                       FALSE);
       if (result != entryStart)
         {
-#ifndef HY_ZIP_API
-          if (result >= zipFile->cache->startCentralDir)
-#else /* HY_ZIP_API */
-          if (result >= ((HyZipCache *)(zipFile->cache))->startCentralDir)
-#endif /* HY_ZIP_API */
+          if (result >= zipCache_getStartCentralDir(zipFile->cache))
             {
               /* ! Cache contents are not valid.  Invalidate it and make a new one */
               if (!retryAllowed)
@@ -1468,8 +1447,8 @@
 */
 
 I_32
-zip_getZipEntry (HyPortLibrary * portLib, HyZipFile * zipFile,
-                 HyZipEntry * entry, const char *filename,
+zip_getZipEntry (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                 VMIZipEntry * entry, const char *filename,
                  BOOLEAN findDirectory)
 {
   PORT_ACCESS_FROM_PORT (portLib);
@@ -1609,8 +1588,8 @@
  *
 */
 I_32
-zip_getZipEntryData (HyPortLibrary * portLib, HyZipFile * zipFile,
-                     HyZipEntry * entry, U_8 * buffer, U_32 bufferSize)
+zip_getZipEntryData (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                     VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 #if defined(HY_NO_THR)
@@ -1782,8 +1761,8 @@
  * @see zip_freeZipEntry
 */
 I_32
-zip_getZipEntryExtraField (HyPortLibrary * portLib, HyZipFile * zipFile,
-                           HyZipEntry * entry, U_8 * buffer, U_32 bufferSize)
+zip_getZipEntryExtraField (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                           VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 #if defined(HY_NO_THR)
@@ -1869,6 +1848,75 @@
 
 #undef CDEV_CURRENT_FUNCTION
 
+/** 
+ *	Attempt to read the raw data for the zip entry entry.
+ * 
+ * @param[in] portLib the port library
+ * @param[in] zipFile the zip file being read from.
+ * @param[in,out] entry the zip entry
+ * @param[in] buffer may not be NULL
+ * @param[in] bufferSize 
+ * @param[in] offset from the start of the entry data
+
+ * @return 0 on success
+ * @return	ZIP_ERR_FILE_READ_ERROR if there is an error reading from zipEntry
+ * @return	ZIP_ERR_FILE_CORRUPT if zipFile is corrupt
+ * @return	ZIP_ERR_ENTRY_NOT_FOUND if entry is not found
+ * @return 	ZIP_ERR_OUT_OF_MEMORY  if there is not enough memory to complete this call
+ * @return 	ZIP_ERR_BUFFER_TOO_SMALL if buffer is too small to hold the comment for zipFile
+ *
+ * @see zip_freeZipEntry
+ *
+*/
+I_32 zip_getZipEntryRawData(HyPortLibrary* portLib, VMIZipFile* zipFile, VMIZipEntry* entry, U_8* buffer, U_32 bufferSize, U_32 offset)
+{
+	PORT_ACCESS_FROM_PORT(portLib);
+#if defined(HY_NO_THR)
+  THREAD_ACCESS_FROM_PORT(portLib);
+#endif /* HY_NO_THR */
+
+	I_32 result;
+	I_64 seekResult;
+
+	ENTER();
+
+	if((offset + bufferSize) > entry->compressedSize) {
+		EXIT();
+		/* Trying to read past the end of the data. */
+		return ZIP_ERR_INTERNAL_ERROR;
+	}
+
+	/* Just read the data in. */
+	if (zipFile->pointer != (entry->dataPointer + offset))  {
+		seekResult =  hyfile_seek(zipFile->fd, entry->dataPointer + offset, HySeekSet);		
+		if ((seekResult < 0) || (seekResult > HYCONST64(0x7FFFFFFF))) {
+			result = ZIP_ERR_FILE_READ_ERROR;
+			goto finished;
+		}
+		zipFile->pointer = (I_32) seekResult;	
+
+		if (zipFile->pointer != (entry->dataPointer + offset))  {
+			result = ZIP_ERR_FILE_READ_ERROR;
+			goto finished;
+		}
+	}
+	result = hyfile_read(zipFile->fd, buffer, bufferSize);
+	if (result != bufferSize) {
+		result = ZIP_ERR_FILE_READ_ERROR;
+		goto finished;
+	}
+	zipFile->pointer += result;
+	EXIT();
+	return 0;
+
+finished:
+	if (result == ZIP_ERR_FILE_READ_ERROR)  {
+		zipFile->pointer = -1;
+	}
+	EXIT();
+	return result;
+}
+
 #define CDEV_CURRENT_FUNCTION zip_getZipEntryComment
 /**
  *	Read the file comment for entry. 
@@ -1893,8 +1941,8 @@
 */
 
 I_32
-zip_getZipEntryComment (HyPortLibrary * portLib, HyZipFile * zipFile,
-                        HyZipEntry * entry, U_8 * buffer, U_32 bufferSize)
+zip_getZipEntryComment (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                        VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 #if defined(HY_NO_THR)
@@ -2007,7 +2055,7 @@
  * @return	ZIP_ERR_OUT_OF_MEMORY if we are out of memory
 */
 I_32
-zip_openZipFile (HyPortLibrary * portLib, char *filename, HyZipFile * zipFile,
+zip_openZipFile (HyPortLibrary * portLib, char *filename, VMIZipFile * zipFile,
                  HyZipCachePool * cachePool)
 {
   PORT_ACCESS_FROM_PORT (portLib);
@@ -2142,18 +2190,14 @@
  * 
 */
 void
-zip_resetZipFile (HyPortLibrary * portLib, HyZipFile * zipFile,
+zip_resetZipFile (HyPortLibrary * portLib, VMIZipFile * zipFile,
                   IDATA * nextEntryPointer)
 {
   *nextEntryPointer = 0;
   if (zipFile)
     {
       if (zipFile->cache)
-#ifndef HY_ZIP_API
-        *nextEntryPointer = zipFile->cache->startCentralDir;
-#else /* HY_ZIP_API */
-        *nextEntryPointer = ((HyZipCache *)(zipFile->cache))->startCentralDir;
-#endif /* HY_ZIP_API */
+        *nextEntryPointer = zipCache_getStartCentralDir(zipFile->cache);
       else
         {
           I_32 result;
@@ -2190,8 +2234,8 @@
  * @see zip_freeZipEntry
 */
 I_32
-zip_getZipEntryFromOffset (HyPortLibrary * portLib, HyZipFile * zipFile,
-                           HyZipEntry * entry, IDATA offset)
+zip_getZipEntryFromOffset (HyPortLibrary * portLib, VMIZipFile * zipFile,
+                           VMIZipEntry * entry, IDATA offset)
 {
   PORT_ACCESS_FROM_PORT (portLib);
 #if defined(HY_NO_THR)

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.h?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/hyzip/shared/zipsup.h Thu Jan 31 02:32:25 2008
@@ -26,7 +26,7 @@
 {
 #endif
 #include "hyport.h"
-#include "hyzip.h"
+#include "vmizip.h"
 
 #if defined(HY_LOCAL_ZLIB)
 #define HY_ZIP_DLL_NAME "z"
@@ -34,6 +34,16 @@
 #define HY_ZIP_DLL_NAME "hyzlib"
 #endif
 
+typedef struct HyZipCachePool HyZipCachePool;
+
+#define ZIP_CentralEnd  0x6054B50
+#define ZIP_CentralHeader  0x2014B50
+#define ZIP_LocalHeader  0x4034B50
+#define ZIP_DataDescriptor  0x8074B50
+#define ZIP_INTERNAL_MAX  80
+#define ZIP_Unknown  0
+#define ZIP_PKZIP  1
+
   typedef struct HyZipCache
   {
     U_8 *zipFileName;
@@ -70,39 +80,42 @@
 
 /* HySourceZipSupport*/
   extern HY_CFUNC I_32 zip_getZipEntryData
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-                HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+                VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize));
   extern HY_CFUNC I_32 zip_getZipEntryFromOffset
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-                HyZipEntry * entry, IDATA offset));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+                VMIZipEntry * entry, IDATA offset));
   extern HY_CFUNC I_32 zip_establishCache
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile));
   extern HY_CFUNC void zip_resetZipFile
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
                 IDATA * nextEntryPointer));
   extern HY_CFUNC I_32 zip_getNextZipEntry
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-                HyZipEntry * zipEntry, IDATA * nextEntryPointer));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+                VMIZipEntry * zipEntry, IDATA * nextEntryPointer));
   extern HY_CFUNC I_32 zip_getZipEntry
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-                HyZipEntry * entry, const char *filename,
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+                VMIZipEntry * 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));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+                VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize));
+  extern HY_CFUNC I_32 zip_getZipEntryRawData
+  PROTOTYPE((HyPortLibrary * portLib, VMIZipFile * zipFile, VMIZipEntry * entry, 
+                U_8 * buffer, U_32 bufferSize, U_32 offset));
   extern HY_CFUNC void zip_initZipEntry
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipEntry * entry));
   extern HY_CFUNC I_32 zip_openZipFile
-    PROTOTYPE ((HyPortLibrary * portLib, char *filename, HyZipFile * zipFile,
+    PROTOTYPE ((HyPortLibrary * portLib, char *filename, VMIZipFile * zipFile,
                 HyZipCachePool * cachePool));
   extern HY_CFUNC void zip_freeZipEntry
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipEntry * entry));
-  struct HyZipFile;
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipEntry * entry));
+  struct VMIZipFile;
   extern HY_CFUNC I_32 VMCALL zip_closeZipFile
-    PROTOTYPE ((HyPortLibrary * portLib, struct HyZipFile * zipFile));
+    PROTOTYPE ((HyPortLibrary * portLib, struct VMIZipFile * zipFile));
   extern HY_CFUNC I_32 zip_getZipEntryComment
-    PROTOTYPE ((HyPortLibrary * portLib, HyZipFile * zipFile,
-                HyZipEntry * entry, U_8 * buffer, U_32 bufferSize));
+    PROTOTYPE ((HyPortLibrary * portLib, VMIZipFile * zipFile,
+                VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize));
 /* HySourceZipCache*/
   extern HY_CFUNC UDATA zipCache_findElement
     PROTOTYPE ((HyZipCache * zipCache, const char *elementName,
@@ -111,7 +124,7 @@
   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));
+    PROTOTYPE ((HyPortLibrary * portLib, char *zipName, IDATA zipNameLength, IDATA zipFileSize, I_64 zipTimeStamp, IDATA startCentralDir));
   extern HY_CFUNC IDATA zipCache_enumNew
     PROTOTYPE ((HyZipCache * zipCache, char *directoryName, void **handle));
   extern HY_CFUNC IDATA zipCache_enumElement
@@ -121,6 +134,10 @@
   extern HY_CFUNC BOOLEAN zipCache_addElement
     PROTOTYPE ((HyZipCache * zipCache, char *elementName,
                 UDATA elementOffset));
+  extern HY_CFUNC IDATA zipCache_getStartCentralDir
+    PROTOTYPE ((HyZipCache *zipCache));
+  extern HY_CFUNC void zipCache_invalidateCache
+    PROTOTYPE ((HyZipCache *zipCache));
 /* HySourceZipCachePool*/
   extern HY_CFUNC BOOLEAN zipCachePool_release
     PROTOTYPE ((HyZipCachePool * zcp, HyZipCache * zipCache));

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmi.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmi.h?rev=617092&r1=617091&r2=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmi.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmi.h Thu Jan 31 02:32:25 2008
@@ -108,7 +108,7 @@
 
     HyZipCachePool *(JNICALL * GetZipCachePool) (VMInterface * vmi);
 #else /* HY_ZIP_API */
-    struct HyZipFunctionTable *(JNICALL * GetZipFunctions) (VMInterface * vmi);
+    struct VMIZipFunctionTable *(JNICALL * GetZipFunctions) (VMInterface * vmi);
 #endif /* HY_ZIP_API */
     JavaVMInitArgs *(JNICALL * GetInitArgs) (VMInterface * vmi);
     vmiError (JNICALL * GetSystemProperty) (VMInterface * vmi, char *key,

Copied: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmizip.h (from r614839, harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/hyzip.h)
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmizip.h?p2=harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmizip.h&p1=harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/hyzip.h&r1=614839&r2=617092&rev=617092&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/hyzip.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmizip.h Thu Jan 31 02:32:25 2008
@@ -14,8 +14,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-#ifndef hyzip_h
-#define hyzip_h
+#ifndef vmizip_h
+#define vmizip_h
 
 #include "hycomp.h"
 #include "vmi.h"
@@ -23,107 +23,100 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-	
-typedef struct HyZipCachePool HyZipCachePool;
-	
-#define ZIP_INTERNAL_MAX  80
-#define ZIP_CM_Reduced1  2
-#define ZIP_Unknown  0
-#define ZIP_GZIP  2
+
+/* function return codes */
+#define ZIP_ERR_FILE_READ_ERROR  -1
+#define ZIP_ERR_NO_MORE_ENTRIES  -2
 #define ZIP_ERR_OUT_OF_MEMORY  -3
+#define ZIP_ERR_UNKNOWN_FILE_TYPE  -4
+#define ZIP_ERR_UNSUPPORTED_FILE_TYPE  -5
 #define ZIP_ERR_FILE_CORRUPT  -6
+#define ZIP_ERR_BUFFER_TOO_SMALL  -7
+#define ZIP_ERR_ENTRY_NOT_FOUND  -8
+#define ZIP_ERR_FILE_OPEN_ERROR  -9
+#define ZIP_ERR_FILE_CLOSE_ERROR  -10
 #define ZIP_ERR_INTERNAL_ERROR  -11
-#define ZIP_CM_Imploded  6
-#define ZIP_CM_Reduced4  5
+
+/* flags used in VMIZipEntry compressionMethod */
+#define ZIP_CM_Stored  0
 #define ZIP_CM_Shrunk  1
+#define ZIP_CM_Reduced1  2
 #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_Imploded  6
+#define ZIP_CM_Reduced4  5
 #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
+#define ZIP_CM_Deflated  8
 
-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;
+/* flags used in zip_getZipEntry(), zip_getZipEntryFromOffset(), and zip_getNextZipEntry() */
+#define ZIP_FLAG_FIND_DIRECTORY 1
+#define ZIP_FLAG_READ_DATA_POINTER 2
+
+/* flags used in zip_openZipFile() */
+#define ZIP_FLAG_OPEN_CACHE 1
 
-typedef struct HyZipFile
+typedef struct VMIZipEntry
 {
-  U_8 *filename;
-  void *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;
-
-typedef struct HyZipFunctionTable {
-	I_32 (PVMCALL zip_getZipEntryData) (VMInterface * vmi, HyZipFile * zipFile, HyZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
-	I_32 (PVMCALL zip_getZipEntryFromOffset) (VMInterface * vmi, HyZipFile * zipFile, HyZipEntry * entry, IDATA offset) ;
-	I_32 (PVMCALL zip_establishCache) (VMInterface * vmi, HyZipFile * zipFile) ;
-	void (PVMCALL zip_resetZipFile) (VMInterface * vmi, HyZipFile * zipFile, IDATA * nextEntryPointer) ;
-	I_32 (PVMCALL zip_getNextZipEntry) (VMInterface * vmi, HyZipFile * zipFile, HyZipEntry * zipEntry, IDATA * nextEntryPointer) ;
-	I_32 (PVMCALL zip_getZipEntry) (VMInterface * vmi, HyZipFile * zipFile, HyZipEntry * entry, const char *filename, BOOLEAN findDirectory) ;
-	I_32 (PVMCALL zip_getZipEntryExtraField) (VMInterface * vmi, HyZipFile * zipFile, HyZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
-	void (PVMCALL zip_initZipEntry) (VMInterface * vmi, HyZipEntry * entry) ;
-	I_32 (PVMCALL zip_openZipFile) (VMInterface * vmi, char *filename, HyZipFile * zipFile) ;
-	void (PVMCALL zip_freeZipEntry) (VMInterface * vmi, HyZipEntry * entry) ;
-	I_32 (PVMCALL zip_closeZipFile) (VMInterface * vmi, HyZipFile * zipFile) ;
-	I_32 (PVMCALL zip_getZipEntryComment) (VMInterface * vmi, HyZipFile * zipFile, HyZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
+	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];
+} VMIZipEntry;
 
-  	UDATA (PVMCALL zipCache_findElement) (void * zipCache, const char *elementName, BOOLEAN searchDirList) ;
-	void (PVMCALL zipCache_kill) (void * zipCache) ;
-	IDATA (PVMCALL zipCache_enumGetDirName) (void *handle, char *nameBuf, UDATA nameBufSize) ;
-	struct HyZipCache *(PVMCALL zipCache_new) (VMInterface * vmi, char *zipName, IDATA zipNameLength) ;
-	IDATA (PVMCALL zipCache_enumNew) (void * zipCache, char *directoryName, void **handle) ;
+typedef struct VMIZipFile
+{
+	U_8 *filename;
+	void *cache;
+	void *cachePool;
+	I_32 fd;
+	I_32 pointer;
+	U_8 internalFilename[80];
+	U_8 type;
+	char _vmipadding0065[3];  /* 3 bytes of automatic padding */
+} VMIZipFile;
+
+typedef struct VMIZipFunctionTable {
+	I_32 (PVMCALL zip_closeZipFile) (VMInterface * vmi, VMIZipFile * zipFile) ;
+	void (PVMCALL zip_freeZipEntry) (VMInterface * vmi, VMIZipEntry * entry) ;
+	I_32 (PVMCALL zip_getNextZipEntry) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * zipEntry, IDATA * nextEntryPointer, I_32 flags) ;
+	I_32 (PVMCALL zip_getZipEntry) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, const char *filename, I_32 flags) ;
+	I_32 (PVMCALL zip_getZipEntryComment) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
+	I_32 (PVMCALL zip_getZipEntryData) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
+	I_32 (PVMCALL zip_getZipEntryExtraField) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
+	I_32 (PVMCALL zip_getZipEntryFromOffset) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, IDATA offset, I_32 flags) ;
+	I_32 (PVMCALL zip_getZipEntryRawData) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize, U_32 offset) ;
+	void (PVMCALL zip_initZipEntry) (VMInterface * vmi, VMIZipEntry * entry) ;
+	I_32 (PVMCALL zip_openZipFile) (VMInterface * vmi, char *filename, VMIZipFile * zipFile, I_32 flags) ;
+	void (PVMCALL zip_resetZipFile) (VMInterface * vmi, VMIZipFile * zipFile, IDATA * nextEntryPointer) ;
 	IDATA (PVMCALL zipCache_enumElement) (void *handle, char *nameBuf, UDATA nameBufSize, UDATA * offset) ;
+	IDATA (PVMCALL zipCache_enumGetDirName) (void *handle, char *nameBuf, UDATA nameBufSize) ;
 	void (PVMCALL zipCache_enumKill) (void *handle) ;
-	BOOLEAN (PVMCALL zipCache_addElement) (void * zipCache, char *elementName, UDATA elementOffset) ;
-	
-	void *(PVMCALL zip_zalloc) (void *opaque, U_32 items, U_32 size) ;
-	void (PVMCALL zip_zfree) (void *opaque, void *address) ;
-	
+	IDATA (PVMCALL zipCache_enumNew) (void * zipCache, char *directoryName, void **handle) ;
+
 	void *reserved;
-} HyZipFunctionTable;
+} VMIZipFunctionTable;
+
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif     /* hyzip_h */
+#endif     /* vmizip_h */



Mime
View raw message