Add stream avail() methods

Makes it more readable to write code that needs to know how much
data/space is available in a stream.
This commit is contained in:
Pierre Ossman
2020-05-19 20:45:22 +02:00
committed by Lauri Kasanen
parent 910fd8fa3e
commit 7f90205cf2
13 changed files with 38 additions and 22 deletions

View File

@@ -85,7 +85,7 @@ JpegInitDestination(j_compress_ptr cinfo)
jc->clear();
dest->pub.next_output_byte = jc->getptr();
dest->pub.free_in_buffer = jc->getend() - jc->getptr();
dest->pub.free_in_buffer = jc->avail();
}
static boolean
@@ -97,7 +97,7 @@ JpegEmptyOutputBuffer(j_compress_ptr cinfo)
jc->setptr(jc->getend());
jc->overrun(jc->getend() - jc->getstart(), 1);
dest->pub.next_output_byte = jc->getptr();
dest->pub.free_in_buffer = jc->getend() - jc->getptr();
dest->pub.free_in_buffer = jc->avail();
return TRUE;
}