Mercurial > libpst
comparison src/readpst.c @ 73:3cb02cb1e6cd stable-0-6-10
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
More changes for Fedora packaging (#434727)
Fixes for const correctness.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 29 May 2008 18:51:02 -0700 |
parents | b12f4e50e2e8 |
children | 987aa872294e |
comparison
equal
deleted
inserted
replaced
72:c21e9c001256 | 73:3cb02cb1e6cd |
---|---|
308 fprintf(stderr, "Couldn't open file %s\n", fname ); | 308 fprintf(stderr, "Couldn't open file %s\n", fname ); |
309 DEBUG_RET(); | 309 DEBUG_RET(); |
310 return 1; | 310 return 1; |
311 } | 311 } |
312 | 312 |
313 while (0 != ( l = fread( buf, 1, 1024, fp))) { | 313 while (0 != (l = fread(buf, 1, 1024, fp))) { |
314 if (0 != pst_decrypt( buf, l, PST_COMP_ENCRYPT)) | 314 if (0 != pst_decrypt(buf, l, PST_COMP_ENCRYPT)) |
315 fprintf(stderr, "pst_decrypt() failed (I'll try to continue)\n"); | 315 fprintf(stderr, "pst_decrypt() failed (I'll try to continue)\n"); |
316 | 316 |
317 if (l != fwrite( buf, 1, l, stdout)) { | 317 if (l != pst_fwrite(buf, 1, l, stdout)) { |
318 fprintf(stderr, "Couldn't output to stdout?\n"); | 318 fprintf(stderr, "Couldn't output to stdout?\n"); |
319 DEBUG_RET(); | 319 DEBUG_RET(); |
320 return 1; | 320 return 1; |
321 } | 321 } |
322 } | 322 } |
383 while (n) { | 383 while (n) { |
384 if (strncmp(body, "From ", 5) == 0) | 384 if (strncmp(body, "From ", 5) == 0) |
385 fprintf(f, ">"); | 385 fprintf(f, ">"); |
386 if ((n = strchr(body, '\n'))) { | 386 if ((n = strchr(body, '\n'))) { |
387 n++; | 387 n++; |
388 fwrite(body, n-body, 1, f); //write just a line | 388 pst_fwrite(body, n-body, 1, f); //write just a line |
389 | |
390 body = n; | 389 body = n; |
391 } | 390 } |
392 } | 391 } |
393 fwrite(body, strlen(body), 1, f); | 392 pst_fwrite(body, strlen(body), 1, f); |
394 DEBUG_RET(); | 393 DEBUG_RET(); |
395 } | 394 } |
396 | 395 |
397 | 396 |
398 char *removeCR (char *c) { | 397 char *removeCR (char *c) { |
680 // The sole purpose of this function is to bypass the pseudo-header prologue | 679 // The sole purpose of this function is to bypass the pseudo-header prologue |
681 // that Microsoft Outlook inserts at the beginning of the internet email | 680 // that Microsoft Outlook inserts at the beginning of the internet email |
682 // headers for emails stored in their "Personal Folders" files. | 681 // headers for emails stored in their "Personal Folders" files. |
683 char *skip_header_prologue(char *headers) { | 682 char *skip_header_prologue(char *headers) { |
684 const char *bad = "Microsoft Mail Internet Headers"; | 683 const char *bad = "Microsoft Mail Internet Headers"; |
685 if ( strncmp(headers, bad, strlen(bad)) == 0 ) { | 684 if (strncmp(headers, bad, strlen(bad)) == 0) { |
686 // Found the offensive header prologue | 685 // Found the offensive header prologue |
687 char *pc = strchr(headers, '\n'); | 686 char *pc = strchr(headers, '\n'); |
688 return pc + 1; | 687 return pc + 1; |
689 } | 688 } |
690 return headers; | 689 return headers; |
725 DEBUG_EMAIL(("Saving attachment to %s\n", temp)); | 724 DEBUG_EMAIL(("Saving attachment to %s\n", temp)); |
726 if (!(fp = fopen(temp, "w"))) { | 725 if (!(fp = fopen(temp, "w"))) { |
727 WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp)); | 726 WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp)); |
728 } else { | 727 } else { |
729 if (current_attach->data) | 728 if (current_attach->data) |
730 fwrite(current_attach->data, 1, current_attach->size, fp); | 729 pst_fwrite(current_attach->data, 1, current_attach->size, fp); |
731 else { | 730 else { |
732 (void)pst_attach_to_file(pst, current_attach, fp); | 731 (void)pst_attach_to_file(pst, current_attach, fp); |
733 } | 732 } |
734 fclose(fp); | 733 fclose(fp); |
735 } | 734 } |
773 } else { | 772 } else { |
774 fprintf(f_output, "Content-Disposition: attachment; filename=\"%s\"\n\n", attach_filename); | 773 fprintf(f_output, "Content-Disposition: attachment; filename=\"%s\"\n\n", attach_filename); |
775 } | 774 } |
776 } | 775 } |
777 if (current_attach->data) { | 776 if (current_attach->data) { |
778 fwrite(enc, 1, strlen(enc), f_output); | 777 pst_fwrite(enc, 1, strlen(enc), f_output); |
779 DEBUG_EMAIL(("Attachment Size after encoding is %i\n", strlen(enc))); | 778 DEBUG_EMAIL(("Attachment Size after encoding is %i\n", strlen(enc))); |
780 free(enc); // caught by valgrind | 779 free(enc); // caught by valgrind |
781 } else { | 780 } else { |
782 (void)pst_attach_to_file_base64(pst, current_attach, f_output); | 781 (void)pst_attach_to_file_base64(pst, current_attach, f_output); |
783 } | 782 } |