From: David Levine Date: Sun, 12 Jun 2016 14:38:19 +0000 (-0400) Subject: Added const to filename args of cpydata(). Then added const to some X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/c546ef90ba8ca862494086de6e754cebe207299b?ds=sidebyside;hp=--cc Added const to filename args of cpydata(). Then added const to some args in mhfixmsg.c. (cherry picked from commit 9f7d48c36f01ba29974834cbcdc24e4c2e1f07d9) --- c546ef90ba8ca862494086de6e754cebe207299b diff --git a/h/prototypes.h b/h/prototypes.h index 8a7d1f70..fc969094 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -54,7 +54,7 @@ void context_replace (char *, char *); 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 *); diff --git a/sbr/cpydata.c b/sbr/cpydata.c index d322ba9b..37d4803a 100644 --- a/sbr/cpydata.c +++ b/sbr/cpydata.c @@ -10,7 +10,7 @@ #include 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]; diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index d9331636..d3c23767 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -91,7 +91,7 @@ typedef struct fix_transformations { 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 *); @@ -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 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 int remove_file (char *); +static int remove_file (const char *); 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. */ - 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); @@ -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_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 ()) @@ -2317,7 +2317,7 @@ fix_always (CT ct, int *message_mods) { 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; @@ -2433,7 +2433,7 @@ set_text_ctparams(CT ct, char *decodetypes, int lf_line_endings) { * 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);