Date: Sat, 9 Aug 2008 13:31:06 GMT From: Anselm Strauss <strauss@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 146987 for review Message-ID: <200808091331.m79DV6Fa084048@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146987 Change 146987 by strauss@strauss_marvelman on 2008/08/09 13:30:40 Better test for step-by-step computed CRC32. Affected files ... .. //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_zip_no_compression.c#6 edit Differences ... ==== //depot/projects/soc2008/strauss_libarchive/libarchive/test/test_write_format_zip_no_compression.c#6 (text+ko) ==== @@ -12,10 +12,12 @@ { struct archive *a; struct archive_entry *entry; - char data[] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; + char data1[] = {'1', '2', '3', '4', '5'}; + char data2[] = {'6', '7', '8', '9', '0'}; char buff[100000]; const char *p, *q, *buffend; size_t used; + int crc; /* Create new ZIP archive in memory without padding. */ assert((a = archive_write_new()) != NULL); @@ -38,7 +40,8 @@ archive_entry_set_ino(entry, 89); archive_entry_set_nlink(entry, 1); assertEqualIntA(a, 0, archive_write_header(a, entry)); - assertEqualIntA(a, 10, archive_write_data(a, data, sizeof(data))); + assertEqualIntA(a, sizeof(data1), archive_write_data(a, data1, sizeof(data1))); + assertEqualIntA(a, sizeof(data2), archive_write_data(a, data2, sizeof(data2))); archive_entry_free(entry); /* TODO: Also test non-regular file and directory entries. */ @@ -80,7 +83,9 @@ /* assertEqualInt(i2(p + 10), XXXX); */ /* Compression method */ /* assertEqualInt(i2(p + 12), XXXX); */ /* File time */ /* assertEqualInt(i2(p + 14), XXXX); */ /* File date */ - assertEqualInt(i4(p + 16), crc32(0, &data, sizeof(data))); /* CRC-32 */ + crc = crc32(0, &data1, sizeof(data1)); + crc = crc32(crc, &data2, sizeof(data2)); + assertEqualInt(i4(p + 16), crc); /* CRC-32 */ /* assertEqualInt(i4(p + 20), XXXX); */ /* Compressed size */ /* assertEqualInt(i4(p + 24), XXXX); */ /* Uncompressed size */ /* assertEqualInt(i2(p + 28), XXXX); */ /* Filename length */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808091331.m79DV6Fa084048>