[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11697 - in Extractor/src: common plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11697 - in Extractor/src: common plugins |
Date: |
Sat, 12 Jun 2010 22:46:13 +0200 |
Author: grothoff
Date: 2010-06-12 22:46:13 +0200 (Sat, 12 Jun 2010)
New Revision: 11697
Modified:
Extractor/src/common/unzip.c
Extractor/src/plugins/zip_extractor.c
Log:
cleaning
Modified: Extractor/src/common/unzip.c
===================================================================
--- Extractor/src/common/unzip.c 2010-06-12 20:39:51 UTC (rev 11696)
+++ Extractor/src/common/unzip.c 2010-06-12 20:46:13 UTC (rev 11697)
@@ -89,9 +89,6 @@
#ifndef ALLOC
# define ALLOC(size) (malloc(size))
#endif
-#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
-#endif
#define SIZECENTRALDIRITEM (0x2e)
#define SIZEZIPLOCALHEADER (0x1e)
@@ -356,7 +353,7 @@
if (uPosFound!=0)
break;
}
- TRYFREE(buf);
+ free(buf);
return uPosFound;
}
@@ -695,13 +692,14 @@
}
- TRYFREE(pfile_in_zip_read_info->read_buffer);
+ if (NULL != pfile_in_zip_read_info->read_buffer)
+ free(pfile_in_zip_read_info->read_buffer);
pfile_in_zip_read_info->read_buffer = NULL;
if (pfile_in_zip_read_info->stream_initialised)
inflateEnd(&pfile_in_zip_read_info->stream);
pfile_in_zip_read_info->stream_initialised = 0;
- TRYFREE(pfile_in_zip_read_info);
+ free(pfile_in_zip_read_info);
s->pfile_in_zip_read=NULL;
@@ -724,7 +722,7 @@
EXTRACTOR_common_unzip_close_current_file(file);
ZCLOSE(s->z_filefunc, s->filestream);
- TRYFREE(s);
+ free(s);
return EXTRACTOR_UNZIP_OK;
}
@@ -1127,10 +1125,10 @@
pfile_in_zip_read_info->raw=raw;
if (pfile_in_zip_read_info->read_buffer==NULL)
- {
- TRYFREE(pfile_in_zip_read_info);
+ {
+ free(pfile_in_zip_read_info);
return EXTRACTOR_UNZIP_INTERNALERROR;
- }
+ }
pfile_in_zip_read_info->stream_initialised=0;
Modified: Extractor/src/plugins/zip_extractor.c
===================================================================
--- Extractor/src/plugins/zip_extractor.c 2010-06-12 20:39:51 UTC (rev
11696)
+++ Extractor/src/plugins/zip_extractor.c 2010-06-12 20:46:13 UTC (rev
11697)
@@ -152,14 +152,13 @@
pos = &data[offset--];
if (offset == stop)
{
-
#if DEBUG_EXTRACT_ZIP
- fprintf (stderr,
+ fprintf (stderr,
"Did not find end of central directory structure signature.
offset: %i\n",
offset);
-#endif /* */
- return 0;
+#endif
+ return 0;
}
/* offset should now point to the start of the end-of-central directory
structure */
@@ -180,26 +179,20 @@
filecomment[filecomment_length] = '\0';
}
}
+
+#if DEBUG_EXTRACT_ZIP
if ((0 != pos[4]) && (0 != pos[5]))
- {
+ fprintf (stderr,
+ "WARNING: This seems to be the last disk in a multi-volume"
+ " ZIP archive, and so this might not work.\n");
+#endif
#if DEBUG_EXTRACT_ZIP
- fprintf (stderr,
- "WARNING: This seems to be the last disk in a multi-volume"
- " ZIP archive, and so this might not work.\n");
-
-#endif /* */
- }
if ((pos[8] != pos[10]) && (pos[9] != pos[11]))
- {
-
-#if DEBUG_EXTRACT_ZIP
- fprintf (stderr,
- "WARNING: May not be able to find all the files in this"
- " ZIP archive (no multi-volume support right now).\n");
-
-#endif /* */
- }
+ fprintf (stderr,
+ "WARNING: May not be able to find all the files in this"
+ " ZIP archive (no multi-volume support right now).\n");
+#endif
entry_total = pos[10] + (pos[11] << 8);
entry_count = 0;
@@ -246,18 +239,17 @@
*/
if (!(('P' == pos[0]) && ('K' == pos[1]) && (0x01 == pos[2])
&& (0x02 == pos[3])))
- {
-
+ {
#if DEBUG_EXTRACT_ZIP
fprintf (stderr,
"Did not find central directory structure signature. offset:
%i\n",
offset);
-
+
#endif
if (filecomment != NULL)
free (filecomment);
return 0;
- }
+ }
start = NULL;
info = NULL;
@@ -278,8 +270,7 @@
fprintf (stderr, "Found filename length %i Comment length: %i\n",
name_length, comment_length);
-#endif /* */
-
+#endif
/* yay, finally get filenames */
if (start == NULL)
{
@@ -316,8 +307,7 @@
pos = &data[offset];
/* check for next header entry (0x02014b50) or (0x06054b50) if at end */
if (('P' != pos[0]) && ('K' != pos[1]))
- {
-
+ {
#if DEBUG_EXTRACT_ZIP
fprintf (stderr,
"Did not find next header in central directory.\n");
@@ -345,15 +335,11 @@
/* TODO: should this return an error? indicates corrupt zipfile (or
disk missing in middle of multi-disk)? */
- if (entry_count != entry_total)
- {
-
#if DEBUG_EXTRACT_ZIP
- fprintf (stderr,
- "WARNING: Did not find all of the zipfile entries that we
should have.\n");
-
-#endif /* */
- }
+ if (entry_count != entry_total)
+ fprintf (stderr,
+ "WARNING: Did not find all of the zipfile entries that we should
have.\n");
+#endif
ret = proc (proc_cls,
"zip",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11697 - in Extractor/src: common plugins,
gnunet <=