PERFORCE change 144955 for review
Anselm Strauss
strauss at FreeBSD.org
Wed Jul 9 16:46:12 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144955
Change 144955 by strauss at strauss_marvelman on 2008/07/09 16:45:50
Forgot to write filename after header ...
Affected files ...
.. //depot/projects/soc2008/strauss_libarchive/TODO#8 edit
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#7 edit
Differences ...
==== //depot/projects/soc2008/strauss_libarchive/TODO#8 (text+ko) ====
@@ -1,6 +1,7 @@
To Be Done
==========
+- How to enable '-Wall' in gcc when calling make?
- Exception handling in ZIP writer
- Update ZIP writer in docs
- Integrate Libarchive 2.5.5
==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#7 (text+ko) ====
@@ -154,13 +154,21 @@
/* TODO: Append entry to central directory. */
- encode(archive_entry_size(entry), &d->compressed_size, sizeof(d->compressed_size));
- encode(archive_entry_size(entry), &d->uncompressed_size, sizeof(d->uncompressed_size));
+ int64_t size = archive_entry_size(entry);
+ encode(size, &d->compressed_size, sizeof(d->compressed_size));
+ encode(size, &d->uncompressed_size, sizeof(d->uncompressed_size));
ret = (a->compressor.write)(a, &h, sizeof(h));
if (ret != ARCHIVE_OK)
return (ARCHIVE_FATAL);
-
+
+ /* Write filename and extra field (extra field is currently null).
+ * These are not included in the header structure due to variable size. */
+ const char *path = archive_entry_pathname(entry);
+ ret = (a->compressor.write)(a, path, sizeof(*path));
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
return (ret);
}
@@ -179,6 +187,7 @@
static int
archive_write_zip_finish_entry(struct archive_write *a)
{
+ /* Write the data descripter after file data has been written. */
int ret;
struct zip *zip = (struct zip *) a->format_data;
struct zip_data_descriptor *d = (struct zip_data_descriptor *) &zip->data_descriptor;
More information about the p4-projects
mailing list