core: Do not pass const char* to functions taking a char*.
authorWerner Koch <wk@gnupg.org>
Tue, 13 Sep 2016 18:44:59 +0000 (20:44 +0200)
committerWerner Koch <wk@gnupg.org>
Tue, 13 Sep 2016 18:44:59 +0000 (20:44 +0200)
Signed-off-by: Werner Koch <wk@gnupg.org>
src/argparse.c
src/engine-gpg.c
src/engine-gpgsm.c
src/engine-uiserver.c
src/gpgme-tool.c

index b6abf86..003334f 100644 (file)
@@ -895,6 +895,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
   char **argv;
   char *s, *s2;
   int i;
+  char string_with_x[] = "x";
 
   initialize( arg, NULL, NULL );
   argc = *arg->argc;
@@ -1106,7 +1107,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
                    argc--; argv++; idx++; /* Skip one.  */
                   }
               }
-           s = "x"; /* This is so that !s[1] yields false.  */
+           s = string_with_x; /* This is so that !s[1] yields false.  */
           }
        else
           {
index 289578b..c528d05 100644 (file)
@@ -1081,7 +1081,11 @@ read_status (engine_gpg_t gpg)
         err = gpg->status.mon_cb (gpg->status.mon_cb_value,
                                   GPGME_STATUS_EOF, "");
       if (gpg->status.fnc)
-        err = gpg->status.fnc (gpg->status.fnc_value, GPGME_STATUS_EOF, "");
+        {
+          char emptystring[1] = {0};
+          err = gpg->status.fnc (gpg->status.fnc_value,
+                                 GPGME_STATUS_EOF, emptystring);
+        }
 
       return err;
     }
index 3f3230b..81e8fab 100644 (file)
@@ -818,8 +818,11 @@ status_handler (void *opaque, int fd)
               && (line[2] == '\0' || line[2] == ' '))
        {
          if (gpgsm->status.fnc)
-           err = gpgsm->status.fnc (gpgsm->status.fnc_value,
-                                    GPGME_STATUS_EOF, "");
+            {
+              char emptystring[1] = {0};
+              err = gpgsm->status.fnc (gpgsm->status.fnc_value,
+                                       GPGME_STATUS_EOF, emptystring);
+            }
 
          if (!err && gpgsm->colon.fnc && gpgsm->colon.any)
             {
index de12f2b..2ed7825 100644 (file)
@@ -669,8 +669,11 @@ status_handler (void *opaque, int fd)
               && (line[2] == '\0' || line[2] == ' '))
        {
          if (uiserver->status.fnc)
-           err = uiserver->status.fnc (uiserver->status.fnc_value,
-                                    GPGME_STATUS_EOF, "");
+            {
+              char emptystring[1] = {0};
+              err = uiserver->status.fnc (uiserver->status.fnc_value,
+                                          GPGME_STATUS_EOF, emptystring);
+            }
 
          if (!err && uiserver->colon.fnc && uiserver->colon.any)
             {
index 5ad5b25..ec85039 100644 (file)
@@ -337,13 +337,14 @@ result_xml_indent (struct result_xml_state *state)
 
 
 gpg_error_t
-result_xml_tag_start (struct result_xml_state *state, char *name, ...)
+result_xml_tag_start (struct result_xml_state *state, const char *name, ...)
 {
   result_xml_write_cb_t cb = state->cb;
   void *hook = state->hook;
   va_list ap;
   char *attr;
   char *attr_val;
+  char string_null[] = "(null)";
 
   va_start (ap, name);
 
@@ -374,7 +375,7 @@ result_xml_tag_start (struct result_xml_state *state, char *name, ...)
 
       attr_val = va_arg (ap, char *);
       if (attr_val == NULL)
-       attr_val = "(null)";
+       attr_val = string_null;
 
       (*cb) (hook, " ", 1);
       (*cb) (hook, attr, strlen (attr));