OSSP CVS Repository

ossp - Check-in [4268]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4268
Date: 2001-Aug-01 16:38:07 (local)
2001-Aug-01 14:38:07 (UTC)
User:simons
Branch:callback-semantic-rewrite
Comment: Rewrote engines to conform with the new semantic.
Tickets:
Inspections:
Files:
ossp-pkg/xds/xdr-decode-int64.c      1.3.2.2 -> 1.3.2.3     2 inserted, 16 deleted
ossp-pkg/xds/xdr-decode-octetstream.c      1.3.2.2 -> 1.3.2.3     9 inserted, 23 deleted
ossp-pkg/xds/xdr-decode-string.c      1.4.2.2 -> 1.4.2.3     9 inserted, 23 deleted
ossp-pkg/xds/xdr-decode-uint32.c      1.3.2.2 -> 1.3.2.3     2 inserted, 16 deleted
ossp-pkg/xds/xdr-decode-uint64.c      1.3.2.3 -> 1.3.2.4     2 inserted, 16 deleted
ossp-pkg/xds/xdr-encode-int32.c      1.3.2.3 -> 1.3.2.4     1 inserted, 15 deleted
ossp-pkg/xds/xdr-encode-int64.c      1.3.2.2 -> 1.3.2.3     1 inserted, 14 deleted
ossp-pkg/xds/xdr-encode-octetstream.c      1.4.2.2 -> 1.4.2.3     5 inserted, 12 deleted
ossp-pkg/xds/xdr-encode-string.c      1.5.2.2 -> 1.5.2.3     5 inserted, 12 deleted
ossp-pkg/xds/xdr-encode-uint32.c      1.3.2.2 -> 1.3.2.3     1 inserted, 15 deleted
ossp-pkg/xds/xdr-encode-uint64.c      1.3.2.2 -> 1.3.2.3     1 inserted, 15 deleted

ossp-pkg/xds/xdr-decode-int64.c 1.3.2.2 -> 1.3.2.3

--- xdr-decode-int64.c   2001/08/01 13:26:29     1.3.2.2
+++ xdr-decode-int64.c   2001/08/01 14:38:07     1.3.2.3
@@ -34,26 +34,12 @@
     xds_int64_t*  value;
     xds_uint64_t  tmp;
 
-    /* Consistency checks. */
-
-    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 8 bytes in the buffer to format our parameter. If we
-       don't have them, return an underflow error. */
-
-    if (buffer_size < 8)
-        return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 8;
+    xds_init_decoding_engine(8);
 
     /* Get value and format it into the buffer. */
 
     value = va_arg(*args, xds_int64_t*);
-    assert(value != NULL);
+    xds_check_parameter(value != NULL);
 
     if (((xds_uint8_t*)buffer)[0] & 0x80)
         {                       /* negative number */


ossp-pkg/xds/xdr-decode-octetstream.c 1.3.2.2 -> 1.3.2.3

--- xdr-decode-octetstream.c     2001/08/01 13:26:29     1.3.2.2
+++ xdr-decode-octetstream.c     2001/08/01 14:38:07     1.3.2.3
@@ -36,32 +36,19 @@
     size_t* p_len;
     size_t  padding;
 
-    /* Consistency checks. */
-
-    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. */
+    xds_init_decoding_engine(4);
 
     p     = va_arg(*args, void**);
     p_len = va_arg(*args, size_t*);
-    assert(p != NULL);
-    assert(p_len != NULL);
+    xds_check_parameter(p != NULL);
+    xds_check_parameter(p_len != NULL);
 
     /* Read the size of the message. */
 
-    if (buffer_size >= 4)
-        {
-        *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];
-        }
-    else
-        return XDS_ERR_UNDERFLOW;
+    *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. */
 
@@ -69,10 +56,9 @@
 
     /* Do we have enough data?. */
 
-    if (buffer_size < 4 + *p_len + padding)
+    *used_buffer_size = 4 + *p_len + padding;
+    if (buffer_size < *used_buffer_size)
         return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 4 + *p_len + padding;
 
     /* Allocate buffer for the data. */
 


ossp-pkg/xds/xdr-decode-string.c 1.4.2.2 -> 1.4.2.3

--- xdr-decode-string.c  2001/08/01 13:26:29     1.4.2.2
+++ xdr-decode-string.c  2001/08/01 14:38:07     1.4.2.3
@@ -36,32 +36,19 @@
     size_t* p_len;
     size_t  padding;
 
-    /* Consistency checks. */
-
-    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. */
+    xds_init_decoding_engine(4);
 
     p     = va_arg(*args, char**);
     p_len = va_arg(*args, size_t*);
-    assert(p != NULL);
-    assert(p_len != NULL);
+    xds_check_parameter(p != NULL);
+    xds_check_parameter(p_len != NULL);
 
     /* Read the size of the message. */
 
-    if (buffer_size >= 4)
-        {
-        *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];
-        }
-    else
-        return XDS_ERR_UNDERFLOW;
+    *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. */
 
@@ -69,10 +56,9 @@
 
     /* Do we have enough data?. */
 
-    if (buffer_size < 4 + *p_len + padding)
+    *used_buffer_size = 4 + *p_len + padding;
+    if (buffer_size < *used_buffer_size)
         return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 4 + *p_len + padding;
 
     /* Allocate buffer for the data. */
 


ossp-pkg/xds/xdr-decode-uint32.c 1.3.2.2 -> 1.3.2.3

--- xdr-decode-uint32.c  2001/08/01 13:26:29     1.3.2.2
+++ xdr-decode-uint32.c  2001/08/01 14:38:07     1.3.2.3
@@ -33,26 +33,12 @@
     {
     xds_uint32_t*  value;
 
-    /* Consistency checks. */
-
-    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;
+    xds_init_decoding_engine(4);
 
     /* Get value and format it into the buffer. */
 
     value = va_arg(*args, xds_uint32_t*);
-    assert(value != NULL);
+    xds_check_parameter(value != NULL);
 
     *value  = ((xds_uint8_t*)buffer)[0]; *value = *value << 8;
     *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8;


ossp-pkg/xds/xdr-decode-uint64.c 1.3.2.3 -> 1.3.2.4

--- xdr-decode-uint64.c  2001/08/01 13:26:29     1.3.2.3
+++ xdr-decode-uint64.c  2001/08/01 14:38:07     1.3.2.4
@@ -33,26 +33,12 @@
     {
     xds_uint64_t*  value;
 
-    /* Consistency checks. */
-
-    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 8 bytes in the buffer to format our parameter. If we
-       don't have them, return an underflow error. */
-
-    if (buffer_size < 8)
-        return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 8;
+    xds_init_decoding_engine(8);
 
     /* Get value and format it into the buffer. */
 
     value = va_arg(*args, xds_uint64_t*);
-    assert(value != NULL);
+    xds_check_parameter(value != NULL);
 
     *value  = ((xds_uint8_t*)buffer)[0]; *value = *value << 8;
     *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8;


ossp-pkg/xds/xdr-encode-int32.c 1.3.2.3 -> 1.3.2.4

--- xdr-encode-int32.c   2001/08/01 13:26:29     1.3.2.3
+++ xdr-encode-int32.c   2001/08/01 14:38:07     1.3.2.4
@@ -34,21 +34,7 @@
     xds_uint32_t tmp;
     xds_int32_t value;
 
-    /* Consistency checks. */
-
-    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 overflow error. */
-
-    if (buffer_size < 4)
-        return XDS_ERR_OVERFLOW;
-    else
-        *used_buffer_size = 4;
+    xds_init_encoding_engine(4);
 
     /* Get value and format it into the buffer. */
 


ossp-pkg/xds/xdr-encode-int64.c 1.3.2.2 -> 1.3.2.3

--- xdr-encode-int64.c   2001/08/01 13:26:29     1.3.2.2
+++ xdr-encode-int64.c   2001/08/01 14:38:07     1.3.2.3
@@ -34,20 +34,7 @@
     xds_uint64_t tmp;
     xds_int64_t  value;
 
-    /* Consistency checks. */
-
-    xds_check_parameter(xds != NULL);
-    xds_check_parameter(buffer != NULL);
-    xds_check_parameter(buffer_size != 0);
-    xds_check_parameter(args != NULL);
-
-    /* We need 8 bytes in the buffer to format our parameter. If we
-       don't have them, return an overflow error. */
-
-    if (buffer_size < 8)
-        return XDS_ERR_OVERFLOW;
-    else
-        *used_buffer_size = 8;
+    xds_init_encoding_engine(8);
 
     /* Get value and format it into the buffer. */
 


ossp-pkg/xds/xdr-encode-octetstream.c 1.4.2.2 -> 1.4.2.3

--- xdr-encode-octetstream.c     2001/08/01 13:26:29     1.4.2.2
+++ xdr-encode-octetstream.c     2001/08/01 14:38:07     1.4.2.3
@@ -36,19 +36,13 @@
     size_t       p_len;
     size_t       padding;
 
-    /* Consistency checks. */
-
-    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);
+    xds_init_encoding_engine(4);
 
     /* Get value from stack and calculate the correct amount of
        padding. */
 
     p       = (xds_uint8_t*)va_arg(*args, void*);
-    assert(p != NULL);
+    xds_check_parameter(p != NULL);
     p_len   = va_arg(*args, size_t);
     padding = (4 - (p_len & 0x03)) & 0x03;
     assert((p_len + padding) % 4 == 0);
@@ -56,10 +50,9 @@
     /* We need (4 + p_len + padding) bytes in the buffer to format our
        parameter. If we don't have them, return an underflow error. */
 
-    if (buffer_size < 4 + p_len + padding)
-        return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 4 + p_len + padding;
+    *used_buffer_size = 4 + p_len + padding;
+    if (buffer_size < *used_buffer_size)
+        return XDS_ERR_OVERFLOW;
 
     /* Format the values into the buffer. */
 


ossp-pkg/xds/xdr-encode-string.c 1.5.2.2 -> 1.5.2.3

--- xdr-encode-string.c  2001/08/01 13:26:29     1.5.2.2
+++ xdr-encode-string.c  2001/08/01 14:38:07     1.5.2.3
@@ -36,19 +36,13 @@
     size_t p_len;
     size_t padding;
 
-    /* Consistency checks. */
-
-    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);
+    xds_init_encoding_engine(4);
 
     /* Get value from stack and calculate the correct amount of
        padding. */
 
     p       = va_arg(*args, char*);
-    assert(p != NULL);
+    xds_check_parameter(p != NULL);
     p_len   = strlen(p);
     padding = (4 - (p_len & 0x03)) & 0x03;
     assert((p_len + padding) % 4 == 0);
@@ -56,10 +50,9 @@
     /* We need (4 + p_len + padding) bytes in the buffer to format our
        parameter. If we don't have them, return an underflow error. */
 
-    if (buffer_size < 4 + p_len + padding)
-        return XDS_ERR_UNDERFLOW;
-    else
-        *used_buffer_size = 4 + p_len + padding;
+    *used_buffer_size = 4 + p_len + padding;
+    if (buffer_size < *used_buffer_size)
+        return XDS_ERR_OVERFLOW;
 
     /* Format the values into the buffer. */
 


ossp-pkg/xds/xdr-encode-uint32.c 1.3.2.2 -> 1.3.2.3

--- xdr-encode-uint32.c  2001/08/01 13:26:29     1.3.2.2
+++ xdr-encode-uint32.c  2001/08/01 14:38:07     1.3.2.3
@@ -33,21 +33,7 @@
     {
     xds_uint32_t value;
 
-    /* Consistency checks. */
-
-    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 overflow error. */
-
-    if (buffer_size < 4)
-        return XDS_ERR_OVERFLOW;
-    else
-        *used_buffer_size = 4;
+    xds_init_encoding_engine(4);
 
     /* Get value and format it into the buffer. */
 


ossp-pkg/xds/xdr-encode-uint64.c 1.3.2.2 -> 1.3.2.3

--- xdr-encode-uint64.c  2001/08/01 13:26:29     1.3.2.2
+++ xdr-encode-uint64.c  2001/08/01 14:38:07     1.3.2.3
@@ -33,21 +33,7 @@
     {
     xds_uint64_t value;
 
-    /* Consistency checks. */
-
-    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 8 bytes in the buffer to format our parameter. If we
-       don't have them, return an overflow error. */
-
-    if (buffer_size < 8)
-        return XDS_ERR_OVERFLOW;
-    else
-        *used_buffer_size = 8;
+    xds_init_encoding_engine(8);
 
     /* Get value and format it into the buffer. */
 

CVSTrac 2.0.1