diff options
-rw-r--r-- | src/ustar.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/ustar.c b/src/ustar.c index 416bb2f..43292e9 100644 --- a/src/ustar.c +++ b/src/ustar.c @@ -29,29 +29,29 @@ #define OPKG_OPK_USTAR_NUM_BASE_ 8 struct _opkg_opk_ustar_header { - unsigned char name [100]; - unsigned char mode [8]; - unsigned char uid [8]; - unsigned char gid [8]; - unsigned char size [12]; - unsigned char mtime [12]; - unsigned char chksum [8]; - unsigned char typeflag [1]; - unsigned char linkname [100]; - unsigned char magic [6]; - unsigned char version [2]; - unsigned char uname [32]; - unsigned char gname [32]; - unsigned char devmajor [8]; - unsigned char devminor [8]; - unsigned char prefix [155]; - unsigned char padding [12]; + char name [100]; + char mode [8]; + char uid [8]; + char gid [8]; + char size [12]; + char mtime [12]; + char chksum [8]; + char typeflag [1]; + char linkname [100]; + char magic [6]; + char version [2]; + char uname [32]; + char gname [32]; + char devmajor [8]; + char devminor [8]; + char prefix [155]; + char padding [12]; } __attribute__((__packed__)); struct opkg_opk_ustar { struct opkg_opk_gzip *gzip; uint64_t data_size_remaining; - unsigned char read_record[OPKG_OPK_USTAR_RECORD_SIZE]; + char read_record[OPKG_OPK_USTAR_RECORD_SIZE]; }; struct opkg_opk_ustar * @@ -74,12 +74,12 @@ static int _opkg_opk_ustar_next(struct opkg_opk_ustar *ustar, struct _opkg_opk_ustar_header *header) { - static unsigned char record[OPKG_OPK_USTAR_RECORD_SIZE]; - char *end; - uint32_t chksum_got; - uint32_t chksum_exp; - size_t i; - unsigned char *header_uc; + static char record[OPKG_OPK_USTAR_RECORD_SIZE]; + char *end; + uint32_t chksum_got; + uint32_t chksum_exp; + size_t i; + char *header_uc; switch (opkg_opk_gzip_read(ustar->gzip, header)) { case OPKG_OPK_OK: @@ -97,7 +97,7 @@ _opkg_opk_ustar_next(struct opkg_opk_ustar *ustar, return OPKG_OPK_ERROR; } - chksum_got = strtol((char *) header->chksum, &end, + chksum_got = strtol(header->chksum, &end, OPKG_OPK_USTAR_NUM_BASE_); chksum_exp = 0; if (*end != '\0') { @@ -106,7 +106,7 @@ _opkg_opk_ustar_next(struct opkg_opk_ustar *ustar, for (i = 0; i < sizeof(header->chksum); ++i) { header->chksum[i] = ' '; } - header_uc = (unsigned char *) header; + header_uc = (char *) header; for (i = 0; i < OPKG_OPK_USTAR_RECORD_SIZE; ++i) { chksum_exp += header_uc[i]; } @@ -118,7 +118,7 @@ _opkg_opk_ustar_next(struct opkg_opk_ustar *ustar, case '0': /* Regular file */ case '7': /* High-performance or regular file */ ustar->data_size_remaining = strtol( - (char *) header->size, &end, + header->size, &end, OPKG_OPK_USTAR_NUM_BASE_); if (*end != '\0') { return OPKG_OPK_ERROR; @@ -162,14 +162,14 @@ opkg_opk_ustar_list(struct opkg_opk_ustar *ustar, memcpy((*member)->name, header.name, sizeof(header.name)); (*member)->name[sizeof(header.name)] = '\0'; } - (*member)->mode = strtol((char *) header.mode, &end, + (*member)->mode = strtol(header.mode, &end, OPKG_OPK_USTAR_NUM_BASE_); if (*end != '\0') { free(*member); return OPKG_OPK_ERROR; } (*member)->size = ustar->data_size_remaining; - (*member)->mtime = strtol((char *) header.mtime, &end, + (*member)->mtime = strtol(header.mtime, &end, OPKG_OPK_USTAR_NUM_BASE_); if (*end != '\0') { free(*member); @@ -219,7 +219,7 @@ int opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, int num_keys, ...) { static struct _opkg_opk_ustar_header header; - static unsigned char name[OPKG_OPK_USTAR_NAME_MAX_LEN]; + static char name[OPKG_OPK_USTAR_NAME_MAX_LEN]; va_list ap; int key; const char *member; @@ -230,7 +230,7 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, int num_keys, ...) } if (header.prefix[0] != '\0') { - sprintf((char *) name, "%s/%s", header.prefix, + sprintf(name, "%s/%s", header.prefix, header.name); } else { memcpy(name, header.name, sizeof(header.name)); @@ -240,7 +240,7 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, int num_keys, ...) va_start(ap, num_keys); for (key = 0; key < num_keys; ++key) { member = va_arg(ap, const char *); - if (strcmp((char *) name, member) == 0) { + if (strcmp(name, member) == 0) { return OPKG_OPK_OK; /* Member found */ } } |