]> diplodocus.org Git - nmh/commitdiff
Added const to filename args of cpydata(). Then added const to some
authorDavid Levine <levinedl@acm.org>
Sun, 12 Jun 2016 14:38:19 +0000 (10:38 -0400)
committerDavid Levine <david.levine@gonift.com>
Sun, 12 Jun 2016 15:35:37 +0000 (11:35 -0400)
args in mhfixmsg.c.

(cherry picked from commit 9f7d48c36f01ba29974834cbcdc24e4c2e1f07d9)

h/prototypes.h
sbr/cpydata.c
uip/mhfixmsg.c

index 8a7d1f70270a69263f34b1b8f07c5fae8207c142..fc969094cdee8d1ecf1a8e24609ee988c37225cc 100644 (file)
@@ -54,7 +54,7 @@ void context_replace (char *, char *);
 void context_save (void);
 char *copy (const char *, char *);
 char **copyip (char **, char **, int);
 void context_save (void);
 char *copy (const char *, char *);
 char **copyip (char **, char **, int);
-void cpydata (int, int, char *, char *);
+void cpydata (int, int, const char *, const char *);
 void cpydgst (int, int, char *, char *);
 char *cpytrim (const char *);
 char *rtrim (char *);
 void cpydgst (int, int, char *, char *);
 char *cpytrim (const char *);
 char *rtrim (char *);
index d322ba9b3ed021d19dd37afdfeb34f9833fa1547..37d4803a7a537f2d96aeeb42f6dbd728b9c6586b 100644 (file)
@@ -10,7 +10,7 @@
 #include <h/mh.h>
 
 void
 #include <h/mh.h>
 
 void
-cpydata (int in, int out, char *ifile, char *ofile)
+cpydata (int in, int out, const char *ifile, const char *ofile)
 {
     int i;
     char buffer[BUFSIZ];
 {
     int i;
     char buffer[BUFSIZ];
index d93316368b3b2638973792280862c21fa8a46e85..d3c23767b8928c7a4ce822d2236a41b0423c7815 100644 (file)
@@ -91,7 +91,7 @@ typedef struct fix_transformations {
 
 int mhfixmsgsbr (CT *, const fix_transformations *, char *);
 static int fix_boundary (CT *, int *);
 
 int mhfixmsgsbr (CT *, const fix_transformations *, char *);
 static int fix_boundary (CT *, int *);
-static int copy_input_to_output (char *, char *);
+static int copy_input_to_output (const char *, const char *);
 static int get_multipart_boundary (CT, char **);
 static int replace_boundary (CT, char *, char *);
 static int fix_types (CT, svector_t, int *);
 static int get_multipart_boundary (CT, char **);
 static int replace_boundary (CT, char *, char *);
 static int fix_types (CT, svector_t, int *);
@@ -119,9 +119,9 @@ static int content_encoding (CT, const char **);
 static int strip_crs (CT, int *);
 static int convert_charsets (CT, char *, int *);
 static int fix_always (CT, int *);
 static int strip_crs (CT, int *);
 static int convert_charsets (CT, char *, int *);
 static int fix_always (CT, int *);
-static int write_content (CT, char *, char *, int, int);
+static int write_content (CT, const char *, char *, int, int);
 static void set_text_ctparams(CT, char *, int);
 static void set_text_ctparams(CT, char *, int);
-static int remove_file (char *);
+static int remove_file (const char *);
 static void report (char *, char *, char *, char *, ...);
 static void pipeser (int);
 
 static void report (char *, char *, char *, char *, ...);
 static void pipeser (int);
 
@@ -416,7 +416,7 @@ main (int argc, char **argv) {
                     if (outfile) {
                         /* Something went wrong.  Output might be expected, such as if this were run
                            as a filter.  Just copy the input to the output. */
                     if (outfile) {
                         /* Something went wrong.  Output might be expected, such as if this were run
                            as a filter.  Just copy the input to the output. */
-                        char *input_filename = path (msgnam, TFILE);
+                        const char *input_filename = path (msgnam, TFILE);
 
                         if (copy_input_to_output (input_filename, outfile) != OK) {
                             advise (NULL, "unable to copy message to %s, it might be lost\n", outfile);
 
                         if (copy_input_to_output (input_filename, outfile) != OK) {
                             advise (NULL, "unable to copy message to %s, it might be lost\n", outfile);
@@ -549,7 +549,7 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) {
 /* Copy input message to output.  Assumes not modifying in place, so this
    might be running as part of a pipeline. */
 static int
 /* Copy input message to output.  Assumes not modifying in place, so this
    might be running as part of a pipeline. */
 static int
-copy_input_to_output (char *input_filename, char *output_filename) {
+copy_input_to_output (const char *input_filename, const char *output_filename) {
     int in = open (input_filename, O_RDONLY);
     int out = strcmp (output_filename, "-")
         ?  open (output_filename, O_WRONLY | O_CREAT, m_gmprot ())
     int in = open (input_filename, O_RDONLY);
     int out = strcmp (output_filename, "-")
         ?  open (output_filename, O_WRONLY | O_CREAT, m_gmprot ())
@@ -2317,7 +2317,7 @@ fix_always (CT ct, int *message_mods) {
 
 
 static int
 
 
 static int
-write_content (CT ct, char *input_filename, char *outfile, int modify_inplace,
+write_content (CT ct, const char *input_filename, char *outfile, int modify_inplace,
                int message_mods) {
     int status = OK;
 
                int message_mods) {
     int status = OK;
 
@@ -2433,7 +2433,7 @@ set_text_ctparams(CT ct, char *decodetypes, int lf_line_endings) {
  * use the standard MH backup file.
  */
 static int
  * use the standard MH backup file.
  */
 static int
-remove_file (char *file) {
+remove_file (const char *file) {
     if (rmmproc) {
         char *rmm_command = concat (rmmproc, " ", file, NULL);
         int status = system (rmm_command);
     if (rmmproc) {
         char *rmm_command = concat (rmmproc, " ", file, NULL);
         int status = system (rmm_command);