From: Timo Sirainen Date: Mon, 30 Oct 2017 14:06:39 +0000 (+0200) Subject: global: Rename i_stream_is_eof() to i_stream_read_eof() X-Git-Tag: 2.3.0.rc1~690 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bc075e2e4ed422f9590c95c3ae223422b97ce6a;p=thirdparty%2Fdovecot%2Fcore.git global: Rename i_stream_is_eof() to i_stream_read_eof() This describes its behavior a bit better. --- diff --git a/src/lib-compression/istream-zlib.c b/src/lib-compression/istream-zlib.c index 63c8f2630d..5f68d75d27 100644 --- a/src/lib-compression/istream-zlib.c +++ b/src/lib-compression/istream-zlib.c @@ -183,7 +183,7 @@ static ssize_t i_stream_zlib_read(struct istream_private *stream) if (ret <= 0) return ret; } - if (!zstream->gz || i_stream_is_eof(stream->parent)) { + if (!zstream->gz || i_stream_read_eof(stream->parent)) { stream->istream.eof = TRUE; return -1; } diff --git a/src/lib-fs/fs-sis.c b/src/lib-fs/fs-sis.c index 5e2d431df3..93eb9863fc 100644 --- a/src/lib-fs/fs-sis.c +++ b/src/lib-fs/fs-sis.c @@ -243,7 +243,7 @@ static int fs_sis_write(struct fs_file *_file, const void *data, size_t size) if (file->hash_input != NULL && stream_cmp_block(file->hash_input, data, size) && - i_stream_is_eof(file->hash_input)) { + i_stream_read_eof(file->hash_input)) { /* try to use existing file */ if (fs_sis_try_link(file)) return 0; @@ -293,7 +293,7 @@ static int fs_sis_write_stream_finish(struct fs_file *_file, bool success) if (file->hash_input != NULL && o_stream_cmp_equals(_file->output) && - i_stream_is_eof(file->hash_input)) { + i_stream_read_eof(file->hash_input)) { o_stream_unref(&_file->output); if (fs_sis_try_link(file)) { fs_write_stream_abort_parent(_file, &file->fs_output); diff --git a/src/lib-http/http-server-request.c b/src/lib-http/http-server-request.c index 1763528afb..6e6522fdc8 100644 --- a/src/lib-http/http-server-request.c +++ b/src/lib-http/http-server-request.c @@ -680,7 +680,7 @@ payload_handler_pump_callback(bool success, struct ostream *output = iostream_pump_get_output(phandler->pump); if (success) { - if (!i_stream_is_eof(conn->incoming_payload)) { + if (!i_stream_read_eof(conn->incoming_payload)) { http_server_request_fail_close(req, 413, "Payload Too Large"); } else { diff --git a/src/lib-oauth2/oauth2.c b/src/lib-oauth2/oauth2.c index 760f8a7c76..d644235611 100644 --- a/src/lib-oauth2/oauth2.c +++ b/src/lib-oauth2/oauth2.c @@ -49,7 +49,7 @@ oauth2_parse_json(struct oauth2_request *req) (void)json_parser_deinit(&req->parser, &error); error = "Invalid response data"; success = FALSE; - } else if (i_stream_is_eof(req->is) && + } else if (i_stream_read_eof(req->is) && req->is->v_offset == 0 && req->is->stream_errno == 0) { /* discard error, empty response is OK. */ (void)json_parser_deinit(&req->parser, &error); diff --git a/src/lib-program-client/program-client.c b/src/lib-program-client/program-client.c index f2143c32f3..09dfdb382a 100644 --- a/src/lib-program-client/program-client.c +++ b/src/lib-program-client/program-client.c @@ -186,7 +186,7 @@ bool program_client_input_pending(struct program_client *pclient) if (pclient->program_input != NULL && !pclient->program_input->closed && - !i_stream_is_eof(pclient->program_input)) { + !i_stream_read_eof(pclient->program_input)) { return TRUE; } @@ -195,7 +195,7 @@ bool program_client_input_pending(struct program_client *pclient) for(i = 0; i < count; i++) { if (efds[i].input != NULL && !efds[i].input->closed && - !i_stream_is_eof(efds[i].input)) { + !i_stream_read_eof(efds[i].input)) { return TRUE; } } @@ -389,7 +389,7 @@ void program_client_extra_fd_input(struct program_client_extra_fd *efd) i_assert(efd->callback != NULL); efd->callback(efd->context, efd->input); - if (efd->input->closed || i_stream_is_eof(efd->input)) { + if (efd->input->closed || i_stream_read_eof(efd->input)) { if (!program_client_input_pending(pclient)) program_client_disconnect(pclient, FALSE); } diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index 0b3aed167e..ffedcc4cad 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -454,7 +454,7 @@ int dbox_file_seek_next(struct dbox_file *file, uoff_t *offset_r, bool *last_r) *offset_r = file->cur_offset; return ret; } - if (i_stream_is_eof(file->input)) { + if (i_stream_read_eof(file->input)) { *last_r = TRUE; return 0; } diff --git a/src/lib-storage/index/dbox-multi/mdbox-purge.c b/src/lib-storage/index/dbox-multi/mdbox-purge.c index 704d855f5a..2c78084dd0 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-purge.c +++ b/src/lib-storage/index/dbox-multi/mdbox-purge.c @@ -215,7 +215,7 @@ mdbox_purge_save_msg(struct mdbox_purge_context *ctx, struct dbox_file *file, ret = -1; } else if (input->v_offset != msg_size) { i_assert(input->v_offset < msg_size); - i_assert(i_stream_is_eof(file->input)); + i_assert(i_stream_read_eof(file->input)); dbox_file_set_corrupted(file, "truncated message at EOF"); ret = 0; diff --git a/src/lib-storage/index/index-mail-binary.c b/src/lib-storage/index/index-mail-binary.c index 9533a470ad..11150d8a75 100644 --- a/src/lib-storage/index/index-mail-binary.c +++ b/src/lib-storage/index/index-mail-binary.c @@ -342,7 +342,7 @@ blocks_count_lines(struct binary_ctx *ctx, struct istream *full_input) if (cur_block->input->eof) { /* go to the next block */ if (++block_idx == block_count) { - i_assert(i_stream_is_eof(full_input)); + i_assert(i_stream_read_eof(full_input)); ret = -1; break; } diff --git a/src/lib/istream.c b/src/lib/istream.c index cb904f5bad..9665cbc3f7 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -393,7 +393,7 @@ bool i_stream_have_bytes_left(struct istream *stream) return i_stream_get_data_size(stream) > 0 || !stream->eof; } -bool i_stream_is_eof(struct istream *stream) +bool i_stream_read_eof(struct istream *stream) { if (i_stream_get_data_size(stream) == 0) (void)i_stream_read(stream); diff --git a/src/lib/istream.h b/src/lib/istream.h index 1efffd9472..a279688d9a 100644 --- a/src/lib/istream.h +++ b/src/lib/istream.h @@ -169,7 +169,7 @@ bool i_stream_have_bytes_left(struct istream *stream); returns EOF/error. Usually it's enough to check for stream->eof instead of calling this function. Note that if the stream isn't at EOF, this function has now read data into the stream buffer. */ -bool i_stream_is_eof(struct istream *stream); +bool i_stream_read_eof(struct istream *stream); /* Returns the absolute offset of the stream. This is the stream's current v_offset + the parent's absolute offset when the stream was created. */ uoff_t i_stream_get_absolute_offset(struct istream *stream);