Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jul 2008 20:25:53 GMT
From:      Anselm Strauss <strauss@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 144846 for review
Message-ID:  <200807072025.m67KPrsO097798@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144846

Change 144846 by strauss@strauss_marvelman on 2008/07/07 20:25:22

	- Now I know why to use format_octal()
	- Added ZIP writer to Makefile (the good thing about place holder methods is that they compile easily ;-)

Affected files ...

.. //depot/projects/soc2008/strauss_libarchive/Makefile.am#5 edit
.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#2 edit

Differences ...

==== //depot/projects/soc2008/strauss_libarchive/Makefile.am#5 (text+ko) ====

@@ -133,6 +133,7 @@
 	libarchive/archive_write_set_format_pax.c		\
 	libarchive/archive_write_set_format_shar.c		\
 	libarchive/archive_write_set_format_ustar.c		\
+	libarchive/archive_write_set_format_zip.c		\
 	libarchive/config_freebsd.h				\
 	libarchive/config_windows.h				\
 	libarchive/filter_fork.c				\

==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#2 (text+ko) ====

@@ -104,23 +104,23 @@
 
 	memset(&h, 0, sizeof(h));
 	
-	h.signature = 0x04034b50;
-	h.version = 0x0200; /* TODO: Set individually for each file entry. */
-	h.flags = 0x0008; /* Flagging bit 3 for using data descriptor. */
-	h.compression = 0x0000; /* No compression. */
-	h.timedate = 0x0000; /* TODO: Using zero (means standard input) for now. */
+	format_octal(0x04034b50, &h.signature, sizeof(h.signature));
+	format_octal(0x0200, &h.version, sizeof(h.version)); /* TODO: Set individually for each file entry. */
+	format_octal(8, &h.flags, sizeof(h.flags)); /* Flagging bit 3 for using data descriptor. */
+	format_octal(0, &h.compression, sizeof(h.compression)); /* No compression. */
+	format_octal(0, &h.timedate, sizeof(h.timedate)); /* TODO: Using zero (means standard input) for now. */
 	/* Next 3 fields are specified in the data descriptor after writing file data. 
 	 * Can't compute them before having seen the data stream. */
-	h.crc32 = h.compressed_size = h.uncompressed_size = 0x00000000;
-	h.filename_length = sizeof(archive_entry_pathname(entry));
-	h.extra_length = 0x0000;
+	format_octal(0, &h.crc32, sizeof(h.crc32));
+	format_octal(0, &h.compressed_size, sizeof(h.compressed_size));
+	format_octal(0, &h.uncompressed_size, sizeof(h.uncompressed_size));
+	format_octal(sizeof(archive_entry_pathname(entry)), &h.filename_length, sizeof(h.filename_length));
+	format_octal(0x0000, &h.extra_length, sizeof(h.extra_length)); /* Not using. */
 	
 	ret = (a->compressor.write)(a, &h, sizeof(h));
 	if (ret != ARCHIVE_OK)
 		return (ARCHIVE_FATAL);
 
-	zip->entry_bytes_remaining = archive_entry_size(entry);
-
 	return (ret);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807072025.m67KPrsO097798>