From eea561871b45a2335ab6a09f14dad627ffcdc1cd Mon Sep 17 00:00:00 2001 From: "\"Robert P. J. Day\"" Date: Thu, 20 Jul 2006 19:02:24 +0000 Subject: "formated" -> "formatted" throughout the code base. --- archival/libunarchive/check_header_gzip.c | 14 ++++----- archival/libunarchive/get_header_ar.c | 24 +++++++------- archival/libunarchive/get_header_tar.c | 40 ++++++++++++------------ archival/unzip.c | 52 +++++++++++++++---------------- 4 files changed, 65 insertions(+), 65 deletions(-) (limited to 'archival') diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c index 77e1e6a46..00d1919a7 100644 --- a/archival/libunarchive/check_header_gzip.c +++ b/archival/libunarchive/check_header_gzip.c @@ -17,18 +17,18 @@ void check_header_gzip(int src_fd) unsigned int mtime; unsigned char xtra_flags; unsigned char os_flags; - } formated; + } formatted; } header; xread(src_fd, header.raw, 8); /* Check the compression method */ - if (header.formated.method != 8) { + if (header.formatted.method != 8) { bb_error_msg_and_die("Unknown compression method %d", - header.formated.method); + header.formatted.method); } - if (header.formated.flags & 0x04) { + if (header.formatted.flags & 0x04) { /* bit 2 set: extra field present */ unsigned char extra_short; @@ -41,19 +41,19 @@ void check_header_gzip(int src_fd) } /* Discard original name if any */ - if (header.formated.flags & 0x08) { + if (header.formatted.flags & 0x08) { /* bit 3 set: original file name present */ while(xread_char(src_fd) != 0); } /* Discard file comment if any */ - if (header.formated.flags & 0x10) { + if (header.formatted.flags & 0x10) { /* bit 4 set: file comment present */ while(xread_char(src_fd) != 0); } /* Read the header checksum */ - if (header.formated.flags & 0x02) { + if (header.formatted.flags & 0x02) { xread_char(src_fd); xread_char(src_fd); } diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c index 48d7a5ad8..4627695e4 100644 --- a/archival/libunarchive/get_header_ar.c +++ b/archival/libunarchive/get_header_ar.c @@ -24,7 +24,7 @@ char get_header_ar(archive_handle_t *archive_handle) char mode[8]; char size[10]; char magic[2]; - } formated; + } formatted; } ar; #ifdef CONFIG_FEATURE_AR_LONG_FILENAMES static char *ar_long_names; @@ -49,20 +49,20 @@ char get_header_ar(archive_handle_t *archive_handle) archive_handle->offset += 60; /* align the headers based on the header magic */ - if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { + if ((ar.formatted.magic[0] != '`') || (ar.formatted.magic[1] != '\n')) { bb_error_msg_and_die("Invalid ar header"); } - typed->mode = strtol(ar.formated.mode, NULL, 8); - typed->mtime = atoi(ar.formated.date); - typed->uid = atoi(ar.formated.uid); - typed->gid = atoi(ar.formated.gid); - typed->size = atoi(ar.formated.size); + typed->mode = strtol(ar.formatted.mode, NULL, 8); + typed->mtime = atoi(ar.formatted.date); + typed->uid = atoi(ar.formatted.uid); + typed->gid = atoi(ar.formatted.gid); + typed->size = atoi(ar.formatted.size); /* long filenames have '/' as the first character */ - if (ar.formated.name[0] == '/') { + if (ar.formatted.name[0] == '/') { #ifdef CONFIG_FEATURE_AR_LONG_FILENAMES - if (ar.formated.name[1] == '/') { + if (ar.formatted.name[1] == '/') { /* If the second char is a '/' then this entries data section * stores long filename for multiple entries, they are stored * in static variable long_names for use in future entries */ @@ -73,7 +73,7 @@ char get_header_ar(archive_handle_t *archive_handle) /* This ar entries data section only contained filenames for other records * they are stored in the static ar_long_names for future reference */ return (get_header_ar(archive_handle)); /* Return next header */ - } else if (ar.formated.name[1] == ' ') { + } else if (ar.formatted.name[1] == ' ') { /* This is the index of symbols in the file for compilers */ data_skip(archive_handle); archive_handle->offset += typed->size; @@ -81,7 +81,7 @@ char get_header_ar(archive_handle_t *archive_handle) } else { /* The number after the '/' indicates the offset in the ar data section (saved in variable long_name) that conatains the real filename */ - const unsigned int long_offset = atoi(&ar.formated.name[1]); + const unsigned int long_offset = atoi(&ar.formatted.name[1]); if (long_offset >= ar_long_name_size) { bb_error_msg_and_die("Cant resolve long filename"); } @@ -92,7 +92,7 @@ char get_header_ar(archive_handle_t *archive_handle) #endif } else { /* short filenames */ - typed->name = bb_xstrndup(ar.formated.name, 16); + typed->name = bb_xstrndup(ar.formatted.name, 16); } typed->name[strcspn(typed->name, " /")] = '\0'; diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 4394d23ee..fb7e9ae8f 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -47,7 +47,7 @@ char get_header_tar(archive_handle_t *archive_handle) char devminor[8]; /* 337-344 */ char prefix[155]; /* 345-499 */ char padding[12]; /* 500-512 */ - } formated; + } formatted; } tar; long sum = 0; long i; @@ -60,7 +60,7 @@ char get_header_tar(archive_handle_t *archive_handle) archive_handle->offset += 512; /* If there is no filename its an empty header */ - if (tar.formated.name[0] == 0) { + if (tar.formatted.name[0] == 0) { if (end) { /* This is the second consecutive empty header! End of archive! * Read until the end to empty the pipe from gz or bz2 @@ -76,9 +76,9 @@ char get_header_tar(archive_handle_t *archive_handle) /* Check header has valid magic, "ustar" is for the proper tar * 0's are for the old tar format */ - if (strncmp(tar.formated.magic, "ustar", 5) != 0) { + if (strncmp(tar.formatted.magic, "ustar", 5) != 0) { #ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY - if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0) + if (strncmp(tar.formatted.magic, "\0\0\0\0\0", 5) != 0) #endif bb_error_msg_and_die("Invalid tar magic"); } @@ -90,7 +90,7 @@ char get_header_tar(archive_handle_t *archive_handle) for (i = 156; i < 512 ; i++) { sum += tar.raw[i]; } - if (sum != strtol(tar.formated.chksum, NULL, 8)) { + if (sum != strtol(tar.formatted.chksum, NULL, 8)) { bb_error_msg("Invalid tar header checksum"); return(EXIT_FAILURE); } @@ -106,29 +106,29 @@ char get_header_tar(archive_handle_t *archive_handle) } else #endif { - file_header->name = bb_xstrndup(tar.formated.name,100); + file_header->name = bb_xstrndup(tar.formatted.name,100); - if (tar.formated.prefix[0]) { + if (tar.formatted.prefix[0]) { char *temp = file_header->name; - file_header->name = concat_path_file(tar.formated.prefix, temp); + file_header->name = concat_path_file(tar.formatted.prefix, temp); free(temp); } } - file_header->uid = strtol(tar.formated.uid, NULL, 8); - file_header->gid = strtol(tar.formated.gid, NULL, 8); - file_header->size = strtol(tar.formated.size, NULL, 8); - file_header->mtime = strtol(tar.formated.mtime, NULL, 8); - file_header->link_name = (tar.formated.linkname[0] != '\0') ? - bb_xstrdup(tar.formated.linkname) : NULL; - file_header->device = makedev(strtol(tar.formated.devmajor, NULL, 8), - strtol(tar.formated.devminor, NULL, 8)); + file_header->uid = strtol(tar.formatted.uid, NULL, 8); + file_header->gid = strtol(tar.formatted.gid, NULL, 8); + file_header->size = strtol(tar.formatted.size, NULL, 8); + file_header->mtime = strtol(tar.formatted.mtime, NULL, 8); + file_header->link_name = (tar.formatted.linkname[0] != '\0') ? + bb_xstrdup(tar.formatted.linkname) : NULL; + file_header->device = makedev(strtol(tar.formatted.devmajor, NULL, 8), + strtol(tar.formatted.devminor, NULL, 8)); /* Set bits 0-11 of the files mode */ - file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8); + file_header->mode = 07777 & strtol(tar.formatted.mode, NULL, 8); /* Set bits 12-15 of the files mode */ - switch (tar.formated.typeflag) { + switch (tar.formatted.typeflag) { /* busybox identifies hard links as being regular files with 0 size and a link name */ case '1': file_header->mode |= S_IFREG; @@ -183,10 +183,10 @@ char get_header_tar(archive_handle_t *archive_handle) #endif case 'g': /* pax global header */ case 'x': /* pax extended header */ - bb_error_msg("Ignoring extension type %c", tar.formated.typeflag); + bb_error_msg("Ignoring extension type %c", tar.formatted.typeflag); break; default: - bb_error_msg("Unknown typeflag: 0x%x", tar.formated.typeflag); + bb_error_msg("Unknown typeflag: 0x%x", tar.formatted.typeflag); } { /* Strip trailing '/' in directories */ /* Must be done after mode is set as '/' is used to check if its a directory */ diff --git a/archival/unzip.c b/archival/unzip.c index 632cc8551..012f355e2 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -53,7 +53,7 @@ typedef union { unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */ unsigned short filename_len; /* 22-23 */ unsigned short extra_len; /* 24-25 */ - } formated ATTRIBUTE_PACKED; + } formatted ATTRIBUTE_PACKED; } zip_header_t; static void unzip_skip(int fd, off_t skip) @@ -77,25 +77,25 @@ static void unzip_create_leading_dirs(char *fn) static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd) { - if (zip_header->formated.method == 0) { + if (zip_header->formatted.method == 0) { /* Method 0 - stored (not compressed) */ - int size = zip_header->formated.ucmpsize; + int size = zip_header->formatted.ucmpsize; if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) { bb_error_msg_and_die("Cannot complete extraction"); } } else { /* Method 8 - inflate */ - inflate_init(zip_header->formated.cmpsize); + inflate_init(zip_header->formatted.cmpsize); inflate_unzip(src_fd, dst_fd); inflate_cleanup(); /* Validate decompression - crc */ - if (zip_header->formated.crc32 != (gunzip_crc ^ 0xffffffffL)) { + if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) { bb_error_msg("Invalid compressed data--crc error"); return 1; } /* Validate decompression - size */ - if (zip_header->formated.ucmpsize != gunzip_bytes_out) { + if (zip_header->formatted.ucmpsize != gunzip_bytes_out) { bb_error_msg("Invalid compressed data--length error"); return 1; } @@ -232,27 +232,27 @@ int unzip_main(int argc, char **argv) /* Read the file header */ xread(src_fd, zip_header.raw, 26); - zip_header.formated.version = SWAP_LE32(zip_header.formated.version); - zip_header.formated.flags = SWAP_LE32(zip_header.formated.flags); - zip_header.formated.method = SWAP_LE32(zip_header.formated.method); - zip_header.formated.modtime = SWAP_LE32(zip_header.formated.modtime); - zip_header.formated.moddate = SWAP_LE32(zip_header.formated.moddate); - zip_header.formated.crc32 = SWAP_LE32(zip_header.formated.crc32); - zip_header.formated.cmpsize = SWAP_LE32(zip_header.formated.cmpsize); - zip_header.formated.ucmpsize = SWAP_LE32(zip_header.formated.ucmpsize); - zip_header.formated.filename_len = SWAP_LE32(zip_header.formated.filename_len); - zip_header.formated.extra_len = SWAP_LE32(zip_header.formated.extra_len); - if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) { - bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method); + zip_header.formatted.version = SWAP_LE32(zip_header.formatted.version); + zip_header.formatted.flags = SWAP_LE32(zip_header.formatted.flags); + zip_header.formatted.method = SWAP_LE32(zip_header.formatted.method); + zip_header.formatted.modtime = SWAP_LE32(zip_header.formatted.modtime); + zip_header.formatted.moddate = SWAP_LE32(zip_header.formatted.moddate); + zip_header.formatted.crc32 = SWAP_LE32(zip_header.formatted.crc32); + zip_header.formatted.cmpsize = SWAP_LE32(zip_header.formatted.cmpsize); + zip_header.formatted.ucmpsize = SWAP_LE32(zip_header.formatted.ucmpsize); + zip_header.formatted.filename_len = SWAP_LE32(zip_header.formatted.filename_len); + zip_header.formatted.extra_len = SWAP_LE32(zip_header.formatted.extra_len); + if ((zip_header.formatted.method != 0) && (zip_header.formatted.method != 8)) { + bb_error_msg_and_die("Unsupported compression method %d", zip_header.formatted.method); } /* Read filename */ free(dst_fn); - dst_fn = xzalloc(zip_header.formated.filename_len + 1); - xread(src_fd, dst_fn, zip_header.formated.filename_len); + dst_fn = xzalloc(zip_header.formatted.filename_len + 1); + xread(src_fd, dst_fn, zip_header.formatted.filename_len); /* Skip extra header bytes */ - unzip_skip(src_fd, zip_header.formated.extra_len); + unzip_skip(src_fd, zip_header.formatted.extra_len); if ((verbosity == v_list) && !list_header_done){ printf(" Length Date Time Name\n" @@ -266,12 +266,12 @@ int unzip_main(int argc, char **argv) i = 'n'; } else { /* Extract entry */ - total_size += zip_header.formated.ucmpsize; + total_size += zip_header.formatted.ucmpsize; if (verbosity == v_list) { /* List entry */ - unsigned int dostime = zip_header.formated.modtime | (zip_header.formated.moddate << 16); + unsigned int dostime = zip_header.formatted.modtime | (zip_header.formatted.moddate << 16); printf("%9u %02u-%02u-%02u %02u:%02u %s\n", - zip_header.formated.ucmpsize, + zip_header.formatted.ucmpsize, (dostime & 0x01e00000) >> 21, (dostime & 0x001f0000) >> 16, (((dostime & 0xfe000000) >> 25) + 1980) % 100, @@ -356,7 +356,7 @@ int unzip_main(int argc, char **argv) overwrite = o_never; case 'n': /* Skip entry data */ - unzip_skip(src_fd, zip_header.formated.cmpsize); + unzip_skip(src_fd, zip_header.formatted.cmpsize); break; case 'r': @@ -376,7 +376,7 @@ int unzip_main(int argc, char **argv) } /* Data descriptor section */ - if (zip_header.formated.flags & 4) { + if (zip_header.formatted.flags & 4) { /* skip over duplicate crc, compressed size and uncompressed size */ unzip_skip(src_fd, 12); } -- cgit v1.2.3