istream-crlf.c revision b52ab39e0900187a1b0d675922a8c91766373fb7
/* Copyright (c) 2007-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream-internal.h"
#include "istream-crlf.h"
struct crlf_istream {
struct istream_private istream;
unsigned int pending_cr:1;
unsigned int last_cr:1;
};
{
}
static void
{
}
{
const unsigned char *data;
if (size == 0) {
return ret;
}
}
return -2;
return 1;
}
{
const unsigned char *data;
if (ret <= 0)
return ret;
/* @UNSAFE: add missing CRs */
if (data[i] == '\n') {
if (i == 0) {
} else {
}
break;
}
}
return ret;
}
{
const unsigned char *data;
int diff;
if (ret <= 0)
return ret;
/* @UNSAFE */
if (data[0] == '\n') {
} else {
if (cstream->pending_cr) {
/* CR without LF */
return 1;
}
}
if (data[0] != '\r')
}
diff = -1;
if (data[i] == '\r') {
continue;
diff = 0;
break;
}
}
}
if (ret == 0) {
return i_stream_crlf_read_lf(stream);
}
return ret;
}
static void
{
i_panic("crlf-istream: seeking unsupported currently");
(void)i_stream_crlf_read_crlf(stream);
if (available == 0) {
return;
}
else {
}
}
}
static const struct stat *
{
}
static struct istream *
{
struct crlf_istream *cstream;
}
{
}
{
}