Commit 012c66dd 012c66ddbbf4c852f2f26e1c075e7ddb808559c1 by Sergey Poznyakoff

Minor change

* libmailutils/mime/mime.c: Fix formatting
1 parent 447719f6
...@@ -244,8 +244,7 @@ _mime_append_header_line (mu_mime_t mime) ...@@ -244,8 +244,7 @@ _mime_append_header_line (mu_mime_t mime)
244 { 244 {
245 char *nhb; 245 char *nhb;
246 246
247 if ((nhb = 247 if ((nhb = realloc (mime->header_buf,
248 realloc (mime->header_buf,
249 mime->header_length + mime->line_ndx + 128)) == NULL) 248 mime->header_length + mime->line_ndx + 128)) == NULL)
250 return; 249 return;
251 mime->header_buf = nhb; 250 mime->header_buf = nhb;
...@@ -271,8 +270,8 @@ _mime_parse_mpart_message (mu_mime_t mime) ...@@ -271,8 +270,8 @@ _mime_parse_mpart_message (mu_mime_t mime)
271 270
272 if ((ret = _mime_setup_buffers (mime)) != 0) 271 if ((ret = _mime_setup_buffers (mime)) != 0)
273 return ret; 272 return ret;
274 if ((boundary = 273 if ((boundary = _mime_get_param (mime->content_type, "boundary", &len))
275 _mime_get_param (mime->content_type, "boundary", &len)) == NULL) 274 == NULL)
276 return EINVAL; 275 return EINVAL;
277 if ((mime->boundary = calloc (1, len + 1)) == NULL) 276 if ((mime->boundary = calloc (1, len + 1)) == NULL)
278 return ENOMEM; 277 return ENOMEM;
...@@ -289,8 +288,7 @@ _mime_parse_mpart_message (mu_mime_t mime) ...@@ -289,8 +288,7 @@ _mime_parse_mpart_message (mu_mime_t mime)
289 blength = strlen (mime->boundary); 288 blength = strlen (mime->boundary);
290 289
291 mu_stream_seek (mime->stream, mime->cur_offset, MU_SEEK_SET, NULL); 290 mu_stream_seek (mime->stream, mime->cur_offset, MU_SEEK_SET, NULL);
292 while ((ret = 291 while ((ret = mu_stream_read (mime->stream, mime->cur_buf, mime->buf_size,
293 mu_stream_read (mime->stream, mime->cur_buf, mime->buf_size,
294 &nbytes)) == 0 && nbytes) 292 &nbytes)) == 0 && nbytes)
295 { 293 {
296 cp = mime->cur_buf; 294 cp = mime->cur_buf;
...@@ -308,9 +306,8 @@ _mime_parse_mpart_message (mu_mime_t mime) ...@@ -308,9 +306,8 @@ _mime_parse_mpart_message (mu_mime_t mime)
308 break; 306 break;
309 307
310 case MIME_STATE_SCAN_BOUNDARY: 308 case MIME_STATE_SCAN_BOUNDARY:
311 cp2 = 309 cp2 = mime->cur_line[0] == '\n'
312 mime->cur_line[0] == 310 ? mime->cur_line + 1 : mime->cur_line;
313 '\n' ? mime->cur_line + 1 : mime->cur_line;
314 if (mime->line_ndx >= blength) 311 if (mime->line_ndx >= blength)
315 { 312 {
316 if ((!strncmp (cp2, "--", 2) 313 if ((!strncmp (cp2, "--", 2)
...@@ -657,7 +654,8 @@ _mime_body_stream_seek (mu_stream_t stream, mu_off_t off, mu_off_t *presult) ...@@ -657,7 +654,8 @@ _mime_body_stream_seek (mu_stream_t stream, mu_off_t off, mu_off_t *presult)
657 while (0) 654 while (0)
658 655
659 static int 656 static int
660 _mime_body_stream_read (mu_stream_t stream, char *buf, size_t buflen, size_t *nbytes) 657 _mime_body_stream_read (mu_stream_t stream, char *buf, size_t buflen,
658 size_t *nbytes)
661 { 659 {
662 struct _mime_body_stream *mstr = (struct _mime_body_stream *)stream; 660 struct _mime_body_stream *mstr = (struct _mime_body_stream *)stream;
663 mu_mime_t mime = mstr->mime; 661 mu_mime_t mime = mstr->mime;
...@@ -898,8 +896,7 @@ mu_mime_create (mu_mime_t *pmime, mu_message_t msg, int flags) ...@@ -898,8 +896,7 @@ mu_mime_create (mu_mime_t *pmime, mu_message_t msg, int flags)
898 { 896 {
899 if ((ret = mu_message_get_header (msg, &mime->hdrs)) == 0) 897 if ((ret = mu_message_get_header (msg, &mime->hdrs)) == 0)
900 { 898 {
901 if ((ret = 899 if ((ret = mu_header_get_value (mime->hdrs,
902 mu_header_get_value (mime->hdrs,
903 MU_HEADER_CONTENT_TYPE, 900 MU_HEADER_CONTENT_TYPE,
904 NULL, 0, &size)) == 0 && size) 901 NULL, 0, &size)) == 0 && size)
905 { 902 {
...@@ -1039,7 +1036,8 @@ mu_mime_get_part (mu_mime_t mime, size_t part, mu_message_t *msg) ...@@ -1039,7 +1036,8 @@ mu_mime_get_part (mu_mime_t mime, size_t part, mu_message_t *msg)
1039 if (ret == 0) 1036 if (ret == 0)
1040 { 1037 {
1041 mu_stream_set_flags (stream, 1038 mu_stream_set_flags (stream,
1042 MU_STREAM_READ | (flags & 1039 MU_STREAM_READ
1040 | (flags &
1043 (MU_STREAM_SEEK 1041 (MU_STREAM_SEEK
1044 | MU_STREAM_NONBLOCK))); 1042 | MU_STREAM_NONBLOCK)));
1045 mu_body_set_stream (body, stream, mime_part->msg); 1043 mu_body_set_stream (body, stream, mime_part->msg);
......