2005-10-01 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Sat, 1 Oct 2005 20:42:34 +0000 (20:42 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Sat, 1 Oct 2005 20:42:34 +0000 (20:42 +0000)
* engine.h (_gpgme_set_engine_info): Add prototype.
* engine-backend.h (struct engine_ops): Change return type of
get_file_name() to const char * to silence gcc warning.
* engine.c (engine_get_file_name): Change return type to const
char * to silence gcc warning.
(gpgme_get_engine_info): Use transitional variable to go from
const char * to char * to silence gcc warning.
(_gpgme_set_engine_info): Likewise.
* engine-gpgsm.c (struct engine_gpgsm): Change type of LINE to
char * to silence gcc warning.
(gpgsm_new): Make ARGV a pointer to const char.
(status_handler): Change type of SRC, END, DST, ALINE and NEWLINE
to char * to silence gcc warning.

gpgme/ChangeLog
gpgme/engine-backend.h
gpgme/engine-gpgsm.c
gpgme/engine.c
gpgme/engine.h

index 4150db02321ca1c12640b58210ecb6a5efeaae4b..21005564dca2795e7cbb4db31080597ca386d683 100644 (file)
@@ -1,5 +1,19 @@
 2005-10-01  Marcus Brinkmann  <marcus@g10code.de>
 
+       * engine.h (_gpgme_set_engine_info): Add prototype.
+       * engine-backend.h (struct engine_ops): Change return type of
+       get_file_name() to const char * to silence gcc warning.
+       * engine.c (engine_get_file_name): Change return type to const
+       char * to silence gcc warning.
+       (gpgme_get_engine_info): Use transitional variable to go from
+       const char * to char * to silence gcc warning.
+       (_gpgme_set_engine_info): Likewise.
+       * engine-gpgsm.c (struct engine_gpgsm): Change type of LINE to
+       char * to silence gcc warning.
+       (gpgsm_new): Make ARGV a pointer to const char.
+       (status_handler): Change type of SRC, END, DST, ALINE and NEWLINE
+       to char * to silence gcc warning.
+
        * gpgme.def: Add gpgme_data_set_file_name,
        gpgme_data_get_file_name, gpgme_sig_notation_clear,
        gpgme_sig_notation_add and gpgme_sig_notation_get.
index 4863119945febae2c09ca08aad998f7625a54d68..27fadbc7e4b8674ce862f3e3625208c4b3adb741 100644 (file)
@@ -33,7 +33,7 @@ struct engine_ops
   /* Static functions.  */
 
   /* Return the default file name for the binary of this engine.  */
-  char *(*get_file_name) (void);
+  const char *(*get_file_name) (void);
 
   /* Returns a malloced string containing the version of the engine
      with the given binary file name (or the default if FILE_NAME is
index c96be8888653a1b3b33827c8d95a151552b325dc..44dbd1f01cc67a6482221374beb35bb1d7775e88 100644 (file)
@@ -85,7 +85,7 @@ struct engine_gpgsm
     void *fnc_value;
     struct
     {
-      unsigned char *line;
+      char *line;
       int linesize;
       int linelen;
     } attic;
@@ -320,7 +320,7 @@ gpgsm_new (void **engine, const char *file_name, const char *home_dir,
 {
   gpgme_error_t err = 0;
   engine_gpgsm_t gpgsm;
-  char *argv[5];
+  const char *argv[5];
   int argc;
   int fds[2];
   int child_fds[4];
@@ -749,17 +749,16 @@ status_handler (void *opaque, int fd)
           /* FIXME We can't use this for binary data because we
              assume this is a string.  For the current usage of colon
              output it is correct.  */
-          unsigned char *src = line + 2;
-         unsigned char *end = line + linelen;
-         unsigned char *dst;
-          unsigned char **aline = &gpgsm->colon.attic.line;
+          char *src = line + 2;
+         char *end = line + linelen;
+         char *dst;
+          char **aline = &gpgsm->colon.attic.line;
          int *alinelen = &gpgsm->colon.attic.linelen;
 
          if (gpgsm->colon.attic.linesize
              < *alinelen + linelen + 1)
            {
-             unsigned char *newline = realloc (*aline,
-                                               *alinelen + linelen + 1);
+             char *newline = realloc (*aline, *alinelen + linelen + 1);
              if (!newline)
                err = gpg_error_from_errno (errno);
              else
@@ -778,7 +777,7 @@ status_handler (void *opaque, int fd)
                    {
                      /* Handle escaped characters.  */
                      ++src;
-                     *dst = (unsigned char) _gpgme_hextobyte (src);
+                     *dst = _gpgme_hextobyte (src);
                      (*alinelen)++;
                      src += 2;
                    }
index b331e9a8f001bae017388d7738e33a19a253b6c6..51f797e8eca38d539a8adda970daaa897983c95e 100644 (file)
@@ -60,7 +60,7 @@ DEFINE_STATIC_LOCK (engine_info_lock);
 
 \f
 /* Get the file name of the engine for PROTOCOL.  */
-static char *
+static const char *
 engine_get_file_name (gpgme_protocol_t proto)
 {
   if (proto > DIM (engine_ops))
@@ -155,12 +155,13 @@ gpgme_get_engine_info (gpgme_engine_info_t *info)
 
       for (proto = 0; proto < DIM (proto_list); proto++)
        {
-         char *file_name = engine_get_file_name (proto_list[proto]);
+         const char *ofile_name = engine_get_file_name (proto_list[proto]);
+         char *file_name;
 
-         if (!file_name)
+         if (!ofile_name)
            continue;
 
-         file_name = strdup (file_name);
+         file_name = strdup (ofile_name);
 
          *lastp = malloc (sizeof (*engine_info));
          if (!*lastp || !file_name)
@@ -304,9 +305,9 @@ _gpgme_set_engine_info (gpgme_engine_info_t info, gpgme_protocol_t proto,
     new_file_name = strdup (file_name);
   else
     {
-      new_file_name = engine_get_file_name (proto);
-      assert (new_file_name);
-      new_file_name = strdup (new_file_name);
+      const char *ofile_name = engine_get_file_name (proto);
+      assert (ofile_name);
+      new_file_name = strdup (ofile_name);
     }
   if (!new_file_name)
     return gpg_error_from_errno (errno);
index 3179e27c70df587157d21424dd065dc5bb3dfc1a..be9c9b73aa703c63e8a0f404b2b0bbfa90992813 100644 (file)
@@ -42,6 +42,13 @@ gpgme_error_t _gpgme_engine_info_copy (gpgme_engine_info_t *r_info);
 /* Release the engine info INFO.  */
 void _gpgme_engine_info_release (gpgme_engine_info_t info);
 
+/* Set the engine info for the info list INFO, protocol PROTO, to the
+   file name FILE_NAME and the home directory HOME_DIR.  */
+gpgme_error_t _gpgme_set_engine_info (gpgme_engine_info_t info,
+                                     gpgme_protocol_t praoto,
+                                     const char *file_name,
+                                     const char *home_dir);
+
 
 gpgme_error_t _gpgme_engine_new (gpgme_engine_info_t info,
                                 engine_t *r_engine,