ossp-pkg/xds/xdr-decode-string.c 1.6 -> 1.7
--- xdr-decode-string.c 2001/08/02 08:10:13 1.6
+++ xdr-decode-string.c 2001/08/02 11:52:11 1.7
@@ -33,43 +33,41 @@
va_list* args)
{
char** p;
- size_t* p_len;
+ size_t p_len;
size_t padding;
xds_init_decoding_engine(4);
p = va_arg(*args, char**);
- p_len = va_arg(*args, size_t*);
xds_check_parameter(p != NULL);
- xds_check_parameter(p_len != NULL);
/* Read the size of the message. */
- *p_len = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8;
- *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8;
- *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8;
- *p_len += ((xds_uint8_t*)buffer)[3];
+ p_len = ((xds_uint8_t*)buffer)[0]; p_len = p_len << 8;
+ p_len += ((xds_uint8_t*)buffer)[1]; p_len = p_len << 8;
+ p_len += ((xds_uint8_t*)buffer)[2]; p_len = p_len << 8;
+ p_len += ((xds_uint8_t*)buffer)[3];
/* Calculate padding. */
- padding = (4 - (*p_len & 0x03)) & 0x03;
+ padding = (4 - (p_len & 0x03)) & 0x03;
/* Do we have enough data?. */
- *used_buffer_size = 4 + *p_len + padding;
+ *used_buffer_size = 4 + p_len + padding;
if (buffer_size < *used_buffer_size)
return XDS_ERR_UNDERFLOW;
/* Allocate buffer for the data. */
- *p = (char*)malloc(*p_len + 1);
+ *p = (char*)malloc(p_len + 1);
if (*p == NULL)
return XDS_ERR_NO_MEM;
/* Copy data into the buffer. */
- memmove(*p, (xds_uint8_t*)buffer+4, *p_len);
- ((xds_uint8_t*)buffer)[4+*p_len] = '\0';
+ memmove(*p, (xds_uint8_t*)buffer+4, p_len);
+ ((xds_uint8_t*)buffer)[4+p_len] = '\0';
/* Done. */
|
|