OSSP CVS Repository

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

Check-in Number: 4263
Date: 2001-Aug-01 15:24:21 (local)
2001-Aug-01 13:24:21 (UTC)
User:simons
Branch:callback-semantic-rewrite
Comment: Use the new xds_init_decoding_engine() macro to check the arguments and to handle the underflow error. This makes the code shorter.
Tickets:
Inspections:
Files:
ossp-pkg/xds/xdr-decode-int32.c      1.3.2.1 -> 1.3.2.2     2 inserted, 17 deleted

ossp-pkg/xds/xdr-decode-int32.c 1.3.2.1 -> 1.3.2.2

--- xdr-decode-int32.c   2001/08/01 11:26:56     1.3.2.1
+++ xdr-decode-int32.c   2001/08/01 13:24:21     1.3.2.2
@@ -25,7 +25,6 @@
    SUCH DAMAGE.
 */
 
-#include <assert.h>
 #include "internal.h"
 
 int xdr_decode_int32(xds_t* xds, void* engine_context,
@@ -35,26 +34,12 @@
     xds_int32_t*  value;
     xds_uint32_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 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_int32_t*);
-    assert(value != NULL);
+    xds_check_parameter(value != NULL);
 
     if (((xds_uint8_t*)buffer)[0] & 0x80)
         {                       /* negative number */

CVSTrac 2.0.1