diff 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
line wrap: on
line diff
--- a/src/readpst.c	Fri May 16 09:06:17 2008 -0700
+++ b/src/readpst.c	Thu May 29 18:51:02 2008 -0700
@@ -310,11 +310,11 @@
             return 1;
         }
 
-        while (0 != ( l = fread( buf, 1, 1024, fp))) {
-            if (0 != pst_decrypt( buf, l, PST_COMP_ENCRYPT))
+        while (0 != (l = fread(buf, 1, 1024, fp))) {
+            if (0 != pst_decrypt(buf, l, PST_COMP_ENCRYPT))
                 fprintf(stderr, "pst_decrypt() failed (I'll try to continue)\n");
 
-            if (l != fwrite( buf, 1, l, stdout)) {
+            if (l != pst_fwrite(buf, 1, l, stdout)) {
                 fprintf(stderr, "Couldn't output to stdout?\n");
                 DEBUG_RET();
                 return 1;
@@ -385,12 +385,11 @@
             fprintf(f, ">");
         if ((n = strchr(body, '\n'))) {
             n++;
-            fwrite(body, n-body, 1, f); //write just a line
-
+            pst_fwrite(body, n-body, 1, f); //write just a line
             body = n;
         }
     }
-    fwrite(body, strlen(body), 1, f);
+    pst_fwrite(body, strlen(body), 1, f);
     DEBUG_RET();
 }
 
@@ -682,7 +681,7 @@
 // headers for emails stored in their "Personal Folders" files.
 char *skip_header_prologue(char *headers) {
     const char *bad = "Microsoft Mail Internet Headers";
-    if ( strncmp(headers, bad, strlen(bad)) == 0 ) {
+    if (strncmp(headers, bad, strlen(bad)) == 0) {
         // Found the offensive header prologue
         char *pc = strchr(headers, '\n');
         return pc + 1;
@@ -727,7 +726,7 @@
         WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp));
     } else {
         if (current_attach->data)
-            fwrite(current_attach->data, 1, current_attach->size, fp);
+            pst_fwrite(current_attach->data, 1, current_attach->size, fp);
         else {
             (void)pst_attach_to_file(pst, current_attach, fp);
         }
@@ -775,7 +774,7 @@
         }
     }
     if (current_attach->data) {
-        fwrite(enc, 1, strlen(enc), f_output);
+        pst_fwrite(enc, 1, strlen(enc), f_output);
         DEBUG_EMAIL(("Attachment Size after encoding is %i\n", strlen(enc)));
         free(enc);  // caught by valgrind
     } else {