OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/xml-encode-uint64.c versions 1.3.2.1 and 1.3.2.2
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/xds/xml-encode-uint64.c 1.3.2.1 -> 1.3.2.2

--- xml-encode-uint64.c  2001/08/01 13:26:30     1.3.2.1
+++ xml-encode-uint64.c  2001/08/01 15:08:02     1.3.2.2
@@ -28,21 +28,16 @@
 #include <string.h>
 #include "internal.h"
 
-int xml_encode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_uint64(xds_t* xds, void* engine_context,
+                     void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                     va_list* args)
     {
     xds_uint64_t value;
     char buf[64];
     size_t i, j;
     char* p;
 
-    /* Consistency checks. */
-
-    assert(xds != NULL);
-    assert(buffer != NULL);
-    assert(buffer_size != 0);
-    assert(args != NULL);
-    if (xds == NULL || buffer == NULL || buffer_size == 0 || args == NULL)
-        return XDS_ERR_INVALID_ARG;
+    xds_init_encoding_engine(8 + 9 + 20);
 
     /* Format value into our buffer. */
 
@@ -56,21 +51,20 @@
         }
     while (value != 0);
 
-    /* Check the buffer size. */
+    /* Store the correct buffer size. */
 
-    if (buffer_size < 8 + 9 + i)
-        return 8 + 9 + i;
+    *used_buffer_size = 8 + 9 + i;
 
     /* Write result into the buffer. */
 
     p = buffer;
-    strcpy(p, "<uint64>");
+    memmove(p, "<uint64>", 8);
     p += 8;
     for (j = i; j > 0; )
         {
         *p++ = buf[--j];
         }
-    strcpy(p, "</uint64>");
+    memmove(p, "</uint64>", 9);
 
-    return 8 + 9 + i;
+    return XDS_OK;
     }

CVSTrac 2.0.1