[frogr] Don't use crypt thread callbacks for newer versions of libgcrypt



commit 1b127dbf0a4c3572c3ad534c2c74fd3a5f9a8928
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Sat Jan 3 07:37:03 2015 +0100

    Don't use crypt thread callbacks for newer versions of libgcrypt
    
    Gcrypt thread callbacks are not used anymore since libgcrypt 1.6,
    so avoid using them if building against that version of the library
    to avoid deprecation warnings.

 src/examples/example.c      |    6 +++++-
 src/flicksoup/fsp-session.c |    5 ++++-
 src/main.c                  |    6 +++++-
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/examples/example.c b/src/examples/example.c
index f4af645..f9fb06b 100644
--- a/src/examples/example.c
+++ b/src/examples/example.c
@@ -28,8 +28,9 @@
 #include <flicksoup/flicksoup.h>
 #include <libsoup/soup.h>
 
-/* Early for gcrypt pthread threads support */
+#if GCRYPT_VERSION_NUMBER < 0x010600
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
 
 #define API_KEY "18861766601de84f0921ce6be729f925"
 #define SHARED_SECRET "6233fbefd85f733a"
@@ -778,8 +779,11 @@ main                                    (int    argc,
 
   g_print ("Running flicksoup example...\n\n");
 
+#if GCRYPT_VERSION_NUMBER < 0x010600
   /* Initialize gcrypt at the very beginning */
   gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
+
   /* Version check should be almost the very first call because it
      makes sure that important subsystems are initialized. */
   g_assert (gcry_check_version (LIBGCRYPT_MIN_VERSION));
diff --git a/src/flicksoup/fsp-session.c b/src/flicksoup/fsp-session.c
index 42740d3..fc012c6 100644
--- a/src/flicksoup/fsp-session.c
+++ b/src/flicksoup/fsp-session.c
@@ -33,8 +33,9 @@
 #include <stdarg.h>
 #include <string.h>
 
-/* We need this macro defined to properly initialize gcrypt */
+#if GCRYPT_VERSION_NUMBER < 0x010600
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
 
 #define FLICKR_API_BASE_URL   "https://api.flickr.com/services/rest";
 #define FLICKR_API_UPLOAD_URL "https://up.flickr.com/services/upload";
@@ -529,7 +530,9 @@ _init_gcrypt                            (void)
                  "flicksoup will initialize gcrypt now, "
                  "but consider to initialize gcrypt yourself "
                  "at the beginning of this program.");
+#if GCRYPT_VERSION_NUMBER < 0x010600
       gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
       /* Version check should be almost the very first call because it
          makes sure that important subsystems are initialized. */
       g_assert (gcry_check_version (LIBGCRYPT_MIN_VERSION));
diff --git a/src/main.c b/src/main.c
index 993ff5b..23ace16 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,8 +33,9 @@
 #include <gcrypt.h>
 #include <pthread.h>
 
-/* Early for gcrypt pthread threads support */
+#if GCRYPT_VERSION_NUMBER < 0x010600
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
 
 int
 main (int argc, char **argv)
@@ -53,8 +54,11 @@ main (int argc, char **argv)
     }
 #endif
 
+#if GCRYPT_VERSION_NUMBER < 0x010600
   /* Initialize gcrypt at the very beginning */
   gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
+
   /* Version check should be almost the very first call because it
      makes sure that important subsystems are initialized. */
   g_assert (gcry_check_version (LIBGCRYPT_MIN_VERSION));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]