OSSP CVS Repository

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

--- xml-decode-uint64.c  2001/08/01 13:26:29     1.3.2.1
+++ xml-decode-uint64.c  2001/08/01 15:08:02     1.3.2.2
@@ -29,29 +29,18 @@
 #include <ctype.h>
 #include "internal.h"
 
-int xml_decode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_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* 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;
-
-    /* The buffer must contain at least opening tag, closing tag and
-       one digit. Check whether it is large enough. */
-
-    if (buffer_size < 8 + 9 + 1)
-        return XDS_ERR_UNDERFLOW;
+    xds_init_decoding_engine(8 + 9 + 1);
 
     /* Does the opening XML tag match? */
 
-    if (strncmp(buffer, "<uint64>", 8) != 0)
+    if (strncasecmp(buffer, "<uint64>", 8) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
     /* Decode the representation of the value. */
@@ -71,8 +60,9 @@
 
     if (p+9 > (char*)buffer + buffer_size)
         return XDS_ERR_UNDERFLOW;
-    else if (strncmp(p, "</uint64>", 9) != 0)
+    else if (strncasecmp(p, "</uint64>", 9) != 0)
         return XDS_ERR_TYPE_MISMATCH;
 
-    return p + 9 - (char*)buffer;
+    *used_buffer_size = p + 9 - (char*)buffer;
+    return XDS_OK;
     }

CVSTrac 2.0.1