[Dovecot] Fwd: Weird problem opening mbox in beta1/2

Chris Wakelin c.d.wakelin at reading.ac.uk
Fri Jan 27 00:23:30 EET 2006


Thanks, that's fixed it! I'm still puzzled about why I *thought* I'd 
opened it successfully before. Maybe I used a different compilation 
environment? I'd been experimenting with gcc 3.3.2 as well as 2.95.

Best Wishes,
Chris

Timo Sirainen wrote:
> On Wed, 2006-01-25 at 18:33 +0000, Chris Wakelin wrote:
>>> So it looks like it might be something to do with the int -> bool changes.
> 
> That's correct. I had mixed integers and booleans in one function, and
> after doing int -> bool change, the returned -1 got translated to same
> as TRUE. Would be nice if gcc complained about those mistakes.. Fixed in
> CVS, and attached patch also fixes it.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ? src/lib-storage/index/mbox/diff
> ? src/lib-storage/index/mbox/mbox-lock.c2
> ? src/lib-storage/index/mbox/mbox-min-index-size.diff
> Index: src/lib-storage/index/mbox/istream-raw-mbox.c
> ===================================================================
> RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
> retrieving revision 1.39
> diff -u -r1.39 istream-raw-mbox.c
> --- src/lib-storage/index/mbox/istream-raw-mbox.c	14 Jan 2006 18:47:52 -0000	1.39
> +++ src/lib-storage/index/mbox/istream-raw-mbox.c	26 Jan 2006 20:41:45 -0000
> @@ -340,7 +340,7 @@
>  				input->real_stream->abs_start_offset);
>  }
>  
> -static bool istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream)
> +static int istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream)
>  {
>  	const unsigned char *data;
>  	size_t size;
> @@ -354,7 +354,7 @@
>  	if ((size == 1 && data[0] == '\n') ||
>  	    (size == 2 && data[0] == '\r' && data[1] == '\n')) {
>  		/* EOF */
> -		return TRUE;
> +		return 1;
>  	}
>  
>  	if (size > 31 && memcmp(data, "\nFrom ", 6) == 0) {
> @@ -364,7 +364,7 @@
>  		data += 7;
>  		size -= 7;
>  	} else {
> -		return FALSE;
> +		return 0;
>  	}
>  
>  	while (memchr(data, '\n', size) == NULL) {
> @@ -373,12 +373,12 @@
>  	}
>  
>  	if (mbox_from_parse(data, size, &received_time, &sender) < 0)
> -		return FALSE;
> +		return 0;
>  
>  	rstream->next_received_time = received_time;
>  	i_free(rstream->next_sender);
>  	rstream->next_sender = sender;
> -	return TRUE;
> +	return 1;
>  }
>  
>  uoff_t istream_raw_mbox_get_start_offset(struct istream *stream)


-- 
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-
Christopher Wakelin,                           c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,  Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK              Fax: +44 (0)118 975 3094


More information about the dovecot mailing list