bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
e2ce8d4a6ac5d82a906178148453e7613fab9ba0Timo Sirainenstatic void o_stream_cmp_close(struct iostream_private *stream,
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen struct cmp_ostream *cstream = (struct cmp_ostream *)stream;
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen while (size > 0) {
534e41e436a7546f36f61e0dc49c0c191d850f6bPhil Carmody (void)i_stream_read_bytes(input, &indata, &insize, size);
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen if (insize == 0 || memcmp(data, indata, max) != 0)
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Siraineno_stream_cmp_sendv(struct ostream_private *stream,
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen const struct const_iovec *iov, unsigned int iov_count)
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen struct cmp_ostream *cstream = (struct cmp_ostream *)stream;
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen unsigned int i;
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen for (i = 0; i < iov_count; i++) {
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen if (!stream_cmp_block(cstream->input, iov[i].iov_base,
e3678f7bfba87b5aa1446a1a7b9928272b4f72a3Timo Sirainen if ((ret = o_stream_sendv(stream->parent, iov, iov_count)) < 0) {
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Siraineno_stream_create_cmp(struct ostream *output, struct istream *input)
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen cstream->ostream.iostream.close = o_stream_cmp_close;
8b247780e911909a9fdc47f69ce6d1478902ad98Timo Sirainen return o_stream_create(&cstream->ostream, output,