diff options
author | Pierre Ossman <ossman@cendio.se> | 2020-05-19 21:07:05 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2020-05-21 11:34:22 +0200 |
commit | 186819080baea53410ae8d8100179a3874ac1e32 (patch) | |
tree | ddc4371f612a76114562f4a890a4c3ac3b3bfea6 /common/rdr/ZlibOutStream.cxx | |
parent | e9425ac04d70481f7cb168a19bcbc47728f838c7 (diff) | |
download | tigervnc-186819080baea53410ae8d8100179a3874ac1e32.tar.gz tigervnc-186819080baea53410ae8d8100179a3874ac1e32.zip |
Simplify stream availability handling
Just have a simply number of bytes argument to avoid a lot of
complexity.
Diffstat (limited to 'common/rdr/ZlibOutStream.cxx')
-rw-r--r-- | common/rdr/ZlibOutStream.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx index f102980a..78abfc49 100644 --- a/common/rdr/ZlibOutStream.cxx +++ b/common/rdr/ZlibOutStream.cxx @@ -98,18 +98,18 @@ void ZlibOutStream::flush() ptr = start; } -size_t ZlibOutStream::overrun(size_t itemSize, size_t nItems) +void ZlibOutStream::overrun(size_t needed) { #ifdef ZLIBOUT_DEBUG vlog.debug("overrun"); #endif - if (itemSize > bufSize) - throw Exception("ZlibOutStream overrun: max itemSize exceeded"); + if (needed > bufSize) + throw Exception("ZlibOutStream overrun: buffer size exceeded"); checkCompressionLevel(); - while (avail() < itemSize) { + while (avail() < needed) { zs->next_in = start; zs->avail_in = ptr - start; @@ -129,13 +129,6 @@ size_t ZlibOutStream::overrun(size_t itemSize, size_t nItems) ptr -= zs->next_in - start; } } - - size_t nAvail; - nAvail = avail() / itemSize; - if (nAvail < nItems) - return nAvail; - - return nItems; } void ZlibOutStream::deflate(int flush) |