ossp-pkg/xds/xdr-decode-int32.c 1.3 -> 1.3.2.1
--- xdr-decode-int32.c 2001/07/23 15:33:42 1.3
+++ xdr-decode-int32.c 2001/08/01 11:26:56 1.3.2.1
@@ -28,20 +28,28 @@
#include <assert.h>
#include "internal.h"
-int xdr_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xdr_decode_int32(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
xds_int32_t* value;
xds_uint32_t tmp;
/* Consistency checks. */
- assert(xds != NULL);
- assert(buffer != NULL);
- 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);
+
+ /* We need 4 bytes in the buffer to format our parameter. If we
+ don't have them, return an underflow error. */
+
if (buffer_size < 4)
return XDS_ERR_UNDERFLOW;
+ else
+ *used_buffer_size = 4;
/* Get value and format it into the buffer. */
@@ -67,5 +75,5 @@
/* Done. */
- return 4;
+ return XDS_OK;
}
|
|