Fix broken buffered I/O (to make cjpeg work)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3678 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/jpeg/jdatadst.c b/common/jpeg/jdatadst.c
index a8f6fb0..b874815 100644
--- a/common/jpeg/jdatadst.c
+++ b/common/jpeg/jdatadst.c
@@ -82,8 +82,9 @@
{
my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
- if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
- (size_t) OUTPUT_BUF_SIZE)
+ if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE
+ - dest->pub.free_in_buffer) !=
+ (size_t) (OUTPUT_BUF_SIZE - dest->pub.free_in_buffer))
ERREXIT(cinfo, JERR_FILE_WRITE);
dest->pub.next_output_byte = dest->buffer;