static int32_t parsecksum(char *cksum, char *name) { Hdr *hp; return hdrotoull(cksum, cksum + sizeof hp->chksum, (uint64_t)-1LL, name, "checksum"); }
static long parsecksum(char *cksum, char *name) { Hdr *hp; return hdrotoull(cksum, cksum + sizeof hp->chksum, (uvlong)-1LL, name, "checksum"); }
/* * return the nominal size from the header block, which is not always the * size in the archive (the archive size may be zero for some file types * regardless of the nominal size). * * gnu and freebsd tars are now recording int64_ts as big-endian binary * with a flag in byte 0 to indicate this, which permits file sizes up to * 2^64-1 (actually 2^80-1 but our file sizes are int64_ts) rather than 2^33-1. */ static Off hdrsize(Hdr *hp) { unsigned char *p; if((unsigned char)hp->size[0] == Binnegsz) { fprint(2, "%s: %s: negative length, which is insane\n", argv0, name(hp)); return 0; } else if((unsigned char)hp->size[0] == Binsize) { p = (unsigned char *)hp->size + sizeof hp->size - 1 - sizeof(int64_t); /* -1 for terminating space */ return G8BEBYTE(p); } return hdrotoull(hp->size, hp->size + sizeof hp->size, 0, name(hp), "size"); }