diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-10-19 14:51:12 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-10-19 14:51:12 +0200 |
commit | f74f280a14f9b79a25e2ba29bab7a3056c94e647 (patch) | |
tree | ed0facddeabacbb8f07e3cc3b058c11db9db1874 /archival | |
parent | 9c28fb8d288cb9b64d364d278731a20cc56fc29c (diff) | |
download | busybox-w32-f74f280a14f9b79a25e2ba29bab7a3056c94e647.tar.gz busybox-w32-f74f280a14f9b79a25e2ba29bab7a3056c94e647.tar.bz2 busybox-w32-f74f280a14f9b79a25e2ba29bab7a3056c94e647.zip |
get_header_tar: shrink 6->64 sign extension code
function old new delta
getOctal 125 107 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libarchive/get_header_tar.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index 41e3efb50..a63c0fb01 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c | |||
@@ -79,10 +79,10 @@ static unsigned long long getOctal(char *str, int len) | |||
79 | * | 79 | * |
80 | * NB: tarballs with NEGATIVE unix times encoded that way were seen! | 80 | * NB: tarballs with NEGATIVE unix times encoded that way were seen! |
81 | */ | 81 | */ |
82 | v = first; | 82 | /* Sign-extend 7bit 'first' to 64bit 'v' (that is, using 6th bit as sign): */ |
83 | /* Sign-extend using 6th bit: */ | 83 | first <<= 1; |
84 | v <<= sizeof(unsigned long long)*8 - 7; | 84 | first >>= 1; /* now 7th bit = 6th bit */ |
85 | v = (long long)v >> (sizeof(unsigned long long)*8 - 7); | 85 | v = first; /* sign-extend 8 bits to 64 */ |
86 | while (--len != 0) | 86 | while (--len != 0) |
87 | v = (v << 8) + (unsigned char) *str++; | 87 | v = (v << 8) + (unsigned char) *str++; |
88 | } | 88 | } |