static int data_fd = -1;
static uschar *spool_name = US"";
static int data_fd = -1;
static uschar *spool_name = US"";
+enum CH_STATE {LF_SEEN, MID_LINE, CR_SEEN};
/*************************************************
/*************************************************
static int
read_message_bdat_smtp(FILE *fout)
{
static int
read_message_bdat_smtp(FILE *fout)
{
-int ch_state = 0, linelength = 0, ch;
+int linelength = 0, ch;
+enum CH_STATE ch_state = LF_SEEN;
- case 0: /* After LF or CRLF */
- ch_state = 1;
+ case LF_SEEN: /* After LF or CRLF */
+ ch_state = MID_LINE;
/* fall through to handle as normal uschar. */
/* fall through to handle as normal uschar. */
- case 1: /* Mid-line state */
+ case MID_LINE: /* Mid-line state */
body_linecount++;
if (linelength > max_received_linelength)
max_received_linelength = linelength;
body_linecount++;
if (linelength > max_received_linelength)
max_received_linelength = linelength;
continue; /* don't write CR */
}
break;
continue; /* don't write CR */
}
break;
- case 2: /* After (unwritten) CR */
+ case CR_SEEN: /* After (unwritten) CR */
body_linecount++;
if (linelength > max_received_linelength)
max_received_linelength = linelength;
linelength = -1;
if (ch == '\n')
body_linecount++;
if (linelength > max_received_linelength)
max_received_linelength = linelength;
linelength = -1;
if (ch == '\n')
else
{
message_size++;
if (fout != NULL && fputc('\n', fout) == EOF) return END_WERROR;
(void) cutthrough_put_nl();
if (ch == '\r') continue; /* don't write CR */
else
{
message_size++;
if (fout != NULL && fputc('\n', fout) == EOF) return END_WERROR;
(void) cutthrough_put_nl();
if (ch == '\r') continue; /* don't write CR */