OSSP CVS Repository

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

Check-in Number: 641
Date: 2001-Aug-09 22:59:05 (local)
2001-Aug-09 20:59:05 (UTC)
User:rse
Branch:
Comment: Final adjustments to coding style in order to make OSSP XDS look equal in style to all other OSSP parts. This should remove most of the strangeness GNU indent usually introduces.
Tickets:
Inspections:
Files:
ossp-pkg/xds/xds.c      1.3 -> 1.4     55 inserted, 64 deleted
ossp-pkg/xds/xds_engine_xdr.c      1.2 -> 1.3     128 inserted, 168 deleted
ossp-pkg/xds/xds_engine_xml.c      1.3 -> 1.4     122 inserted, 172 deleted
ossp-pkg/xds/xds_test_lib.c      1.2 -> 1.3     65 inserted, 147 deleted
ossp-pkg/xds/xds_test_xdr.c      1.2 -> 1.3     24 inserted, 52 deleted
ossp-pkg/xds/xds_test_xml.c      1.2 -> 1.3     14 inserted, 29 deleted

ossp-pkg/xds/xds.c 1.3 -> 1.4

--- xds.c        2001/08/09 19:58:35     1.3
+++ xds.c        2001/08/09 20:59:05     1.4
@@ -45,9 +45,8 @@
     }
 
     /* Allocate context structure. */
-    ctx = malloc(sizeof (struct xds_context));
-    if (ctx == NULL)
-        return NULL; /* errno is set by calloc() */
+    if ((ctx = malloc(sizeof (struct xds_context))) == NULL)
+        return NULL; /* errno set by malloc(3) */
 
     /* Set mode of operation in context. */
     ctx->mode = mode;
@@ -68,7 +67,9 @@
 
 void xds_destroy(xds_t *xds)
 {
-    /* Sanity checks. */
+    size_t i;
+
+    /* Sanity check parameter. */
     assert(xds != NULL);
     if (xds == NULL)
         return;
@@ -78,25 +79,23 @@
            || (xds->buffer_capacity == 0 && xds->buffer_len == 0));
     if (xds->buffer != NULL && xds->we_own_buffer)
         free(xds->buffer);
-
     assert(xds->engines != NULL || xds->engines_capacity == 0);
     if (xds->engines != NULL) {
-        size_t i;
-        for (i = 0; i < xds->engines_len; ++i) {
+        for (i = 0; i < xds->engines_len; i++) {
             assert(xds->engines[i].name != NULL);
             free(xds->engines[i].name);
         }
         free(xds->engines);
     }
-
     free(xds);
+
     return;
 }
 
 int xds_setbuffer(xds_t *xds, xds_scope_t flag, void *buffer,
                   size_t buffer_len)
 {
-    /* Sanity checks. */
+    /* Sanity check parameters. */
     xds_check_parameter(xds != NULL);
     xds_check_parameter(flag == XDS_GIFT || flag == XDS_LOAN);
     xds_check_parameter((buffer != NULL && buffer_len != 0)
@@ -127,8 +126,7 @@
 int xds_getbuffer(xds_t *xds, xds_scope_t flag, void **buffer,
                   size_t *buffer_len)
 {
-    /* Sanity checks. */
-
+    /* Sanity check parameters. */
     xds_check_parameter(xds != NULL);
     xds_check_parameter(flag == XDS_GIFT || flag == XDS_LOAN);
     xds_check_parameter(buffer != NULL);
@@ -139,7 +137,8 @@
     *buffer_len = xds->buffer_len;
     if (flag == XDS_GIFT) {
         xds->buffer = NULL;
-        xds->buffer_capacity = xds->buffer_len = 0;
+        xds->buffer_capacity = 0;
+        xds->buffer_len = 0;
     }
     else
         xds->buffer_len = 0;
@@ -148,8 +147,8 @@
 }
 
 static int xds_set_capacity(void **array, size_t *array_capacity,
-                     size_t new_capacity, size_t elem_size,
-                     size_t initial_capacity)
+                            size_t new_capacity, size_t elem_size,
+                            size_t initial_capacity)
 {
     void *buf;
     size_t size;
@@ -165,13 +164,12 @@
         return XDS_OK;
 
     /* Find the correct capacity. */
-    size = (*array_capacity != 0) ? *array_capacity * 2 : initial_capacity; 
+    size = (*array_capacity != 0) ? (*array_capacity * 2) : initial_capacity; 
     while (size < new_capacity)
         size *= 2;
 
     /* Allocate the array and store the new values. */
-    buf = realloc(*array, size * elem_size);
-    if (buf == NULL)
+    if ((buf = realloc(*array, size * elem_size)) == NULL)
         return XDS_ERR_NO_MEM;
     *array = buf;
     *array_capacity = size;
@@ -190,7 +188,7 @@
     xds_check_parameter(pos != NULL);
 
     /* Use binary search to find "name" in "engines". */
-    for (first = 0; (last - first) > 0;) {
+    for (first = 0; (last - first) > 0; ) {
         size_t half = first + ((last - first) / 2);
         int rc = strcmp(engines[half].name, name);
         if (rc < 0)
@@ -203,8 +201,8 @@
             last = half;
         assert(first <= last);
     }
-
     *pos = first;
+
     return XDS_FALSE;
 }
 
@@ -244,12 +242,12 @@
             return rc;
         memmove(&xds->engines[pos + 1], &xds->engines[pos],
                 (xds->engines_len - pos) * sizeof (engine_map_t));
-        ++xds->engines_len;
+        xds->engines_len++;
     }
 
     /* Insert entry. */
-    xds->engines[pos].name = (char *)name;
-    xds->engines[pos].engine = engine;
+    xds->engines[pos].name    = (char *)name;
+    xds->engines[pos].engine  = engine;
     xds->engines[pos].context = engine_context;
 
     /* Everything is fine. */
@@ -264,7 +262,7 @@
     /* Sanity checks. */
     xds_check_parameter(xds != NULL);
     xds_check_parameter(name != NULL);
-    for (pos = 0; name[pos] != '\0'; ++pos) {
+    for (pos = 0; name[pos] != '\0'; pos++) {
         if (!isalnum((int)name[pos]) && name[pos] != '-' && name[pos] != '_')
             return XDS_ERR_INVALID_ARG;
     }
@@ -279,13 +277,11 @@
     free(xds->engines[pos].name);
     memmove(&xds->engines[pos], &xds->engines[pos + 1],
             (xds->engines_len - (pos + 1)) * sizeof (engine_map_t));
-    --xds->engines_len;
+    xds->engines_len--;
 
     /* Lower capacity if necessary. */
-    rc = xds_set_capacity((void **)&xds->engines,
-                          &xds->engines_capacity,
-                          xds->engines_len,
-                          sizeof (engine_map_t),
+    rc = xds_set_capacity((void **)&xds->engines, &xds->engines_capacity,
+                          xds->engines_len, sizeof (engine_map_t),
                           XDS_INITIAL_ENGINES_CAPACITY);
     assert(rc == XDS_OK || rc == XDS_ERR_NO_MEM);
     if (rc != XDS_OK)
@@ -298,6 +294,7 @@
 {
     int rc;
     va_list args;
+
     va_start(args, fmt);
     rc = xds_vencode(xds, fmt, args);
     va_end(args);
@@ -321,11 +318,11 @@
         return XDS_ERR_INVALID_MODE;
 
     /* Ensure we have a buffer allocated ready for use. */
-    if (xds->buffer == NULL) {         /* allocate a new buffer */
-        rc = xds_set_capacity((void **)&xds->buffer,
-                              &xds->buffer_capacity,
-                              XDS_INITIAL_BUFFER_CAPACITY,
-                              sizeof (char), XDS_INITIAL_BUFFER_CAPACITY);
+    if (xds->buffer == NULL) { 
+        /* allocate a new buffer */
+        rc = xds_set_capacity((void **)&xds->buffer, &xds->buffer_capacity,
+                              XDS_INITIAL_BUFFER_CAPACITY, sizeof (char), 
+                              XDS_INITIAL_BUFFER_CAPACITY);
         assert(rc == XDS_OK || rc == XDS_ERR_NO_MEM);
         if (rc != XDS_OK)
             return rc;
@@ -333,16 +330,15 @@
         xds->we_own_buffer = XDS_TRUE;
     }
 
-    /* Iterate through the items in the format string and execute the
-       apropriate engines. */
+    /* Iterate through items in format string and execute apropriate engines. */
     fmt = p = strdup(fmt_arg);
     if (fmt == NULL)
         return XDS_ERR_NO_MEM;
     buffer_len_backup = xds->buffer_len;
     for (name = p; *p != '\0'; name = p) {
         while (isalnum((int)*p) || *p == '-' || *p == '_')
-            ++p;
-        if (*p)
+            p++;
+        if (*p != '\0')
             *p++ = '\0';
         else
             *p = '\0';
@@ -352,8 +348,8 @@
             size_t used_buffer_size;
             size_t pos;
 
-            if (xds_find_engine(xds->engines, xds->engines_len, name, &pos) ==
-                XDS_FALSE) {
+            if (xds_find_engine(xds->engines, xds->engines_len, name, &pos) 
+                == XDS_FALSE) {
                 rc = XDS_ERR_UNKNOWN_ENGINE;
                 goto leave;
             }
@@ -365,8 +361,7 @@
                     if (xds->we_own_buffer) {
                         rc = xds_set_capacity((void **)&xds->buffer,
                                               &xds->buffer_capacity,
-                                              xds->buffer_len + 1,
-                                              sizeof (char),
+                                              xds->buffer_len + 1, sizeof (char),
                                               XDS_INITIAL_BUFFER_CAPACITY);
                         assert(rc == XDS_OK || rc == XDS_ERR_NO_MEM);
                         if (rc != XDS_OK)
@@ -381,13 +376,11 @@
                 /* Execute the engine. */
                 used_buffer_size = 0;
                 args_backup = args;
-                rc = (*xds->engines[pos].engine)(xds,
-                                                 xds->engines[pos].context,
-                                                 xds->buffer +
-                                                 xds->buffer_len,
-                                                 xds->buffer_capacity -
-                                                 xds->buffer_len,
-                                                 &used_buffer_size, &args);
+                rc = (*xds->engines[pos].engine)(
+                         xds, xds->engines[pos].context,
+                         xds->buffer + xds->buffer_len,
+                         xds->buffer_capacity - xds->buffer_len,
+                         &used_buffer_size, &args);
                 assert(rc <= 0);
                 if (rc == XDS_OK) {
                     restart_engine = XDS_FALSE;
@@ -400,13 +393,11 @@
                     restart_engine = XDS_TRUE;
                     args = args_backup;
 
-                    rc = xds_set_capacity((void **)&xds->buffer,
-                                          &xds->buffer_capacity,
-                                          xds->buffer_capacity +
-                                          ((used_buffer_size ==
-                                            0) ? 1 : used_buffer_size),
-                                          sizeof (char),
-                                          XDS_INITIAL_BUFFER_CAPACITY);
+                    rc = xds_set_capacity(
+                            (void **)&xds->buffer, &xds->buffer_capacity,
+                            xds->buffer_capacity +
+                            ((used_buffer_size == 0) ? 1 : used_buffer_size),
+                            sizeof (char), XDS_INITIAL_BUFFER_CAPACITY);
                     assert(rc == XDS_OK || rc == XDS_ERR_NO_MEM);
                     if (rc != XDS_OK)
                         goto leave;
@@ -431,6 +422,7 @@
 {
     int rc;
     va_list args;
+
     va_start(args, fmt);
     rc = xds_vdecode(xds, fmt, args);
     va_end(args);
@@ -464,8 +456,8 @@
     buffer_len_backup = xds->buffer_len;
     for (name = p; *p != '\0'; name = p) {
         while (isalnum((int)*p) || *p == '-' || *p == '_')
-            ++p;
-        if (*p)
+            p++;
+        if (*p != '\0')
             *p++ = '\0';
         else
             *p = '\0';
@@ -473,14 +465,13 @@
         if (strlen(name) > 0) {
             size_t pos;
             size_t used_buffer_size = 0;
+
             if (xds_find_engine(xds->engines, xds->engines_len, name, &pos)) {
-                rc = (*xds->engines[pos].engine)(xds,
-                                                 xds->engines[pos].context,
-                                                 xds->buffer +
-                                                 xds->buffer_len,
-                                                 xds->buffer_capacity -
-                                                 xds->buffer_len,
-                                                 &used_buffer_size, &args);
+                rc = (*xds->engines[pos].engine)(
+                         xds, xds->engines[pos].context,
+                         xds->buffer + xds->buffer_len,
+                         xds->buffer_capacity - xds->buffer_len,
+                         &used_buffer_size, &args);
                 assert(rc <= 0);
                 if (rc == XDS_OK)
                     xds->buffer_len += used_buffer_size;


ossp-pkg/xds/xds_engine_xdr.c 1.2 -> 1.3

--- xds_engine_xdr.c     2001/08/09 19:58:35     1.2
+++ xds_engine_xdr.c     2001/08/09 20:59:05     1.3
@@ -31,9 +31,9 @@
 
 #include "xds.h"
 
-int xdr_encode_int32(xds_t * xds, void *engine_context,
+int xdr_encode_int32(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_uint32_t tmp;
     xds_int32_t value;
@@ -41,7 +41,6 @@
     xds_init_encoding_engine(4);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_uint32_t);
     if (value < 0) {
         value = 0 - value;
@@ -49,19 +48,17 @@
     }
     else
         tmp = (xds_uint32_t) value;
-    ((xds_uint8_t *) buffer)[0] = (tmp >> 24) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[1] = (tmp >> 16) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[2] = (tmp >> 8) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[3] = (tmp >> 0) & 0x000000ff;
-
-    /* Done. */
+    ((xds_uint8_t *)buffer)[0] = (tmp >> 24) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[1] = (tmp >> 16) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[2] = (tmp >>  8) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[3] = (tmp >>  0) & 0x000000ff;
 
     return XDS_OK;
 }
 
-int xdr_decode_int32(xds_t * xds, void *engine_context,
+int xdr_decode_int32(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_int32_t *value;
     xds_uint32_t tmp;
@@ -69,88 +66,81 @@
     xds_init_decoding_engine(4);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_int32_t *);
     xds_check_parameter(value != NULL);
 
-    if (((xds_uint8_t *) buffer)[0] & 0x80) {   /* negative number */
-        tmp = ((xds_uint8_t *) buffer)[0];
+    if (((xds_uint8_t *) buffer)[0] & 0x80) {   
+        /* negative number */
+        tmp =  ((xds_uint8_t *)buffer)[0];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[1];
+        tmp += ((xds_uint8_t *)buffer)[1];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[2];
+        tmp += ((xds_uint8_t *)buffer)[2];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[3];
+        tmp += ((xds_uint8_t *)buffer)[3];
         tmp = 0 - tmp;
-        *value = 0 - (int32_t) tmp;
+        *value = 0 - (int32_t)tmp;
     }
-    else {                             /* positive number */
-        *value = ((xds_uint8_t *) buffer)[0];
+    else {                             
+        /* positive number */
+        *value =  ((xds_uint8_t *)buffer)[0];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[1];
+        *value += ((xds_uint8_t *)buffer)[1];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[2];
+        *value += ((xds_uint8_t *)buffer)[2];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[3];
+        *value += ((xds_uint8_t *)buffer)[3];
     }
 
-    /* Done. */
-
     return XDS_OK;
 }
 
-int xdr_encode_uint32(xds_t * xds, void *engine_context,
+int xdr_encode_uint32(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint32_t value;
 
     xds_init_encoding_engine(4);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_uint32_t);
-    ((xds_uint8_t *) buffer)[0] = (value >> 24) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[1] = (value >> 16) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[2] = (value >> 8) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[3] = (value >> 0) & 0x000000ff;
-
-    /* Done. */
+    ((xds_uint8_t *)buffer)[0] = (value >> 24) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[1] = (value >> 16) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[2] = (value >>  8) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[3] = (value >>  0) & 0x000000ff;
 
     return XDS_OK;
 }
 
-int xdr_decode_uint32(xds_t * xds, void *engine_context,
+int xdr_decode_uint32(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint32_t *value;
 
     xds_init_decoding_engine(4);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_uint32_t *);
     xds_check_parameter(value != NULL);
 
-    *value = ((xds_uint8_t *) buffer)[0];
+    *value =  ((xds_uint8_t *)buffer)[0];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[1];
+    *value += ((xds_uint8_t *)buffer)[1];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[2];
+    *value += ((xds_uint8_t *)buffer)[2];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[3];
-
-    /* Done. */
+    *value += ((xds_uint8_t *)buffer)[3];
 
     return XDS_OK;
 }
 
 #ifdef XDS_HAVE_64_BIT_SUPPORT
 
-int xdr_encode_int64(xds_t * xds, void *engine_context,
+int xdr_encode_int64(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_uint64_t tmp;
     xds_int64_t value;
@@ -158,31 +148,28 @@
     xds_init_encoding_engine(8);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_uint64_t);
     if (value < 0) {
         value = 0 - value;
-        tmp = 0 - (xds_uint64_t) value;
+        tmp = 0 - (xds_uint64_t)value;
     }
     else
-        tmp = (xds_uint64_t) value;
-    ((xds_uint8_t *) buffer)[0] = (tmp >> 56) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[1] = (tmp >> 48) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[2] = (tmp >> 40) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[3] = (tmp >> 32) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[4] = (tmp >> 24) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[5] = (tmp >> 16) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[6] = (tmp >> 8) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[7] = (tmp >> 0) & 0x000000ff;
-
-    /* Done. */
+        tmp = (xds_uint64_t)value;
+    ((xds_uint8_t *)buffer)[0] = (tmp >> 56) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[1] = (tmp >> 48) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[2] = (tmp >> 40) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[3] = (tmp >> 32) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[4] = (tmp >> 24) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[5] = (tmp >> 16) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[6] = (tmp >>  8) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[7] = (tmp >>  0) & 0x000000ff;
 
     return XDS_OK;
 }
 
-int xdr_decode_int64(xds_t * xds, void *engine_context,
+int xdr_decode_int64(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_int64_t *value;
     xds_uint64_t tmp;
@@ -190,130 +177,125 @@
     xds_init_decoding_engine(8);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_int64_t *);
     xds_check_parameter(value != NULL);
 
-    if (((xds_uint8_t *) buffer)[0] & 0x80) {   /* negative number */
-        tmp = ((xds_uint8_t *) buffer)[0];
+    if (((xds_uint8_t *)buffer)[0] & 0x80) {  
+        /* negative number */
+        tmp =  ((xds_uint8_t *)buffer)[0];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[1];
+        tmp += ((xds_uint8_t *)buffer)[1];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[2];
+        tmp += ((xds_uint8_t *)buffer)[2];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[3];
+        tmp += ((xds_uint8_t *)buffer)[3];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[4];
+        tmp += ((xds_uint8_t *)buffer)[4];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[5];
+        tmp += ((xds_uint8_t *)buffer)[5];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[6];
+        tmp += ((xds_uint8_t *)buffer)[6];
         tmp = tmp << 8;
-        tmp += ((xds_uint8_t *) buffer)[7];
+        tmp += ((xds_uint8_t *)buffer)[7];
         tmp = 0 - tmp;
-        *value = 0 - (xds_int64_t) tmp;
+        *value = 0 - (xds_int64_t)tmp;
     }
-    else {                             /* positive number */
-        *value = ((xds_uint8_t *) buffer)[0];
+    else {
+        /* positive number */
+        *value =  ((xds_uint8_t *)buffer)[0];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[1];
+        *value += ((xds_uint8_t *)buffer)[1];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[2];
+        *value += ((xds_uint8_t *)buffer)[2];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[3];
+        *value += ((xds_uint8_t *)buffer)[3];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[4];
+        *value += ((xds_uint8_t *)buffer)[4];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[5];
+        *value += ((xds_uint8_t *)buffer)[5];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[6];
+        *value += ((xds_uint8_t *)buffer)[6];
         *value = *value << 8;
-        *value += ((xds_uint8_t *) buffer)[7];
+        *value += ((xds_uint8_t *)buffer)[7];
     }
 
-    /* Done. */
-
     return XDS_OK;
 }
 
-int xdr_encode_uint64(xds_t * xds, void *engine_context,
+int xdr_encode_uint64(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint64_t value;
 
     xds_init_encoding_engine(8);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_uint64_t);
-    ((xds_uint8_t *) buffer)[0] = (value >> 56) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[1] = (value >> 48) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[2] = (value >> 40) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[3] = (value >> 32) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[4] = (value >> 24) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[5] = (value >> 16) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[6] = (value >> 8) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[7] = (value >> 0) & 0x000000ff;
-
-    /* Done. */
+    ((xds_uint8_t *)buffer)[0] = (value >> 56) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[1] = (value >> 48) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[2] = (value >> 40) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[3] = (value >> 32) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[4] = (value >> 24) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[5] = (value >> 16) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[6] = (value >>  8) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[7] = (value >>  0) & 0x000000ff;
 
     return XDS_OK;
 }
 
-int xdr_decode_uint64(xds_t * xds, void *engine_context,
+int xdr_decode_uint64(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint64_t *value;
 
     xds_init_decoding_engine(8);
 
     /* Get value and format it into the buffer. */
-
     value = va_arg(*args, xds_uint64_t *);
     xds_check_parameter(value != NULL);
 
-    *value = ((xds_uint8_t *) buffer)[0];
+    *value =  ((xds_uint8_t *)buffer)[0];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[1];
+    *value += ((xds_uint8_t *)buffer)[1];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[2];
+    *value += ((xds_uint8_t *)buffer)[2];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[3];
+    *value += ((xds_uint8_t *)buffer)[3];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[4];
+    *value += ((xds_uint8_t *)buffer)[4];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[5];
+    *value += ((xds_uint8_t *)buffer)[5];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[6];
+    *value += ((xds_uint8_t *)buffer)[6];
     *value = *value << 8;
-    *value += ((xds_uint8_t *) buffer)[7];
-
-    /* Done. */
+    *value += ((xds_uint8_t *)buffer)[7];
 
     return XDS_OK;
 }
 
 #endif /* XDS_HAVE_64_BIT_SUPPORT */
 
-int xdr_encode_double(xds_t * xds, void *engine_context,
+int xdr_encode_double(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
+    /* XXX */
     return -1;
 }
 
-int xdr_decode_double(xds_t * xds, void *engine_context,
+int xdr_decode_double(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
+    /* XXX */
     return -1;
 }
 
-int xdr_encode_string(xds_t * xds, void *engine_context,
+int xdr_encode_string(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     char *p;
     size_t p_len;
@@ -322,7 +304,6 @@
     xds_init_encoding_engine(4);
 
     /* Get value from stack and calculate the correct amount of padding. */
-
     p = va_arg(*args, char *);
     xds_check_parameter(p != NULL);
     p_len = strlen(p);
@@ -330,29 +311,25 @@
     assert((p_len + padding) % 4 == 0);
 
     /* We need (4 + p_len + padding) bytes in the buffer to format our
-     * parameter. If we don't have them, return an underflow error. */
-
+       parameter. If we don't have them, return an underflow error. */
     *used_buffer_size = 4 + p_len + padding;
     if (buffer_size < *used_buffer_size)
         return XDS_ERR_OVERFLOW;
 
     /* Format the values into the buffer. */
-
-    ((xds_uint8_t *) buffer)[0] = (p_len >> 24) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[1] = (p_len >> 16) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[2] = (p_len >> 8) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[3] = (p_len >> 0) & 0x000000ff;
-    memmove((xds_uint8_t *) buffer + 4, p, p_len);
-    memset((xds_uint8_t *) buffer + 4 + p_len, 0, padding);
-
-    /* Done. */
+    ((xds_uint8_t *)buffer)[0] = (p_len >> 24) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[1] = (p_len >> 16) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[2] = (p_len >>  8) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[3] = (p_len >>  0) & 0x000000ff;
+    memmove((xds_uint8_t *)buffer + 4, p, p_len);
+    memset((xds_uint8_t *)buffer + 4 + p_len, 0, padding);
 
     return XDS_OK;
 }
 
-int xdr_decode_string(xds_t * xds, void *engine_context,
+int xdr_decode_string(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     char **p;
     size_t p_len;
@@ -360,48 +337,42 @@
 
     xds_init_decoding_engine(4);
 
+    /* Get value. */
     p = va_arg(*args, char **);
     xds_check_parameter(p != NULL);
 
     /* Read the size of the message. */
-
-    p_len = ((xds_uint8_t *) buffer)[0];
+    p_len =  ((xds_uint8_t *)buffer)[0];
     p_len = p_len << 8;
-    p_len += ((xds_uint8_t *) buffer)[1];
+    p_len += ((xds_uint8_t *)buffer)[1];
     p_len = p_len << 8;
-    p_len += ((xds_uint8_t *) buffer)[2];
+    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)[3];
 
     /* Calculate padding. */
-
     padding = (4 - (p_len & 0x03)) & 0x03;
 
-    /* Do we have enough data?. */
-
+    /* Do we have enough data? */
     *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);
     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';
-
-    /* Done. */
+    memmove(*p, (xds_uint8_t *)buffer + 4, p_len);
+    ((xds_uint8_t *)buffer)[4 + p_len] = '\0';
 
     return XDS_OK;
 }
 
-int xdr_encode_octetstream(xds_t * xds, void *engine_context,
+int xdr_encode_octetstream(xds_t *xds, void *engine_context,
                            void *buffer, size_t buffer_size,
-                           size_t * used_buffer_size, va_list * args)
+                           size_t *used_buffer_size, va_list *args)
 {
     xds_uint8_t *p;
     size_t p_len;
@@ -410,7 +381,6 @@
     xds_init_encoding_engine(4);
 
     /* Get value from stack and calculate the correct amount of padding. */
-
     p = (xds_uint8_t *) va_arg(*args, void *);
     xds_check_parameter(p != NULL);
     p_len = va_arg(*args, size_t);
@@ -418,29 +388,25 @@
     assert((p_len + padding) % 4 == 0);
 
     /* We need (4 + p_len + padding) bytes in the buffer to format our
-     * parameter. If we don't have them, return an underflow error. */
-
+       parameter. If we don't have them, return an underflow error. */
     *used_buffer_size = 4 + p_len + padding;
     if (buffer_size < *used_buffer_size)
         return XDS_ERR_OVERFLOW;
 
     /* Format the values into the buffer. */
-
-    ((xds_uint8_t *) buffer)[0] = (p_len >> 24) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[1] = (p_len >> 16) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[2] = (p_len >> 8) & 0x000000ff;
-    ((xds_uint8_t *) buffer)[3] = (p_len >> 0) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[0] = (p_len >> 24) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[1] = (p_len >> 16) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[2] = (p_len >>  8) & 0x000000ff;
+    ((xds_uint8_t *)buffer)[3] = (p_len >>  0) & 0x000000ff;
     memmove((xds_uint8_t *) buffer + 4, p, p_len);
     memset((xds_uint8_t *) buffer + 4 + p_len, 0, padding);
 
-    /* Done. */
-
     return XDS_OK;
 }
 
-int xdr_decode_octetstream(xds_t * xds, void *engine_context,
+int xdr_decode_octetstream(xds_t *xds, void *engine_context,
                            void *buffer, size_t buffer_size,
-                           size_t * used_buffer_size, va_list * args)
+                           size_t *used_buffer_size, va_list *args)
 {
     void **p;
     size_t *p_len;
@@ -454,36 +420,30 @@
     xds_check_parameter(p_len != NULL);
 
     /* Read the size of the message. */
-
-    *p_len = ((xds_uint8_t *) buffer)[0];
+    *p_len =  ((xds_uint8_t *)buffer)[0];
     *p_len = *p_len << 8;
-    *p_len += ((xds_uint8_t *) buffer)[1];
+    *p_len += ((xds_uint8_t *)buffer)[1];
     *p_len = *p_len << 8;
-    *p_len += ((xds_uint8_t *) buffer)[2];
+    *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)[3];
 
     /* Calculate padding. */
-
     padding = (4 - (*p_len & 0x03)) & 0x03;
 
-    /* Do we have enough data?. */
-
+    /* Do we have enough data? */
     *used_buffer_size = 4 + *p_len + padding;
     if (buffer_size < *used_buffer_size)
         return XDS_ERR_UNDERFLOW;
 
     /* Allocate buffer for the data. */
-
     *p = malloc(*p_len);
     if (*p == NULL)
         return XDS_ERR_NO_MEM;
 
     /* Copy data into the buffer. */
-
     memmove(*p, (xds_uint8_t *) buffer + 4, *p_len);
 
-    /* Done. */
-
     return XDS_OK;
 }
+


ossp-pkg/xds/xds_engine_xml.c 1.3 -> 1.4

--- xds_engine_xml.c     2001/08/09 19:58:35     1.3
+++ xds_engine_xml.c     2001/08/09 20:59:05     1.4
@@ -41,48 +41,49 @@
 static const char xds_xml_end_text[] = 
     "</xds>\n";
 
-int xml_encode_begin(xds_t * xds, void *engine_context,
+int xml_encode_begin(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_init_encoding_engine(strlen(xds_xml_begin_text));
     memmove(buffer, xds_xml_begin_text, strlen(xds_xml_begin_text));
     return XDS_OK;
 }
 
-int xml_decode_begin(xds_t * xds, void *engine_context,
+int xml_decode_begin(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_init_encoding_engine(strlen(xds_xml_begin_text));
-    if (strncasecmp(buffer, xds_xml_begin_text, strlen(xds_xml_begin_text)) !=
-        0)
+    if (strncasecmp(buffer, xds_xml_begin_text, 
+                    strlen(xds_xml_begin_text)) != 0)
         return XDS_ERR_TYPE_MISMATCH;
     return XDS_OK;
 }
 
-int xml_encode_end(xds_t * xds, void *engine_context,
+int xml_encode_end(xds_t *xds, void *engine_context,
                    void *buffer, size_t buffer_size,
-                   size_t * used_buffer_size, va_list * args)
+                   size_t *used_buffer_size, va_list *args)
 {
     xds_init_encoding_engine(strlen(xds_xml_end_text));
     memmove(buffer, xds_xml_end_text, strlen(xds_xml_end_text));
     return XDS_OK;
 }
 
-int xml_decode_end(xds_t * xds, void *engine_context,
+int xml_decode_end(xds_t *xds, void *engine_context,
                    void *buffer, size_t buffer_size,
-                   size_t * used_buffer_size, va_list * args)
+                   size_t *used_buffer_size, va_list *args)
 {
     xds_init_decoding_engine(strlen(xds_xml_end_text));
-    if (strncasecmp(buffer, xds_xml_end_text, strlen(xds_xml_end_text)) != 0)
+    if (strncasecmp(buffer, xds_xml_end_text, 
+                    strlen(xds_xml_end_text)) != 0)
         return XDS_ERR_TYPE_MISMATCH;
     return XDS_OK;
 }
 
-int xml_encode_int32(xds_t * xds, void *engine_context,
+int xml_encode_int32(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_int32_t value;
     char buf[32];
@@ -93,8 +94,7 @@
     xds_init_encoding_engine(7 + 8 + 11);
 
     /* Get the value and format it into our buffer. Keep track of the length
-     * of the formatted result. */
-
+       of the formatted result. */
     value = va_arg(*args, xds_int32_t);
     if (value < 0) {
         negative = XDS_TRUE;
@@ -107,29 +107,26 @@
         unsigned char remainder = value % 10;
         value = value / 10;
         buf[i++] = '0' + remainder;
-    }
-    while (value != 0);
+    } while (value != 0);
     if (negative)
         buf[i++] = '-';
 
     /* Now that we know the correct size of our data's representation, write
-     * it into the buffer. */
-
+       it into the buffer. */
     *used_buffer_size = 7 + 8 + i;
     p = buffer;
     memmove(p, "<int32>", 7);
     p += 7;
-    for (j = i; j > 0;) {
+    for (j = i; j > 0;)
         *p++ = buf[--j];
-    }
     memmove(p, "</int32>", 8);
 
     return XDS_OK;
 }
 
-int xml_decode_int32(xds_t * xds, void *engine_context,
+int xml_decode_int32(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_int32_t *value;
     char *p;
@@ -138,18 +135,16 @@
     xds_init_decoding_engine(7 + 8 + 1);
 
     /* Does the opening XML tag match? */
-
     if (strncasecmp(buffer, "<int32>", 7) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Decode the representation of the value. */
-
     value = va_arg(*args, xds_int32_t *);
     *value = 0;
     p = (char *)buffer + 7;
     if (*p == '-') {
         negative = XDS_TRUE;
-        ++p;
+        p++;
     }
     else
         negative = XDS_FALSE;
@@ -163,7 +158,6 @@
         *value = 0 - *value;
 
     /* Does the closing XML tag match? */
-
     if (p + 8 > (char *)buffer + buffer_size)
         return XDS_ERR_UNDERFLOW;
     else if (strncasecmp(p, "</int32>", 8) != 0)
@@ -173,9 +167,9 @@
     return XDS_OK;
 }
 
-int xml_encode_uint32(xds_t * xds, void *engine_context,
+int xml_encode_uint32(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint32_t value;
     char buf[32];
@@ -185,36 +179,31 @@
     xds_init_encoding_engine(8 + 9 + 10);
 
     /* Format value into our buffer. */
-
     value = va_arg(*args, xds_uint32_t);
     i = 0;
     do {
         unsigned char remainder = value % 10;
         value = value / 10;
         buf[i++] = '0' + remainder;
-    }
-    while (value != 0);
+    } while (value != 0);
 
     /* Store the correct buffer size. */
-
     *used_buffer_size = 8 + 9 + i;
 
     /* Write result into the buffer. */
-
     p = buffer;
     memmove(p, "<uint32>", 8);
     p += 8;
-    for (j = i; j > 0;) {
+    for (j = i; j > 0;)
         *p++ = buf[--j];
-    }
     memmove(p, "</uint32>", 9);
 
     return XDS_OK;
 }
 
-int xml_decode_uint32(xds_t * xds, void *engine_context,
+int xml_decode_uint32(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint32_t *value;
     char *p;
@@ -222,12 +211,10 @@
     xds_init_decoding_engine(8 + 9 + 1);
 
     /* Does the opening XML tag match? */
-
     if (strncasecmp(buffer, "<uint32>", 8) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Decode the representation of the value. */
-
     value = va_arg(*args, xds_uint32_t *);
     *value = 0;
     p = (char *)buffer + 8;
@@ -239,7 +226,6 @@
     }
 
     /* Does the closing XML tag match? */
-
     if (p + 9 > (char *)buffer + buffer_size)
         return XDS_ERR_UNDERFLOW;
     else if (strncasecmp(p, "</uint32>", 9) != 0)
@@ -251,9 +237,9 @@
 
 #ifdef XDS_HAVE_64_BIT_SUPPORT
 
-int xml_encode_int64(xds_t * xds, void *engine_context,
+int xml_encode_int64(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_int64_t value;
     char buf[64];
@@ -264,7 +250,6 @@
     xds_init_encoding_engine(7 + 8 + 21);
 
     /* Format value into our buffer. */
-
     value = va_arg(*args, xds_int64_t);
     if (value < 0) {
         negative = XDS_TRUE;
@@ -277,31 +262,27 @@
         unsigned char remainder = value % 10;
         value = value / 10;
         buf[i++] = '0' + remainder;
-    }
-    while (value != 0);
+    } while (value != 0);
     if (negative)
         buf[i++] = '-';
 
     /* Store the correct buffer size. */
-
     *used_buffer_size = 7 + 8 + i;
 
     /* Write result into the buffer. */
-
     p = buffer;
     memmove(p, "<int64>", 7);
     p += 7;
-    for (j = i; j > 0;) {
+    for (j = i; j > 0;)
         *p++ = buf[--j];
-    }
     memmove(p, "</int64>", 8);
 
     return XDS_OK;
 }
 
-int xml_decode_int64(xds_t * xds, void *engine_context,
+int xml_decode_int64(xds_t *xds, void *engine_context,
                      void *buffer, size_t buffer_size,
-                     size_t * used_buffer_size, va_list * args)
+                     size_t *used_buffer_size, va_list *args)
 {
     xds_int64_t *value;
     char *p;
@@ -310,18 +291,16 @@
     xds_init_decoding_engine(7 + 8 + 1);
 
     /* Does the opening XML tag match? */
-
     if (strncasecmp(buffer, "<int64>", 7) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Decode the representation of the value. */
-
     value = va_arg(*args, xds_int64_t *);
     *value = 0;
     p = (char *)buffer + 7;
     if (*p == '-') {
         negative = XDS_TRUE;
-        ++p;
+        p++;
     }
     else
         negative = XDS_FALSE;
@@ -335,7 +314,6 @@
         *value = 0 - *value;
 
     /* Does the closing XML tag match? */
-
     if (p + 8 > (char *)buffer + buffer_size)
         return XDS_ERR_UNDERFLOW;
     else if (strncasecmp(p, "</int64>", 8) != 0)
@@ -345,9 +323,9 @@
     return XDS_OK;
 }
 
-int xml_encode_uint64(xds_t * xds, void *engine_context,
+int xml_encode_uint64(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint64_t value;
     char buf[64];
@@ -357,36 +335,31 @@
     xds_init_encoding_engine(8 + 9 + 20);
 
     /* Format value into our buffer. */
-
     value = va_arg(*args, xds_uint64_t);
     i = 0;
     do {
         unsigned char remainder = value % 10;
         value = value / 10;
         buf[i++] = '0' + remainder;
-    }
-    while (value != 0);
+    } while (value != 0);
 
     /* Store the correct buffer size. */
-
     *used_buffer_size = 8 + 9 + i;
 
     /* Write result into the buffer. */
-
     p = buffer;
     memmove(p, "<uint64>", 8);
     p += 8;
-    for (j = i; j > 0;) {
+    for (j = i; j > 0;)
         *p++ = buf[--j];
-    }
     memmove(p, "</uint64>", 9);
 
     return XDS_OK;
 }
 
-int xml_decode_uint64(xds_t * xds, void *engine_context,
+int xml_decode_uint64(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     xds_uint64_t *value;
     char *p;
@@ -394,12 +367,10 @@
     xds_init_decoding_engine(8 + 9 + 1);
 
     /* Does the opening XML tag match? */
-
     if (strncasecmp(buffer, "<uint64>", 8) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Decode the representation of the value. */
-
     value = va_arg(*args, xds_uint64_t *);
     *value = 0;
     p = (char *)buffer + 8;
@@ -411,7 +382,6 @@
     }
 
     /* Does the closing XML tag match? */
-
     if (p + 9 > (char *)buffer + buffer_size)
         return XDS_ERR_UNDERFLOW;
     else if (strncasecmp(p, "</uint64>", 9) != 0)
@@ -423,22 +393,24 @@
 
 #endif /* XDS_HAVE_64_BIT_SUPPORT */
 
-int xml_encode_double(xds_t * xds, void *engine_context,
+int xml_encode_double(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
+    /* XXX */
     return -1;
 }
 
-int xml_decode_double(xds_t * xds, void *engine_context,
+int xml_decode_double(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
+    /* XXX */
     return -1;
 }
 
-#define bits(c) (0x80 | ((c) & 0x3F))
-#define put(c)  *strptr++ = (c);
+#define bits(c)     (0x80 | ((c) & 0x3F))
+#define put(c)      *strptr++ = (c);
 #define putbits(c)  put(bits(c))
 #define finish()    *strptr = '\0'
 
@@ -487,19 +459,19 @@
         finish();
     }
     else
-        finish();                      /* Not a valid Unicode "character" */
+        finish(); /* Not a valid Unicode "character" */
 
     return strptr;
 }
 
-static const char TAG_OPEN[] = "<string>";
-static const char TAG_CLOSE[] = "</string>";
-static const size_t TAG_OPEN_LEN = sizeof (TAG_OPEN) - 1;
+static const char   TAG_OPEN[]    = "<string>";
+static const char   TAG_CLOSE[]   = "</string>";
+static const size_t TAG_OPEN_LEN  = sizeof (TAG_OPEN) - 1;
 static const size_t TAG_CLOSE_LEN = sizeof (TAG_CLOSE) - 1;
 
-int xml_encode_string(xds_t * xds, void *engine_context,
+int xml_encode_string(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     char *src;
     size_t src_len;
@@ -508,120 +480,120 @@
     char *tmp;
 
     /* Setup the engine. We need at least space for our tags; how long the
-     * actual content is going to be will be seen soon. */
-
+       actual content is going to be will be seen soon. */
     xds_init_encoding_engine(TAG_OPEN_LEN + TAG_CLOSE_LEN);
 
     /* Get the data from the stack. */
-
     src = va_arg(*args, char *);
     xds_check_parameter(src != NULL);
     src_len = strlen(src);
 
     /* Set up the target buffer. */
-
     dst = buffer;
     dst_size = buffer_size;
 
     /* Write the opening tag. */
-
     memmove(dst, TAG_OPEN, TAG_OPEN_LEN);
     dst += TAG_OPEN_LEN;
     dst_size -= TAG_OPEN_LEN;
 
     /* Format the data into the buffer. */
-
     while (src_len > 0 && dst_size > 0) {
-        if (*((xds_uint8_t *) src) >= 0x80) {   /* UTF-8ify it. */
+        if (*((xds_uint8_t *) src) >= 0x80) { 
+            /* UTF-8ify it. */
             if (dst_size >= 7) {
                 tmp = sputu8((xds_uint32_t) * ((xds_uint8_t *) src), dst);
-                ++src;
-                --src_len;
+                src++;
+                src_len--;
                 dst_size -= tmp - dst;
                 dst = tmp;
             }
             else
                 dst_size = 0;
         }
-        else if (*src == '<') {        /* Turn into "&lt;". */
+        else if (*src == '<') { 
+            /* Turn into "&lt;". */
             if (dst_size >= 4) {
                 *dst++ = '&';
-                --dst_size;
+                dst_size--;
                 *dst++ = 'l';
-                --dst_size;
+                dst_size--;
                 *dst++ = 't';
-                --dst_size;
+                dst_size--;
                 *dst++ = ';';
-                --dst_size;
-                ++src;
-                --src_len;
+                dst_size--;
+                src++;
+                src_len--;
             }
             else
                 dst_size = 0;
         }
-        else if (*src == '&') {        /* Turn into "&amp;". */
+        else if (*src == '&') {
+            /* Turn into "&amp;". */
             if (dst_size >= 5) {
                 *dst++ = '&';
-                --dst_size;
+                dst_size--;
                 *dst++ = 'a';
-                --dst_size;
+                dst_size--;
                 *dst++ = 'm';
-                --dst_size;
+                dst_size--;
                 *dst++ = 'p';
-                --dst_size;
+                dst_size--;
                 *dst++ = ';';
-                --dst_size;
-                ++src;
-                --src_len;
+                dst_size--;
+                src++;
+                src_len--;
             }
             else
                 dst_size = 0;
         }
-        else if (*src == '>') {        /* Turn into "&gt;". */
+        else if (*src == '>') {
+            /* Turn into "&gt;". */
             if (dst_size >= 4) {
                 *dst++ = '&';
-                --dst_size;
+                dst_size--;
                 *dst++ = 'g';
-                --dst_size;
+                dst_size--;
                 *dst++ = 't';
-                --dst_size;
+                dst_size--;
                 *dst++ = ';';
-                --dst_size;
-                ++src;
-                --src_len;
+                dst_size--;
+                src++;
+                src_len--;
             }
             else
                 dst_size = 0;
         }
-        else {                         /* No special character; just copy it. 
-                                        */
+        else {  
+            /* No special character; just copy it. */
             *dst++ = *src++;
-            --src_len;
-            --dst_size;
+            src_len--;
+            dst_size--;
         }
     }
-    if (src_len > 0) {                 /* Target buffer was too small. */
+    if (src_len > 0) {
+        /* Target buffer was too small. */
         *used_buffer_size = buffer_size + 1;
         return XDS_ERR_OVERFLOW;
     }
 
     /* Write the closing tag. */
-
     memmove(dst, TAG_CLOSE, TAG_CLOSE_LEN);
     dst += TAG_CLOSE_LEN;
     dst_size -= TAG_CLOSE_LEN;
 
-    /* Done. */
-
     *used_buffer_size = dst - (char *)buffer;
     return XDS_OK;
 }
 
-#define INVALID 0x80000000
-
-#define get(c)  c = *strptr++; \
-    if (chars) (*chars)++; \
-    if ((c) == 0) return (unsigned int)EOF
+#define INVALID \
+    0x80000000
+#define get(c) \
+    c = *strptr++; \
+    if (chars) \
+        (*chars)++; \
+    if ((c) == 0) \
+        return (unsigned int)EOF
 
 static unsigned int sgetu8(unsigned char *strptr, int *chars)
 {
@@ -636,7 +608,6 @@
         return (unsigned int)EOF;
 
     get(c);
-
     if ((c & 0xFE) == 0xFC) {
         c &= 0x01;
         iterations = 5;
@@ -673,9 +644,9 @@
     return c;
 }
 
-int xml_decode_string(xds_t * xds, void *engine_context,
+int xml_decode_string(xds_t *xds, void *engine_context,
                       void *buffer, size_t buffer_size,
-                      size_t * used_buffer_size, va_list * args)
+                      size_t *used_buffer_size, va_list *args)
 {
     char **target_buffer;
     char *src;
@@ -685,30 +656,25 @@
     unsigned int rc;
 
     /* Setup the engine. We need at least space for our tags; how long the
-     * actual content is going to be will be seen soon. */
-
+       actual content is going to be will be seen soon. */
     xds_init_encoding_engine(TAG_OPEN_LEN + TAG_CLOSE_LEN);
 
     /* Is the opening tag there? */
-
     if (strncasecmp(buffer, TAG_OPEN, TAG_OPEN_LEN) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Determine the length of the encoded data. */
-
     src = (char *)buffer + TAG_OPEN_LEN;
     for (src_len = 0; src[src_len] != '<'; ++src_len)
         if (src[src_len] == '\0')
             return XDS_ERR_TYPE_MISMATCH;
 
     /* Check the closing tag. */
-
     if (strncasecmp(src + src_len, TAG_CLOSE, TAG_CLOSE_LEN) != 0)
         return XDS_ERR_TYPE_MISMATCH;
     *used_buffer_size = TAG_OPEN_LEN + src_len + TAG_CLOSE_LEN;
 
     /* Allocate target buffer. */
-
     target_buffer = va_arg(*args, char **);
     xds_check_parameter(target_buffer != NULL);
     *target_buffer = dst = malloc(src_len + 1);
@@ -716,7 +682,6 @@
         return XDS_ERR_NO_MEM;
 
     /* Decode the data into the target buffer. */
-
     while (src_len > 0) {
         if (*src == '&') {
             if (src_len >= 4 && strncmp(src, "&lt;", 4) == 0) {
@@ -740,24 +705,22 @@
             }
         }
         else if (*((xds_uint8_t *) src) >= 0x80) {
-            rc = sgetu8((xds_uint8_t *) src, &utf8_len);
+            rc = sgetu8((xds_uint8_t *)src, &utf8_len);
             if (rc == (unsigned int)EOF)
                 return XDS_ERR_UNDERFLOW;
             else if (rc == INVALID || rc > 255)
                 return XDS_ERR_TYPE_MISMATCH;
-            *dst++ = (xds_uint8_t) rc;
+            *dst++ = (xds_uint8_t)rc;
             src += utf8_len;
             src_len -= utf8_len;
         }
         else {
             *dst++ = *src++;
-            --src_len;
+            src_len--;
         }
     }
     *dst = '\0';
 
-    /* Done. */
-
     return XDS_OK;
 }
 
@@ -765,8 +728,8 @@
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 static const char xds_pad64 = '=';
 
-static int base64_encode(char *dst, size_t dstlen, unsigned char const *src,
-                         size_t srclen)
+static int base64_encode(char *dst, size_t dstlen, 
+                         unsigned char const *src, size_t srclen)
 {
     size_t dstpos;
     unsigned char input[3];
@@ -791,10 +754,10 @@
         input[2] = *src++;
         srclen -= 3;
 
-        output[0] = (input[0] >> 2);
+        output[0] = ( input[0] >> 2);
         output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
         output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
-        output[3] = (input[2] & 0x3f);
+        output[3] = ( input[2] & 0x3f);
 
         if (dstpos + 4 > dstlen)
             return -1;
@@ -810,7 +773,7 @@
         for (i = 0; i < srclen; i++)
             input[i] = *src++;
 
-        output[0] = (input[0] >> 2);
+        output[0] = ( input[0] >> 2);
         output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
         output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
 
@@ -832,26 +795,23 @@
     return dstpos;
 }
 
-int xml_encode_octetstream(xds_t * xds, void *engine_context,
+int xml_encode_octetstream(xds_t *xds, void *engine_context,
                            void *buffer, size_t buffer_size,
-                           size_t * used_buffer_size, va_list * args)
+                           size_t *used_buffer_size, va_list *args)
 {
     xds_uint8_t *src;
     size_t src_len;
 
     /* We need at least 27 byte for the starting and ending tag. */
-
     xds_init_encoding_engine(13 + 14);
 
     /* Get parameters from stack. */
-
-    src = (xds_uint8_t *) va_arg(*args, void *);
+    src = (xds_uint8_t *)va_arg(*args, void *);
     xds_check_parameter(src != NULL);
     src_len = va_arg(*args, size_t);
 
     /* Calculate how many bytes we'll need in buffer and make sure we have
-     * them. */
-
+       them. */
     *used_buffer_size = base64_encode(NULL, 0, src, src_len);
     if (*used_buffer_size == (size_t) - 1)
         return XDS_ERR_UNKNOWN;
@@ -861,10 +821,8 @@
         return XDS_ERR_OVERFLOW;
 
     /* Format the data into the buffer. */
-
     memmove(buffer, "<octetstream>", 13);
-    if (base64_encode((char *)buffer + 13, buffer_size - 13, src, src_len) <
-        0)
+    if (base64_encode((char *)buffer + 13, buffer_size - 13, src, src_len) < 0)
         return XDS_ERR_UNKNOWN;
     memmove((char *)buffer + *used_buffer_size - 14, "</octetstream>", 14);
 
@@ -873,8 +831,8 @@
     return XDS_OK;
 }
 
-static int base64_decode(unsigned char *dst, size_t dstlen, char const *src,
-                         size_t srclen)
+static int base64_decode(unsigned char *dst, size_t dstlen, 
+                         char const *src, size_t srclen)
 {
     int dstidx, state, ch = 0;
     unsigned char res;
@@ -941,8 +899,7 @@
      * We are done decoding Base-64 chars.  Let's see if we ended
      * on a byte boundary, and/or with erroneous trailing characters.
      */
-
-    if (ch == xds_pad64) {             /* We got a pad char. */
+    if (ch == xds_pad64) {         /* We got a pad char. */
         switch (state) {
             case 0:                /* Invalid = in first position */
             case 1:                /* Invalid = in second position */
@@ -994,9 +951,9 @@
     return dstidx;
 }
 
-int xml_decode_octetstream(xds_t * xds, void *engine_context,
+int xml_decode_octetstream(xds_t *xds, void *engine_context,
                            void *buffer, size_t buffer_size,
-                           size_t * used_buffer_size, va_list * args)
+                           size_t *used_buffer_size, va_list *args)
 {
     char *p;
     size_t p_len;
@@ -1004,23 +961,19 @@
     size_t *data_len;
 
     /* We need at least 27 byte for the starting and ending tag. */
-
     xds_init_encoding_engine(13 + 14);
 
     /* Get parameters from stack. */
-
     data = va_arg(*args, xds_uint8_t **);
     xds_check_parameter(data != NULL);
     data_len = va_arg(*args, size_t *);
 
     /* Check for the opening tag. */
-
     if (memcmp("<octetstream>", buffer, 13) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Find the end of the data and calculate the length of the
-     * base64-encoded stuff. */
-
+       base64-encoded stuff. */
     p = (char *)buffer + 13;
     while (p < ((char *)buffer + buffer_size) && *p != '<')
         ++p;
@@ -1032,8 +985,7 @@
     }
 
     /* Now find out how long the decoded data is going to be, allocate a
-     * buffer for it, and decode away. */
-
+       buffer for it, and decode away. */
     *data_len = base64_decode(NULL, 0, p, p_len);
     if (*data_len == (size_t) - 1)
         return XDS_ERR_UNKNOWN;
@@ -1043,14 +995,12 @@
     base64_decode(*data, *data_len, p, p_len);
 
     /* Check that we have a closing tag. */
-
     if (memcmp(p + p_len, "</octetstream>", 14) != 0) {
         free(*data);
         return XDS_ERR_TYPE_MISMATCH;
     }
 
-    /* Done. */
-
     *used_buffer_size = 13 + p_len + 14;
     return XDS_OK;
 }
+


ossp-pkg/xds/xds_test_lib.c 1.2 -> 1.3

--- xds_test_lib.c       2001/08/09 19:58:35     1.2
+++ xds_test_lib.c       2001/08/09 20:59:05     1.3
@@ -34,13 +34,12 @@
 
 #ifdef XDS_TEST_XDS_CORE
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *ctx[50];
     size_t i;
 
     /* Open a bunch of contextes and close them again. */
-
     for (i = 0; i < sizeof (ctx) / sizeof (xds_t *); ++i) {
         if (i % 2 == 0)
             ctx[i] = xds_init(XDS_ENCODE);
@@ -58,7 +57,6 @@
 
 #ifdef NDEBUG
     /* Check how the library deals with errorneous arguments. */
-
     if (xds_init((xds_mode_t) 42) != NULL || errno != EINVAL) {
         printf
             ("Called xds_init() with invalid mode but didn't get EINVAL.\n");
@@ -66,13 +64,11 @@
     }
 
     /* Call xds_destroy() with an invalid context and see whether we survive
-     * that. */
-
+       that. */
     xds_destroy(NULL);
 #endif
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -80,7 +76,7 @@
 
 #ifdef XDS_TEST_XDS_FIND_ENGINE
 
-int main()
+int main(int argc, char *argv[])
 {
     const engine_map_t engines[] = {
         {"alan", NULL, 0},
@@ -101,118 +97,83 @@
     size_t i;
 
     /* Does xds_find_engine handle an empty array? */
-
     if (xds_find_engine(engines, 0, "whatever", &pos)) {
-        printf
-            ("xds_find_engine() said 'whatever' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'whatever' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != 0) {
-        printf
-            ("xds_find_engine() would insert 'whatever' at position %d, but 0 is correct.\n",
-             pos);
+        printf("xds_find_engine() would insert 'whatever' at position %d, but 0 is correct.\n", pos);
         exit(1);
     }
 
     /* Search for every single entry in the array and check the results. */
-
     for (i = 0; i < engines_len; ++i) {
         if (!xds_find_engine(engines, engines_len, engines[i].name, &pos)) {
-            printf
-                ("xds_find_engine() said '%s' wouldn't be in the array, but that's wrong.\n",
-                 engines[i].name);
+            printf("xds_find_engine() said '%s' wouldn't be in the array, but that's wrong.\n", engines[i].name);
             exit(1);
         }
         if (pos != i) {
-            printf
-                ("xds_find_engine() would insert '%s' at position %d, but %d is correct.\n",
-                 engines[i].name, pos, i);
+            printf("xds_find_engine() would insert '%s' at position %d, but %d is correct.\n", engines[i].name, pos, i);
             exit(1);
         }
     }
 
     /* Search for non-existing name that would be inserted at the first
-     * position. */
-
+       position. */
     if (xds_find_engine(engines, engines_len, "aaron", &pos)) {
-        printf
-            ("xds_find_engine() said 'aaron' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'aaron' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != 0) {
-        printf
-            ("xds_find_engine() would insert 'aaron' at position %d, but 0 is correct.\n",
-             pos);
+        printf("xds_find_engine() would insert 'aaron' at position %d, but 0 is correct.\n", pos);
         exit(1);
     }
 
     /* Search for non-existing name that would be inserted at last position. */
-
     if (xds_find_engine(engines, engines_len, "zerberos", &pos)) {
-        printf
-            ("xds_find_engine() said 'zerberos' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'zerberos' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != engines_len) {
-        printf
-            ("xds_find_engine() would insert 'zerberos' at position %d, but %d is correct.\n",
-             pos, engines_len);
+        printf("xds_find_engine() would insert 'zerberos' at position %d, but %d is correct.\n", pos, engines_len);
         exit(1);
     }
 
-    /* Search for non-existing names that would be inserted at random
-     * positions. */
-
+    /* Search for non-existing names that would be inserted at random positions. */
     if (xds_find_engine(engines, engines_len, "balthasar", &pos)) {
-        printf
-            ("xds_find_engine() said 'balthasar' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'balthasar' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != 1) {
-        printf
-            ("xds_find_engine() would insert 'balthasar' at position %d, but 1 is correct.\n",
-             pos);
+        printf("xds_find_engine() would insert 'balthasar' at position %d, but 1 is correct.\n", pos);
         exit(1);
     }
-
     if (xds_find_engine(engines, engines_len, "bulli", &pos)) {
-        printf
-            ("xds_find_engine() said 'bulli' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'bulli' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != 2) {
-        printf
-            ("xds_find_engine() would insert 'bulli' at position %d, but 2 is correct.\n",
-             pos);
+        printf("xds_find_engine() would insert 'bulli' at position %d, but 2 is correct.\n", pos);
         exit(1);
     }
-
     if (xds_find_engine(engines, engines_len, "hildegard", &pos)) {
-        printf
-            ("xds_find_engine() said 'hildegard' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'hildegard' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != 8) {
-        printf
-            ("xds_find_engine() would insert 'hildegard' at position %d, but 8 is correct.\n",
-             pos);
+        printf("xds_find_engine() would insert 'hildegard' at position %d, but 8 is correct.\n", pos);
         exit(1);
     }
-
     if (xds_find_engine(engines, engines_len, "harald", &pos)) {
-        printf
-            ("xds_find_engine() said 'harald' would be in the array, but that's wrong.\n");
+        printf("xds_find_engine() said 'harald' would be in the array, but that's wrong.\n");
         exit(1);
     }
     if (pos != 7) {
-        printf
-            ("xds_find_engine() would insert 'harald' at position %d, but 7 is correct.\n",
-             pos);
+        printf("xds_find_engine() would insert 'harald' at position %d, but 7 is correct.\n", pos);
         exit(1);
     }
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -220,14 +181,14 @@
 
 #ifdef XDS_TEST_XDS_REGISTER
 
-static int dummy_engine(xds_t * xds, void *engine_context,
+static int dummy_engine(xds_t *xds, void *engine_context,
                         void *buffer, size_t buffer_size,
-                        size_t * used_buffer_size, va_list * args)
+                        size_t *used_buffer_size, va_list *args)
 {
     return 0;
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     const char *test_names[] = {
         "foo",
@@ -242,7 +203,6 @@
     size_t i;
 
     /* Create context. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -250,8 +210,7 @@
     }
 
     /* Register the dummy callback under an invalid name to see whether the
-     * routine fails correctly. */
-
+       routine fails correctly. */
     if (xds_register(xds, "abcdefh1230#", &dummy_engine, NULL) !=
         XDS_ERR_INVALID_ARG) {
         printf
@@ -260,7 +219,6 @@
     }
 
     /* Register the dummy callback under multiple names. */
-
     for (i = 0; i < test_names_len; ++i) {
         if (xds_register(xds, test_names[i], &dummy_engine, NULL) != XDS_OK) {
             printf("Failed to register engine for '%s'.\n", test_names[i]);
@@ -269,14 +227,12 @@
     }
 
     /* Register the callback again, overwriting an existing entry. */
-
     if (xds_register(xds, "claus", &dummy_engine, NULL) != XDS_OK) {
         printf("Failed to re-register engine for 'claus'.\n");
         return 1;
     }
 
     /* Ensure that everything is in alphabetical order. */
-
     for (i = 1; i < xds->engines_len; ++i) {
         assert(xds->engines[i - 1].name != NULL);
         assert(xds->engines[i].name != NULL);
@@ -287,15 +243,12 @@
     }
 
     /* Try to remove an unknown entry. */
-
     if (xds_unregister(xds, "abacadabra") != XDS_ERR_UNKNOWN_ENGINE) {
-        printf
-            ("xds_unregister() succeeded at removing 'abacadabra' even though it is not there.\n");
+        printf("xds_unregister() succeeded at removing 'abacadabra' even though it is not there.\n");
         exit(1);
     }
 
     /* Remove an entry from the middle. */
-
     if (xds_unregister(xds, test_names[test_names_len / 2]) != XDS_OK) {
         printf("xds_unregister() failed to remove '%s'.\n",
                test_names[test_names_len / 2]);
@@ -303,7 +256,6 @@
     }
 
     /* Remove the last entry. */
-
     assert(test_names_len > 0);
     if (xds_unregister(xds, test_names[test_names_len - 1]) != XDS_OK) {
         printf("xds_unregister() failed to remove '%s'.\n",
@@ -312,18 +264,15 @@
     }
 
     /* Remove the first entry. */
-
     if (xds_unregister(xds, test_names[0]) != XDS_OK) {
         printf("xds_unregister() failed to remove '%s'.\n", test_names[0]);
         exit(1);
     }
 
     /* Clean up. */
-
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -331,9 +280,9 @@
 
 #ifdef XDS_TEST_XDS_SETBUFFER
 
-static int dummy_engine(xds_t * xds, void *engine_context,
+static int dummy_engine(xds_t *xds, void *engine_context,
                         void *buffer, size_t buffer_size,
-                        size_t * used_buffer_size, va_list * args)
+                        size_t *used_buffer_size, va_list *args)
 {
     assert(xds != NULL);
     assert(buffer != NULL);
@@ -348,14 +297,13 @@
     return XDS_OK;
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
     size_t buffer_size;
 
     /* Create XDS context. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -363,15 +311,13 @@
     }
 
     /* Register the callback. */
-
     if (xds_register(xds, "dummy", &dummy_engine, NULL) != XDS_OK) {
         printf("Failed to register my encoding engine.\n");
         return 1;
     }
 
     /* Give the library a buffer of 32 byte, call the engine once, get the
-     * buffer back and see whether it has been enlarged or not. */
-
+       buffer back and see whether it has been enlarged or not. */
     buffer_size = 32;
     buffer = malloc(buffer_size);
     if (buffer == NULL) {
@@ -386,22 +332,19 @@
         printf("xds_encode() failed!\n");
         return 1;
     }
-    if (xds_getbuffer(xds, XDS_GIFT, (void **)&buffer, &buffer_size) !=
-        XDS_OK) {
+    if (xds_getbuffer(xds, XDS_GIFT, (void **)&buffer, &buffer_size) != XDS_OK) {
         printf("xds_getbuffer() failed!\n");
         return 1;
     }
     if (buffer_size < 64) {
-        printf
-            ("xds_encode() did not enlarge the buffer after processing the callback\n");
+        printf("xds_encode() did not enlarge the buffer after processing the callback\n");
         printf("even though all capacity was used up!\n");
         return 1;
     }
 
     /* Loan the library a buffer we own, call the engine once to exceed the
-     * buffer's capacity and check, whether the library returns the correct
-     * error code. */
-
+       buffer's capacity and check, whether the library returns the correct
+       error code. */
     buffer = malloc(32);
     if (buffer == NULL) {
         printf("Failed to allocate my memory.\n");
@@ -419,11 +362,9 @@
     free(buffer);
 
     /* Clean up. */
-
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -431,20 +372,19 @@
 
 #ifdef XDS_TEST_XDS_GETBUFFER
 
-static int dummy_engine(xds_t * xds, void *engine_context,
+static int dummy_engine(xds_t *xds, void *engine_context,
                         void *buffer, size_t buffer_size,
-                        size_t * used_buffer_size, va_list * args)
+                        size_t *used_buffer_size, va_list *args)
 {
     if (buffer_size < 6)
         return XDS_ERR_OVERFLOW;
     else
         *used_buffer_size = 6;
-
     memmove(buffer, "Hallo!", 6);
     return XDS_OK;
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *old;
@@ -453,7 +393,6 @@
     size_t new_len;
 
     /* Create XDS context. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -461,16 +400,14 @@
     }
 
     /* Register the dummy callback under multiple names. */
-
     if (xds_register(xds, "text", &dummy_engine, (void *)42) != XDS_OK) {
         printf("Failed to register my encoding engine.\n");
         return 1;
     }
 
     /* Encode something, then flush the buffer by calling xds_getbuffer(),
-     * then encode something new and verify that the old buffer hasn't ben
-     * overwritten and that the new one contains the correct string. */
-
+       then encode something new and verify that the old buffer hasn't ben
+       overwritten and that the new one contains the correct string. */
     if (xds_encode(xds, "text text") != XDS_OK) {
         printf("xds_encode() failed!\n");
         return 1;
@@ -496,9 +433,8 @@
     free(new);
 
     /* Encode somthing, then get the buffer via XDS_LOAN and verify the
-     * contents. Encode something new and compare the new content with what
-     * we expect. */
-
+       contents. Encode something new and compare the new content with what
+       we expect. */
     if (xds_encode(xds, "text text") != XDS_OK) {
         printf("xds_encode() failed!\n");
         return 1;
@@ -530,11 +466,9 @@
     }
 
     /* Clean up. */
-
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -542,9 +476,9 @@
 
 #ifdef XDS_TEST_XDS_ENCODE
 
-static int dummy_engine(xds_t * xds, void *engine_context,
+static int dummy_engine(xds_t *xds, void *engine_context,
                         void *buffer, size_t buffer_size,
-                        size_t * used_buffer_size, va_list * args)
+                        size_t *used_buffer_size, va_list *args)
 {
     if (xds == NULL) {
         printf("XDS context isn't passed through to registered engine.\n");
@@ -577,12 +511,11 @@
     return XDS_OK;
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
 
     /* Create XDS context. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -590,7 +523,6 @@
     }
 
     /* Register the dummy callback under multiple names. */
-
     if (xds_register(xds, "int", &dummy_engine, (void *)42) != XDS_OK ||
         xds_register(xds, "float", &dummy_engine, (void *)42) != XDS_OK ||
         xds_register(xds, "double", &dummy_engine, (void *)42) != XDS_OK ||
@@ -600,7 +532,6 @@
     }
 
     /* Let's go and encode something. */
-
     if (xds_encode(xds, "int:text    double double float") != XDS_OK) {
         printf("xds_encode() failed!\n");
         return 1;
@@ -611,11 +542,9 @@
     }
 
     /* Clean up. */
-
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -623,9 +552,9 @@
 
 #ifdef XDS_TEST_XDS_DECODE
 
-static int dummy_engine(xds_t * xds, void *engine_context,
+static int dummy_engine(xds_t *xds, void *engine_context,
                         void *buffer, size_t buffer_size,
-                        size_t * used_buffer_size, va_list * args)
+                        size_t *used_buffer_size, va_list *args)
 {
     if (xds == NULL) {
         printf("XDS context isn't passed through to registered engine.\n");
@@ -656,21 +585,19 @@
         exit(1);
     }
     if (memcmp(buffer, "Hallo!", 6) != 0) {
-        printf
-            ("The contents of the decode buffer are not what we expected.\n");
+        printf("The contents of the decode buffer are not what we expected.\n");
         exit(1);
     }
     *used_buffer_size = 6;
     return XDS_OK;
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char buffer[] = "Hallo!Hallo!Hallo!";
 
     /* Create XDS context. */
-
     xds = xds_init(XDS_DECODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -678,27 +605,22 @@
     }
 
     /* Register the dummy callback under multiple names. */
-
     if (xds_register(xds, "text", &dummy_engine, (void *)42) != XDS_OK) {
         printf("Failed to register my decoding engines.\n");
         return 1;
     }
 
-    /* Decode the buffer and have the callback report when something is
-     * wrong. */
-
+    /* Decode the buffer and have the callback report when something is wrong. */
     if (xds_setbuffer(xds, XDS_LOAN, buffer, sizeof (buffer) - 1) != XDS_OK) {
         printf("xds_decode() failed!");
         return 1;
     }
-
     if (xds_decode(xds, "text::text text") != XDS_OK) {
         printf("xds_decode() failed!");
         return 1;
     }
 
     /* Clean up. */
-
     xds_destroy(xds);
 
     /* Everything went fine. */
@@ -710,9 +632,9 @@
 
 #ifdef XDS_TEST_XDS_ENGINE_RESTART
 
-static int dummy_engine(xds_t * xds, void *engine_context,
+static int dummy_engine(xds_t *xds, void *engine_context,
                         void *buffer, size_t buffer_size,
-                        size_t * used_buffer_size, va_list * args)
+                        size_t *used_buffer_size, va_list *args)
 {
     if (xds == NULL) {
         printf("XDS context isn't passed through to registered engine.\n");
@@ -749,19 +671,18 @@
     return XDS_OK;
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
     size_t buffer_size;
 
     /* Create an XDS context and set a buffer that's too small for the first
-     * encode() call. Then call encode() with two parameters: the one the
-     * engine is expecting and a different one after that. The engine will
-     * complain if it sees the second value -- what would mean that the args
-     * parameter was not resetted to the original value before the engine is
-     * restarted after buffer enlargement. */
-
+       encode() call. Then call encode() with two parameters: the one the
+       engine is expecting and a different one after that. The engine will
+       complain if it sees the second value -- what would mean that the args
+       parameter was not resetted to the original value before the engine is
+       restarted after buffer enlargement. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -798,9 +719,9 @@
     xds_uint32_t positive;
 };
 
-static int encode_mystruct_engine(xds_t * xds, void *engine_context,
+static int encode_mystruct_engine(xds_t *xds, void *engine_context,
                                   void *buffer, size_t buffer_size,
-                                  size_t * used_buffer_size, va_list * args)
+                                  size_t *used_buffer_size, va_list *args)
 {
     struct mystruct *ms;
 
@@ -814,9 +735,9 @@
     return xds_encode(xds, "int32 uint32", ms->small, ms->positive);
 }
 
-static int decode_mystruct_engine(xds_t * xds, void *engine_context,
+static int decode_mystruct_engine(xds_t *xds, void *engine_context,
                                   void *buffer, size_t buffer_size,
-                                  size_t * used_buffer_size, va_list * args)
+                                  size_t *used_buffer_size, va_list *args)
 {
     struct mystruct *ms;
 
@@ -830,7 +751,7 @@
     return xds_decode(xds, "int32 uint32", &(ms->small), &(ms->positive));
 }
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -841,14 +762,13 @@
     ms.positive = 42;
 
     /* Encode our copy of mystruct using our encoding callback. Then get a
-     * the buffer and destroy the context again. */
-
+       the buffer and destroy the context again. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
         return 1;
     }
-    if (xds_register(xds, "mystruct", &encode_mystruct_engine, NULL) != XDS_OK
+    if (   xds_register(xds, "mystruct", &encode_mystruct_engine, NULL) != XDS_OK
         || xds_register(xds, "int32", &xdr_encode_int32, NULL) != XDS_OK
         || xds_register(xds, "uint32", &xdr_encode_uint32, NULL) != XDS_OK) {
         printf("Failed to register my encoding engines.\n");
@@ -881,7 +801,6 @@
     printf("The encoded representation is %u bytes long.\n", buffer_size);
 
     /* Now create a decoding context and decode the whole thing again. */
-
     xds = xds_init(XDS_DECODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -904,7 +823,6 @@
     xds_destroy(xds);
 
     /* Both structures must be identical. */
-
     if (ms.small != new_ms.small
         || ms.positive != new_ms.positive) {
         printf("Decoded data does not match the original!\n");
@@ -912,8 +830,8 @@
     }
 
     /* Everything went fine. */
-
     return 0;
 }
 
 #endif /* XDS_TEST_XDS_MYSTRUCT */
+


ossp-pkg/xds/xds_test_xdr.c 1.2 -> 1.3

--- xds_test_xdr.c       2001/08/09 19:58:35     1.2
+++ xds_test_xdr.c       2001/08/09 20:59:05     1.3
@@ -37,7 +37,7 @@
 
 #ifdef XDS_TEST_XDR_INT32
 
-int main()
+int main(int argc, char *argv[])
 {
     XDR xdrs;
     char xdr_buf[1024];
@@ -59,7 +59,6 @@
     size_t i;
 
     /* Encode the values array using the RPC-XDR implementation. */
-
     xdrmem_create(&xdrs, xdr_buf, sizeof (xdr_buf), XDR_ENCODE);
     for (i = 0; i < sizeof (values) / sizeof (xds_int32_t); ++i)
         xdr_int32_t(&xdrs, &values[i]);
@@ -67,7 +66,6 @@
     xdr_destroy(&xdrs);
 
     /* Encode the values array using the XDS implementation. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -91,7 +89,6 @@
     xds_destroy(xds);
 
     /* Both buffers must be equal now. */
-
     if (xdr_buf_size != xds_buf_size) {
         printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size,
                xds_buf_size);
@@ -103,9 +100,8 @@
     }
 
     /* Now we decode the values again using the XDS implementation and
-     * compare them to our original values. Obviously, they should not
-     * differ. */
-
+       compare them to our original values. Obviously, they should not
+       differ. */
     xds = xds_init(XDS_DECODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -133,7 +129,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -142,13 +137,13 @@
 #ifdef XDS_TEST_XDR_UINT32
 
 #ifdef __FreeBSD__
-static int xdr_uint32_t(XDR * xdrs, uint32_t * val)
+static int xdr_uint32_t(XDR *xdrs, uint32_t *val)
 {
     return xdr_u_int32_t(xdrs, val);
 }
 #endif
 
-int main()
+int main(int argc, char *argv[])
 {
     XDR xdrs;
     char xdr_buf[1024];
@@ -169,7 +164,6 @@
     size_t i;
 
     /* Encode the values array using the RPC-XDR implementation. */
-
     xdrmem_create(&xdrs, xdr_buf, sizeof (xdr_buf), XDR_ENCODE);
     for (i = 0; i < sizeof (values) / sizeof (xds_uint32_t); ++i)
         xdr_uint32_t(&xdrs, &values[i]);
@@ -177,7 +171,6 @@
     xdr_destroy(&xdrs);
 
     /* Encode the values array using the XDS implementation. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -201,7 +194,6 @@
     xds_destroy(xds);
 
     /* Both buffers must be equal now. */
-
     if (xdr_buf_size != xds_buf_size) {
         printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size,
                xds_buf_size);
@@ -213,9 +205,8 @@
     }
 
     /* Now we decode the values again using the XDS implementation and
-     * compare them to our original values. Obviously, they should not
-     * differ. */
-
+       compare them to our original values. Obviously, they should not
+       differ. */
     xds = xds_init(XDS_DECODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -243,7 +234,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -253,7 +243,7 @@
 
 #ifdef XDS_HAVE_64_BIT_SUPPORT
 
-int main()
+int main(int argc, char *argv[])
 {
     XDR xdrs;
     char xdr_buf[1024];
@@ -275,7 +265,6 @@
     size_t i;
 
     /* Encode the values array using the RPC-XDR implementation. */
-
     xdrmem_create(&xdrs, xdr_buf, sizeof (xdr_buf), XDR_ENCODE);
     for (i = 0; i < sizeof (values) / sizeof (xds_int64_t); ++i)
         xdr_int64_t(&xdrs, &values[i]);
@@ -283,7 +272,6 @@
     xdr_destroy(&xdrs);
 
     /* Encode the values array using the XDS implementation. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -307,7 +295,6 @@
     xds_destroy(xds);
 
     /* Both buffers must be equal now. */
-
     if (xdr_buf_size != xds_buf_size) {
         printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size,
                xds_buf_size);
@@ -319,9 +306,8 @@
     }
 
     /* Now we decode the values again using the XDS implementation and
-     * compare them to our original values. Obviously, they should not
-     * differ. */
-
+       compare them to our original values. Obviously, they should not
+       differ. */
     xds = xds_init(XDS_DECODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -349,7 +335,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -362,13 +347,13 @@
 #ifdef XDS_HAVE_64_BIT_SUPPORT 
 
 #ifdef __FreeBSD__
-static int xdr_uint64_t(XDR * xdrs, uint64_t * val)
+static int xdr_uint64_t(XDR *xdrs, uint64_t *val)
 {
     return xdr_u_int64_t(xdrs, val);
 }
 #endif
 
-int main()
+int main(int argc, char *argv[])
 {
     XDR xdrs;
     char xdr_buf[1024];
@@ -389,7 +374,6 @@
     size_t i;
 
     /* Encode the values array using the RPC-XDR implementation. */
-
     xdrmem_create(&xdrs, xdr_buf, sizeof (xdr_buf), XDR_ENCODE);
     for (i = 0; i < sizeof (values) / sizeof (xds_uint64_t); ++i)
         xdr_uint64_t(&xdrs, &values[i]);
@@ -397,7 +381,6 @@
     xdr_destroy(&xdrs);
 
     /* Encode the values array using the XDS implementation. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -421,7 +404,6 @@
     xds_destroy(xds);
 
     /* Both buffers must be equal now. */
-
     if (xdr_buf_size != xds_buf_size) {
         printf("The buffer sizes don't match: %d != %d.\n", xdr_buf_size,
                xds_buf_size);
@@ -433,9 +415,8 @@
     }
 
     /* Now we decode the values again using the XDS implementation and
-     * compare them to our original values. Obviously, they should not
-     * differ. */
-
+       compare them to our original values. Obviously, they should not
+       differ. */
     xds = xds_init(XDS_DECODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -463,7 +444,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -473,7 +453,7 @@
 
 #ifdef XDS_TEST_XDR_STRING
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -483,8 +463,7 @@
     char *new_msg;
 
     /* Encode the string as octet stream. Then erase the buffer and decode
-     * the string back, verifying that it hasn't changed. */
-
+       the string back, verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -538,7 +517,6 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -546,7 +524,7 @@
 
 #ifdef XDS_TEST_XDR_STRING_EMPTY
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -556,8 +534,7 @@
     char *new_msg;
 
     /* Encode the string as octet stream. Then erase the buffer and decode
-     * the string back, verifying that it hasn't changed. */
-
+       the string back, verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -607,7 +584,6 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -615,7 +591,7 @@
 
 #ifdef XDS_TEST_XDR_OCTETSTREAM
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -626,8 +602,7 @@
     size_t new_msg_size;
 
     /* Encode the string as octet stream. Then erase the buffer and decode
-     * the string back, verifying that it hasn't changed. */
-
+       the string back, verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -682,7 +657,6 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -690,7 +664,7 @@
 
 #ifdef XDS_TEST_XDR_OCTETSTREAM_EMPTY
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -701,8 +675,7 @@
     size_t new_msg_size;
 
     /* Encode the string as octet stream. Then erase the buffer and decode
-     * the string back, verifying that it hasn't changed. */
-
+       the string back, verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -723,8 +696,7 @@
     }
     xds_destroy(xds);
     if (buffer_size % 4 != 0) {
-        printf
-            ("The encoded octet stream's buffer size is not a multiple of 4.\n");
+        printf("The encoded octet stream's buffer size is not a multiple of 4.\n");
         return 1;
     }
 
@@ -757,8 +729,8 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
 #endif /* XDS_TEST_XDR_OCTETSTREAM_EMPTY */
+


ossp-pkg/xds/xds_test_xml.c 1.2 -> 1.3

--- xds_test_xml.c       2001/08/09 19:58:35     1.2
+++ xds_test_xml.c       2001/08/09 20:59:05     1.3
@@ -35,7 +35,7 @@
 
 #ifdef XDS_TEST_XML_INT32
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -53,7 +53,6 @@
     size_t i;
 
     /* Encode the values array, then decode it back and compare the numbers. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -125,7 +124,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -133,7 +131,7 @@
 
 #ifdef XDS_TEST_XML_UINT32
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -150,7 +148,6 @@
     size_t i;
 
     /* Encode the values array, then decode it back and compare the numbers. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -202,7 +199,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -212,7 +208,7 @@
 
 #ifdef XDS_HAVE_64_BIT_SUPPORT
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -230,7 +226,6 @@
     size_t i;
 
     /* Encode the values array, then decode it back and compare the numbers. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -280,7 +275,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -292,7 +286,7 @@
 
 #ifdef XDS_HAVE_64_BIT_SUPPORT
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -309,7 +303,6 @@
     size_t i;
 
     /* Encode the values array, then decode it back and compare the numbers. */
-
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -359,7 +352,6 @@
     xds_destroy(xds);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -369,7 +361,7 @@
 
 #ifdef XDS_TEST_XML_DOUBLE
 
-int main()
+int main(int argc, char *argv[])
 {
 #if 0
     xds_t *xds;
@@ -445,7 +437,7 @@
 
 #ifdef XDS_TEST_XML_STRING
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -455,8 +447,7 @@
     char *new_msg;
 
     /* Encode the string, then erase the buffer and decode the string back,
-     * verifying that it hasn't changed. */
-
+       verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -512,7 +503,6 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -520,7 +510,7 @@
 
 #ifdef XDS_TEST_XML_STRING_EMPTY
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -530,8 +520,7 @@
     char *new_msg;
 
     /* Encode the string, then erase the buffer and decode the string back,
-     * verifying that it hasn't changed. */
-
+       verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -587,7 +576,6 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -595,7 +583,7 @@
 
 #ifdef XDS_TEST_XML_OCTETSTREAM
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -606,8 +594,7 @@
     size_t new_msg_size;
 
     /* Encode the string as octet stream. Then erase the buffer and decode
-     * the string back, verifying that it hasn't changed. */
-
+       the string back, verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -663,7 +650,6 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
@@ -671,7 +657,7 @@
 
 #ifdef XDS_TEST_XML_OCTETSTREAM_EMPTY
 
-int main()
+int main(int argc, char *argv[])
 {
     xds_t *xds;
     char *buffer;
@@ -682,8 +668,7 @@
     size_t new_msg_size;
 
     /* Encode the string as octet stream. Then erase the buffer and decode
-     * the string back, verifying that it hasn't changed. */
-
+       the string back, verifying that it hasn't changed. */
     xds = xds_init(XDS_ENCODE);
     if (xds == NULL) {
         printf("Failed to initialize XDS context.\n");
@@ -739,8 +724,8 @@
     free(new_msg);
 
     /* Everything went fine. */
-
     return 0;
 }
 
 #endif /* XDS_TEST_XML_OCTETSTREAM_EMPTY */
+

CVSTrac 2.0.1