]> diplodocus.org Git - nmh/blobdiff - uip/mhfixmsg.c
Use existing macros min() and max() more.
[nmh] / uip / mhfixmsg.c
index 5a777010bb1c28b620aa724a4149a54bc0d24ae0..c4016f9e6d280eb3ccf8e292c997f3b38a758c72 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * mhfixmsg.c -- rewrite a message with various transformations
+/* mhfixmsg.c -- rewrite a message with various transformations
  *
  * This code is Copyright (c) 2002 and 2013, by the authors of nmh.
  * See the COPYRIGHT file in the root directory of the nmh
  *
  * This code is Copyright (c) 2002 and 2013, by the authors of nmh.
  * See the COPYRIGHT file in the root directory of the nmh
@@ -765,11 +764,9 @@ get_multipart_boundary (CT ct, char **part_boundary) {
             }
         }
 
             }
         }
 
-        if (! end_boundary  &&  begin > (off_t) (ct->c_begin + sizeof buffer)) {
-            begin -= sizeof buffer;
-        } else {
+        if (end_boundary  ||  begin <= (off_t) (ct->c_begin + sizeof buffer))
             break;
             break;
-        }
+        begin -= sizeof buffer;
     }
 
     /* Get boundary at beginning of multipart. */
     }
 
     /* Get boundary at beginning of multipart. */
@@ -1015,10 +1012,8 @@ fix_types (CT ct, svector_t fixtypes, int *message_mods) {
                                                 type, ct_type_subtype);
                                     }
                                     break;
                                                 type, ct_type_subtype);
                                     }
                                     break;
-                                } else {
-                                    inform("did not find %s in %s",
-                                            type, hf->value);
                                 }
                                 }
+                                inform("did not find %s in %s", type, hf->value);
                             }
                         }
                     }
                             }
                         }
                     }
@@ -1068,7 +1063,7 @@ replace_substring (char **str, const char *old, const char *new) {
 char *
 remove_parameter (char *str, const char *name) {
     /* It looks to me, based on the BNF in RFC 2045, than there can't
 char *
 remove_parameter (char *str, const char *name) {
     /* It looks to me, based on the BNF in RFC 2045, than there can't
-       be whitespace betwwen the parameter name and the "=", or
+       be whitespace between the parameter name and the "=", or
        between the "=" and the parameter value. */
     char *param_name = concat (name, "=", NULL);
     char *cp;
        between the "=" and the parameter value. */
     char *param_name = concat (name, "=", NULL);
     char *cp;
@@ -1355,11 +1350,9 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods, int replacetextplain) {
                                        multipart/alternative. */
                                     remove_parameter (hf->value, "type");
                                     break;
                                        multipart/alternative. */
                                     remove_parameter (hf->value, "type");
                                     break;
-                                } else {
-                                    inform("did not find multipart/"
-                                                  "related in header %s",
-                                            hf->value);
                                 }
                                 }
+                                inform("did not find multipart/"
+                                    "related in header %s", hf->value);
                             }
                         }
                     } else {
                             }
                         }
                     } else {
@@ -1628,7 +1621,7 @@ decode_part (CT ct) {
     (void) m_unlink (tmp_decoded);
     free (tmp_decoded);
     if (fclose (file)) {
     (void) m_unlink (tmp_decoded);
     free (tmp_decoded);
     if (fclose (file)) {
-        admonish (NULL, "unable to close temporary file %s", tempfile);
+        inform("unable to close temporary file %s, continuing...", tempfile);
     }
 
     return status;
     }
 
     return status;
@@ -2166,7 +2159,8 @@ content_encoding (CT ct, const char **reason) {
                         *reason = "";
                     }
                     break;
                         *reason = "";
                     }
                     break;
-                } else if (*cp == '\n') {
+                }
+                if (*cp == '\n') {
                     line_len = 0;
                 } else if (! isascii ((unsigned char) *cp)) {
                     encoding = CE_8BIT;
                     line_len = 0;
                 } else if (! isascii ((unsigned char) *cp)) {
                     encoding = CE_8BIT;
@@ -2301,7 +2295,7 @@ strip_crs (CT ct, int *message_mods) {
                 }
 
                 if (close (fd)) {
                 }
 
                 if (close (fd)) {
-                    admonish (NULL, "unable to write temporary file %s",
+                    inform("unable to write temporary file %s, continuing...",
                               stripped_content_file);
                     (void) m_unlink (stripped_content_file);
                     status = NOTOK;
                               stripped_content_file);
                     (void) m_unlink (stripped_content_file);
                     status = NOTOK;
@@ -2716,15 +2710,15 @@ write_content (CT ct, const char *input_filename, char *outfile, FILE *outfp,
                                expand filename to absolute path. */
                             int file = ct->c_file  &&  ct->c_file[0] == '/';
 
                                expand filename to absolute path. */
                             int file = ct->c_file  &&  ct->c_file[0] == '/';
 
-                            admonish (NULL, "unable to rename %s %s to %s",
+                            inform("unable to rename %s %s to %s, continuing...",
                                       file ? "file" : "message", outfile,
                                       infile);
                             status = NOTOK;
                         }
                     }
                 } else {
                                       file ? "file" : "message", outfile,
                                       infile);
                             status = NOTOK;
                         }
                     }
                 } else {
-                    admonish (NULL, "unable to remove input file %s, "
-                              "not modifying it", infile);
+                    inform("unable to remove input file %s, "
+                       "not modifying it, continuing...", infile);
                     (void) m_unlink (outfile);
                     status = NOTOK;
                 }
                     (void) m_unlink (outfile);
                     status = NOTOK;
                 }