X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mbox.c;h=618fbdf672ccad0dfb73689c19500371595abd28;hp=5f76334032d67b348f77e01656105518a4a4c76b;hb=c65e926c6633e7247003bfc8e484a9a2179a5497;hpb=dbacadf0ce81052365d7a43373ac7d4ac67ff91e diff --git a/mbox.c b/mbox.c index 5f76334..618fbdf 100644 --- a/mbox.c +++ b/mbox.c @@ -26,7 +26,6 @@ #include #include #include -#include #include @@ -132,7 +131,6 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL) { /* TODO: memory leak??? */ - debug_print (1, ("unexpected EOF\n")); break; } @@ -140,7 +138,6 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) if (!is_from (buf, return_path, sizeof (return_path), &t)) { if (fseeko (ctx->fp, loc, SEEK_SET) != 0) { - debug_print (1, ("fseeko() failed\n")); mutt_error _("Mailbox is corrupt!"); return (-1); @@ -160,8 +157,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 || fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL || m_strcmp(MMDF_SEP, buf) != 0) { - if (fseeko (ctx->fp, loc, SEEK_SET) != 0) - debug_print (1, ("fseeko() failed\n")); + fseeko (ctx->fp, loc, SEEK_SET); hdr->content->length = -1; } } @@ -194,7 +190,6 @@ static int mmdf_parse_mailbox (CONTEXT * ctx) ctx->msgcount++; } else { - debug_print (1, ("corrupt mailbox!\n")); mutt_error _("Mailbox is corrupt!"); return (-1); @@ -288,12 +283,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx) if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 || fgets (buf, sizeof (buf), ctx->fp) == NULL || m_strncmp("From ", buf, 5) != 0) { - debug_print (1, ("bad content-length in message %d (cl=%zd)\n", - curhdr->index, curhdr->content->length)); - debug_print (1, ("LINE: %s\n", buf)); - if (fseeko (ctx->fp, loc, SEEK_SET) != 0) { /* nope, return the previous position */ - debug_print (1, ("fseeko() failed\n")); - } + fseeko (ctx->fp, loc, SEEK_SET); /* nope, return the previous position */ curhdr->content->length = -1; } } @@ -312,8 +302,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx) int cl = curhdr->content->length; /* count the number of lines in this message */ - if (fseeko (ctx->fp, loc, SEEK_SET) != 0) - debug_print (1, ("fseeko() failed\n")); + fseeko (ctx->fp, loc, SEEK_SET); while (cl-- > 0) { if (fgetc (ctx->fp) == '\n') curhdr->lines++; @@ -321,8 +310,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx) } /* return to the offset of the next message separator */ - if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0) - debug_print (1, ("fseeko() failed\n")); + fseeko(ctx->fp, tmploc, SEEK_SET); } } @@ -441,13 +429,11 @@ static int _mbox_check_mailbox (CONTEXT * ctx, int *index_hint) * see the message separator at *exactly* what used to be the end of the * folder. */ - if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0) - debug_print (1, ("fseeko() failed\n")); + fseeko (ctx->fp, ctx->size, SEEK_SET); if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL) { if ((ctx->magic == M_MBOX && m_strncmp("From ", buffer, 5) == 0) || (ctx->magic == M_MMDF && m_strcmp(MMDF_SEP, buffer) == 0)) { - if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0) - debug_print (1, ("fseeko() failed\n")); + fseeko (ctx->fp, ctx->size, SEEK_SET); if (ctx->magic == M_MBOX) mbox_parse_mailbox (ctx); else @@ -467,14 +453,12 @@ static int _mbox_check_mailbox (CONTEXT * ctx, int *index_hint) } else modified = 1; - } - else { - debug_print (1, ("fgets returned NULL.\n")); + } else { modified = 1; } - } - else + } else { modified = 1; + } } if (modified) { @@ -603,7 +587,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused) mutt_error _("sync: mbox modified, but no modified messages! (report this bug)"); mutt_sleep (5); /* the mutt_error /will/ get cleared! */ - debug_print (1, ("no modified messages.\n")); unlink (tempfile); goto bail; } @@ -698,7 +681,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused) if (fclose (fp) != 0) { fp = NULL; - debug_print (1, ("fclose() returned non-zero.\n")); unlink (tempfile); mutt_perror (tempfile); mutt_sleep (5); @@ -717,7 +699,6 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused) if ((fp = fopen (tempfile, "r")) == NULL) { mutt_unblock_signals (); mx_fastclose_mailbox (ctx); - debug_print (1, ("unable to reopen temp copy of mailbox!\n")); mutt_perror (tempfile); mutt_sleep (5); return (-1); @@ -728,16 +709,12 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused) fgets (buf, sizeof (buf), ctx->fp) == NULL || (ctx->magic == M_MBOX && m_strncmp("From ", buf, 5) != 0) || (ctx->magic == M_MMDF && m_strcmp(MMDF_SEP, buf) != 0)) { - debug_print (1, ("message not in expected position.\n")); - debug_print (1, ("LINE: %s\n", buf)); i = -1; } else { if (fseeko (ctx->fp, offset, SEEK_SET) != 0) { /* return to proper offset */ i = -1; - debug_print (1, ("fseeko() failed\n")); - } - else { + } else { /* copy the temp mailbox back into place starting at the first * change/deleted message */ @@ -933,7 +910,6 @@ static int mbox_reopen_mailbox (CONTEXT * ctx, int *index_hint) case M_MBOX: case M_MMDF: if (fseeko (ctx->fp, 0, SEEK_SET) != 0) { - debug_print (1, ("fseeko() failed\n")); rc = -1; } else {