From: Sergey Poznyakoff Date: Sat, 19 May 2007 17:03:28 +0000 (+0000) Subject: Global extended_header removed, use new xheader calls instead. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=250db35f17d7700f4d209fd086b7dbc5b7ebe88f;p=chaz%2Ftar Global extended_header removed, use new xheader calls instead. --- diff --git a/src/compare.c b/src/compare.c index 2163a29..7df3d98 100644 --- a/src/compare.c +++ b/src/compare.c @@ -602,7 +602,6 @@ verify_volume (void) diff_archive (); tar_stat_destroy (¤t_stat_info); - xheader_destroy (&extended_header); } access_mode = ACCESS_WRITE; diff --git a/src/create.c b/src/create.c index eaaf8a7..1b31a3d 100644 --- a/src/create.c +++ b/src/create.c @@ -711,10 +711,10 @@ write_extended (bool global, struct tar_stat_info *st, union block *old_header) char *p; int type; - if (extended_header.buffer || extended_header.stk == NULL) + if (st->xhdr.buffer || st->xhdr.stk == NULL) return old_header; - xheader_finish (&extended_header); + xheader_finish (&st->xhdr); memcpy (hp.buffer, old_header, sizeof (hp)); if (global) { @@ -726,7 +726,7 @@ write_extended (bool global, struct tar_stat_info *st, union block *old_header) type = XHDTYPE; p = xheader_xhdr_name (st); } - xheader_write (type, p, &extended_header); + xheader_write (type, p, &st->xhdr); free (p); header = find_next_block (); memcpy (header, &hp.buffer, sizeof (hp.buffer)); @@ -1269,7 +1269,7 @@ create_archive (void) const char *p; open_archive (ACCESS_WRITE); - xheader_write_global (); + buffer_write_global_xheader (); if (incremental_option) { diff --git a/src/delete.c b/src/delete.c index 160d5ba..e649739 100644 --- a/src/delete.c +++ b/src/delete.c @@ -307,10 +307,10 @@ delete_archive_members (void) } /* Copy header. */ - if (extended_header.size) + if (current_stat_info.xhdr.size) { - write_recent_bytes (extended_header.buffer, - extended_header.size); + write_recent_bytes (current_stat_info.xhdr.buffer, + current_stat_info.xhdr.size); } else { diff --git a/src/list.c b/src/list.c index d6768d9..8a97b03 100644 --- a/src/list.c +++ b/src/list.c @@ -76,7 +76,6 @@ read_and (void (*do_something) (void)) { prev_status = status; tar_stat_destroy (¤t_stat_info); - xheader_destroy (&extended_header); status = read_header (false); switch (status) @@ -387,12 +386,16 @@ read_header_primitive (bool raw_extended_headers, struct tar_stat_info *info) } else if (header->header.typeflag == XHDTYPE || header->header.typeflag == SOLARIS_XHDTYPE) - xheader_read (header, OFF_FROM_HEADER (header->header.size)); + xheader_read (&info->xhdr, header, + OFF_FROM_HEADER (header->header.size)); else if (header->header.typeflag == XGLTYPE) { - xheader_read (header, OFF_FROM_HEADER (header->header.size)); - xheader_decode_global (); - xheader_destroy (&extended_header); + struct xheader xhdr; + memset (&xhdr, 0, sizeof xhdr); + xheader_read (&xhdr, header, + OFF_FROM_HEADER (header->header.size)); + xheader_decode_global (&xhdr); + xheader_destroy (&xhdr); } /* Loop! */ @@ -518,7 +521,7 @@ decode_header (union block *header, struct tar_stat_info *stat_info, && ISOCTAL (header->star_header.ctime[0]) && header->star_header.ctime[11] == ' ') format = STAR_FORMAT; - else if (extended_header.size) + else if (stat_info->xhdr.size) format = POSIX_FORMAT; else format = USTAR_FORMAT; diff --git a/src/sparse.c b/src/sparse.c index 93aee99..aa76c61 100644 --- a/src/sparse.c +++ b/src/sparse.c @@ -945,16 +945,19 @@ pax_dump_header_0 (struct tar_sparse_file *file) file->stat_info->file_name = xheader_format_name (file->stat_info, "%d/GNUSparseFile.%p/%f", 0); - xheader_string_begin (); + xheader_string_begin (&file->stat_info->xhdr); for (i = 0; i < file->stat_info->sparse_map_avail; i++) { if (i) - xheader_string_add (","); - xheader_string_add (umaxtostr (map[i].offset, nbuf)); - xheader_string_add (","); - xheader_string_add (umaxtostr (map[i].numbytes, nbuf)); + xheader_string_add (&file->stat_info->xhdr, ","); + xheader_string_add (&file->stat_info->xhdr, + umaxtostr (map[i].offset, nbuf)); + xheader_string_add (&file->stat_info->xhdr, ","); + xheader_string_add (&file->stat_info->xhdr, + umaxtostr (map[i].numbytes, nbuf)); } - if (!xheader_string_end ("GNU.sparse.map")) + if (!xheader_string_end (&file->stat_info->xhdr, + "GNU.sparse.map")) { free (file->stat_info->file_name); file->stat_info->file_name = save_file_name; diff --git a/src/tar.c b/src/tar.c index e21a646..1b95ccf 100644 --- a/src/tar.c +++ b/src/tar.c @@ -2408,6 +2408,7 @@ tar_stat_destroy (struct tar_stat_info *st) free (st->gname); free (st->sparse_map); free (st->dumpdir); + xheader_destroy (&st->xhdr); memset (st, 0, sizeof (*st)); } diff --git a/src/update.c b/src/update.c index 6546b03..fa18c1d 100644 --- a/src/update.c +++ b/src/update.c @@ -110,7 +110,7 @@ update_archive (void) name_gather (); open_archive (ACCESS_UPDATE); - xheader_write_global (); + buffer_write_global_xheader (); while (!found_end) { @@ -181,7 +181,6 @@ update_archive (void) } tar_stat_destroy (¤t_stat_info); - xheader_destroy (&extended_header); previous_status = status; }