aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2020-05-19 20:45:22 +0200
committerPierre Ossman <ossman@cendio.se>2020-05-21 11:34:22 +0200
commitb35ae29f932288b0529eb9eed21c31364a3489a4 (patch)
treed7c680494c170e6d9282dc51b2be1d05604f65ba /tests
parentdc38699af81e8bb953946000121f0a48cf30b962 (diff)
downloadtigervnc-b35ae29f932288b0529eb9eed21c31364a3489a4.tar.gz
tigervnc-b35ae29f932288b0529eb9eed21c31364a3489a4.zip
Add stream avail() methods
Makes it more readable to write code that needs to know how much data/space is available in a stream.
Diffstat (limited to 'tests')
-rw-r--r--tests/perf/decperf.cxx4
-rw-r--r--tests/perf/encperf.cxx4
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/perf/decperf.cxx b/tests/perf/decperf.cxx
index a6a50899..687ac7a9 100644
--- a/tests/perf/decperf.cxx
+++ b/tests/perf/decperf.cxx
@@ -102,8 +102,8 @@ void DummyOutStream::flush()
size_t DummyOutStream::overrun(size_t itemSize, size_t nItems)
{
flush();
- if (itemSize * nItems > (size_t)(end - ptr))
- nItems = (end - ptr) / itemSize;
+ if (itemSize * nItems > avail())
+ nItems = avail() / itemSize;
return nItems;
}
diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx
index 1b14151b..4665346f 100644
--- a/tests/perf/encperf.cxx
+++ b/tests/perf/encperf.cxx
@@ -159,8 +159,8 @@ void DummyOutStream::flush()
size_t DummyOutStream::overrun(size_t itemSize, size_t nItems)
{
flush();
- if (itemSize * nItems > (size_t)(end - ptr))
- nItems = (end - ptr) / itemSize;
+ if (itemSize * nItems > avail())
+ nItems = avail() / itemSize;
return nItems;
}