diff options
author | Max Kellermann <max@musicpd.org> | 2020-09-04 18:02:05 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-09-04 18:02:22 +0200 |
commit | 990f631cbcdab3a611fb4d90fbf8a06f5c5c1183 (patch) | |
tree | f1ca42d07a2a44618931d7059e6114f5291cd610 /src/archive | |
parent | db46d84458be54fedd89613f881ffe6181bdb03e (diff) |
archive/bzip2: make variables more local
Diffstat (limited to 'src/archive')
-rw-r--r-- | src/archive/plugins/Bzip2ArchivePlugin.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/archive/plugins/Bzip2ArchivePlugin.cxx b/src/archive/plugins/Bzip2ArchivePlugin.cxx index 8e7ebab2c..bedb5c54a 100644 --- a/src/archive/plugins/Bzip2ArchivePlugin.cxx +++ b/src/archive/plugins/Bzip2ArchivePlugin.cxx @@ -141,16 +141,13 @@ Bzip2InputStream::Read(void *ptr, size_t length) const ScopeUnlock unlock(mutex); - int bz_result; - size_t nbytes = 0; - bzstream.next_out = (char *)ptr; bzstream.avail_out = length; do { const bool had_input = FillBuffer(); - bz_result = BZ2_bzDecompress(&bzstream); + const int bz_result = BZ2_bzDecompress(&bzstream); if (bz_result == BZ_STREAM_END) { eof = true; @@ -164,7 +161,7 @@ Bzip2InputStream::Read(void *ptr, size_t length) throw std::runtime_error("Unexpected end of bzip2 file"); } while (bzstream.avail_out == length); - nbytes = length - bzstream.avail_out; + const size_t nbytes = length - bzstream.avail_out; offset += nbytes; return nbytes; |