Index: ossp-pkg/xds/xdr-decode-double.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-double.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-double.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-double.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-double.c +++ - 2024-05-11 15:57:04.870773209 +0200 @@ -0,0 +1,35 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_decode_double(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + return -1; + } Index: ossp-pkg/xds/xdr-decode-int32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int32.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-int32.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-int32.c +++ - 2024-05-11 15:57:04.873480843 +0200 @@ -0,0 +1,64 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_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; + xds_uint32_t tmp; + + xds_init_decoding_engine(4); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_int32_t*); + xds_check_parameter(value != NULL); + + if (((xds_uint8_t*)buffer)[0] & 0x80) + { /* negative number */ + tmp = ((xds_uint8_t*)buffer)[0]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[1]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[2]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[3]; + tmp = 0 - tmp; + *value = 0 - (int32_t)tmp; + } + else + { /* positive number */ + *value = ((xds_uint8_t*)buffer)[0]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[3]; + } + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-decode-int64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int64.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-int64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-int64.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-int64.c +++ - 2024-05-11 15:57:04.876214135 +0200 @@ -0,0 +1,72 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_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; + xds_uint64_t tmp; + + xds_init_decoding_engine(8); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_int64_t*); + xds_check_parameter(value != NULL); + + if (((xds_uint8_t*)buffer)[0] & 0x80) + { /* negative number */ + tmp = ((xds_uint8_t*)buffer)[0]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[1]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[2]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[3]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[4]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[5]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[6]; tmp = tmp << 8; + tmp += ((xds_uint8_t*)buffer)[7]; + tmp = 0 - tmp; + *value = 0 - (xds_int64_t)tmp; + } + else + { /* positive number */ + *value = ((xds_uint8_t*)buffer)[0]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[3]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[4]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[5]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[6]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[7]; + } + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-decode-octetstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-octetstream.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-octetstream.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-octetstream.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-octetstream.c +++ - 2024-05-11 15:57:04.878879188 +0200 @@ -0,0 +1,76 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +int xdr_decode_octetstream(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + void** p; + size_t* p_len; + size_t padding; + + xds_init_decoding_engine(4); + + p = va_arg(*args, void**); + p_len = va_arg(*args, size_t*); + xds_check_parameter(p != NULL); + xds_check_parameter(p_len != NULL); + + /* Read the size of the message. */ + + *p_len = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8; + *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8; + *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8; + *p_len += ((xds_uint8_t*)buffer)[3]; + + /* Calculate padding. */ + + padding = (4 - (*p_len & 0x03)) & 0x03; + + /* Do we have enough data?. */ + + *used_buffer_size = 4 + *p_len + padding; + if (buffer_size < *used_buffer_size) + return XDS_ERR_UNDERFLOW; + + /* Allocate buffer for the data. */ + + *p = malloc(*p_len); + if (*p == NULL) + return XDS_ERR_NO_MEM; + + /* Copy data into the buffer. */ + + memmove(*p, (xds_uint8_t*)buffer+4, *p_len); + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-decode-string.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-string.c,v co -q -kk -p'1.6' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-string.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-string.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-string.c +++ - 2024-05-11 15:57:04.882241870 +0200 @@ -0,0 +1,77 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +int xdr_decode_string(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + char** p; + size_t* p_len; + size_t padding; + + xds_init_decoding_engine(4); + + p = va_arg(*args, char**); + p_len = va_arg(*args, size_t*); + xds_check_parameter(p != NULL); + xds_check_parameter(p_len != NULL); + + /* Read the size of the message. */ + + *p_len = ((xds_uint8_t*)buffer)[0]; *p_len = *p_len << 8; + *p_len += ((xds_uint8_t*)buffer)[1]; *p_len = *p_len << 8; + *p_len += ((xds_uint8_t*)buffer)[2]; *p_len = *p_len << 8; + *p_len += ((xds_uint8_t*)buffer)[3]; + + /* Calculate padding. */ + + padding = (4 - (*p_len & 0x03)) & 0x03; + + /* Do we have enough data?. */ + + *used_buffer_size = 4 + *p_len + padding; + if (buffer_size < *used_buffer_size) + return XDS_ERR_UNDERFLOW; + + /* Allocate buffer for the data. */ + + *p = (char*)malloc(*p_len + 1); + if (*p == NULL) + return XDS_ERR_NO_MEM; + + /* Copy data into the buffer. */ + + memmove(*p, (xds_uint8_t*)buffer+4, *p_len); + ((xds_uint8_t*)buffer)[4+*p_len] = '\0'; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-decode-uint32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint32.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-uint32.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-uint32.c +++ - 2024-05-11 15:57:04.884916580 +0200 @@ -0,0 +1,51 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_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; + + xds_init_decoding_engine(4); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_uint32_t*); + xds_check_parameter(value != NULL); + + *value = ((xds_uint8_t*)buffer)[0]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[3]; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-decode-uint64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint64.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-decode-uint64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-decode-uint64.c' 2>/dev/null --- ossp-pkg/xds/xdr-decode-uint64.c +++ - 2024-05-11 15:57:04.887575365 +0200 @@ -0,0 +1,55 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_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; + + xds_init_decoding_engine(8); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_uint64_t*); + xds_check_parameter(value != NULL); + + *value = ((xds_uint8_t*)buffer)[0]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[1]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[2]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[3]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[4]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[5]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[6]; *value = *value << 8; + *value += ((xds_uint8_t*)buffer)[7]; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-encode-double.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-double.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-double.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-double.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-double.c +++ - 2024-05-11 15:57:04.890224050 +0200 @@ -0,0 +1,35 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_encode_double(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + return -1; + } Index: ossp-pkg/xds/xdr-encode-int32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int32.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-int32.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-int32.c +++ - 2024-05-11 15:57:04.892890138 +0200 @@ -0,0 +1,57 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_encode_int32(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + xds_uint32_t tmp; + xds_int32_t value; + + xds_init_encoding_engine(4); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_uint32_t); + if (value < 0) + { + value = 0 - value; + tmp = 0 - (xds_uint32_t)value; + } + else + tmp = (xds_uint32_t)value; + ((xds_uint8_t*)buffer)[0] = (tmp >> 24) & 0x000000ff; + ((xds_uint8_t*)buffer)[1] = (tmp >> 16) & 0x000000ff; + ((xds_uint8_t*)buffer)[2] = (tmp >> 8) & 0x000000ff; + ((xds_uint8_t*)buffer)[3] = (tmp >> 0) & 0x000000ff; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-encode-int64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int64.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-int64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-int64.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-int64.c +++ - 2024-05-11 15:57:04.895533951 +0200 @@ -0,0 +1,61 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_encode_int64(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + xds_uint64_t tmp; + xds_int64_t value; + + xds_init_encoding_engine(8); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_uint64_t); + if (value < 0) + { + value = 0 - value; + tmp = 0 - (xds_uint64_t)value; + } + else + tmp = (xds_uint64_t)value; + ((xds_uint8_t*)buffer)[0] = (tmp >> 56) & 0x000000ff; + ((xds_uint8_t*)buffer)[1] = (tmp >> 48) & 0x000000ff; + ((xds_uint8_t*)buffer)[2] = (tmp >> 40) & 0x000000ff; + ((xds_uint8_t*)buffer)[3] = (tmp >> 32) & 0x000000ff; + ((xds_uint8_t*)buffer)[4] = (tmp >> 24) & 0x000000ff; + ((xds_uint8_t*)buffer)[5] = (tmp >> 16) & 0x000000ff; + ((xds_uint8_t*)buffer)[6] = (tmp >> 8) & 0x000000ff; + ((xds_uint8_t*)buffer)[7] = (tmp >> 0) & 0x000000ff; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-encode-octetstream.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-octetstream.c,v co -q -kk -p'1.6' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-octetstream.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-octetstream.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-octetstream.c +++ - 2024-05-11 15:57:04.898190319 +0200 @@ -0,0 +1,69 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +int xdr_encode_octetstream(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + xds_uint8_t* p; + size_t p_len; + size_t padding; + + xds_init_encoding_engine(4); + + /* Get value from stack and calculate the correct amount of + padding. */ + + p = (xds_uint8_t*)va_arg(*args, void*); + xds_check_parameter(p != NULL); + p_len = va_arg(*args, size_t); + padding = (4 - (p_len & 0x03)) & 0x03; + assert((p_len + padding) % 4 == 0); + + /* We need (4 + p_len + padding) bytes in the buffer to format our + parameter. If we don't have them, return an underflow error. */ + + *used_buffer_size = 4 + p_len + padding; + if (buffer_size < *used_buffer_size) + return XDS_ERR_OVERFLOW; + + /* Format the values into the buffer. */ + + ((xds_uint8_t*)buffer)[0] = (p_len >> 24) & 0x000000ff; + ((xds_uint8_t*)buffer)[1] = (p_len >> 16) & 0x000000ff; + ((xds_uint8_t*)buffer)[2] = (p_len >> 8) & 0x000000ff; + ((xds_uint8_t*)buffer)[3] = (p_len >> 0) & 0x000000ff; + memmove((xds_uint8_t*)buffer+4, p, p_len); + memset((xds_uint8_t*)buffer+4+p_len, 0, padding); + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-encode-string.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-string.c,v co -q -kk -p'1.7' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-string.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-string.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-string.c +++ - 2024-05-11 15:57:04.900849647 +0200 @@ -0,0 +1,69 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +int xdr_encode_string(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + char* p; + size_t p_len; + size_t padding; + + xds_init_encoding_engine(4); + + /* Get value from stack and calculate the correct amount of + padding. */ + + p = va_arg(*args, char*); + xds_check_parameter(p != NULL); + p_len = strlen(p); + padding = (4 - (p_len & 0x03)) & 0x03; + assert((p_len + padding) % 4 == 0); + + /* We need (4 + p_len + padding) bytes in the buffer to format our + parameter. If we don't have them, return an underflow error. */ + + *used_buffer_size = 4 + p_len + padding; + if (buffer_size < *used_buffer_size) + return XDS_ERR_OVERFLOW; + + /* Format the values into the buffer. */ + + ((xds_uint8_t*)buffer)[0] = (p_len >> 24) & 0x000000ff; + ((xds_uint8_t*)buffer)[1] = (p_len >> 16) & 0x000000ff; + ((xds_uint8_t*)buffer)[2] = (p_len >> 8) & 0x000000ff; + ((xds_uint8_t*)buffer)[3] = (p_len >> 0) & 0x000000ff; + memmove((xds_uint8_t*)buffer+4, p, p_len); + memset((xds_uint8_t*)buffer+4+p_len, 0, padding); + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-encode-uint32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint32.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint32.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-uint32.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-uint32.c +++ - 2024-05-11 15:57:04.903486330 +0200 @@ -0,0 +1,49 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_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; + + xds_init_encoding_engine(4); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_uint32_t); + ((xds_uint8_t*)buffer)[0] = (value >> 24) & 0x000000ff; + ((xds_uint8_t*)buffer)[1] = (value >> 16) & 0x000000ff; + ((xds_uint8_t*)buffer)[2] = (value >> 8) & 0x000000ff; + ((xds_uint8_t*)buffer)[3] = (value >> 0) & 0x000000ff; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xdr-encode-uint64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint64.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/xds/Attic/xdr-encode-uint64.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xdr-encode-uint64.c' 2>/dev/null --- ossp-pkg/xds/xdr-encode-uint64.c +++ - 2024-05-11 15:57:04.906151909 +0200 @@ -0,0 +1,53 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include "xds.h" + +int xdr_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; + + xds_init_encoding_engine(8); + + /* Get value and format it into the buffer. */ + + value = va_arg(*args, xds_uint64_t); + ((xds_uint8_t*)buffer)[0] = (value >> 56) & 0x000000ff; + ((xds_uint8_t*)buffer)[1] = (value >> 48) & 0x000000ff; + ((xds_uint8_t*)buffer)[2] = (value >> 40) & 0x000000ff; + ((xds_uint8_t*)buffer)[3] = (value >> 32) & 0x000000ff; + ((xds_uint8_t*)buffer)[4] = (value >> 24) & 0x000000ff; + ((xds_uint8_t*)buffer)[5] = (value >> 16) & 0x000000ff; + ((xds_uint8_t*)buffer)[6] = (value >> 8) & 0x000000ff; + ((xds_uint8_t*)buffer)[7] = (value >> 0) & 0x000000ff; + + /* Done. */ + + return XDS_OK; + } Index: ossp-pkg/xds/xml-decode-begin.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-begin.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-begin.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xml-decode-begin.c' 2>/dev/null --- ossp-pkg/xds/xml-decode-begin.c +++ - 2024-05-11 15:57:04.908818325 +0200 @@ -0,0 +1,39 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +int xml_decode_begin(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + 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 XDS_OK; + } Index: ossp-pkg/xds/xml-decode-double.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-double.c,v co -q -kk -p'1.4' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-double.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xml-decode-double.c' 2>/dev/null --- ossp-pkg/xds/xml-decode-double.c +++ /dev/null 2024-05-11 15:55:00.000000000 +0200 @@ -1,35 +0,0 @@ -/* - XDS - OSSP Extensible Data Serialization Library - Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) - Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) - - This file is part of OSSP XDS, an extensible data serialization - library which can be found at http://www.ossp.com/pkg/xds/. - - Permission to use, copy, modify, and distribute this software for - any purpose with or without fee is hereby granted, provided that - the above copyright notice and this permission notice appear in all - copies. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#include "internal.h" - -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; - } Index: ossp-pkg/xds/xml-decode-end.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-end.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-end.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xml-decode-end.c' 2>/dev/null --- ossp-pkg/xds/xml-decode-end.c +++ - 2024-05-11 15:57:04.914124224 +0200 @@ -0,0 +1,39 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +int xml_decode_end(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + 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 XDS_OK; + } Index: ossp-pkg/xds/xml-decode-int32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-int32.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-int32.c,v' 2>/dev/null --- xml-decode-int32.c 2001/08/01 15:25:47 1.3 +++ xml-decode-int32.c 2001/08/02 08:10:13 1.4 @@ -27,7 +27,7 @@ #include #include -#include "internal.h" +#include "xds.h" int xml_decode_int32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, size_t* used_buffer_size, Index: ossp-pkg/xds/xml-decode-int64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-int64.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-int64.c,v' 2>/dev/null --- xml-decode-int64.c 2001/08/01 15:25:47 1.4 +++ xml-decode-int64.c 2001/08/02 08:10:13 1.5 @@ -27,7 +27,7 @@ #include #include -#include "internal.h" +#include "xds.h" int xml_decode_int64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, size_t* used_buffer_size, Index: ossp-pkg/xds/xml-decode-uint32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-uint32.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-uint32.c,v' 2>/dev/null --- xml-decode-uint32.c 2001/08/01 15:25:47 1.3 +++ xml-decode-uint32.c 2001/08/02 08:10:13 1.4 @@ -27,7 +27,7 @@ #include #include -#include "internal.h" +#include "xds.h" int xml_decode_uint32(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, size_t* used_buffer_size, Index: ossp-pkg/xds/xml-decode-uint64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-uint64.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-decode-uint64.c,v' 2>/dev/null --- xml-decode-uint64.c 2001/08/01 15:25:47 1.4 +++ xml-decode-uint64.c 2001/08/02 08:10:13 1.5 @@ -27,7 +27,7 @@ #include #include -#include "internal.h" +#include "xds.h" int xml_decode_uint64(xds_t* xds, void* engine_context, void* buffer, size_t buffer_size, size_t* used_buffer_size, Index: ossp-pkg/xds/xml-encode-begin.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-begin.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-begin.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xml-encode-begin.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-begin.c +++ - 2024-05-11 15:57:04.932207852 +0200 @@ -0,0 +1,43 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +const char xds_xml_begin_text[] = \ + "\n" \ + "\n" \ + "\n"; + +int xml_encode_begin(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + xds_init_encoding_engine(strlen(xds_xml_begin_text)); + memmove(buffer, xds_xml_begin_text, strlen(xds_xml_begin_text)); + return XDS_OK; + } Index: ossp-pkg/xds/xml-encode-double.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-double.c,v co -q -kk -p'1.4' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-double.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xml-encode-double.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-double.c +++ /dev/null 2024-05-11 15:55:00.000000000 +0200 @@ -1,35 +0,0 @@ -/* - XDS - OSSP Extensible Data Serialization Library - Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) - Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) - - This file is part of OSSP XDS, an extensible data serialization - library which can be found at http://www.ossp.com/pkg/xds/. - - Permission to use, copy, modify, and distribute this software for - any purpose with or without fee is hereby granted, provided that - the above copyright notice and this permission notice appear in all - copies. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#include "internal.h" - -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; - } Index: ossp-pkg/xds/xml-encode-end.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-end.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-end.c,v' | diff -u /dev/null - -L'ossp-pkg/xds/xml-encode-end.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-end.c +++ - 2024-05-11 15:57:04.937485675 +0200 @@ -0,0 +1,40 @@ +/* + XDS - OSSP Extensible Data Serialization Library + Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) + Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) + + This file is part of OSSP XDS, an extensible data serialization + library which can be found at http://www.ossp.com/pkg/xds/. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +#include +#include "xds.h" + +const char xds_xml_end_text[] = "\n"; + +int xml_encode_end(xds_t* xds, void* engine_context, + void* buffer, size_t buffer_size, size_t* used_buffer_size, + va_list* args) + { + xds_init_encoding_engine(strlen(xds_xml_end_text)); + memmove(buffer, xds_xml_end_text, strlen(xds_xml_end_text)); + return XDS_OK; + } Index: ossp-pkg/xds/xml-encode-int32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-int32.c,v co -q -kk -p'1.4' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-int32.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xml-encode-int32.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-int32.c +++ /dev/null 2024-05-11 15:55:00.000000000 +0200 @@ -1,79 +0,0 @@ -/* - XDS - OSSP Extensible Data Serialization Library - Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) - Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) - - This file is part of OSSP XDS, an extensible data serialization - library which can be found at http://www.ossp.com/pkg/xds/. - - Permission to use, copy, modify, and distribute this software for - any purpose with or without fee is hereby granted, provided that - the above copyright notice and this permission notice appear in all - copies. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#include -#include "internal.h" - -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]; - size_t i, j; - char* p; - int negative; - - xds_init_encoding_engine(7 + 8 + 11); - - /* 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) - { - negative = XDS_TRUE; - value = 0 - value; - } - else - negative = XDS_FALSE; - i = 0; - do - { - unsigned char remainder = value % 10; - value = value / 10; - buf[i++] = '0' + remainder; - } - while (value != 0); - if (negative) - buf[i++] = '-'; - - /* 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; - memmove(p, "", 7); - p += 7; - for (j = i; j > 0; ) - { - *p++ = buf[--j]; - } - memmove(p, "", 8); - - return XDS_OK; - } Index: ossp-pkg/xds/xml-encode-int64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-int64.c,v co -q -kk -p'1.4' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-int64.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xml-encode-int64.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-int64.c +++ /dev/null 2024-05-11 15:55:00.000000000 +0200 @@ -1,80 +0,0 @@ -/* - XDS - OSSP Extensible Data Serialization Library - Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) - Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) - - This file is part of OSSP XDS, an extensible data serialization - library which can be found at http://www.ossp.com/pkg/xds/. - - Permission to use, copy, modify, and distribute this software for - any purpose with or without fee is hereby granted, provided that - the above copyright notice and this permission notice appear in all - copies. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#include -#include "internal.h" - -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]; - size_t i, j; - char* p; - int negative; - - xds_init_encoding_engine(7 + 8 + 21); - - /* Format value into our buffer. */ - - value = va_arg(*args, xds_int64_t); - if (value < 0) - { - negative = XDS_TRUE; - value = 0 - value; - } - else - negative = XDS_FALSE; - i = 0; - do - { - unsigned char remainder = value % 10; - value = value / 10; - buf[i++] = '0' + remainder; - } - while (value != 0); - if (negative) - buf[i++] = '-'; - - /* Store the correct buffer size. */ - - *used_buffer_size = 7 + 8 + i; - - /* Write result into the buffer. */ - - p = buffer; - memmove(p, "", 7); - p += 7; - for (j = i; j > 0; ) - { - *p++ = buf[--j]; - } - memmove(p, "", 8); - - return XDS_OK; - } Index: ossp-pkg/xds/xml-encode-uint32.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-uint32.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-uint32.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xml-encode-uint32.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-uint32.c +++ /dev/null 2024-05-11 15:55:00.000000000 +0200 @@ -1,70 +0,0 @@ -/* - XDS - OSSP Extensible Data Serialization Library - Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) - Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) - - This file is part of OSSP XDS, an extensible data serialization - library which can be found at http://www.ossp.com/pkg/xds/. - - Permission to use, copy, modify, and distribute this software for - any purpose with or without fee is hereby granted, provided that - the above copyright notice and this permission notice appear in all - copies. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#include -#include "internal.h" - -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; - - xds_init_encoding_engine(8 + 9 + 10); - - /* Format value into our buffer. */ - - value = va_arg(*args, xds_uint32_t); - i = 0; - do - { - unsigned char remainder = value % 10; - value = value / 10; - buf[i++] = '0' + remainder; - } - while (value != 0); - - /* Store the correct buffer size. */ - - *used_buffer_size = 8 + 9 + i; - - /* Write result into the buffer. */ - - p = buffer; - memmove(p, "", 8); - p += 8; - for (j = i; j > 0; ) - { - *p++ = buf[--j]; - } - memmove(p, "", 9); - - return XDS_OK; - } Index: ossp-pkg/xds/xml-encode-uint64.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-uint64.c,v co -q -kk -p'1.4' '/v/ossp/cvs/ossp-pkg/xds/Attic/xml-encode-uint64.c,v' | diff -u - /dev/null -L'ossp-pkg/xds/xml-encode-uint64.c' 2>/dev/null --- ossp-pkg/xds/xml-encode-uint64.c +++ /dev/null 2024-05-11 15:55:00.000000000 +0200 @@ -1,70 +0,0 @@ -/* - XDS - OSSP Extensible Data Serialization Library - Copyright (c) 2001 The OSSP Project (http://www.ossp.org/) - Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/) - - This file is part of OSSP XDS, an extensible data serialization - library which can be found at http://www.ossp.com/pkg/xds/. - - Permission to use, copy, modify, and distribute this software for - any purpose with or without fee is hereby granted, provided that - the above copyright notice and this permission notice appear in all - copies. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -#include -#include "internal.h" - -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; - - xds_init_encoding_engine(8 + 9 + 20); - - /* Format value into our buffer. */ - - value = va_arg(*args, xds_uint64_t); - i = 0; - do - { - unsigned char remainder = value % 10; - value = value / 10; - buf[i++] = '0' + remainder; - } - while (value != 0); - - /* Store the correct buffer size. */ - - *used_buffer_size = 8 + 9 + i; - - /* Write result into the buffer. */ - - p = buffer; - memmove(p, "", 8); - p += 8; - for (j = i; j > 0; ) - { - *p++ = buf[--j]; - } - memmove(p, "", 9); - - return XDS_OK; - }