[svn] gcry - r1252 - in trunk: cipher src
svn author marcus
cvs at cvs.gnupg.org
Thu May 10 00:20:56 CEST 2007
Author: marcus
Date: 2007-05-10 00:20:26 +0200 (Thu, 10 May 2007)
New Revision: 1252
Modified:
trunk/cipher/ChangeLog
trunk/cipher/ac.c
trunk/src/ChangeLog
trunk/src/gcrypt.h.in
Log:
src/
2007-05-09 Marcus Brinkmann <marcus at g10code.de>
* gcrypt.h.in (gcry_ac_io_t): Add name for anonymous union, and mark
all members as internal (actually: deprecated).
cipher/
2007-05-09 Marcus Brinkmann <marcus at g10code.de>
* ac.c (_gcry_ac_io_init_va, _gcry_ac_io_write, _gcry_ac_io_read):
Adjust users of gcry_ac_io_t because union is not anonymous
anymore.
Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog 2007-05-09 18:13:31 UTC (rev 1251)
+++ trunk/cipher/ChangeLog 2007-05-09 22:20:26 UTC (rev 1252)
@@ -1,3 +1,9 @@
+2007-05-09 Marcus Brinkmann <marcus at g10code.de>
+
+ * ac.c (_gcry_ac_io_init_va, _gcry_ac_io_write, _gcry_ac_io_read):
+ Adjust users of gcry_ac_io_t because union is not anonymous
+ anymore.
+
2007-05-02 Werner Koch <wk at g10code.com>
* camellia-glue.c (camellia_setkey, camellia_encrypt)
Modified: trunk/cipher/ac.c
===================================================================
--- trunk/cipher/ac.c 2007-05-09 18:13:31 UTC (rev 1251)
+++ trunk/cipher/ac.c 2007-05-09 22:20:26 UTC (rev 1252)
@@ -946,13 +946,13 @@
switch (type)
{
case GCRY_AC_IO_STRING:
- ac_io->readable.string.data = va_arg (ap, unsigned char *);
- ac_io->readable.string.data_n = va_arg (ap, size_t);
+ ac_io->io.readable.string.data = va_arg (ap, unsigned char *);
+ ac_io->io.readable.string.data_n = va_arg (ap, size_t);
break;
case GCRY_AC_IO_CALLBACK:
- ac_io->readable.callback.cb = va_arg (ap, gcry_ac_data_read_cb_t);
- ac_io->readable.callback.opaque = va_arg (ap, void *);
+ ac_io->io.readable.callback.cb = va_arg (ap, gcry_ac_data_read_cb_t);
+ ac_io->io.readable.callback.opaque = va_arg (ap, void *);
break;
}
break;
@@ -960,13 +960,13 @@
switch (type)
{
case GCRY_AC_IO_STRING:
- ac_io->writable.string.data = va_arg (ap, unsigned char **);
- ac_io->writable.string.data_n = va_arg (ap, size_t *);
+ ac_io->io.writable.string.data = va_arg (ap, unsigned char **);
+ ac_io->io.writable.string.data_n = va_arg (ap, size_t *);
break;
case GCRY_AC_IO_CALLBACK:
- ac_io->writable.callback.cb = va_arg (ap, gcry_ac_data_write_cb_t);
- ac_io->writable.callback.opaque = va_arg (ap, void *);
+ ac_io->io.writable.callback.cb = va_arg (ap, gcry_ac_data_write_cb_t);
+ ac_io->io.writable.callback.opaque = va_arg (ap, void *);
break;
}
break;
@@ -1022,18 +1022,18 @@
{
unsigned char *p;
- if (*ac_io->writable.string.data)
+ if (*ac_io->io.writable.string.data)
{
- p = gcry_realloc (*ac_io->writable.string.data,
- *ac_io->writable.string.data_n + buffer_n);
+ p = gcry_realloc (*ac_io->io.writable.string.data,
+ *ac_io->io.writable.string.data_n + buffer_n);
if (! p)
err = gcry_error_from_errno (errno);
else
{
- if (*ac_io->writable.string.data != p)
- *ac_io->writable.string.data = p;
- memcpy (p + *ac_io->writable.string.data_n, buffer, buffer_n);
- *ac_io->writable.string.data_n += buffer_n;
+ if (*ac_io->io.writable.string.data != p)
+ *ac_io->io.writable.string.data = p;
+ memcpy (p + *ac_io->io.writable.string.data_n, buffer, buffer_n);
+ *ac_io->io.writable.string.data_n += buffer_n;
}
}
else
@@ -1047,16 +1047,16 @@
else
{
memcpy (p, buffer, buffer_n);
- *ac_io->writable.string.data = p;
- *ac_io->writable.string.data_n = buffer_n;
+ *ac_io->io.writable.string.data = p;
+ *ac_io->io.writable.string.data_n = buffer_n;
}
}
}
break;
case GCRY_AC_IO_CALLBACK:
- err = (*ac_io->writable.callback.cb) (ac_io->writable.callback.opaque,
- buffer, buffer_n);
+ err = (*ac_io->io.writable.callback.cb) (ac_io->io.writable.callback.opaque,
+ buffer, buffer_n);
break;
}
@@ -1084,7 +1084,7 @@
size_t bytes_to_read;
size_t bytes_wanted;
- bytes_available = ac_io->readable.string.data_n - nread;
+ bytes_available = ac_io->io.readable.string.data_n - nread;
bytes_wanted = *buffer_n;
if (bytes_wanted > bytes_available)
@@ -1092,15 +1092,15 @@
else
bytes_to_read = bytes_wanted;
- memcpy (buffer, ac_io->readable.string.data + nread, bytes_to_read);
+ memcpy (buffer, ac_io->io.readable.string.data + nread, bytes_to_read);
*buffer_n = bytes_to_read;
err = 0;
break;
}
case GCRY_AC_IO_CALLBACK:
- err = (*ac_io->readable.callback.cb) (ac_io->readable.callback.opaque,
- buffer, buffer_n);
+ err = (*ac_io->io.readable.callback.cb)
+ (ac_io->io.readable.callback.opaque, buffer, buffer_n);
break;
}
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-05-09 18:13:31 UTC (rev 1251)
+++ trunk/src/ChangeLog 2007-05-09 22:20:26 UTC (rev 1252)
@@ -1,3 +1,8 @@
+2007-05-09 Marcus Brinkmann <marcus at g10code.de>
+
+ * gcrypt.h.in (gcry_ac_io_t): Add name for anonymous union, and mark
+ all members as internal (actually: deprecated).
+
2007-05-04 Werner Koch <wk at g10code.com>
* Makefile.am (.rc.lo): New to replace gmake specific suffix rule.
Modified: trunk/src/gcrypt.h.in
===================================================================
--- trunk/src/gcrypt.h.in 2007-05-09 18:13:31 UTC (rev 1251)
+++ trunk/src/gcrypt.h.in 2007-05-09 22:20:26 UTC (rev 1252)
@@ -101,6 +101,15 @@
#define _GCRY_GCC_ATTR_MALLOC
#endif
+/* Some members in a public type should only be used internally.
+ There is no "internal" attribute, so we abuse the deprecated
+ attribute to discourage external use. */
+#ifdef _GCRYPT_IN_LIBGCRYPT
+#define _GCRY_ATTR_INTERNAL
+#else
+#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
+#endif
+
/* Wrappers for the libgpg-error library. */
typedef gpg_error_t gcry_error_t;
@@ -1253,8 +1262,8 @@
typedef struct gcry_ac_io
{
/* This is an INTERNAL structure, do NOT use manually. */
- gcry_ac_io_mode_t mode;
- gcry_ac_io_type_t type;
+ gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
+ gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
union
{
union
@@ -1285,7 +1294,7 @@
} string;
void *opaque;
} writable;
- };
+ } io _GCRY_ATTR_INTERNAL;
}
gcry_ac_io_t;
More information about the Gnupg-commits
mailing list