Hi Kevin,

On Sun, Jan 25, 2026 at 06:30:23PM +0800, Kevin J. McCarthy wrote:
> When one is missing, include the previous newline as part of the
> message.
> 
> This addresses ticket 415.  It's not a perfect solution, but it stops
> the problem from propagating into other mbox files.
> ---
>  mbox.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mbox.c b/mbox.c
> index a2a32d13..2a266da7 100644
> --- a/mbox.c
> +++ b/mbox.c
> @@ -314,7 +314,8 @@ int mbox_parse_mailbox (CONTEXT *ctx)
>  
>       if (PREV->content->length < 0)
>       {
> -       PREV->content->length = loc - PREV->content->offset - 1;
> +       PREV->content->length = loc - PREV->content->offset -
> +                                  (has_mbox_sep ? 1 : 0);

You may want to simplify as 

          PREV->content->length = loc - PREV->content->offset - !!has_mbox_sep;

The main advantage is that it fits in 80 columns.


Have a lovely day!
Alex

>         if (PREV->content->length < 0)
>           PREV->content->length = 0;
>       }
> @@ -451,7 +452,8 @@ int mbox_parse_mailbox (CONTEXT *ctx)
>  
>      if (PREV->content->length < 0)
>      {
> -      PREV->content->length = ftello (ctx->fp) - PREV->content->offset - 1;
> +      PREV->content->length = ftello (ctx->fp) - PREV->content->offset -
> +                              (has_mbox_sep ? 1 : 0);
>        if (PREV->content->length < 0)
>       PREV->content->length = 0;
>      }
> -- 
> 2.52.0
> 

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to