From 9e7dabfa8274777916da364b50284cfa51ac9a6f Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 1 Apr 2000 21:58:27 +0000 Subject: Compare mbox_file_size and mbox_modtime to the results of stat()ing the * providers/mbox/camel-mbox-folder.c (_check_get_or_maybe_generate_summary_file): Compare mbox_file_size and mbox_modtime to the results of stat()ing the mbox file, not the summary file. Duh. (_close): Update the summary's mbox_file_size and mbox_modtime before writing it to disk. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_save, camel_mbox_summary_load): Wow. I must have been tired when I wrote this code. First, the comparison bug above. Second, it was using ntohs and htons instead of ntohl and htonl. Third, I was reading the status flag byte in two different places and thus getting out of sync. Fourth, it was writing out field_length bytes of each header field after having converted field_length to network byte order, resulting in lots of random crap being appended, and the summary files being huge. (Fortunately, since the size/modtime comparison was biffed, the garbage summary read from disk was always immediately discarded.) * providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): fix an off-by-one error that caused the last-used UID to be reused if the summary file was regenerated. (That one wasn't my fault. :-) svn path=/trunk/; revision=2279 --- camel/providers/mbox/camel-mbox-parser.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'camel/providers/mbox/camel-mbox-parser.c') diff --git a/camel/providers/mbox/camel-mbox-parser.c b/camel/providers/mbox/camel-mbox-parser.c index 7c0eec5379..c03639133f 100644 --- a/camel/providers/mbox/camel-mbox-parser.c +++ b/camel/providers/mbox/camel-mbox-parser.c @@ -584,20 +584,29 @@ read_message_begining (CamelMboxPreParser *parser, gchar **message_summary) /** * camel_mbox_parse_file: read an mbox file and parse it. * @fd: file descriptor opened on the mbox file. - * @message_delimiter: character string delimiting the beginig of a new message - * @start_position: poition in the file where to start the parsing. - * @get_message_summary: should the parser retrieve the begining of the messages - * @status_callback: function to call peridically to indicate the progress of the parser - * @status_interval: floating value between 0 and 1 indicate how often to call @status_callback. + * @message_delimiter: character string delimiting the beginig of a + * new message + * @start_position: position in the file where to start the parsing. + * @file_size: on output, the size in bytes of the file + * @next_uid: on output, the next uid available for use + * @get_message_summary: should the parser retrieve the begining of + * the messages + * @status_callback: function to call peridically to indicate the + * progress of the parser + * @status_interval: floating value between 0 and 1 indicate how often + * to call @status_callback. * @user_data: user data that will be passed to the callback function * - * This routine parses an mbox file and retreives both the message starting positions and - * some of the informations contained in the message. Those informations are mainly - * some RFC822 headers values but also (optionally) the first characters of the mail - * body. The @get_message_summary parameter allows to enable or disable this option. + * This routine parses an mbox file and retreives both the message + * starting positions and some of the informations contained in the + * message. Those informations are mainly some RFC822 headers values + * but also (optionally) the first characters of the mail body. The + * @get_message_summary parameter allows to enable or disable this + * option. * * - * Return value: An array of CamelMboxParserMessageInfo containing the informations on each message parsed in the file + * Return value: An array of CamelMboxParserMessageInfo containing the + * informations on each message parsed in the file **/ GArray * camel_mbox_parse_file (int fd, @@ -766,7 +775,7 @@ camel_mbox_parse_file (int fd, G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + G_STRUCT_OFFSET (CamelMboxParserMessageInfo, status))); g_free (x_ev_header_content); - next_available_uid = MAX (next_available_uid, parser->current_message_info.uid); + next_available_uid = MAX (next_available_uid, parser->current_message_info.uid + 1); newline = TRUE; continue; -- cgit v1.2.3