Package: libgcrypt11-dev
Version: 1.2.2-1
Severity: normal
Tags: patch

Hi,

when I try to use GCRY_THREAD_OPTION_PTHREAD_IMPL from /usr/include/gcrypt.h 
with g++, there are compilation problems due to missing casts from void * to 
pthread_mutex_t * and back. The following version works for me quite well:

static int gcry_pthread_mutex_init (void **priv)
{
  int err = 0;
  pthread_mutex_t *lock = (pthread_mutex_t*) malloc (sizeof 
(pthread_mutex_t));

  if (!lock)
    err = ENOMEM;
  if (!err)
    {
      err = pthread_mutex_init (lock, NULL);
      if (err)
        free (lock);
      else
        *priv = lock;
    }
  return err;
}
static int gcry_pthread_mutex_destroy (void **lock)
  { int err = pthread_mutex_destroy ((pthread_mutex_t*) *lock);  free (*lock); 
return err; }
static int gcry_pthread_mutex_lock (void **lock)
  { return pthread_mutex_lock ((pthread_mutex_t*) *lock); }
static int gcry_pthread_mutex_unlock (void **lock)
  { return pthread_mutex_unlock ((pthread_mutex_t *) *lock); }

static struct gcry_thread_cbs gcry_threads_pthread =
{ GCRY_THREAD_OPTION_PTHREAD, NULL,
  gcry_pthread_mutex_init, gcry_pthread_mutex_destroy,
  gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock };


NOTE that this is not the macro version, but easily to be created. I don't 
know if the other macros are causing problems, too.


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-k7
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-15) (ignored: LC_ALL set to 
[EMAIL PROTECTED])

Versions of packages libgcrypt11-dev depends on:
ii  libc6-dev [libc-dev]        2.3.6-3    GNU C Library: Development Librari
ii  libgcrypt11                 1.2.2-1    LGPL Crypto library - runtime libr
ii  libgpg-error-dev          1.2-1      library for common error values an

libgcrypt11-dev recommends no packages.

-- no debconf information

Attachment: pgp4yjLvqaXwd.pgp
Description: PGP signature

Reply via email to