[git] GPG-ERROR - branch, master, updated. libgpg-error-1.27-240-gf9a33a7

by Werner Koch cvs at cvs.gnupg.org
Mon Dec 11 16:38:16 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Error codes used by GnuPG et al.".

The branch, master has been updated
       via  f9a33a7f7e44a644ff4e31f7e9f1c2c1ec1f8eee (commit)
       via  de167fa92d009745c51dae547990845282cbb351 (commit)
      from  4acf116ba6d144c2cfa39ff54a23b8864b4ce895 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f9a33a7f7e44a644ff4e31f7e9f1c2c1ec1f8eee
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 11 16:33:37 2017 +0100

    core: Avoid using estream_t in the public API.
    
    * src/gpg-error.h.in: Always use gpgrt_stream-t.
    --
    
    estream_t can only be used if GPGRT_ENABLE_ES_MACROS is defined.
    
    Fixes-commit: 1865c0ba1769b407a3c504f1ab0a4278704a9fc1
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 86c6a8a..46e8f53 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -1035,7 +1035,7 @@ void _gpgrt_log_assert (const char *expr, const char *file, int line,
 #define GPGRT_SPAWN_DETACHED  128 /* Start the process in the background.  */
 
 /* Function and convenience macros to create pipes.  */
-gpg_err_code_t gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
+gpg_err_code_t gpgrt_make_pipe (int filedes[2], gpgrt_stream_t *r_fp,
                                 int direction, int nonblock);
 #define gpgrt_create_pipe(a)              gpgrt_make_pipe ((a),NULL,  0,  0);
 #define gpgrt_create_inbound_pipe(a,b,c)  gpgrt_make_pipe ((a), (b), -1,(c));
@@ -1046,9 +1046,9 @@ gpg_err_code_t gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
 gpg_err_code_t gpgrt_spawn_process (const char *pgmname, const char *argv[],
                                     int *execpt, void (*preexec)(void),
                                     unsigned int flags,
-                                    estream_t *r_infp,
-                                    estream_t *r_outfp,
-                                    estream_t *r_errfp,
+                                    gpgrt_stream_t *r_infp,
+                                    gpgrt_stream_t *r_outfp,
+                                    gpgrt_stream_t *r_errfp,
                                     pid_t *pid);
 
 /* Fork and exec PGNNAME and connect the process to the given FDs.  */
@@ -1075,6 +1075,35 @@ void gpgrt_kill_process (pid_t pid);
 /* Release process resources identified by PID.  */
 void gpgrt_release_process (pid_t pid);
 
+/*
+ * Time functions
+ */
+
+/* Our representation of time requires 8 byte.  The value guaranteed
+ * to be a C string with no '\n' in it.  The time is always UTC.  */
+typedef unsigned char gpgrt_time_t[8];
+
+/* Check that ATIME is a valid time.  */
+gpg_err_code_t gpgrt_check_time (const gpgrt_time_t atime);
+
+/* Convert time into a Julian Date.  Returns 0 for invalid dates.  */
+unsigned int gpgrt_time2jd (const gpgrt_time_t atime, int *r_seconds);
+
+/* Convert the Julian Date (JD,SECS) into a time.  If SECS is -1 noon
+ * is assumed.  */
+void gpgrt_jd2time (gpgrt_time_t atime, unsigned int jd, int secs);
+
+/* Convert a time into a Julian Date and return it as a float with
+ * fractional seconds.  */
+static GPG_ERR_INLINE double
+gpgrt_time2jd_dbl (const gpgrt_time_t atime)
+{
+  unsigned int jd;
+  int secs;
+  jd = gpgrt_time2jd (atime, &secs);
+  return jd + (secs/86400.0);
+}
+
 
 
 #ifdef __cplusplus

commit de167fa92d009745c51dae547990845282cbb351
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Dec 8 13:31:07 2017 +0100

    core: Rename the gpgrt_log_levels enum values.
    
    * src/gpg-error.h.in (gprt_log_levels): Rename to GPGRT_LOGLVL.
    --
    
    Explicitly naming them and not distinguishing them from the other log
    constants is a Good Thing anyway.  It also helps against the symbol name
    clash with the GPGRT enum values from gnupg's logging module.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 991636d..86c6a8a 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -928,18 +928,18 @@ gpg_error_t gpgrt_b64dec_finish (gpgrt_b64state_t state);
 /* Log levels as used by gpgrt_log.  */
 enum gpgrt_log_levels
   {
-    GPGRT_LOG_BEGIN,
-    GPGRT_LOG_CONT,
-    GPGRT_LOG_INFO,
-    GPGRT_LOG_WARN,
-    GPGRT_LOG_ERROR,
-    GPGRT_LOG_FATAL,
-    GPGRT_LOG_BUG,
-    GPGRT_LOG_DEBUG
+    GPGRT_LOGLVL_BEGIN,
+    GPGRT_LOGLVL_CONT,
+    GPGRT_LOGLVL_INFO,
+    GPGRT_LOGLVL_WARN,
+    GPGRT_LOGLVL_ERROR,
+    GPGRT_LOGLVL_FATAL,
+    GPGRT_LOGLVL_BUG,
+    GPGRT_LOGLVL_DEBUG
   };
 
 
-/* The next 4 fucntions are not thread-safe - call them early.  */
+/* The next 4 functions are not thread-safe - call them early.  */
 void gpgrt_log_set_sink (const char *name, gpgrt_stream_t stream, int fd);
 void gpgrt_log_set_socket_dir_cb (const char *(*fnc)(void));
 void gpgrt_log_set_pid_suffix_cb (int (*cb)(unsigned long *r_value));
diff --git a/src/logging.c b/src/logging.c
index 70c13ba..1a4f620 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -688,7 +688,7 @@ print_prefix (int level, int leading_backspace)
   int rc;
   int length = 0;
 
-  if (level != GPGRT_LOG_CONT)
+  if (level != GPGRT_LOGLVL_CONT)
     { /* Note this does not work for multiple line logging as we would
        * need to print to a buffer first */
       if (with_time && !force_prefixes)
@@ -741,20 +741,20 @@ print_prefix (int level, int leading_backspace)
 
   switch (level)
     {
-    case GPGRT_LOG_BEGIN: break;
-    case GPGRT_LOG_CONT: break;
-    case GPGRT_LOG_INFO: break;
-    case GPGRT_LOG_WARN: break;
-    case GPGRT_LOG_ERROR: break;
-    case GPGRT_LOG_FATAL:
+    case GPGRT_LOGLVL_BEGIN: break;
+    case GPGRT_LOGLVL_CONT: break;
+    case GPGRT_LOGLVL_INFO: break;
+    case GPGRT_LOGLVL_WARN: break;
+    case GPGRT_LOGLVL_ERROR: break;
+    case GPGRT_LOGLVL_FATAL:
       _gpgrt_fputs_unlocked ("Fatal: ", logstream);
       length += 7;
       break;
-    case GPGRT_LOG_BUG:
+    case GPGRT_LOGLVL_BUG:
       _gpgrt_fputs_unlocked ("Ohhhh jeeee: ", logstream);
       length += 13;
       break;
-    case GPGRT_LOG_DEBUG:
+    case GPGRT_LOGLVL_DEBUG:
       _gpgrt_fputs_unlocked ("DBG: ", logstream);
       length += 5;
       break;
@@ -800,7 +800,7 @@ _gpgrt_logv_internal (int level, int ignore_arg_ptr, const char *extrastring,
     }
 
   _gpgrt_flockfile (logstream);
-  if (missing_lf && level != GPGRT_LOG_CONT)
+  if (missing_lf && level != GPGRT_LOGLVL_CONT)
     _gpgrt_putc_unlocked ('\n', logstream );
   missing_lf = 0;
 
@@ -904,14 +904,14 @@ _gpgrt_logv_internal (int level, int ignore_arg_ptr, const char *extrastring,
         }
     }
 
-  if (level == GPGRT_LOG_FATAL)
+  if (level == GPGRT_LOGLVL_FATAL)
     {
       if (missing_lf)
         _gpgrt_putc_unlocked ('\n', logstream);
       _gpgrt_funlockfile (logstream);
       exit (2);
     }
-  else if (level == GPGRT_LOG_BUG)
+  else if (level == GPGRT_LOGLVL_BUG)
     {
       if (missing_lf)
         _gpgrt_putc_unlocked ('\n', logstream );
@@ -935,7 +935,7 @@ _gpgrt_logv_internal (int level, int ignore_arg_ptr, const char *extrastring,
     _gpgrt_funlockfile (logstream);
 
   /* Bumb the error counter for log_error.  */
-  if (level == GPGRT_LOG_ERROR)
+  if (level == GPGRT_LOGLVL_ERROR)
     {
       /* Protect against counter overflow.  */
       if (errorcount < 30000)
@@ -1003,7 +1003,7 @@ _gpgrt_log_info (const char *fmt, ...)
   va_list arg_ptr ;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_INFO, 0, NULL, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_INFO, 0, NULL, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -1014,7 +1014,7 @@ _gpgrt_log_error (const char *fmt, ...)
   va_list arg_ptr ;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_ERROR, 0, NULL, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_ERROR, 0, NULL, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -1025,7 +1025,7 @@ _gpgrt_log_fatal (const char *fmt, ...)
   va_list arg_ptr ;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_FATAL, 0, NULL, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_FATAL, 0, NULL, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
   abort (); /* Never called; just to make the compiler happy.  */
 }
@@ -1037,7 +1037,7 @@ _gpgrt_log_bug (const char *fmt, ...)
   va_list arg_ptr ;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_BUG, 0, NULL, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_BUG, 0, NULL, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
   abort (); /* Never called; just to make the compiler happy.  */
 }
@@ -1049,7 +1049,7 @@ _gpgrt_log_debug (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_DEBUG, 0, NULL, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_DEBUG, 0, NULL, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -1063,7 +1063,7 @@ _gpgrt_log_debug_string (const char *string, const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_DEBUG, 0, string, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_DEBUG, 0, string, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -1074,7 +1074,8 @@ _gpgrt_log_printf (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (fmt ? GPGRT_LOG_CONT : GPGRT_LOG_BEGIN, 0, NULL, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (fmt ? GPGRT_LOGLVL_CONT : GPGRT_LOGLVL_BEGIN,
+                        0, NULL, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -1084,7 +1085,7 @@ _gpgrt_log_printf (const char *fmt, ...)
 void
 _gpgrt_log_flush (void)
 {
-  do_log_ignore_arg (GPGRT_LOG_CONT, NULL);
+  do_log_ignore_arg (GPGRT_LOGLVL_CONT, NULL);
 }
 
 
@@ -1103,7 +1104,7 @@ _gpgrt_logv_printhex (const void *buffer, size_t length,
   /* FIXME: This printing is not yet protected by _gpgrt_flockfile.  */
   if (fmt && *fmt)
     {
-      _gpgrt_logv_internal (GPGRT_LOG_DEBUG, 0, NULL, NULL, fmt, arg_ptr);
+      _gpgrt_logv_internal (GPGRT_LOGLVL_DEBUG, 0, NULL, NULL, fmt, arg_ptr);
       wrap = 1;
     }
 
@@ -1175,13 +1176,14 @@ _gpgrt_logv_clock (const char *fmt, va_list arg_ptr)
     initial = now;
 
   snprintf (clockbuf, sizeof clockbuf, "[%6llu] ", (now - initial)/1000);
-  _gpgrt_logv_internal (GPGRT_LOG_DEBUG, 0, NULL, clockbuf, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_DEBUG, 0, NULL, clockbuf, fmt, arg_ptr);
 
 #else /*!ENABLE_LOG_CLOCK*/
 
   /* You may need to link with -ltr to use the above code.  */
 
-  _gpgrt_logv_internal (GPGRT_LOG_DEBUG, 0, NULL, "[no clock] ", fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_DEBUG,
+                        0, NULL, "[no clock] ", fmt, arg_ptr);
 
 #endif  /*!ENABLE_LOG_CLOCK*/
 }
@@ -1204,10 +1206,10 @@ _gpgrt__log_assert (const char *expr, const char *file,
                    int line, const char *func)
 {
 #ifdef GPGRT_HAVE_MACRO_FUNCTION
-  _gpgrt_log (GPGRT_LOG_BUG, "Assertion \"%s\" in %s failed (%s:%d)\n",
+  _gpgrt_log (GPGRT_LOGLVL_BUG, "Assertion \"%s\" in %s failed (%s:%d)\n",
               expr, func, file, line);
 #else /*!GPGRT_HAVE_MACRO_FUNCTION*/
-  _gpgrt_log (GPGRT_LOG_BUG, "Assertion \"%s\" failed (%s:%d)\n",
+  _gpgrt_log (GPGRT_LOGLVL_BUG, "Assertion \"%s\" failed (%s:%d)\n",
            expr, file, line);
 #endif /*!GPGRT_HAVE_MACRO_FUNCTION*/
   abort (); /* Never called; just to make the compiler happy.  */
diff --git a/src/visibility.c b/src/visibility.c
index fb187a5..2039ef7 100644
--- a/src/visibility.c
+++ b/src/visibility.c
@@ -905,7 +905,7 @@ gpgrt_log_info (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv (GPGRT_LOG_INFO, fmt, arg_ptr);
+  _gpgrt_logv (GPGRT_LOGLVL_INFO, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -915,7 +915,7 @@ gpgrt_log_error (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv (GPGRT_LOG_ERROR, fmt, arg_ptr);
+  _gpgrt_logv (GPGRT_LOGLVL_ERROR, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -925,7 +925,7 @@ gpgrt_log_fatal (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv (GPGRT_LOG_FATAL, fmt, arg_ptr);
+  _gpgrt_logv (GPGRT_LOGLVL_FATAL, fmt, arg_ptr);
   va_end (arg_ptr);
   abort (); /* Never called; just to make the compiler happy.  */
 }
@@ -936,7 +936,7 @@ gpgrt_log_bug (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv (GPGRT_LOG_BUG, fmt, arg_ptr);
+  _gpgrt_logv (GPGRT_LOGLVL_BUG, fmt, arg_ptr);
   va_end (arg_ptr);
   abort (); /* Never called; just to make the compiler happy.  */
 }
@@ -947,7 +947,7 @@ gpgrt_log_debug (const char *fmt, ...)
   va_list arg_ptr ;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv (GPGRT_LOG_DEBUG, fmt, arg_ptr);
+  _gpgrt_logv (GPGRT_LOGLVL_DEBUG, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -957,7 +957,7 @@ gpgrt_log_debug_string (const char *string, const char *fmt, ...)
   va_list arg_ptr ;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv_internal (GPGRT_LOG_DEBUG, 0, string, NULL, fmt, arg_ptr);
+  _gpgrt_logv_internal (GPGRT_LOGLVL_DEBUG, 0, string, NULL, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 
@@ -967,7 +967,7 @@ gpgrt_log_printf (const char *fmt, ...)
   va_list arg_ptr;
 
   va_start (arg_ptr, fmt);
-  _gpgrt_logv (fmt ? GPGRT_LOG_CONT : GPGRT_LOG_BEGIN, fmt, arg_ptr);
+  _gpgrt_logv (fmt ? GPGRT_LOGLVL_CONT : GPGRT_LOGLVL_BEGIN, fmt, arg_ptr);
   va_end (arg_ptr);
 }
 

-----------------------------------------------------------------------

Summary of changes:
 src/gpg-error.h.in | 55 +++++++++++++++++++++++++++++++++++++++++-------------
 src/logging.c      | 54 +++++++++++++++++++++++++++--------------------------
 src/visibility.c   | 14 +++++++-------
 3 files changed, 77 insertions(+), 46 deletions(-)


hooks/post-receive
-- 
Error codes used by GnuPG et al.
http://git.gnupg.org




More information about the Gnupg-commits mailing list