aboutsummaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
author"Robert P. J. Day" <rpjday@mindspring.com>2006-07-20 19:02:24 +0000
committer"Robert P. J. Day" <rpjday@mindspring.com>2006-07-20 19:02:24 +0000
commiteea561871b45a2335ab6a09f14dad627ffcdc1cd (patch)
tree7c45d6a5741adb652c047366dddf3a2e8ce62929 /archival/libunarchive
parentbf30c69a38a38561b4165549478a14efdbb95a53 (diff)
downloadbusybox-w32-eea561871b45a2335ab6a09f14dad627ffcdc1cd.tar.gz
busybox-w32-eea561871b45a2335ab6a09f14dad627ffcdc1cd.tar.bz2
busybox-w32-eea561871b45a2335ab6a09f14dad627ffcdc1cd.zip
"formated" -> "formatted" throughout the code base.
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/check_header_gzip.c14
-rw-r--r--archival/libunarchive/get_header_ar.c24
-rw-r--r--archival/libunarchive/get_header_tar.c40
3 files changed, 39 insertions, 39 deletions
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)
17 unsigned int mtime; 17 unsigned int mtime;
18 unsigned char xtra_flags; 18 unsigned char xtra_flags;
19 unsigned char os_flags; 19 unsigned char os_flags;
20 } formated; 20 } formatted;
21 } header; 21 } header;
22 22
23 xread(src_fd, header.raw, 8); 23 xread(src_fd, header.raw, 8);
24 24
25 /* Check the compression method */ 25 /* Check the compression method */
26 if (header.formated.method != 8) { 26 if (header.formatted.method != 8) {
27 bb_error_msg_and_die("Unknown compression method %d", 27 bb_error_msg_and_die("Unknown compression method %d",
28 header.formated.method); 28 header.formatted.method);
29 } 29 }
30 30
31 if (header.formated.flags & 0x04) { 31 if (header.formatted.flags & 0x04) {
32 /* bit 2 set: extra field present */ 32 /* bit 2 set: extra field present */
33 unsigned char extra_short; 33 unsigned char extra_short;
34 34
@@ -41,19 +41,19 @@ void check_header_gzip(int src_fd)
41 } 41 }
42 42
43 /* Discard original name if any */ 43 /* Discard original name if any */
44 if (header.formated.flags & 0x08) { 44 if (header.formatted.flags & 0x08) {
45 /* bit 3 set: original file name present */ 45 /* bit 3 set: original file name present */
46 while(xread_char(src_fd) != 0); 46 while(xread_char(src_fd) != 0);
47 } 47 }
48 48
49 /* Discard file comment if any */ 49 /* Discard file comment if any */
50 if (header.formated.flags & 0x10) { 50 if (header.formatted.flags & 0x10) {
51 /* bit 4 set: file comment present */ 51 /* bit 4 set: file comment present */
52 while(xread_char(src_fd) != 0); 52 while(xread_char(src_fd) != 0);
53 } 53 }
54 54
55 /* Read the header checksum */ 55 /* Read the header checksum */
56 if (header.formated.flags & 0x02) { 56 if (header.formatted.flags & 0x02) {
57 xread_char(src_fd); 57 xread_char(src_fd);
58 xread_char(src_fd); 58 xread_char(src_fd);
59 } 59 }
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)
24 char mode[8]; 24 char mode[8];
25 char size[10]; 25 char size[10];
26 char magic[2]; 26 char magic[2];
27 } formated; 27 } formatted;
28 } ar; 28 } ar;
29#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES 29#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
30 static char *ar_long_names; 30 static char *ar_long_names;
@@ -49,20 +49,20 @@ char get_header_ar(archive_handle_t *archive_handle)
49 archive_handle->offset += 60; 49 archive_handle->offset += 60;
50 50
51 /* align the headers based on the header magic */ 51 /* align the headers based on the header magic */
52 if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { 52 if ((ar.formatted.magic[0] != '`') || (ar.formatted.magic[1] != '\n')) {
53 bb_error_msg_and_die("Invalid ar header"); 53 bb_error_msg_and_die("Invalid ar header");
54 } 54 }
55 55
56 typed->mode = strtol(ar.formated.mode, NULL, 8); 56 typed->mode = strtol(ar.formatted.mode, NULL, 8);
57 typed->mtime = atoi(ar.formated.date); 57 typed->mtime = atoi(ar.formatted.date);
58 typed->uid = atoi(ar.formated.uid); 58 typed->uid = atoi(ar.formatted.uid);
59 typed->gid = atoi(ar.formated.gid); 59 typed->gid = atoi(ar.formatted.gid);
60 typed->size = atoi(ar.formated.size); 60 typed->size = atoi(ar.formatted.size);
61 61
62 /* long filenames have '/' as the first character */ 62 /* long filenames have '/' as the first character */
63 if (ar.formated.name[0] == '/') { 63 if (ar.formatted.name[0] == '/') {
64#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES 64#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
65 if (ar.formated.name[1] == '/') { 65 if (ar.formatted.name[1] == '/') {
66 /* If the second char is a '/' then this entries data section 66 /* If the second char is a '/' then this entries data section
67 * stores long filename for multiple entries, they are stored 67 * stores long filename for multiple entries, they are stored
68 * in static variable long_names for use in future entries */ 68 * in static variable long_names for use in future entries */
@@ -73,7 +73,7 @@ char get_header_ar(archive_handle_t *archive_handle)
73 /* This ar entries data section only contained filenames for other records 73 /* This ar entries data section only contained filenames for other records
74 * they are stored in the static ar_long_names for future reference */ 74 * they are stored in the static ar_long_names for future reference */
75 return (get_header_ar(archive_handle)); /* Return next header */ 75 return (get_header_ar(archive_handle)); /* Return next header */
76 } else if (ar.formated.name[1] == ' ') { 76 } else if (ar.formatted.name[1] == ' ') {
77 /* This is the index of symbols in the file for compilers */ 77 /* This is the index of symbols in the file for compilers */
78 data_skip(archive_handle); 78 data_skip(archive_handle);
79 archive_handle->offset += typed->size; 79 archive_handle->offset += typed->size;
@@ -81,7 +81,7 @@ char get_header_ar(archive_handle_t *archive_handle)
81 } else { 81 } else {
82 /* The number after the '/' indicates the offset in the ar data section 82 /* The number after the '/' indicates the offset in the ar data section
83 (saved in variable long_name) that conatains the real filename */ 83 (saved in variable long_name) that conatains the real filename */
84 const unsigned int long_offset = atoi(&ar.formated.name[1]); 84 const unsigned int long_offset = atoi(&ar.formatted.name[1]);
85 if (long_offset >= ar_long_name_size) { 85 if (long_offset >= ar_long_name_size) {
86 bb_error_msg_and_die("Cant resolve long filename"); 86 bb_error_msg_and_die("Cant resolve long filename");
87 } 87 }
@@ -92,7 +92,7 @@ char get_header_ar(archive_handle_t *archive_handle)
92#endif 92#endif
93 } else { 93 } else {
94 /* short filenames */ 94 /* short filenames */
95 typed->name = bb_xstrndup(ar.formated.name, 16); 95 typed->name = bb_xstrndup(ar.formatted.name, 16);
96 } 96 }
97 97
98 typed->name[strcspn(typed->name, " /")] = '\0'; 98 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)
47 char devminor[8]; /* 337-344 */ 47 char devminor[8]; /* 337-344 */
48 char prefix[155]; /* 345-499 */ 48 char prefix[155]; /* 345-499 */
49 char padding[12]; /* 500-512 */ 49 char padding[12]; /* 500-512 */
50 } formated; 50 } formatted;
51 } tar; 51 } tar;
52 long sum = 0; 52 long sum = 0;
53 long i; 53 long i;
@@ -60,7 +60,7 @@ char get_header_tar(archive_handle_t *archive_handle)
60 archive_handle->offset += 512; 60 archive_handle->offset += 512;
61 61
62 /* If there is no filename its an empty header */ 62 /* If there is no filename its an empty header */
63 if (tar.formated.name[0] == 0) { 63 if (tar.formatted.name[0] == 0) {
64 if (end) { 64 if (end) {
65 /* This is the second consecutive empty header! End of archive! 65 /* This is the second consecutive empty header! End of archive!
66 * Read until the end to empty the pipe from gz or bz2 66 * 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)
76 /* Check header has valid magic, "ustar" is for the proper tar 76 /* Check header has valid magic, "ustar" is for the proper tar
77 * 0's are for the old tar format 77 * 0's are for the old tar format
78 */ 78 */
79 if (strncmp(tar.formated.magic, "ustar", 5) != 0) { 79 if (strncmp(tar.formatted.magic, "ustar", 5) != 0) {
80#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY 80#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
81 if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0) 81 if (strncmp(tar.formatted.magic, "\0\0\0\0\0", 5) != 0)
82#endif 82#endif
83 bb_error_msg_and_die("Invalid tar magic"); 83 bb_error_msg_and_die("Invalid tar magic");
84 } 84 }
@@ -90,7 +90,7 @@ char get_header_tar(archive_handle_t *archive_handle)
90 for (i = 156; i < 512 ; i++) { 90 for (i = 156; i < 512 ; i++) {
91 sum += tar.raw[i]; 91 sum += tar.raw[i];
92 } 92 }
93 if (sum != strtol(tar.formated.chksum, NULL, 8)) { 93 if (sum != strtol(tar.formatted.chksum, NULL, 8)) {
94 bb_error_msg("Invalid tar header checksum"); 94 bb_error_msg("Invalid tar header checksum");
95 return(EXIT_FAILURE); 95 return(EXIT_FAILURE);
96 } 96 }
@@ -106,29 +106,29 @@ char get_header_tar(archive_handle_t *archive_handle)
106 } else 106 } else
107#endif 107#endif
108 { 108 {
109 file_header->name = bb_xstrndup(tar.formated.name,100); 109 file_header->name = bb_xstrndup(tar.formatted.name,100);
110 110
111 if (tar.formated.prefix[0]) { 111 if (tar.formatted.prefix[0]) {
112 char *temp = file_header->name; 112 char *temp = file_header->name;
113 file_header->name = concat_path_file(tar.formated.prefix, temp); 113 file_header->name = concat_path_file(tar.formatted.prefix, temp);
114 free(temp); 114 free(temp);
115 } 115 }
116 } 116 }
117 117
118 file_header->uid = strtol(tar.formated.uid, NULL, 8); 118 file_header->uid = strtol(tar.formatted.uid, NULL, 8);
119 file_header->gid = strtol(tar.formated.gid, NULL, 8); 119 file_header->gid = strtol(tar.formatted.gid, NULL, 8);
120 file_header->size = strtol(tar.formated.size, NULL, 8); 120 file_header->size = strtol(tar.formatted.size, NULL, 8);
121 file_header->mtime = strtol(tar.formated.mtime, NULL, 8); 121 file_header->mtime = strtol(tar.formatted.mtime, NULL, 8);
122 file_header->link_name = (tar.formated.linkname[0] != '\0') ? 122 file_header->link_name = (tar.formatted.linkname[0] != '\0') ?
123 bb_xstrdup(tar.formated.linkname) : NULL; 123 bb_xstrdup(tar.formatted.linkname) : NULL;
124 file_header->device = makedev(strtol(tar.formated.devmajor, NULL, 8), 124 file_header->device = makedev(strtol(tar.formatted.devmajor, NULL, 8),
125 strtol(tar.formated.devminor, NULL, 8)); 125 strtol(tar.formatted.devminor, NULL, 8));
126 126
127 /* Set bits 0-11 of the files mode */ 127 /* Set bits 0-11 of the files mode */
128 file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8); 128 file_header->mode = 07777 & strtol(tar.formatted.mode, NULL, 8);
129 129
130 /* Set bits 12-15 of the files mode */ 130 /* Set bits 12-15 of the files mode */
131 switch (tar.formated.typeflag) { 131 switch (tar.formatted.typeflag) {
132 /* busybox identifies hard links as being regular files with 0 size and a link name */ 132 /* busybox identifies hard links as being regular files with 0 size and a link name */
133 case '1': 133 case '1':
134 file_header->mode |= S_IFREG; 134 file_header->mode |= S_IFREG;
@@ -183,10 +183,10 @@ char get_header_tar(archive_handle_t *archive_handle)
183#endif 183#endif
184 case 'g': /* pax global header */ 184 case 'g': /* pax global header */
185 case 'x': /* pax extended header */ 185 case 'x': /* pax extended header */
186 bb_error_msg("Ignoring extension type %c", tar.formated.typeflag); 186 bb_error_msg("Ignoring extension type %c", tar.formatted.typeflag);
187 break; 187 break;
188 default: 188 default:
189 bb_error_msg("Unknown typeflag: 0x%x", tar.formated.typeflag); 189 bb_error_msg("Unknown typeflag: 0x%x", tar.formatted.typeflag);
190 } 190 }
191 { /* Strip trailing '/' in directories */ 191 { /* Strip trailing '/' in directories */
192 /* Must be done after mode is set as '/' is used to check if its a directory */ 192 /* Must be done after mode is set as '/' is used to check if its a directory */