archive/bzip2: make variables more local
This commit is contained in:
parent
db46d84458
commit
990f631cbc
@ -141,16 +141,13 @@ Bzip2InputStream::Read(void *ptr, size_t length)
|
|||||||
|
|
||||||
const ScopeUnlock unlock(mutex);
|
const ScopeUnlock unlock(mutex);
|
||||||
|
|
||||||
int bz_result;
|
|
||||||
size_t nbytes = 0;
|
|
||||||
|
|
||||||
bzstream.next_out = (char *)ptr;
|
bzstream.next_out = (char *)ptr;
|
||||||
bzstream.avail_out = length;
|
bzstream.avail_out = length;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const bool had_input = FillBuffer();
|
const bool had_input = FillBuffer();
|
||||||
|
|
||||||
bz_result = BZ2_bzDecompress(&bzstream);
|
const int bz_result = BZ2_bzDecompress(&bzstream);
|
||||||
|
|
||||||
if (bz_result == BZ_STREAM_END) {
|
if (bz_result == BZ_STREAM_END) {
|
||||||
eof = true;
|
eof = true;
|
||||||
@ -164,7 +161,7 @@ Bzip2InputStream::Read(void *ptr, size_t length)
|
|||||||
throw std::runtime_error("Unexpected end of bzip2 file");
|
throw std::runtime_error("Unexpected end of bzip2 file");
|
||||||
} while (bzstream.avail_out == length);
|
} while (bzstream.avail_out == length);
|
||||||
|
|
||||||
nbytes = length - bzstream.avail_out;
|
const size_t nbytes = length - bzstream.avail_out;
|
||||||
offset += nbytes;
|
offset += nbytes;
|
||||||
|
|
||||||
return nbytes;
|
return nbytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user