Commit 7ad5eabd 7ad5eabd928687d4f6a7139db79ad48ffb5a30a8 by Sergey Poznyakoff

(finish_stream): Set map.first if necessary

(burst_digest): Initialize eb_length
(burst_rename): Skip messages that do not need to be renamed.
(main): Do not process inplace if burst_count is 0
1 parent 7f45e402
...@@ -233,6 +233,8 @@ finish_stream (mu_stream_t *pstr) ...@@ -233,6 +233,8 @@ finish_stream (mu_stream_t *pstr)
233 mu_message_t msg; 233 mu_message_t msg;
234 mu_stream_seek (*pstr, 0, SEEK_SET); 234 mu_stream_seek (*pstr, 0, SEEK_SET);
235 msg = mh_stream_to_message (*pstr); 235 msg = mh_stream_to_message (*pstr);
236 if (!map.first)
237 mu_mailbox_uidnext (tmpbox, &map.first);
236 burst_or_copy (msg, recursive, 1); 238 burst_or_copy (msg, recursive, 1);
237 mu_stream_close (*pstr); 239 mu_stream_close (*pstr);
238 mu_stream_destroy (pstr, mu_stream_get_owner (*pstr)); 240 mu_stream_destroy (pstr, mu_stream_get_owner (*pstr));
...@@ -271,7 +273,7 @@ burst_digest (mu_message_t msg) ...@@ -271,7 +273,7 @@ burst_digest (mu_message_t msg)
271 size_t n; 273 size_t n;
272 int state = S1; 274 int state = S1;
273 size_t count = 0; 275 size_t count = 0;
274 int eb_length; 276 int eb_length = 0;
275 277
276 mu_message_size (msg, &bufsize); 278 mu_message_size (msg, &bufsize);
277 279
...@@ -461,6 +463,9 @@ burst_rename (mh_msgset_t *ms, size_t lastuid) ...@@ -461,6 +463,9 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
461 j--; 463 j--;
462 } 464 }
463 465
466 if (ms->list[i-1] == lastuid)
467 continue;
468
464 asprintf (&from, "%lu", (unsigned long) ms->list[i-1]); 469 asprintf (&from, "%lu", (unsigned long) ms->list[i-1]);
465 asprintf (&to, "%lu", (unsigned long) lastuid); 470 asprintf (&to, "%lu", (unsigned long) lastuid);
466 --lastuid; 471 --lastuid;
...@@ -588,7 +593,7 @@ main (int argc, char **argv) ...@@ -588,7 +593,7 @@ main (int argc, char **argv)
588 if (rc) 593 if (rc)
589 return rc; 594 return rc;
590 595
591 if (inplace) 596 if (inplace && burst_count)
592 { 597 {
593 mu_url_t dst_url = NULL; 598 mu_url_t dst_url = NULL;
594 size_t i, next_uid, last_uid; 599 size_t i, next_uid, last_uid;
......