[kaffe] CVS kaffe (robilad): more zip entry closing cleanup

Kaffe CVS cvs-commits at kaffe.org
Fri Feb 15 15:49:53 PST 2008


PatchSet 7756 
Date: 2008/02/15 23:46:56
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
more zip entry closing cleanup

008-02-16  Dalibor Topic  <robilad at kaffe.org>

* libraries/clib/zip/ZipFile.c (java_util_zip_ZipFile_getZipData0)
(java_util_zip_ZipFile_getZipEntries0): Only close entries we've
opened successfully.

Members: 
	ChangeLog:1.5256->1.5257 
	libraries/clib/zip/ZipFile.c:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5256 kaffe/ChangeLog:1.5257
--- kaffe/ChangeLog:1.5256	Fri Feb 15 23:34:42 2008
+++ kaffe/ChangeLog	Fri Feb 15 23:46:56 2008
@@ -1,3 +1,9 @@
+2008-02-16  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/clib/zip/ZipFile.c (java_util_zip_ZipFile_getZipData0)
+	(java_util_zip_ZipFile_getZipEntries0): Only close entries we've 
+	opened successfully.
+
 2008-02-15  Dalibor Topic  <robilad at kaffe.org>
 
 	* libraries/clib/zip/ZipFile.c (java_util_zip_ZipFile_getZipEntry0)
Index: kaffe/libraries/clib/zip/ZipFile.c
diff -u kaffe/libraries/clib/zip/ZipFile.c:1.6 kaffe/libraries/clib/zip/ZipFile.c:1.7
--- kaffe/libraries/clib/zip/ZipFile.c:1.6	Fri Feb 15 23:34:44 2008
+++ kaffe/libraries/clib/zip/ZipFile.c	Fri Feb 15 23:46:58 2008
@@ -120,9 +120,10 @@
 	if( size > 0 )
 	{
 	  ZZIP_FILE *entry = getZipEntry( zip, unhand(zentry)->name);
-	  if (entry != NULL)
+	  if (entry != NULL) {
 	    buf = getDataJarFile(entry);
-	  zzip_file_close(entry);
+	    zzip_file_close(entry);
+	  }
 	  if (buf == 0) {
 	    return (NULL);
 	  }
@@ -141,7 +142,6 @@
 {
 	Hjava_util_Vector* vec;
 	ZZIP_DIR* zfile;
-	ZZIP_FILE* entry;
 	ZZIP_DIRENT * zip_entry = NULL; 
 	HObject** elems;
 	int i = 0;
@@ -156,11 +156,15 @@
 
 	zzip_rewinddir(zfile);
 	do {
+	  ZZIP_FILE* entry;
+
 	  zip_entry = zzip_readdir(zfile);
 	  if (NULL != zip_entry) {
 	    entry = zzip_file_open(zfile, zip_entry->d_name, 0);
-	    elems[i] = (HObject*)makeZipEntry(entry, stringC2Java(zip_entry->d_name));
-	    zzip_file_close(entry);
+	    if (NULL != entry) {
+	      elems[i] = (HObject*)makeZipEntry(entry, stringC2Java(zip_entry->d_name));
+	      zzip_file_close(entry);
+	    }
 	    i++;
 	  }
 	}while (zip_entry != NULL);




More information about the kaffe mailing list