comparison src/libpst.c @ 100:1e4a7610d525

fixes from Justin Greer to add -D option to include deleted items, to add missing email headers, to fix bug in my_stristr()
author Carl Byington <carl@five-ten-sg.com>
date Thu, 02 Oct 2008 15:29:36 -0700
parents 57bc6251f8dd
children 1fc33da23175
comparison
equal deleted inserted replaced
99:b7f456946c5b 100:1e4a7610d525
872 lostfound_ptr = lostfound_head; 872 lostfound_ptr = lostfound_head;
873 while (lostfound_ptr && (lostfound_ptr->ptr->id != parent_id)) { 873 while (lostfound_ptr && (lostfound_ptr->ptr->id != parent_id)) {
874 lostfound_ptr = lostfound_ptr->next; 874 lostfound_ptr = lostfound_ptr->next;
875 } 875 }
876 if (!lostfound_ptr) { 876 if (!lostfound_ptr) {
877 DEBUG_WARN(("ERROR -- cannot find parent with id %#"PRIx64". Adding to lost/found\n", parent_id)); 877 DEBUG_WARN(("ERROR -- cannot find parent with id %#"PRIx64". Adding id %#"PRIx64" to lost/found\n", parent_id, d_ptr->id));
878 lostfound_ptr = (struct cache_list_node*) xmalloc(sizeof(struct cache_list_node)); 878 lostfound_ptr = (struct cache_list_node*) xmalloc(sizeof(struct cache_list_node));
879 lostfound_ptr->prev = NULL; 879 lostfound_ptr->prev = NULL;
880 lostfound_ptr->next = lostfound_head; 880 lostfound_ptr->next = lostfound_head;
881 lostfound_ptr->parent = parent_id; 881 lostfound_ptr->parent = parent_id;
882 lostfound_ptr->ptr = d_ptr; 882 lostfound_ptr->ptr = d_ptr;
883 lostfound_head = lostfound_ptr; 883 lostfound_head = lostfound_ptr;
884 } else { 884 } else {
885 parent = lostfound_ptr->ptr; 885 parent = lostfound_ptr->ptr;
886 DEBUG_INDEX(("Found parent (%#"PRIx64") in Lost and Found\n", parent->id)); 886 DEBUG_INDEX(("Found parent (%#"PRIx64") in lost/found\n", parent->id));
887 } 887 }
888 } 888 }
889 889
890 if (cache_ptr || parent) { 890 if (cache_ptr || parent) {
891 if (cache_ptr) 891 if (cache_ptr)
1060 // check here to see if d_ptr is the parent of any of the items in the lost / found list 1060 // check here to see if d_ptr is the parent of any of the items in the lost / found list
1061 lostfound_ptr = lostfound_head; 1061 lostfound_ptr = lostfound_head;
1062 lostfound_shd = NULL; 1062 lostfound_shd = NULL;
1063 while (lostfound_ptr) { 1063 while (lostfound_ptr) {
1064 if (lostfound_ptr->parent == d_ptr->id) { 1064 if (lostfound_ptr->parent == d_ptr->id) {
1065 DEBUG_INDEX(("Found a child (%#"PRIx64") of the current record. Joining to main structure.\n", lostfound_ptr->ptr->id)); 1065 DEBUG_INDEX(("Found a lost/found child (%#"PRIx64") of the current record. Joining to main structure.\n", lostfound_ptr->ptr->id));
1066 parent = d_ptr; 1066 parent = d_ptr;
1067 d_ptr = lostfound_ptr->ptr; 1067 d_ptr = lostfound_ptr->ptr;
1068 parent->no_child++; 1068 parent->no_child++;
1069 d_ptr->parent = parent; 1069 d_ptr->parent = parent;
1070 if (parent->child_tail) parent->child_tail->next = d_ptr; 1070 if (parent->child_tail) parent->child_tail->next = d_ptr;
1130 cache_head = cache_ptr; 1130 cache_head = cache_ptr;
1131 } 1131 }
1132 // free the lost and found 1132 // free the lost and found
1133 while (lostfound_head) { 1133 while (lostfound_head) {
1134 lostfound_ptr = lostfound_head->next; 1134 lostfound_ptr = lostfound_head->next;
1135 WARN(("unused lost/found item with parent %#"PRIx64"))", lostfound_head->parent)); 1135 WARN(("unused lost/found item %#"PRIx64" with parent %#"PRIx64, lostfound_head->parent, lostfound_head->ptr->id));
1136 free(lostfound_head); 1136 free(lostfound_head);
1137 lostfound_head = lostfound_ptr; 1137 lostfound_head = lostfound_ptr;
1138 } 1138 }
1139 } 1139 }
1140 if (buf) free(buf); 1140 if (buf) free(buf);