--- xdr-decode-string.c 2001/07/23 15:33:42 1.4
+++ xdr-decode-string.c 2001/08/01 11:26:56 1.4.2.1
@@ -29,7 +29,9 @@
#include <assert.h>
#include "internal.h"
-int xdr_decode_string(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xdr_decode_string(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
char** p;
size_t* p_len;
@@ -37,12 +39,11 @@
/* Consistency checks. */
- assert(xds != NULL);
- assert(buffer != NULL);
- assert(buffer_size != 0);
- assert(args != NULL);
- if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
- return XDS_ERR_INVALID_ARG;
+ xds_check_parameter(xds != NULL);
+ xds_check_parameter(buffer != NULL);
+ xds_check_parameter(buffer_size != 0);
+ xds_check_parameter(used_buffer_size != NULL);
+ xds_check_parameter(args != NULL);
/* Get pointers from the stack. */
@@ -71,6 +72,8 @@
if (buffer_size < 4 + *p_len + padding)
return XDS_ERR_UNDERFLOW;
+ else
+ *used_buffer_size = 4 + *p_len + padding;
/* Allocate buffer for the data. */
@@ -85,5 +88,5 @@
/* Done. */
- return 4 + *p_len + padding;
+ return XDS_OK;
}
|