- if (curhdr->content->length > 0)
- {
- long tmploc;
-
- loc = ftell (ctx->fp);
- tmploc = loc + curhdr->content->length + 1;
-
- if (0 < tmploc && tmploc < ctx->size)
- {
- /*
- * check to see if the content-length looks valid. we expect to
- * to see a valid message separator at this point in the stream
- */
- if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
- fgets (buf, sizeof (buf), ctx->fp) == NULL ||
- mutt_strncmp ("From ", buf, 5) != 0)
- {
- dprint (1, (debugfile, "mbox_parse_mailbox: bad content-length in message %d (cl=%ld)\n", curhdr->index, curhdr->content->length));
- dprint (1, (debugfile, "\tLINE: %s", buf));
- if (fseek (ctx->fp, loc, SEEK_SET) != 0) /* nope, return the previous position */
- {
- dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
- }
- curhdr->content->length = -1;
- }
- }
- else if (tmploc != ctx->size)
- {
- /* content-length would put us past the end of the file, so it
- * must be wrong
- */
- curhdr->content->length = -1;
- }
-
- if (curhdr->content->length != -1)
- {
- /* good content-length. check to see if we know how many lines
- * are in this message.
- */
- if (curhdr->lines == 0)
- {
- int cl = curhdr->content->length;
-
- /* count the number of lines in this message */
- if (fseek (ctx->fp, loc, SEEK_SET) != 0)
- dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
- while (cl-- > 0)
- {
- if (fgetc (ctx->fp) == '\n')
- curhdr->lines++;
- }
- }
-
- /* return to the offset of the next message separator */
- if (fseek (ctx->fp, tmploc, SEEK_SET) != 0)
- dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
- }
+ if (curhdr->content->length > 0) {
+ long tmploc;
+
+ loc = ftell (ctx->fp);
+ tmploc = loc + curhdr->content->length + 1;
+
+ if (0 < tmploc && tmploc < ctx->size) {
+ /*
+ * check to see if the content-length looks valid. we expect to
+ * to see a valid message separator at this point in the stream
+ */
+ if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
+ fgets (buf, sizeof (buf), ctx->fp) == NULL ||
+ mutt_strncmp ("From ", buf, 5) != 0) {
+ dprint (1,
+ (debugfile,
+ "mbox_parse_mailbox: bad content-length in message %d (cl=%ld)\n",
+ curhdr->index, curhdr->content->length));
+ dprint (1, (debugfile, "\tLINE: %s", buf));
+ if (fseek (ctx->fp, loc, SEEK_SET) != 0) { /* nope, return the previous position */
+ dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
+ }
+ curhdr->content->length = -1;
+ }
+ }
+ else if (tmploc != ctx->size) {
+ /* content-length would put us past the end of the file, so it
+ * must be wrong
+ */
+ curhdr->content->length = -1;
+ }
+
+ if (curhdr->content->length != -1) {
+ /* good content-length. check to see if we know how many lines
+ * are in this message.
+ */
+ if (curhdr->lines == 0) {
+ int cl = curhdr->content->length;
+
+ /* count the number of lines in this message */
+ if (fseek (ctx->fp, loc, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
+ while (cl-- > 0) {
+ if (fgetc (ctx->fp) == '\n')
+ curhdr->lines++;
+ }
+ }
+
+ /* return to the offset of the next message separator */
+ if (fseek (ctx->fp, tmploc, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
+ }