struct archive_entry *ae;
struct archive *a;
FILE *f;
- // Compute min and max 64-bit signed twos-complement values
+ // Compute max 64-bit signed twos-complement value
// without relying on overflow. This assumes that long long
// is at least 64 bits.
const static long long max_int64 = ((((long long)1) << 62) - 1) + (((long long)1) << 62);
assertEqualString(archive_entry_pathname(ae), "dir2/smallfile");
assertEqualInt(archive_entry_size(ae), 1);
+ /* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile");
+ assertEqualInt(archive_entry_size(ae), -1);
+
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "dir2/bigfile");
assertEqualInt(archive_entry_size(ae), max_int64);
- /* Size of this file is actually max_int64 + 1, but that should
- * overflow and be returned as max_int64. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "dir2/toobigfile");
+ /* Size in mtree is max_int64 + 1; should return max_int64. */
assertEqualInt(archive_entry_size(ae), max_int64);
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString(archive_entry_pathname(ae), "dir2/veryoldfile");
- /* We can't know exact value here without knowing range of time_t. */
- min_time = archive_entry_mtime(ae);
+ /* The value in the file is MIN_INT64_T, but time_t may be narrower. */
/* Verify min_time is the smallest possible time_t. */
+ min_time = archive_entry_mtime(ae);
assert(min_time <= 0);
assert(min_time - 1 > 0);
assertEqualInt(archive_entry_mtime(ae), min_time);
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
- assertEqualInt(18, archive_file_count(a));
+ assertEqualInt(19, archive_file_count(a));
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
M='EP93UF:6QE"B`@+BX*("XN"FYO=&EN9&ER('1Y<&4]9FEL90ID:7(R+V9U
M;&QI;F1I<C(@;6]D93TP-C0T"F1I<C(O96UP='EF:6QE('1Y<&4]9FEL92!S
M:7IE/3!X,`ID:7(R+W-M86QL9FEL92!T>7!E/69I;&4@<VEZ93TP,#`P,#`P
-M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#$*9&ER,B]B:6=F:6QE('1Y<&4]9FEL
-M92!S:7IE/3DR,C,S-S(P,S8X-30W-S4X,#<*9&ER,B]T;V]B:6=F:6QE('1Y
-M<&4]9FEL92!S:7IE/3DR,C,S-S(P,S8X-30W-S4X,#@*9&ER,B]V97)Y;VQD
-M9FEL92!T>7!E/69I;&4@=&EM93TM.3(R,S,W,C`S-C@U-#<W-3@P.`ID:7(R
-M+W1O;V]L9&9I;&4@='EP93UF:6QE('1I;64]+3DR,C,S-S(P,S8X-30W-S4X
-$,#D*"@``
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#$*9&ER,B]T;V]S;6%L;&9I;&4@='EP
+M93UF:6QE('-I>F4]+3$*9&ER,B]B:6=F:6QE('1Y<&4]9FEL92!S:7IE/3DR
+M,C,S-S(P,S8X-30W-S4X,#<*9&ER,B]T;V]B:6=F:6QE('1Y<&4]9FEL92!S
+M:7IE/3DR,C,S-S(P,S8X-30W-S4X,#@*9&ER,B]V97)Y;VQD9FEL92!T>7!E
+M/69I;&4@=&EM93TM.3(R,S,W,C`S-C@U-#<W-3@P.`ID:7(R+W1O;V]L9&9I
+H;&4@='EP93UF:6QE('1I;64]+3DR,C,S-S(P,S8X-30W-S4X,#D*"@``
`
end