comparison src/lib-index/mbox/mbox-index.c @ 87:18f0d0952a7d HEAD

fix
author Timo Sirainen <tss@iki.fi>
date Thu, 29 Aug 2002 00:46:30 +0300
parents 55e09f36d23d
children a6d7ed739926
comparison
equal deleted inserted replaced
86:73e79cf8f496 87:18f0d0952a7d
111 } 111 }
112 112
113 int mbox_skip_crlf(IOBuffer *inbuf) 113 int mbox_skip_crlf(IOBuffer *inbuf)
114 { 114 {
115 unsigned char *data; 115 unsigned char *data;
116 unsigned int size; 116 unsigned int size, pos;
117 117
118 while (io_buffer_read_data(inbuf, &data, &size, 1) >= 0) { 118 pos = 0;
119 if (size > 0) { 119 while (io_buffer_read_data(inbuf, &data, &size, pos) >= 0) {
120 if (size > 0 && pos == 0) {
120 if (data[0] == '\n') { 121 if (data[0] == '\n') {
121 io_buffer_skip(inbuf, 1); 122 io_buffer_skip(inbuf, 1);
122 return TRUE; 123 return TRUE;
123 } 124 }
124 if (data[0] != '\r') 125 if (data[0] != '\r')
125 return FALSE; 126 return FALSE;
126 127
127 if (size > 1) { 128 pos++;
128 if (data[1] != '\n') 129 }
129 return FALSE; 130 if (size > 1 && pos == 1) {
131 if (data[1] != '\n')
132 return FALSE;
130 133
131 io_buffer_skip(inbuf, 2); 134 io_buffer_skip(inbuf, 2);
132 return TRUE; 135 return TRUE;
133 }
134 } 136 }
135 } 137 }
136 138
137 /* end of file */ 139 /* end of file */
138 return TRUE; 140 return TRUE;