[svn] assuan - r251 - in trunk: doc src
svn author marcus
cvs at cvs.gnupg.org
Mon Sep 3 14:29:39 CEST 2007
Author: marcus
Date: 2007-09-03 14:29:07 +0200 (Mon, 03 Sep 2007)
New Revision: 251
Modified:
trunk/doc/ChangeLog
trunk/doc/assuan.texi
trunk/src/ChangeLog
trunk/src/assuan-defs.h
trunk/src/assuan-inquire.c
trunk/src/assuan.h
Log:
doc/
2007-09-03 Marcus Brinkmann <marcus at g10code.de>
* assuan.texi: Fix prototype and documentation for
assuan_inquire_ext.
src/
2007-09-03 Marcus Brinkmann <marcus at g10code.de>
* assuan.h (assuan_inquire_ext): Move buffer and buffer_length
arguments callback in prototype.
* assuan-defs.h (struct assuan_context_s): Remove members
inquire_r_buffer and inquire_r_buffer_len. Add buffer and buffer
length arguments to inquire_cb.
* assuan-inquire.c (_assuan_inquire_ext_cb): Return buffer and
buffer length via callback.
(assuan_inquire_ext): Move buffer and buffer length arguments to
callback.
Modified: trunk/doc/ChangeLog
===================================================================
--- trunk/doc/ChangeLog 2007-08-24 05:59:50 UTC (rev 250)
+++ trunk/doc/ChangeLog 2007-09-03 12:29:07 UTC (rev 251)
@@ -1,3 +1,8 @@
+2007-09-03 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan.texi: Fix prototype and documentation for
+ assuan_inquire_ext.
+
2007-08-24 Werner Koch <wk at g10code.com>
* lgpl.texi: Replace by LGPLv2.1 version.
Modified: trunk/doc/assuan.texi
===================================================================
--- trunk/doc/assuan.texi 2007-08-24 05:59:50 UTC (rev 250)
+++ trunk/doc/assuan.texi 2007-09-03 12:29:07 UTC (rev 251)
@@ -1295,12 +1295,13 @@
regular end.
@end deftypefun
- at deftypefun assuan_error_t assuan_inquire_ext (@w{assuan_context_t @var{ctx}}, @w{const char *@var{keyword}}, @w{unsigned char **@var{r_buffer}}, @w{size_t *@var{r_length}}, @w{size_t @var{maxlen}}, @w{int (*@var{cb}) (void *cb_data, int rc)}, @w{void *@var{cb_data}})
+ at deftypefun assuan_error_t assuan_inquire_ext (@w{assuan_context_t @var{ctx}}, @w{const char *@var{keyword}}, @w{size_t @var{maxlen}}, @w{int (*@var{cb}) (void *cb_data, int rc, unsigned char *buffer, size_t buffer_len)}, @w{void *@var{cb_data}})
-This is the same as @code{assuan_inquire} but the caller has to
-provide the outer loop (using @code{assuan_process_next}). The caller
-should specify a continuation with @var{cb}, which receives
- at var{cb_data} as its first argument.
+This is similar to @code{assuan_inquire} but the caller has to provide
+the outer loop (using @code{assuan_process_next}). The caller should
+specify a continuation with @var{cb}, which receives @var{cb_data} as
+its first argument, and the error code as well as the inquired data as
+its remaining arguments.
@end deftypefun
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-08-24 05:59:50 UTC (rev 250)
+++ trunk/src/ChangeLog 2007-09-03 12:29:07 UTC (rev 251)
@@ -1,3 +1,17 @@
+<<<<<<< .mine
+2007-09-03 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan.h (assuan_inquire_ext): Move buffer and buffer_length
+ arguments callback in prototype.
+ * assuan-defs.h (struct assuan_context_s): Remove members
+ inquire_r_buffer and inquire_r_buffer_len. Add buffer and buffer
+ length arguments to inquire_cb.
+ * assuan-inquire.c (_assuan_inquire_ext_cb): Return buffer and
+ buffer length via callback.
+ (assuan_inquire_ext): Move buffer and buffer length arguments to
+ callback.
+
+=======
2007-08-24 Werner Koch <wk at g10code.com>
Switched license to back to LGPLv2.1.
@@ -2,2 +16,3 @@
+>>>>>>> .r250
2007-08-09 Marcus Brinkmann <marcus at g10code.de>
Modified: trunk/src/assuan-defs.h
===================================================================
--- trunk/src/assuan-defs.h 2007-08-24 05:59:50 UTC (rev 250)
+++ trunk/src/assuan-defs.h 2007-09-03 12:29:07 UTC (rev 251)
@@ -1,5 +1,5 @@
/* assuan-defs.c - Internal definitions to Assuan
- * Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -107,10 +107,8 @@
int in_command;
/* The following members are used by assuan_inquire_ext. */
- int (*inquire_cb) (void *cb_data, int rc);
+ int (*inquire_cb) (void *cb_data, int rc, unsigned char *buf, size_t len);
void *inquire_cb_data;
- unsigned char **inquire_r_buffer;
- size_t *inquire_r_buffer_len;
void *inquire_membuf;
char *hello_line;
Modified: trunk/src/assuan-inquire.c
===================================================================
--- trunk/src/assuan-inquire.c 2007-08-24 05:59:50 UTC (rev 250)
+++ trunk/src/assuan-inquire.c 2007-09-03 12:29:07 UTC (rev 251)
@@ -1,5 +1,5 @@
/* assuan-inquire.c - handle inquire stuff
- * Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -310,15 +310,20 @@
return 0;
leave:
- if (mb)
- {
- *(ctx->inquire_r_buffer) = get_membuf (mb, ctx->inquire_r_buffer_len);
- if (!*(ctx->inquire_r_buffer))
- rc = _assuan_error (ASSUAN_Out_Of_Core);
- free_membuf (mb);
- free (mb);
- }
- (ctx->inquire_cb) (ctx->inquire_cb_data, rc);
+ {
+ size_t buf_len = 0;
+ unsigned char *buf = NULL;
+
+ if (mb)
+ {
+ buf = get_membuf (mb, &buf_len);
+ if (!buf)
+ rc = _assuan_error (ASSUAN_Out_Of_Core);
+ free_membuf (mb);
+ free (mb);
+ }
+ (ctx->inquire_cb) (ctx->inquire_cb_data, rc, buf, buf_len);
+ }
return rc;
}
@@ -326,8 +331,6 @@
* assuan_inquire_ext:
* @ctx: An assuan context
* @keyword: The keyword used for the inquire
- * @r_buffer: Returns an allocated buffer
- * @r_length: Returns the length of this buffer
* @maxlen: If not 0, the size limit of the inquired data.
* @cb: A callback handler which is invoked after the operation completed.
* @cb_data: A user-provided value passed to the callback handler.
@@ -339,9 +342,10 @@
* Return value: 0 on success or an ASSUAN error code
**/
assuan_error_t
-assuan_inquire_ext (assuan_context_t ctx, const char *keyword,
- unsigned char **r_buffer, size_t *r_length, size_t maxlen,
- int (*cb) (void *cb_data, int rc), void *cb_data)
+assuan_inquire_ext (assuan_context_t ctx, const char *keyword, size_t maxlen,
+ int (*cb) (void *cb_data, int rc, unsigned char *buf,
+ size_t len),
+ void *cb_data)
{
assuan_error_t rc;
struct membuf *mb = NULL;
@@ -350,9 +354,7 @@
if (!ctx || !keyword || (10 + strlen (keyword) >= sizeof (cmdbuf)))
return _assuan_error (ASSUAN_Invalid_Value);
- nodataexpected = !r_buffer && !r_length && !maxlen;
- if (!nodataexpected && (!r_buffer || !r_length))
- return _assuan_error (ASSUAN_Invalid_Value);
+ nodataexpected = !maxlen;
if (!ctx->is_server)
return _assuan_error (ASSUAN_Not_A_Server);
if (ctx->in_inquire)
@@ -381,8 +383,6 @@
ctx->inquire_cb = cb;
ctx->inquire_cb_data = cb_data;
ctx->inquire_membuf = mb;
- ctx->inquire_r_buffer = r_buffer;
- ctx->inquire_r_buffer_len = r_length;
return 0;
}
Modified: trunk/src/assuan.h
===================================================================
--- trunk/src/assuan.h 2007-08-24 05:59:50 UTC (rev 250)
+++ trunk/src/assuan.h 2007-09-03 12:29:07 UTC (rev 251)
@@ -466,9 +466,10 @@
unsigned char **r_buffer, size_t *r_length,
size_t maxlen);
assuan_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword,
- unsigned char **r_buffer, size_t *r_length,
size_t maxlen,
- int (*cb) (void *cb_data, int rc),
+ int (*cb) (void *cb_data, int rc,
+ unsigned char *buf,
+ size_t buf_len),
void *cb_data);
/*-- assuan-buffer.c --*/
assuan_error_t assuan_read_line (assuan_context_t ctx,
More information about the Gnupg-commits
mailing list