From owner-p4-projects@FreeBSD.ORG Tue Jul 22 20:06:22 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 18EE11065672; Tue, 22 Jul 2008 20:06:22 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D141D106566B for ; Tue, 22 Jul 2008 20:06:21 +0000 (UTC) (envelope-from strauss@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C94C68FC08 for ; Tue, 22 Jul 2008 20:06:21 +0000 (UTC) (envelope-from strauss@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m6MK6Lpr024404 for ; Tue, 22 Jul 2008 20:06:21 GMT (envelope-from strauss@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m6MK6LBR024402 for perforce@freebsd.org; Tue, 22 Jul 2008 20:06:21 GMT (envelope-from strauss@FreeBSD.org) Date: Tue, 22 Jul 2008 20:06:21 GMT Message-Id: <200807222006.m6MK6LBR024402@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to strauss@FreeBSD.org using -f From: Anselm Strauss To: Perforce Change Reviews Cc: Subject: PERFORCE change 145653 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2008 20:06:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=145653 Change 145653 by strauss@strauss_marvelman on 2008/07/22 20:05:50 - Fixed a pointer and a return mistake in zip writer - Started another test for zip writer, but having bus error in archive_entry_size() call Affected files ... .. //depot/projects/soc2008/strauss_libarchive/Makefile.am#9 edit .. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#15 edit .. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_zip_no_compression.c#1 add Differences ... ==== //depot/projects/soc2008/strauss_libarchive/Makefile.am#9 (text+ko) ==== @@ -233,6 +233,7 @@ libarchive/test/test_write_format_tar_empty.c \ libarchive/test/test_write_format_tar_ustar.c \ libarchive/test/test_write_format_zip_empty.c \ + libarchive/test/test_write_format_zip_no_compression.c \ libarchive/test/test_write_open_memory.c libarchive_test_CPPFLAGS= -I$(top_builddir)/libarchive -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test ==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#15 (text+ko) ==== @@ -173,7 +173,7 @@ archive_set_error(&a->archive, ENOMEM, "Can't allocate zip header data"); return (ARCHIVE_FATAL); } - l->entry = entry; + l->entry = entry; /* TODO: Maybe bad idea, do copy or store only needed fields. */ l->next = zip->central_directory; zip->central_directory = l; @@ -201,13 +201,13 @@ int64_t size = archive_entry_size(entry); zip_encode(size, &d->compressed_size, sizeof(d->compressed_size)); zip_encode(size, &d->uncompressed_size, sizeof(d->uncompressed_size)); - + ret = (a->compressor.write)(a, &h, sizeof(h)); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); - + ret = (a->compressor.write)(a, path, strlen(path)); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); - + return (ARCHIVE_OK); } @@ -216,9 +216,10 @@ { int ret; ret = (a->compressor.write)(a, buff, s); - if (ret != ARCHIVE_OK) - return (ARCHIVE_FATAL); - return (ret); + if (ret >= 0) + return (s); + else + return (ret); /* TODO: Compute data descriptor CRC. */ } @@ -246,7 +247,7 @@ struct zip_file_header_link *l; struct zip_file_header h; struct zip_central_directory_end end; - uint64_t size; + int64_t size; off_t offset; const char *path; int entries; @@ -287,7 +288,7 @@ if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); /* Writing filename. */ - ret = (a->compressor.write)(a, &path, strlen(path)); + ret = (a->compressor.write)(a, path, strlen(path)); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); l = l->next; @@ -305,7 +306,7 @@ /* Writing end of central directory. */ ret = (a->compressor.write)(a, &end, sizeof(end)); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); - + return (ARCHIVE_OK); } @@ -314,7 +315,7 @@ { struct zip *zip; struct zip_file_header_link *l; - + zip = (struct zip *)a->format_data; l = (struct zip_file_header_link *) zip->central_directory; while (l != NULL) {