Commit 990f631c authored by Max Kellermann's avatar Max Kellermann

archive/bzip2: make variables more local

parent db46d844
...@@ -141,16 +141,13 @@ Bzip2InputStream::Read(void *ptr, size_t length) ...@@ -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) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment