Re: Early-posting a new idea for the summary format
- From: Philip Van Hoof <spam pvanhoof be>
- To: tinymail-devel-list gnome org
- Subject: Re: Early-posting a new idea for the summary format
- Date: Thu, 01 Feb 2007 23:52:43 +0100
On Thu, 2007-02-01 at 23:47 +0100, Philip Van Hoof wrote:
Two immediate problems that I just spotted:
Before the while loop must the offset be set by reading the first
integer of the mmap.
The ptr += strlen (field) after the un_alias is all wrong. The ptr
should be passed by reference to un_alias which will increase it with 5
in case of the content[0]==0x01 situation and with strlen(content) in
case of the other situation.
> static void
> un_alias (char *start, char *content)
> {
> if (content[0] == 0x01)
> return (char *) (start + ((int) content[1]));
>
> return content;
> }
>
> static uint32
> get_flags (CamelSummaryInfo *s, int segment, int n)
> {
> int offset = n * sizeof (int);
> return (uint32) s->flags_mmaps [segment] [offset];
> }
>
> void load_it (CamelFolderSummary *s)
> {
> int segment;
>
> for (segment = 0; segment < s->segment_cnt; segment++)
> {
> while (next != end_of(s->summary_mmaps[segment]))
> {
> CameMessageInfo *info = new..();
>
> offset = next;
>
> load_msg_info (s, segment, info, i, offset,
> &next);
>
> camel_folder_summary_add (s, info);
> i++;
> }
> }
> }
>
> static void
> load_msg_info (CamelSummaryInfo *s, int segment, CamelMessageInfo *info,
> int n, int offset, int *next)
> {
> char *start = s->summary_mmaps[segment];
> CamelMessageInfoBase *bi = (CamelMessageInfoBase *) info;
> CamelMessageContentInfo *ci;
>
> int cnt, i;
> char *type, *subtype;
> char *ptr = start + offset;
>
> bi->flags = get_flags (s, segment, n);
>
> bi->message_id = ptr;
> ptr += 8;
> bi->uid = ptr;
> ptr += strlen (bi->uid);
> bi->subject = un_alias (start, ptr);
> ptr += strlen (bi->subject);
> bi->from = un_alias (start, ptr);
> ptr += strlen (bi->from);
> bi->to = un_alias (start, ptr);
> ptr += strlen (bi->to);
> bi->cc = un_alias (start, ptr);
> ptr += strlen (bi->cc);
>
> bi->size = (int) ptr;
> ptr += sizeof (int);
> bi->sent = (int) ptr;
> ptr += sizeof (int);
> bi->received = (int) ptr;
> ptr += sizeof (int);
>
> type = un_alias (start, ptr);
> ptr += strlen (type);
> subtype = un_alias (start, ptr);
> ptr += strlen (subtype);
>
> bi->content = camel_folder_summary_content_info_new (s);
>
> cnt = decode_uint32 (ptr, &ptr);
>
> for (i=0; i< cnt; i++)
> {
> char *name, *value;
>
> name = un_alias (start, ptr);
> ptr += strlen (name);
> value = un_alias (start, ptr);
> ptr += strlen (value);
>
> camel_content_type_set_param (bi->content, name, value);
> }
>
> bi->content->id = un_alias (start, ptr);
> ptr += strlen (bi->content->id);
> bi->content->description = un_alias (start, ptr);
> ptr += strlen (bi->content->description);
> bi->content->encoding = un_alias (start, ptr);
> ptr += strlen (bi->uid);
>
> *next = (int) ptr;
> }
>
>
> --
> Philip Van Hoof, software developer
> home: me at pvanhoof dot be
> gnome: pvanhoof at gnome dot org
> http://www.pvanhoof.be/blog
>
>
>
>
> _______________________________________________
> tinymail-devel-list mailing list
> tinymail-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/tinymail-devel-list
--
Philip Van Hoof, software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://www.pvanhoof.be/blog
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]