OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/xml-encode-int64.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-int64.c 1.3.2.1 -> 1.3.2.2

--- xml-encode-int64.c   2001/08/01 13:26:30     1.3.2.1
+++ xml-encode-int64.c   2001/08/01 15:08:02     1.3.2.2
@@ -28,7 +28,9 @@
 #include <string.h>
 #include "internal.h"
 
-int xml_encode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_int64(xds_t* xds, void* engine_context,
+                     void* buffer, size_t buffer_size, size_t* used_buffer_size,
+                     va_list* args)
     {
     xds_int64_t value;
     char buf[64];
@@ -36,14 +38,7 @@
     char* p;
     int negative;
 
-    /* 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(7 + 8 + 21);
 
     /* Format value into our buffer. */
 
@@ -66,21 +61,20 @@
     if (negative)
         buf[i++] = '-';
 
-    /* Check the buffer size. */
+    /* Store the correct buffer size. */
 
-    if (buffer_size < 7 + 8 + i)
-        return 7 + 8 + i;
+    *used_buffer_size = 7 + 8 + i;
 
     /* Write result into the buffer. */
 
     p = buffer;
-    strcpy(p, "<int64>");
+    memmove(p, "<int64>", 7);
     p += 7;
     for (j = i; j > 0; )
         {
         *p++ = buf[--j];
         }
-    strcpy(p, "</int64>");
+    memmove(p, "</int64>", 8);
 
-    return 7 + 8 + i;
+    return XDS_OK;
     }

CVSTrac 2.0.1