Mercurial > libpst
comparison src/dumpblocks.c @ 164:ab384fed78c5
Compensate for iconv conversion to utf-7 that produces strings that are not null terminated.
Don't produce empty attachment files in separate mode.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 16 Mar 2009 18:31:39 -0700 |
parents | fc11b1d1ad34 |
children | 6954d315aaa8 |
comparison
equal
deleted
inserted
replaced
163:03fbb0269f3c | 164:ab384fed78c5 |
---|---|
54 ptr = pstfile.i_head; | 54 ptr = pstfile.i_head; |
55 outname = (char *) xmalloc(OUT_BUF); | 55 outname = (char *) xmalloc(OUT_BUF); |
56 printf("Saving blocks\n"); | 56 printf("Saving blocks\n"); |
57 while (ptr != NULL) { | 57 while (ptr != NULL) { |
58 /* if (pstfile.encryption == PST_ENC) { | 58 /* if (pstfile.encryption == PST_ENC) { |
59 c = pst_ff_getIDblock_dec(&pstfile, ptr->id, buf); | 59 c = pst_ff_getIDblock_dec(&pstfile, ptr->i_id, buf); |
60 } else { */ | 60 } else { */ |
61 if ((ptr->id & 0x02) == 0 && pstfile.encryption == PST_ENC) { | 61 if ((ptr->i_id & 0x02) == 0 && pstfile.encryption == PST_ENC) { |
62 c = pst_ff_getIDblock_dec(&pstfile, ptr->id, &buf); | 62 c = pst_ff_getIDblock_dec(&pstfile, ptr->i_id, &buf); |
63 } else { | 63 } else { |
64 c = pst_ff_getIDblock(&pstfile, ptr->id, &buf); | 64 c = pst_ff_getIDblock(&pstfile, ptr->i_id, &buf); |
65 } | 65 } |
66 | 66 |
67 if (c > 0) { | 67 if (c > 0) { |
68 snprintf(outname, OUT_BUF, "%#"PRIx64, ptr->id); | 68 snprintf(outname, OUT_BUF, "%#"PRIx64, ptr->i_id); |
69 if ((fp = fopen(outname, "wb")) == NULL) { | 69 if ((fp = fopen(outname, "wb")) == NULL) { |
70 printf("Failed to open file %s\n", outname); | 70 printf("Failed to open file %s\n", outname); |
71 continue; | 71 continue; |
72 } | 72 } |
73 pst_fwrite(buf, 1, c, fp); | 73 pst_fwrite(buf, 1, c, fp); |
74 fclose(fp); | 74 fclose(fp); |
75 } else { | 75 } else { |
76 printf("Failed to read block id %#"PRIx64"\n", ptr->id); | 76 printf("Failed to read block i_id %#"PRIx64"\n", ptr->i_id); |
77 } | 77 } |
78 ptr = ptr->next; | 78 ptr = ptr->next; |
79 } | 79 } |
80 pst_close(&pstfile); | 80 pst_close(&pstfile); |
81 DEBUG_RET(); | 81 DEBUG_RET(); |