Skip to content

Commit

Permalink
Replaced i_stream_read_data() calls with _read_bytes and _read_more()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed May 16, 2016
1 parent 8ab4f24 commit 2c0aa0f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/lib-sieve-tool/mail-raw.c
Expand Up @@ -94,11 +94,11 @@ static struct istream *mail_raw_create_stream
input = i_stream_create_fd(fd, 4096, FALSE);
input->blocking = TRUE;
/* If input begins with a From-line, drop it */
ret = i_stream_read_data(input, &data, &size, 5);
if (ret > 0 && size >= 5 && memcmp(data, "From ", 5) == 0) {
ret = i_stream_read_bytes(input, &data, &size, 5);
if (ret > 0 && memcmp(data, "From ", 5) == 0) {
/* skip until the first LF */
i_stream_skip(input, 5);
while ( i_stream_read_data(input, &data, &size, 0) > 0 ) {
while ( i_stream_read_more(input, &data, &size) > 0 ) {
for (i = 0; i < size; i++) {
if (data[i] == '\n')
break;
Expand Down
2 changes: 1 addition & 1 deletion src/lib-sieve/sieve-message.c
Expand Up @@ -1580,7 +1580,7 @@ int sieve_message_body_get_raw
i_stream_skip(input, hdr_size.physical_size);

/* Read raw message body */
while ( (ret=i_stream_read_data(input, &data, &size, 0)) > 0 ) {
while ( (ret=i_stream_read_more(input, &data, &size)) > 0 ) {
buffer_append(buf, data, size);

i_stream_skip(input, size);
Expand Down
4 changes: 2 additions & 2 deletions src/lib-sieve/util/program-client-remote.c
Expand Up @@ -280,8 +280,8 @@ static int program_client_remote_disconnect
size_t size;

/* Skip any remaining program output and parse the exit code */
while ((ret = i_stream_read_data
(pclient->program_input, &data, &size, 0)) > 0) {
while ((ret = i_stream_read_more
(pclient->program_input, &data, &size)) > 0) {
i_stream_skip(pclient->program_input, size);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib-sieve/util/program-client.c
Expand Up @@ -244,7 +244,7 @@ static void program_client_program_input(struct program_client *pclient)
int ret = 0;

if ( input != NULL ) {
while ( (ret=i_stream_read_data(input, &data, &size, 0)) > 0 ) {
while ( (ret=i_stream_read_more(input, &data, &size)) > 0 ) {
if ( output != NULL ) {
ssize_t sent;

Expand Down
4 changes: 2 additions & 2 deletions src/managesieve-login/client-authenticate.c
Expand Up @@ -201,8 +201,8 @@ static int managesieve_client_auth_read_response
client->auth_response = str_new(default_pool, I_MAX(resp_size+1, 256));
}

while ( (ret=i_stream_read_data
(msieve_client->auth_response_input, &data, &size, 0) ) > 0 ) {
while ( (ret=i_stream_read_more
(msieve_client->auth_response_input, &data, &size) ) > 0 ) {

if (str_len(client->auth_response) + size > LOGIN_MAX_AUTH_BUF_SIZE) {
client_destroy(client, "Authentication response too large");
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/doveadm-sieve/doveadm-sieve-sync.c
Expand Up @@ -248,7 +248,7 @@ sieve_attribute_set_default(struct mail_storage *storage,
if (value->value != NULL) {
type = value->value[0];
} else if (value->value_stream != NULL) {
ret = i_stream_read_data(value->value_stream, &data, &size, 0);
ret = i_stream_read_more(value->value_stream, &data, &size);
if (ret == -1) {
mail_storage_set_critical(storage, "read(%s) failed: %m",
i_stream_get_name(value->value_stream));
Expand Down
2 changes: 1 addition & 1 deletion src/testsuite/cmd-test-message.c
Expand Up @@ -497,7 +497,7 @@ static int cmd_test_message_print_operation_execute
printf("\n--MESSAGE: \n");

/* Pipe the message to the outgoing SMTP transport */
while (i_stream_read_data(input, &data, &size, 0) > 0) {
while (i_stream_read_more(input, &data, &size) > 0) {
ssize_t wret;

if ( (wret=write(1, data, size)) <= 0 )
Expand Down

0 comments on commit 2c0aa0f

Please sign in to comment.