Check-in Number:
|
4270 | |
Date: |
2001-Aug-01 17:08:02 (local)
2001-Aug-01 15:08:02 (UTC) |
User: | simons |
Branch: | callback-semantic-rewrite |
Comment: |
Rewrote callbacks for new semantic. |
Tickets: |
|
Inspections: |
|
Files: |
ossp-pkg/xds/xml-decode-begin.c
|
1.1.2.1
->
1.1.2.2
|
 
5 inserted, 15 deleted
|
ossp-pkg/xds/xml-decode-double.c
|
1.3
->
1.3.2.1
|
 
3 inserted, 1 deleted
|
ossp-pkg/xds/xml-decode-end.c
|
1.1.2.1
->
1.1.2.2
|
 
5 inserted, 15 deleted
|
ossp-pkg/xds/xml-decode-int32.c
|
1.2.2.1
->
1.2.2.2
|
 
8 inserted, 18 deleted
|
ossp-pkg/xds/xml-decode-int64.c
|
1.3.2.1
->
1.3.2.2
|
 
8 inserted, 18 deleted
|
ossp-pkg/xds/xml-decode-uint32.c
|
1.2.2.1
->
1.2.2.2
|
 
8 inserted, 18 deleted
|
ossp-pkg/xds/xml-decode-uint64.c
|
1.3.2.1
->
1.3.2.2
|
 
8 inserted, 18 deleted
|
ossp-pkg/xds/xml-encode-begin.c
|
1.1.2.1
->
1.1.2.2
|
 
6 inserted, 14 deleted
|
ossp-pkg/xds/xml-encode-double.c
|
1.3
->
1.3.2.1
|
 
3 inserted, 1 deleted
|
ossp-pkg/xds/xml-encode-end.c
|
1.1.2.1
->
1.1.2.2
|
 
6 inserted, 14 deleted
|
ossp-pkg/xds/xml-encode-int32.c
|
1.3.2.1
->
1.3.2.2
|
 
12 inserted, 19 deleted
|
ossp-pkg/xds/xml-encode-int64.c
|
1.3.2.1
->
1.3.2.2
|
 
9 inserted, 15 deleted
|
ossp-pkg/xds/xml-encode-uint32.c
|
1.2.2.1
->
1.2.2.2
|
 
9 inserted, 15 deleted
|
ossp-pkg/xds/xml-encode-uint64.c
|
1.3.2.1
->
1.3.2.2
|
 
9 inserted, 15 deleted
|
|
ossp-pkg/xds/xml-decode-begin.c 1.1.2.1 -> 1.1.2.2
--- xml-decode-begin.c 2001/08/01 13:26:29 1.1.2.1
+++ xml-decode-begin.c 2001/08/01 15:08:02 1.1.2.2
@@ -28,22 +28,12 @@
#include <string.h>
#include "internal.h"
-int xml_decode_begin(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_begin(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
- /* 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;
-
- if (buffer_size < strlen(xds_xml_begin_text))
- return XDS_ERR_UNDERFLOW;
-
+ xds_init_encoding_engine(strlen(xds_xml_begin_text));
if (strncasecmp(buffer, xds_xml_begin_text, strlen(xds_xml_begin_text)) != 0)
return XDS_ERR_TYPE_MISMATCH;
-
- return strlen(xds_xml_begin_text);
+ return XDS_OK;
}
|
|
ossp-pkg/xds/xml-decode-double.c 1.3 -> 1.3.2.1
--- xml-decode-double.c 2001/07/24 13:52:41 1.3
+++ xml-decode-double.c 2001/08/01 15:08:02 1.3.2.1
@@ -27,7 +27,9 @@
#include "internal.h"
-int xml_decode_double(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_double(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
return -1;
}
|
|
ossp-pkg/xds/xml-decode-end.c 1.1.2.1 -> 1.1.2.2
--- xml-decode-end.c 2001/08/01 13:26:29 1.1.2.1
+++ xml-decode-end.c 2001/08/01 15:08:02 1.1.2.2
@@ -28,22 +28,12 @@
#include <string.h>
#include "internal.h"
-int xml_decode_end(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_end(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
- /* 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;
-
- if (buffer_size < strlen(xds_xml_end_text))
- return XDS_ERR_UNDERFLOW;
-
+ xds_init_decoding_engine(strlen(xds_xml_end_text));
if (strncasecmp(buffer, xds_xml_end_text, strlen(xds_xml_end_text)) != 0)
return XDS_ERR_TYPE_MISMATCH;
-
- return strlen(xds_xml_end_text);
+ return XDS_OK;
}
|
|
ossp-pkg/xds/xml-decode-int32.c 1.2.2.1 -> 1.2.2.2
--- xml-decode-int32.c 2001/08/01 13:26:29 1.2.2.1
+++ xml-decode-int32.c 2001/08/01 15:08:02 1.2.2.2
@@ -29,30 +29,19 @@
#include <ctype.h>
#include "internal.h"
-int xml_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_int32(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
xds_int32_t* value;
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;
-
- /* The buffer must contain at least opening tag, closing tag and
- one digit. Check whether it is large enough. */
-
- if (buffer_size < 7 + 8 + 1)
- return XDS_ERR_UNDERFLOW;
+ xds_init_decoding_engine(7 + 8 + 1);
/* Does the opening XML tag match? */
- if (strncmp(buffer, "<int32>", 7) != 0)
+ if (strncasecmp(buffer, "<int32>", 7) != 0)
return XDS_ERR_TYPE_MISMATCH;
/* Decode the representation of the value. */
@@ -81,8 +70,9 @@
if (p+8 > (char*)buffer + buffer_size)
return XDS_ERR_UNDERFLOW;
- else if (strncmp(p, "</int32>", 8) != 0)
+ else if (strncasecmp(p, "</int32>", 8) != 0)
return XDS_ERR_TYPE_MISMATCH;
- return p + 8 - (char*)buffer;
+ *used_buffer_size = p + 8 - (char*)buffer;
+ return XDS_OK;
}
|
|
ossp-pkg/xds/xml-decode-int64.c 1.3.2.1 -> 1.3.2.2
--- xml-decode-int64.c 2001/08/01 13:26:29 1.3.2.1
+++ xml-decode-int64.c 2001/08/01 15:08:02 1.3.2.2
@@ -29,30 +29,19 @@
#include <ctype.h>
#include "internal.h"
-int xml_decode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_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* 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;
-
- /* The buffer must contain at least opening tag, closing tag and
- one digit. Check whether it is large enough. */
-
- if (buffer_size < 7 + 8 + 1)
- return XDS_ERR_UNDERFLOW;
+ xds_init_decoding_engine(7 + 8 + 1);
/* Does the opening XML tag match? */
- if (strncmp(buffer, "<int64>", 7) != 0)
+ if (strncasecmp(buffer, "<int64>", 7) != 0)
return XDS_ERR_TYPE_MISMATCH;
/* Decode the representation of the value. */
@@ -81,8 +70,9 @@
if (p+8 > (char*)buffer + buffer_size)
return XDS_ERR_UNDERFLOW;
- else if (strncmp(p, "</int64>", 8) != 0)
+ else if (strncasecmp(p, "</int64>", 8) != 0)
return XDS_ERR_TYPE_MISMATCH;
- return p + 8 - (char*)buffer;
+ *used_buffer_size = p + 8 - (char*)buffer;
+ return XDS_OK;
}
|
|
ossp-pkg/xds/xml-decode-uint32.c 1.2.2.1 -> 1.2.2.2
--- xml-decode-uint32.c 2001/08/01 13:26:29 1.2.2.1
+++ xml-decode-uint32.c 2001/08/01 15:08:02 1.2.2.2
@@ -29,29 +29,18 @@
#include <ctype.h>
#include "internal.h"
-int xml_decode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_decode_uint32(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
xds_uint32_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, "<uint32>", 8) != 0)
+ if (strncasecmp(buffer, "<uint32>", 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, "</uint32>", 9) != 0)
+ else if (strncasecmp(p, "</uint32>", 9) != 0)
return XDS_ERR_TYPE_MISMATCH;
- return p + 9 - (char*)buffer;
+ *used_buffer_size = p + 9 - (char*)buffer;
+ return XDS_OK;
}
|
|
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;
}
|
|
ossp-pkg/xds/xml-encode-begin.c 1.1.2.1 -> 1.1.2.2
--- xml-encode-begin.c 2001/08/01 13:26:29 1.1.2.1
+++ xml-encode-begin.c 2001/08/01 15:08:02 1.1.2.2
@@ -33,19 +33,11 @@
"<!DOCTYPE xds SYSTEM \"http://www.ossp.org/pkg/xds/xds-xml.dtd\">\n" \
"<xds>\n";
-int xml_encode_begin(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_begin(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
- /* 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;
-
- if (buffer_size >= strlen(xds_xml_begin_text))
- memmove(buffer, xds_xml_begin_text, strlen(xds_xml_begin_text));
-
- return strlen(xds_xml_begin_text);
+ xds_init_encoding_engine(strlen(xds_xml_begin_text));
+ memmove(buffer, xds_xml_begin_text, strlen(xds_xml_begin_text));
+ return XDS_OK;
}
|
|
ossp-pkg/xds/xml-encode-double.c 1.3 -> 1.3.2.1
--- xml-encode-double.c 2001/07/24 13:52:41 1.3
+++ xml-encode-double.c 2001/08/01 15:08:02 1.3.2.1
@@ -27,7 +27,9 @@
#include "internal.h"
-int xml_encode_double(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_double(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
return -1;
}
|
|
ossp-pkg/xds/xml-encode-end.c 1.1.2.1 -> 1.1.2.2
--- xml-encode-end.c 2001/08/01 13:26:29 1.1.2.1
+++ xml-encode-end.c 2001/08/01 15:08:02 1.1.2.2
@@ -30,19 +30,11 @@
const char xds_xml_end_text[] = "</xds>\n";
-int xml_encode_end(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_end(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
- /* 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;
-
- if (buffer_size >= strlen(xds_xml_end_text))
- memmove(buffer, xds_xml_end_text, strlen(xds_xml_end_text));
-
- return strlen(xds_xml_end_text);
+ xds_init_encoding_engine(strlen(xds_xml_end_text));
+ memmove(buffer, xds_xml_end_text, strlen(xds_xml_end_text));
+ return XDS_OK;
}
|
|
ossp-pkg/xds/xml-encode-int32.c 1.3.2.1 -> 1.3.2.2
--- xml-encode-int32.c 2001/08/01 13:26:30 1.3.2.1
+++ xml-encode-int32.c 2001/08/01 15:08:02 1.3.2.2
@@ -28,7 +28,9 @@
#include <string.h>
#include "internal.h"
-int xml_encode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_int32(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
xds_int32_t value;
char buf[32];
@@ -36,16 +38,10 @@
char* p;
int negative;
- /* Consistency checks. */
+ xds_init_encoding_engine(7 + 8 + 11);
- 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 our buffer. */
+ /* Get the value and format it into our buffer. Keep track of the
+ length of the formatted result. */
value = va_arg(*args, xds_int32_t);
if (value < 0)
@@ -66,21 +62,18 @@
if (negative)
buf[i++] = '-';
- /* Check the buffer size. */
-
- if (buffer_size < 7 + 8 + i)
- return 7 + 8 + i;
-
- /* Write result into the buffer. */
+ /* Now that we know the correct size of our data's representation,
+ write it into the buffer. */
+ *used_buffer_size = 7 + 8 + i;
p = buffer;
- strcpy(p, "<int32>");
+ memmove(p, "<int32>", 7);
p += 7;
for (j = i; j > 0; )
{
*p++ = buf[--j];
}
- strcpy(p, "</int32>");
+ memmove(p, "</int32>", 8);
- return 7 + 8 + i;
+ return XDS_OK;
}
|
|
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;
}
|
|
ossp-pkg/xds/xml-encode-uint32.c 1.2.2.1 -> 1.2.2.2
--- xml-encode-uint32.c 2001/08/01 13:26:30 1.2.2.1
+++ xml-encode-uint32.c 2001/08/01 15:08:02 1.2.2.2
@@ -28,21 +28,16 @@
#include <string.h>
#include "internal.h"
-int xml_encode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, va_list* args)
+int xml_encode_uint32(xds_t* xds, void* engine_context,
+ void* buffer, size_t buffer_size, size_t* used_buffer_size,
+ va_list* args)
{
xds_uint32_t value;
char buf[32];
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 + 10);
/* 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, "<uint32>");
+ memmove(p, "<uint32>", 8);
p += 8;
for (j = i; j > 0; )
{
*p++ = buf[--j];
}
- strcpy(p, "</uint32>");
+ memmove(p, "</uint32>", 9);
- return 8 + 9 + i;
+ return XDS_OK;
}
|
|
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;
}
|
|