ossp-pkg/xds/xml-encode-int32.c 1.1 -> 1.2
--- xml-encode-int32.c 2001/07/23 15:28:53 1.1
+++ xml-encode-int32.c 2001/07/23 15:57:47 1.2
@@ -25,10 +25,31 @@
SUCH DAMAGE.
*/
+#include <stdio.h>
#include <assert.h>
#include "internal.h"
int xml_encode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
{
- return -1;
+ int rc;
+ xds_int32_t value;
+
+ /* 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;
+
+ /* Format value into buffer. */
+
+ value = va_arg(*args, xds_int32_t);
+ rc = snprintf(buffer, buffer_size, "<int32>%d</int32>", value);
+ if (rc < 0)
+ return buffer_size*2;
+ assert(rc >= 15);
+
+ return rc;
}
|
|