w32: Remove all support for WindowsCE
[gpgme.git] / src / util.h
index a1be6e7..cea5e1f 100644 (file)
 #define UTIL_H
 
 #ifdef HAVE_W32_SYSTEM
-# ifdef HAVE_W32CE_SYSTEM
-#  include "w32-ce.h"
-# else
-#  include "winsock2.h"
-#  include "windows.h"
-# endif
+# include "winsock2.h"
+# include "windows.h"
 #endif
 
 /* For pid_t.  */
 \f
 #define DIM(v) (sizeof(v)/sizeof((v)[0]))
 
-#if GPG_ERROR_VERSION_NUMBER < 0x011500 /* 1.21 */
-# define GPG_ERR_FALSE 256
-#endif
-
 #if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */
 # define GPG_ERR_ENGINE_TOO_OLD 300
 # define GPG_ERR_TOO_OLD        308
@@ -95,11 +87,12 @@ _gpgme_stpcpy (char *a, const char *b)
 #define stpcpy(a,b) _gpgme_stpcpy ((a), (b))
 #endif /*!HAVE_STPCPY*/
 
-#if !HAVE_VASPRINTF
-#include <stdarg.h>
-int vasprintf (char **result, const char *format, va_list args);
-int asprintf (char **result, const char *format, ...);
-#endif
+
+/* Due to a bug in mingw32's snprintf related to the 'l' modifier and
+   for increased portability we use our snprintf on all systems. */
+#undef snprintf
+#define snprintf gpgrt_snprintf
+
 
 #if REPLACE_TTYNAME_R
 int _gpgme_ttyname_r (int fd, char *buf, size_t buflen);
@@ -164,11 +157,15 @@ gpgme_off_t _gpgme_string_to_off (const char *string);
    point to the next non-parsed character in TIMESTRING. */
 time_t _gpgme_parse_timestamp (const char *timestamp, char **endp);
 
-
-gpgme_error_t _gpgme_map_gnupg_error (char *err);
+/* Variant of _gpgme_parse_timestamp to return an unsigned long or 0
+ * on error or missing timestamp.  */
+unsigned long _gpgme_parse_timestamp_ul (const char *timestamp);
 
 int _gpgme_map_pk_algo (int algo, gpgme_protocol_t protocol);
 
+const char *_gpgme_cipher_algo_name (int algo, gpgme_protocol_t protocol);
+const char *_gpgme_cipher_mode_name (int algo, gpgme_protocol_t protocol);
+
 \f
 /*-- b64dec.c --*/
 
@@ -207,9 +204,6 @@ const char *_gpgme_status_to_string (gpgme_status_code_t code);
 int _gpgme_mkstemp (int *fd, char **name);
 const char *_gpgme_get_w32spawn_path (void);
 #endif /*HAVE_W32_SYSTEM*/
-#ifdef HAVE_W32CE_SYSTEM
-char *_gpgme_w32ce_get_debug_envvar (void);
-#endif /*HAVE_W32CE_SYSTEM*/
 
 
 \f
@@ -220,4 +214,26 @@ extern struct assuan_malloc_hooks _gpgme_assuan_malloc_hooks;
 int _gpgme_assuan_log_cb (assuan_context_t ctx, void *hook,
                          unsigned int cat, const char *msg);
 
+\f
+
+/* Parse the compliance field.  */
+#define PARSE_COMPLIANCE_FLAGS(flags, result)                          \
+  do {                                                                 \
+    char *comp_p, *comp_endp;                                          \
+    unsigned long comp_ul;                                             \
+                                                                       \
+    for (comp_p = (flags);                                             \
+        comp_p                                                         \
+          && (comp_ul = strtoul (comp_p, &comp_endp, 10))              \
+          && comp_p != comp_endp;                                      \
+        comp_p = comp_endp)                                            \
+      {                                                                        \
+       switch (comp_ul)                                                \
+         {                                                             \
+         case 23: (result)->is_de_vs = 1; break;                       \
+         }                                                             \
+      }                                                                        \
+  } while (0)
+
+
 #endif /* UTIL_H */