*has_nuls_r = FALSE;
missing_cr_count = 0; startpos = 0;
- while (i_stream_read_bytes(input, &msg, &size, startpos + 1) > 0) {
+ while ((ret = i_stream_read_bytes(input, &msg, &size, startpos + 1)) > 0) {
for (i = startpos; i < size; i++) {
if (msg[i] != '\n') {
if (msg[i] == '\0')
hdr->physical_size += i - startpos;
}
+ i_assert(ret == -1 || ret > 0);
+
ret = input->stream_errno != 0 ? -1 : 0;
i_stream_skip(input, startpos);
hdr->physical_size += startpos;
*has_nuls_r = FALSE;
missing_cr_count = 0;
- if ((ret = i_stream_read_more(input, &msg, &size)) <= 0)
+ if ((ret = i_stream_read_more(input, &msg, &size)) <= 0) {
+ i_assert(ret == -1);
return ret < 0 && input->stream_errno != 0 ? -1 : 0;
+ }
if (msg[0] == '\n')
missing_cr_count++;
/* leave the last character, it may be \r */
i_stream_skip(input, i - 1);
body->physical_size += i - 1;
- } while (i_stream_read_bytes(input, &msg, &size, 2) > 0);
+ } while ((ret = i_stream_read_bytes(input, &msg, &size, 2)) > 0);
+ i_assert(ret == -1);
ret = input->stream_errno != 0 ? -1 : 0;