diff options
Diffstat (limited to 'ext/xmlrpc')
30 files changed, 975 insertions, 1211 deletions
diff --git a/ext/xmlrpc/config.w32 b/ext/xmlrpc/config.w32 index 4da691e976..35fbf26181 100644 --- a/ext/xmlrpc/config.w32 +++ b/ext/xmlrpc/config.w32 @@ -5,8 +5,10 @@ ARG_WITH("xmlrpc", "XMLRPC-EPI support", "no"); if (PHP_XMLRPC != "no") { if (CHECK_HEADER_ADD_INCLUDE("xmlrpc.h", "CFLAGS_XMLRPC", configure_module_dirname + "/libxmlrpc") - && CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS") - && ADD_EXTENSION_DEP('xmlrpc', 'libxml')) { + && CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_XMLRPC") + && CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS_XMLRPC", PHP_PHP_BUILD + "\\include\\libxml2") + && ADD_EXTENSION_DEP('xmlrpc', 'libxml') + && ADD_EXTENSION_DEP('xmlrpc', 'xml')) { EXTENSION('xmlrpc', 'xmlrpc-epi-php.c', PHP_XMLRPC_SHARED, "-DVERSION=\"0.50\""); ADD_SOURCES(configure_module_dirname + "/libxmlrpc", "base64.c simplestring.c xml_to_dandarpc.c \ xmlrpc_introspection.c encodings.c system_methods.c xml_to_xmlrpc.c \ diff --git a/ext/xmlrpc/libxmlrpc/base64.c b/ext/xmlrpc/libxmlrpc/base64.c index d020bd6646..fa6cc32b51 100644 --- a/ext/xmlrpc/libxmlrpc/base64.c +++ b/ext/xmlrpc/libxmlrpc/base64.c @@ -54,13 +54,13 @@ void base64_encode_xmlrpc(struct buffer_st *b, const char *source, int length) int i, hiteof = 0; int offset = 0; int olen; - + olen = 0; - + buffer_new(b); - + /* Fill dtable with character encodings. */ - + for (i = 0; i < 26; i++) { dtable[i] = 'A' + i; dtable[26 + i] = 'a' + i; @@ -70,11 +70,11 @@ void base64_encode_xmlrpc(struct buffer_st *b, const char *source, int length) } dtable[62] = '+'; dtable[63] = '/'; - + while (!hiteof) { unsigned char igroup[3], ogroup[4]; int c, n; - + igroup[0] = igroup[1] = igroup[2] = 0; for (n = 0; n < 3; n++) { c = *(source++); @@ -90,11 +90,11 @@ void base64_encode_xmlrpc(struct buffer_st *b, const char *source, int length) ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)]; ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)]; ogroup[3] = dtable[igroup[2] & 0x3F]; - + /* Replace characters in output stream with "=" pad characters if fewer than three characters were read from the end of the input stream. */ - + if (n < 3) { ogroup[3] = '='; if (n < 2) { diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c index f4cc212d7c..081e38e5de 100644 --- a/ext/xmlrpc/libxmlrpc/encodings.c +++ b/ext/xmlrpc/libxmlrpc/encodings.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -44,6 +44,7 @@ static const char rcsid[] = "#(@) $Id$"; #include <errno.h> +#include <string.h> #ifdef HAVE_GICONV_H #include <giconv.h> diff --git a/ext/xmlrpc/libxmlrpc/encodings.h b/ext/xmlrpc/libxmlrpc/encodings.h index 486360b1be..1931686dce 100644 --- a/ext/xmlrpc/libxmlrpc/encodings.h +++ b/ext/xmlrpc/libxmlrpc/encodings.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. - - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. - - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. - - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. - - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. +/* + Copyright 2000 Epinions, Inc. + + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. + + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. + + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. + + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ diff --git a/ext/xmlrpc/libxmlrpc/queue.c b/ext/xmlrpc/libxmlrpc/queue.c index 24187383fd..6a0ba1df47 100644 --- a/ext/xmlrpc/libxmlrpc/queue.c +++ b/ext/xmlrpc/libxmlrpc/queue.c @@ -1,6 +1,6 @@ static const char rcsid[] = "#(@) $Id$"; -/* +/* * Date last modified: Jan 2001 * Modifications by Dan Libby (dan@libby.com), including: * - various fixes, null checks, etc @@ -508,7 +508,7 @@ void *Q_Previous(queue *q) { if(!q) return NULL; - + if(q->cursor->prev == NULL) return NULL; diff --git a/ext/xmlrpc/libxmlrpc/queue.h b/ext/xmlrpc/libxmlrpc/queue.h index be73f6da00..16726dc9ce 100644 --- a/ext/xmlrpc/libxmlrpc/queue.h +++ b/ext/xmlrpc/libxmlrpc/queue.h @@ -1,4 +1,4 @@ -/* +/* * Date last modified: Jan 2001 * Modifications by Dan Libby (dan@libby.com), including: * - various fixes, null checks, etc diff --git a/ext/xmlrpc/libxmlrpc/simplestring.h b/ext/xmlrpc/libxmlrpc/simplestring.h index 7e88cd0ef0..b46b0d779a 100644 --- a/ext/xmlrpc/libxmlrpc/simplestring.h +++ b/ext/xmlrpc/libxmlrpc/simplestring.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. - - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. - - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. - - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. - - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. +/* + Copyright 2000 Epinions, Inc. + + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. + + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. + + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. + + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ diff --git a/ext/xmlrpc/libxmlrpc/system_methods.c b/ext/xmlrpc/libxmlrpc/system_methods.c index c47236df14..ff5e651fd0 100644 --- a/ext/xmlrpc/libxmlrpc/system_methods.c +++ b/ext/xmlrpc/libxmlrpc/system_methods.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2001 Epinions, Inc. +/* + Copyright 2001 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -331,7 +331,7 @@ XMLRPC_VALUE xsm_system_multicall_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, XMLRPC_RequestSetData(request, params); XMLRPC_RequestSetRequestType(request, xmlrpc_request_call); - XMLRPC_AddValueToVector(xRandomArray, + XMLRPC_AddValueToVector(xRandomArray, XMLRPC_ServerCallMethod(server, request, userData)); XMLRPC_AddValueToVector(xReturn, xRandomArray); @@ -364,7 +364,7 @@ XMLRPC_VALUE xsm_system_get_capabilities_cb(XMLRPC_SERVER server, XMLRPC_REQUEST NULL); return xReturn; - + } /*-*********************** diff --git a/ext/xmlrpc/libxmlrpc/system_methods_private.h b/ext/xmlrpc/libxmlrpc/system_methods_private.h index 72408fd3c4..fa3fc279f2 100644 --- a/ext/xmlrpc/libxmlrpc/system_methods_private.h +++ b/ext/xmlrpc/libxmlrpc/system_methods_private.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2001 Dan Libby, Epinions, Inc. +/* + Copyright 2001 Dan Libby, Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -68,7 +68,7 @@ /*---------------------------------------------------------------------------- * Structures */ - + /*---------------------------------------------------------------------------- * Globals */ @@ -78,11 +78,11 @@ */ void xsm_register(XMLRPC_SERVER server); int xsm_is_system_method(XMLRPC_Callback cb); - + /*---------------------------------------------------------------------------- * Macros */ - + #endif /* __SYSTEM_METHODS_PRIVATE_H */ diff --git a/ext/xmlrpc/libxmlrpc/xml_element.c b/ext/xmlrpc/libxmlrpc/xml_element.c index 56642d4614..6fc6bd3977 100644 --- a/ext/xmlrpc/libxmlrpc/xml_element.c +++ b/ext/xmlrpc/libxmlrpc/xml_element.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -98,7 +98,7 @@ static const char rcsid[] = "#(@) $Id$"; * about anything with minor mods. * NOTES * This code incorporates ideas from expat-ensor from http://xml.ensor.org. - * + * * It was coded primarily to act as a go-between for expat and xmlrpc. To this * end, it stores xml elements, their sub-elements, and their attributes in an * in-memory tree. When expat is done parsing, the tree can be walked, thus @@ -112,12 +112,12 @@ static const char rcsid[] = "#(@) $Id$"; * - output option for xml escaping data. Choices include no escaping, entity escaping, * or CDATA sections. * - output option for character encoding. Defaults to (none) utf-8. - * - output option for verbosity/readability. ultra-compact, newlines, pretty/level indented. + * - output option for verbosity/readability. ultra-compact, newlines, pretty/level indented. * * BUGS * there must be some. ******/ - + #include "ext/xml/expat_compat.h" #ifdef _WIN32 #include "xmlrpc_win32.h" @@ -284,7 +284,7 @@ static int xml_elem_writefunc(int (*fptr)(void *data, const char *text, int size static int create_xml_escape(char *pString, unsigned char c) -{ +{ int counter = 0; pString[counter++] = '&'; @@ -298,7 +298,7 @@ static int create_xml_escape(char *pString, unsigned char c) pString[counter++] = c + '0'; pString[counter++] = ';'; - return counter; + return counter; } #define non_ascii(c) (c > 127) @@ -724,7 +724,7 @@ xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTI /* int byte_total = XML_GetCurrentByteCount(parser); */ const char * error_str = XML_ErrorString(err_code); if(byte_idx >= 0) { - snprintf(buf, + snprintf(buf, sizeof(buf), "\n\tdata beginning %ld before byte index: %s\n", byte_idx > 10 ? 10 : byte_idx, @@ -737,7 +737,7 @@ xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTI "\tcolumn: %i\n" "\tbyte index: %ld\n" "\ttotal bytes: %i\n%s ", - err_code, error_str, line_num, + err_code, error_str, line_num, col_num, byte_idx, byte_total, buf); */ diff --git a/ext/xmlrpc/libxmlrpc/xml_element.h b/ext/xmlrpc/libxmlrpc/xml_element.h index cfe7ca2483..7ff87af445 100644 --- a/ext/xmlrpc/libxmlrpc/xml_element.h +++ b/ext/xmlrpc/libxmlrpc/xml_element.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -150,7 +150,7 @@ typedef struct _xml_element { const char* name; /* element identifier */ simplestring text; /* text contained between element begin/end pairs */ struct _xml_element* parent; /* element's parent */ - + queue attrs; /* attribute list */ queue children; /* child element list */ } xml_element; diff --git a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c index 753222c55d..000df192fd 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -181,7 +181,7 @@ xml_element* DANDARPC_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE const char* pAttrType = NULL; xml_element_attr* attr_type = bNoAddType ? NULL : malloc(sizeof(xml_element_attr)); - + if(attr_type) { attr_type->key = strdup(ATTR_TYPE); attr_type->val = 0; @@ -285,7 +285,7 @@ xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { xml_element_attr* version = malloc(sizeof(xml_element_attr)); version->key = strdup(ATTR_VERSION); version->val = strdup(VAL_VERSION_0_9); - + wrapper = xml_elem_new(); if(request_type == xmlrpc_request_response) { @@ -311,7 +311,7 @@ xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { simplestring_add(&method->text, pStr); Q_PushTail(&wrapper->children, method); } - Q_PushTail(&wrapper->children, + Q_PushTail(&wrapper->children, DANDARPC_to_xml_element_worker(request, XMLRPC_RequestGetData(request))); } return root; diff --git a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h index 6facb55778..d4018a4fbf 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h +++ b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.h @@ -5,35 +5,35 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ #ifndef XML_TO_DANDARPC_H #define XML_TO_DANDARPC_H -#include "time.h" +#include "time.h" #include "xmlrpc.h" XMLRPC_VALUE xml_element_to_DANDARPC_VALUE(xml_element* el); diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c index 61f9834e9d..e0604bae62 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.c @@ -217,7 +217,7 @@ static XMLRPC_VALUE gen_fault_xmlrpc(XMLRPC_VALUE node, xml_element* el_target) } /* returns a new XMLRPC_VALUE representing a soap fault, comprised of a struct with four keys. */ -static XMLRPC_VALUE gen_soap_fault(const char* fault_code, const char* fault_string, +static XMLRPC_VALUE gen_soap_fault(const char* fault_code, const char* fault_string, const char* actor, const char* details) { XMLRPC_VALUE xReturn = XMLRPC_CreateVector(TOKEN_FAULT, xmlrpc_vector_struct); XMLRPC_AddValuesToVector(xReturn, @@ -230,11 +230,11 @@ static XMLRPC_VALUE gen_soap_fault(const char* fault_code, const char* fault_str } /* translates xml soap dom to native data structures. recursive. */ -XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, +XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC_VALUE xParent, struct array_info* parent_array, - XMLRPC_VALUE xCurrent, - xml_element* el, + XMLRPC_VALUE xCurrent, + xml_element* el, int depth) { XMLRPC_REQUEST_TYPE rtype = xmlrpc_request_none; @@ -252,7 +252,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, const char* type = NULL, *arrayType=NULL, *actor = NULL; xml_element_attr* attr_iter = Q_Head(&el->attrs); int b_must_understand = 0; - + /* in soap, types may be specified in either element name -or- with xsi:type attribute. */ if (is_soap_type(el->name)) { type = el->name; @@ -295,7 +295,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, /* TODO: implement callbacks or other mechanism for applications to "understand" these headers. For now, we just bail if we get a mustUnderstand header intended for us. */ - XMLRPC_RequestSetError(request, + XMLRPC_RequestSetError(request, gen_soap_fault("SOAP-ENV:MustUnderstand", "SOAP Must Understand Error", "", "")); @@ -308,7 +308,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC_SetValueID_Case(xCurrent, id, 0, xmlrpc_case_exact); } - /* according to soap spec, + /* according to soap spec, depth 1 = Envelope, 2 = Header, Body & Fault, 3 = methodcall or response. */ if (depth == 3) { const char* methodname = el->name; @@ -463,13 +463,13 @@ xml_element* SOAP_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE nod pAttrType = TOKEN_ARRAY; } - /* check for fault, which is a rather special case. + /* check for fault, which is a rather special case. (can't these people design anything consistent/simple/elegant?) */ else if (type == xmlrpc_type_struct) { int fault_type = get_fault_type(node); if (fault_type) { if (fault_type == 1) { - /* gen fault from xmlrpc style fault codes + /* gen fault from xmlrpc style fault codes notice that we get a new node, which must be freed herein. */ node = gen_fault_xmlrpc(node, elem_val); bFreeNode = 1; @@ -601,8 +601,8 @@ xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) { if (body) { /* go ahead and serialize first... */ - xml_element* el_serialized = - SOAP_to_xml_element_worker(request, + xml_element* el_serialized = + SOAP_to_xml_element_worker(request, XMLRPC_RequestGetData(request)); /* check for fault, in which case, there is no intermediate element */ @@ -628,7 +628,7 @@ xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) { the response, so we have to check that. */ else { char buf[128]; - snprintf(buf, sizeof(buf), "%s%s", + snprintf(buf, sizeof(buf), "%s%s", methodname ? methodname : "", "Response"); diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.h b/ext/xmlrpc/libxmlrpc/xml_to_soap.h index 9ae9308b22..5369b862a1 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_soap.h +++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. - - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. - - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. - - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. - - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. +/* + Copyright 2000 Epinions, Inc. + + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. + + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. + + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. + + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c index 13976077be..c557ee06d8 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -95,7 +95,7 @@ XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC } } else if (!strcmp(el->name, ELEM_DATA) /* should be ELEM_ARRAY, but there is an extra level. weird */ - || (!strcmp(el->name, ELEM_PARAMS) && + || (!strcmp(el->name, ELEM_PARAMS) && (XMLRPC_RequestGetRequestType(request) == xmlrpc_request_call)) ) { /* this "PARAMS" concept is silly. dave?! */ xml_element* iter = (xml_element*)Q_Head(&el->children); XMLRPC_SetIsVector(current_val, xmlrpc_vector_array); @@ -118,7 +118,7 @@ XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC iter = (xml_element*)Q_Next(&el->children); } } - else if (!strcmp(el->name, ELEM_STRING) || + else if (!strcmp(el->name, ELEM_STRING) || (!strcmp(el->name, ELEM_VALUE) && Q_Size(&el->children) == 0)) { XMLRPC_SetValueString(current_val, el->text.str, el->text.len); } @@ -164,7 +164,7 @@ XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST_worker(XMLRPC_REQUEST request, XMLRPC iter = (xml_element*)Q_Head(&el->children); while ( iter ) { - xml_element_to_XMLRPC_REQUEST_worker(request, parent_vector, + xml_element_to_XMLRPC_REQUEST_worker(request, parent_vector, current_val, iter); iter = (xml_element*)Q_Next(&el->children); } @@ -186,7 +186,7 @@ XMLRPC_VALUE xml_element_to_XMLRPC_REQUEST(XMLRPC_REQUEST request, xml_element* return NULL; } -xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VALUE node, +xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VALUE node, XMLRPC_REQUEST_TYPE request_type, int depth) { #define BUF_SIZE 512 xml_element* root = NULL; @@ -197,9 +197,9 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA xml_element* elem_val = xml_elem_new(); /* special case for when root element is not an array */ - if (depth == 0 && - !(type == xmlrpc_vector && - vtype == xmlrpc_vector_array && + if (depth == 0 && + !(type == xmlrpc_vector && + vtype == xmlrpc_vector_array && request_type == xmlrpc_request_call) ) { int bIsFault = (vtype == xmlrpc_vector_struct && XMLRPC_VectorGetValueWithID(node, ELEM_FAULTCODE)); @@ -228,8 +228,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA break; case xmlrpc_double: { - TSRMLS_FETCH(); - elem_val->name = strdup(ELEM_DOUBLE); + elem_val->name = strdup(ELEM_DOUBLE); ap_php_snprintf(buf, BUF_SIZE, "%.*G", (int) EG(precision), XMLRPC_GetValueDouble(node)); simplestring_add(&elem_val->text, buf); } @@ -270,7 +269,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA */ xml_element* data = xml_elem_new(); data->name = strdup(ELEM_DATA); - + elem_val->name = strdup(ELEM_ARRAY); Q_PushTail(&elem_val->children, data); root_vector_elem = data; @@ -399,7 +398,7 @@ xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { } } if (xParams) { - Q_PushTail(&wrapper->children, + Q_PushTail(&wrapper->children, XMLRPC_to_xml_element_worker(NULL, XMLRPC_RequestGetData(request), XMLRPC_RequestGetRequestType(request), 0)); } else { diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h index 234a153460..006f88f7c4 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h +++ b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -34,7 +34,7 @@ #ifndef XML_TO_XMLRPC_H #define XML_TO_XMLRPC_H -#include "time.h" +#include "time.h" #include "xmlrpc.h" XMLRPC_VALUE xml_element_to_XMLRPC_VALUE(xml_element* el); diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c index f184cf49ee..0836f27291 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc.c +++ b/ext/xmlrpc/libxmlrpc/xmlrpc.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -92,7 +92,7 @@ static const char rcsid[] = "#(@) $Id$"; * adding cvs log to history section * * 10/15/2000 -- danda -- adding robodoc documentation - * 08/2000 -- danda -- PHP C extension that uses XMLRPC + * 08/2000 -- danda -- PHP C extension that uses XMLRPC * 08/2000 -- danda -- support for two vocabularies: danda-rpc and xml-rpc * 09/1999 -- danda -- Initial API, before I even knew of standard XMLRPC vocab. Response only. * 07/2000 -- danda -- wrote new implementation to be compatible with xmlrpc standard and @@ -109,7 +109,7 @@ static const char rcsid[] = "#(@) $Id$"; * * This code aims to be a full-featured C implementation of XMLRPC. It does not * have any networking code. Rather, it is intended to be plugged into apps - * or libraries with existing networking facilities, eg PHP, apache, perl, mozilla, + * or libraries with existing networking facilities, eg PHP, apache, perl, mozilla, * home-brew application servers, etc. * * Usage Paradigm: @@ -130,13 +130,13 @@ static const char rcsid[] = "#(@) $Id$"; * it can be used as a standalone dom implementation. * - Because of this, the same XMLRPC data can be serialized into multiple xml vocabularies. * It is simply a matter of writing a transport. So far, two transports have been defined. - * The default xmlrpc vocab (xml_to_xmlrpc.c), and simple-rpc (xml_to_dandarpc.c) which is + * The default xmlrpc vocab (xml_to_xmlrpc.c), and simple-rpc (xml_to_dandarpc.c) which is * proprietary, but imho more readable, and nice for proprietary legacy reasons. * - Various output options, including: xml escaping via CDATA or entity, case folding, * vocab version, and character encoding. * - One to One mapping between C structures and actual values, unlike ensor which forces * one to understand the arcana of the xmlrpc vocab. - * - support for mixed indexed/keyed vector types, making it more compatible with + * - support for mixed indexed/keyed vector types, making it more compatible with * languages such as PHP. * - quite speedy compared to implementations written in interpreted languages. Also, uses * intelligent string handling, so not many strlen() calls, etc. @@ -187,7 +187,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) { int n; int i; char buf[30]; - + if (strchr (text, '-')) { char *p = (char *) text, *p2 = buf; @@ -522,7 +522,7 @@ XMLRPC_VALUE XMLRPC_RequestGetData(XMLRPC_REQUEST request) { * XMLRPC_VALUE XMLRPC_RequestSetError(XMLRPC_REQUEST request, XMLRPC_VALUE error) * FUNCTION * Associates a block of xmlrpc data, representing an error - * condition, with the request. + * condition, with the request. * INPUTS * request -- previously allocated request struct * error -- previously allocated error code or struct @@ -651,7 +651,7 @@ XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST requ * val -- previously allocated XMLRPC_VALUE * buf_len -- length of returned buffer, if not null * RESULT - * char* -- newly allocated buffer containing XML. + * char* -- newly allocated buffer containing XML. * It is the caller's responsibility to free it. * SEE ALSO * XMLRPC_REQUEST_ToXML () @@ -684,7 +684,7 @@ char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len) { * request -- previously allocated XMLRPC_REQUEST * buf_len -- size of returned buf, if not null * RESULT - * char* -- newly allocated buffer containing XML. + * char* -- newly allocated buffer containing XML. * It is the caller's responsibility to free it. * SEE ALSO * XMLRPC_REQUEST_ToXML () @@ -761,8 +761,8 @@ static XMLRPC_VALUE map_expat_errors(XML_ELEM_ERROR error) { if(error) { XMLRPC_ERROR_CODE code; char buf[1024]; - snprintf(buf, sizeof(buf), - "error occurred at line %ld, column %ld, byte index %ld", + snprintf(buf, sizeof(buf), + "error occurred at line %ld, column %ld, byte index %ld", error->line, error->column, error->byte_index); /* expat specific errors */ @@ -801,7 +801,7 @@ static XMLRPC_VALUE map_expat_errors(XML_ELEM_ERROR error) { * XMLRPC_REQUEST * SOURCE */ -XMLRPC_REQUEST XMLRPC_REQUEST_FromXML (const char *in_buf, int len, +XMLRPC_REQUEST XMLRPC_REQUEST_FromXML (const char *in_buf, int len, XMLRPC_REQUEST_INPUT_OPTIONS in_options) { XMLRPC_REQUEST request = XMLRPC_RequestNew(); STRUCT_XML_ELEM_ERROR error = {0}; @@ -921,7 +921,7 @@ const char *XMLRPC_SetValueID_Case(XMLRPC_VALUE value, const char* id, int len, #ifdef XMLRPC_DEBUG_REFCOUNT printf("set value id: %s\n", pRetval); -#endif +#endif } } @@ -1026,7 +1026,7 @@ void XMLRPC_SetValueBoolean(XMLRPC_VALUE value, int val) { * FUNCTION * Set the XMLRPC_VALUE to be a vector (list) type. The vector may be one of * [xmlrpc_array | xmlrpc_struct | xmlrpc_mixed]. An array has only index values. - * A struct has key/val pairs. Mixed allows both index and key/val combinations. + * A struct has key/val pairs. Mixed allows both index and key/val combinations. * INPUTS * value The xml value who's vector type we will set * type New type of vector as enumerated by XMLRPC_VECTOR_TYPE @@ -1121,7 +1121,7 @@ XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type) { /* Not yet implemented. * * This should use a hash to determine if a given target id has already - * been appended. + * been appended. * * Alternately, it could walk the entire vector, but that could be quite * slow for very large lists. @@ -1154,7 +1154,7 @@ static int isDuplicateEntry(XMLRPC_VALUE target, XMLRPC_VALUE source) { */ int XMLRPC_AddValueToVector(XMLRPC_VALUE target, XMLRPC_VALUE source) { if(target && source) { - if(target->type == xmlrpc_vector && target->v && + if(target->type == xmlrpc_vector && target->v && target->v->q && target->v->type != xmlrpc_vector_none) { /* guard against putting value of unknown type into vector */ @@ -1464,7 +1464,7 @@ void XMLRPC_CleanupValue(XMLRPC_VALUE value) { XMLRPC_VALUE cur = (XMLRPC_VALUE)Q_Head(value->v->q); while( cur ) { XMLRPC_CleanupValue(cur); - + /* Make sure some idiot didn't include a vector as a child of itself * and thus it would have already free'd these. */ @@ -1503,7 +1503,7 @@ void XMLRPC_CleanupValue(XMLRPC_VALUE value) { else { printf("free'd 0x%x\n", value); } -#endif +#endif simplestring_free(&value->id); simplestring_free(&value->str); @@ -1617,7 +1617,7 @@ XMLRPC_VALUE XMLRPC_CopyValue(XMLRPC_VALUE value) { * NOTES * Use this when function when you need to modify the contents of * the copied value separately from the original. - * + * * this function is recursive, thus the value and all of its children * (if any) will be duplicated. * SOURCE @@ -1712,7 +1712,7 @@ XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time) { * value The target XMLRPC_VALUE * s The desired new time value * RESULT - * void + * void * BUGS * This function currently attempts to convert the time string to a valid unix time * value before passing it. Behavior when the string is invalid or out of range @@ -1750,7 +1750,7 @@ void XMLRPC_SetValueDateTime_ISO8601(XMLRPC_VALUE value, const char* s) { * id The id of the new value, or NULL * s The desired new time value * RESULT - * newly allocated XMLRPC_VALUE, or NULL if no value created. + * newly allocated XMLRPC_VALUE, or NULL if no value created. * BUGS * See XMLRPC_SetValueDateTime_ISO8601 () * SEE ALSO @@ -1786,7 +1786,7 @@ XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s) { * s The desired new binary value * len The length of s, or NULL. If buffer is not null terminated, len *must* be passed. * RESULT - * void + * void * NOTES * Data is set/stored/retrieved as passed in, but is base64 encoded for XML transfer, and * decoded on the other side. This is transparent to the caller. @@ -1853,7 +1853,7 @@ XMLRPC_VALUE XMLRPC_CreateValueBase64(const char* id, const char* s, int len) { * value The target XMLRPC_VALUE * val The desired new double value * RESULT - * void + * void * SEE ALSO * XMLRPC_GetValueDouble () * XMLRPC_CreateValueDouble () @@ -1880,7 +1880,7 @@ void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val) { * id id of the newly created value, or NULL * d The desired new double value * RESULT - * void + * void * SEE ALSO * XMLRPC_GetValueDouble () * XMLRPC_CreateValueDouble () @@ -1910,7 +1910,7 @@ XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double d) { * INPUTS * value source XMLRPC_VALUE of type xmlrpc_string * RESULT - * void + * void * SEE ALSO * XMLRPC_SetValueString () * XMLRPC_GetValueType () @@ -1931,7 +1931,7 @@ const char* XMLRPC_GetValueString(XMLRPC_VALUE value) { * FUNCTION * determine length of string value * INPUTS - * value XMLRPC_VALUE of type xmlrpc_string + * value XMLRPC_VALUE of type xmlrpc_string * RESULT * length of string, or 0 * NOTES @@ -1954,7 +1954,7 @@ int XMLRPC_GetValueStringLen(XMLRPC_VALUE value) { * FUNCTION * retrieve integer value. * INPUTS - * value XMLRPC_VALUE of type xmlrpc_int + * value XMLRPC_VALUE of type xmlrpc_int * RESULT * integer value or 0 if value is not valid int * NOTES @@ -2128,7 +2128,7 @@ const char* XMLRPC_GetValueID(XMLRPC_VALUE value) { * RESULT * count of items in vector * NOTES - * This is a cheap operation even on large vectors. Vector size is + * This is a cheap operation even on large vectors. Vector size is * maintained by queue during add/remove ops. * SEE ALSO * XMLRPC_AddValueToVector () @@ -2266,7 +2266,7 @@ XMLRPC_VECTOR_TYPE XMLRPC_GetVectorType(XMLRPC_VALUE value) { * data type of value as enumerated by XMLRPC_VALUE_TYPE_EASY * xmlrpc_type_none if not a value. * NOTES - * all values are of type xmlrpc_type_empty until set. + * all values are of type xmlrpc_type_empty until set. * SEE ALSO * XMLRPC_SetValue* * XMLRPC_CreateValue* @@ -2401,7 +2401,7 @@ void XMLRPC_ServerDestroy(XMLRPC_SERVER server) { my_free(sm); sm = Q_Next(&server->methodlist); } - if(server->xIntrospection) { + if (server->xIntrospection) { XMLRPC_CleanupValue(server->xIntrospection); } @@ -2440,7 +2440,7 @@ int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_C if(server && name && cb) { server_method* sm = malloc(sizeof(server_method)); - + if(sm) { sm->name = strdup(name); sm->method = cb; @@ -2510,7 +2510,7 @@ const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype) { * XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName) * FUNCTION * retrieve C callback associated with a given method name. - * INPUTS + * INPUTS * server The XMLRPC_SERVER the method is registered with * callName the method to find * RESULT @@ -2556,7 +2556,7 @@ XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callNa * NOTES * It is typically the caller's responsibility to free the returned value. * - * Often the caller will want to serialize the result as XML, via + * Often the caller will want to serialize the result as XML, via * XMLRPC_VALUE_To_XML () or XMLRPC_REQUEST_To_XML () * SEE ALSO * XMLRPC_ServerFindMethod () @@ -2749,12 +2749,12 @@ XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON * This function now supports some "standardized" fault codes, as specified at. * http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php. * If one of these fault codes is received, the description string will automatically - * be prefixed with a standard error string and 2 newlines. + * be prefixed with a standard error string and 2 newlines. * * The actual transformation between this complex type and the xml "<fault>" element takes * place in the xmlrpc to xml serialization layer. This step is not performed when using the * simplerpc serialization, meaning that there will be no "<fault>" element in that - * serialization. There will simply be a standard struct with 2 child elements. + * serialization. There will simply be a standard struct with 2 child elements. * imho, the "<fault>" element is unnecessary and/or out of place as part of the standard API. * * SOURCE @@ -2970,7 +2970,7 @@ const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response) { * SYNOPSIS * void XMLRPC_Free(void* mem) * FUNCTION - * frees a block of memory allocated by xmlrpc. + * frees a block of memory allocated by xmlrpc. * INPUTS * mem memory to free * RESULT @@ -2995,9 +2995,9 @@ void XMLRPC_Free(void* mem) { * FUNCTION * returns library version string * INPUTS - * + * * RESULT - * const char* + * const char* * NOTES * SOURCE */ diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.h b/ext/xmlrpc/libxmlrpc/xmlrpc.h index dde3d5e122..9b0d934129 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -191,9 +191,9 @@ typedef enum _xmlrpc_error_code { * SOURCE */ typedef enum _xmlrpc_version { - xmlrpc_version_none = 0, /* not a recognized vocabulary */ - xmlrpc_version_1_0 = 1, /* xmlrpc 1.0 standard vocab */ - xmlrpc_version_simple = 2, /* alt more readable vocab */ + xmlrpc_version_none = 0, /* not a recognized vocabulary */ + xmlrpc_version_1_0 = 1, /* xmlrpc 1.0 standard vocab */ + xmlrpc_version_simple = 2, /* alt more readable vocab */ xmlrpc_version_danda = 2, /* same as simple. legacy */ xmlrpc_version_soap_1_1 = 3 /* SOAP. version 1.1 */ } XMLRPC_VERSION; diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c index 9964d839f3..6da21b974e 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2001 Epinions, Inc. +/* + Copyright 2001 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -165,7 +165,7 @@ static XMLRPC_VALUE xi_system_describe_methods_cb(XMLRPC_SERVER server, XMLRPC_R qi = Q_Iter_Next_F(qi); } } - + return xResponse; } @@ -184,8 +184,8 @@ static XMLRPC_VALUE xi_system_list_methods_cb(XMLRPC_SERVER server, XMLRPC_REQUE return xResponse; } -/* this complies with system.methodSignature as defined at - * http://xmlrpc.usefulinc.com/doc/sysmethodsig.html +/* this complies with system.methodSignature as defined at + * http://xmlrpc.usefulinc.com/doc/sysmethodsig.html */ static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) { const char* method = XMLRPC_GetValueString(XMLRPC_VectorRewind(XMLRPC_RequestGetData(input))); @@ -212,11 +212,11 @@ static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_R while(xSigIter) { /* first type is the return value */ type = XMLRPC_VectorGetStringWithID(XMLRPC_VectorRewind( - XMLRPC_VectorGetValueWithID(xSigIter, xi_token_returns)), + XMLRPC_VectorGetValueWithID(xSigIter, xi_token_returns)), xi_token_type); - XMLRPC_AddValueToVector(xTypesArray, - XMLRPC_CreateValueString(NULL, - type ? type : type_to_str(xmlrpc_none, 0), + XMLRPC_AddValueToVector(xTypesArray, + XMLRPC_CreateValueString(NULL, + type ? type : type_to_str(xmlrpc_none, 0), 0)); /* the rest are parameters */ @@ -226,7 +226,7 @@ static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_R /* iter through params, adding to types array */ while(xIter) { XMLRPC_AddValueToVector(xTypesArray, - XMLRPC_CreateValueString(NULL, + XMLRPC_CreateValueString(NULL, XMLRPC_VectorGetStringWithID(xIter, xi_token_type), 0)); xIter = XMLRPC_VectorNext(xParams); @@ -243,8 +243,8 @@ static XMLRPC_VALUE xi_system_method_signature_cb(XMLRPC_SERVER server, XMLRPC_R return xResponse; } -/* this complies with system.methodHelp as defined at - * http://xmlrpc.usefulinc.com/doc/sysmethhelp.html +/* this complies with system.methodHelp as defined at + * http://xmlrpc.usefulinc.com/doc/sysmethhelp.html */ static XMLRPC_VALUE xi_system_method_help_cb(XMLRPC_SERVER server, XMLRPC_REQUEST input, void* userData) { const char* method = XMLRPC_GetValueString(XMLRPC_VectorRewind(XMLRPC_RequestGetData(input))); @@ -355,7 +355,7 @@ XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err if(xSubList) { xml_element* elem_iter = Q_Head(&el->children); while(elem_iter) { - XMLRPC_AddValueToVector(xSubList, + XMLRPC_AddValueToVector(xSubList, xml_element_to_method_description(elem_iter, err)); elem_iter = Q_Next(&el->children); } @@ -366,8 +366,8 @@ XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err } /* these three kids are about equivalent */ - else if(!strcmp(el->name, "params") || - !strcmp(el->name, "returns") || + else if(!strcmp(el->name, "params") || + !strcmp(el->name, "returns") || !strcmp(el->name, "signature")) { if(Q_Size(&el->children)) { xml_element* elem_iter = Q_Head(&el->children); @@ -375,7 +375,7 @@ XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err while(elem_iter) { - XMLRPC_AddValueToVector(xReturn, + XMLRPC_AddValueToVector(xReturn, xml_element_to_method_description(elem_iter, err)); elem_iter = Q_Next(&el->children); } @@ -390,7 +390,7 @@ XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err XMLRPC_VectorAppendString(xReturn, xi_token_name, name, 0); while(elem_iter) { - XMLRPC_AddValueToVector(xReturn, + XMLRPC_AddValueToVector(xReturn, xml_element_to_method_description(elem_iter, err)); elem_iter = Q_Next(&el->children); } @@ -407,14 +407,14 @@ XMLRPC_VALUE xml_element_to_method_description(xml_element* el, XMLRPC_ERROR err xReturn = XMLRPC_CreateVector(el->name, xmlrpc_vector_mixed); while(elem_iter) { - XMLRPC_AddValueToVector(xReturn, + XMLRPC_AddValueToVector(xReturn, xml_element_to_method_description(elem_iter, err)); elem_iter = Q_Next(&el->children); } } - /* or anything at all really, so long as its got some text. - * no reason being all snotty about a spec, right? + /* or anything at all really, so long as its got some text. + * no reason being all snotty about a spec, right? */ else if(el->name && el->text.len) { xReturn = XMLRPC_CreateValueString(el->name, el->text.str, el->text.len); @@ -480,7 +480,7 @@ XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR * updates server with additional introspection data * INPUTS * server - target server - * desc - introspection data, should be a struct generated by + * desc - introspection data, should be a struct generated by * XMLRPC_IntrospectionCreateDescription () * RESULT * int - 1 if success, else 0 @@ -579,7 +579,7 @@ int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_Intr if(server && cb) { doc_method* dm = calloc(1, sizeof(doc_method)); - + if(dm) { dm->method = cb; dm->b_called = 0; diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h index 656e441b96..41a31c6f51 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -58,8 +58,8 @@ #define xi_token_returns "returns" #define xi_token_related "related" #define xi_token_sub "sub" - - + + /*---------------------------------------------------------------------------- * Includes */ @@ -67,7 +67,7 @@ /*---------------------------------------------------------------------------- * Structures */ - + /****d* VALUE/XMLRPC_IntrospectionCallback * NAME * XMLRPC_IntrospectionCallback @@ -77,8 +77,8 @@ */ typedef void (*XMLRPC_IntrospectionCallback)(XMLRPC_SERVER server, void* userData); /******/ - - + + /*---------------------------------------------------------------------------- * Globals */ @@ -89,7 +89,7 @@ typedef void (*XMLRPC_IntrospectionCallback)(XMLRPC_SERVER server, void* userDat XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR error); int XMLRPC_ServerAddIntrospectionData(XMLRPC_SERVER server, XMLRPC_VALUE desc); int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_IntrospectionCallback cb); - + /*---------------------------------------------------------------------------- * Macros */ diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h index 7b97fa7ed7..5b231fe344 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection_private.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2001 Dan Libby, Epinions, Inc. +/* + Copyright 2001 Dan Libby, Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -72,7 +72,7 @@ #define xi_token_system_method_help "system.methodHelp" #define xi_token_system_method_signature "system.methodSignature" - + /*---------------------------------------------------------------------------- * Includes */ @@ -83,8 +83,8 @@ typedef struct _doc_method { XMLRPC_IntrospectionCallback method; int b_called; -} doc_method; - +} doc_method; + /*---------------------------------------------------------------------------- * Globals */ @@ -93,11 +93,11 @@ typedef struct _doc_method { * Functions */ void xi_register_system_methods(XMLRPC_SERVER server); - + /*---------------------------------------------------------------------------- * Macros */ - + #endif /* __XI_INTROSPECTION_PRIVATE_H */ diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_private.h b/ext/xmlrpc/libxmlrpc/xmlrpc_private.h index 65c6b136a6..fbe7104aac 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_private.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_private.h @@ -5,28 +5,28 @@ Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2000 Epinions, Inc. +/* + Copyright 2000 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -67,7 +67,7 @@ extern "C" { /*---------------------------------------------------------------------------- * Structures */ - + /* Some of these are typedef'd in xmlrpc.h for public use */ typedef struct _xmlrpc_vector* XMLRPC_VECTOR; @@ -103,7 +103,7 @@ typedef struct _xmlrpc_value { * Internal representation of an XML request. * * This struct is opaque to callers and should be accessed only via accessor functions. - * + * * SEE ALSO * XMLRPC_VALUE * XMLRPC_RequestNew () @@ -133,7 +133,7 @@ typedef struct _xmlrpc_vector { * internal representation of an xmlrpc server * * This struct is opaque to callers and should be accessed only via accessor functions. - * + * * SEE ALSO * XMLRPC_ServerCreate () * XMLRPC_ServerDestroy () @@ -162,12 +162,12 @@ typedef struct _server_method { */ server_method* find_method(XMLRPC_SERVER server, const char* name); const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype); - + /*---------------------------------------------------------------------------- * Macros */ #define my_free(thing) if(thing) {free(thing); thing = 0;} - + #ifdef __cplusplus } diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h b/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h index b212ccda5e..3e45052b0d 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h @@ -6,11 +6,11 @@ #ifndef inline # define inline __inline #endif -#ifndef snprintf +#if !defined(snprintf) && _MSC_VER < 1900 # define snprintf _snprintf #endif #ifndef strcasecmp # define strcasecmp(s1, s2) stricmp(s1, s2) #endif -#endif
\ No newline at end of file +#endif diff --git a/ext/xmlrpc/php_xmlrpc.h b/ext/xmlrpc/php_xmlrpc.h index 23ccb3d3fd..615af09cdc 100644 --- a/ext/xmlrpc/php_xmlrpc.h +++ b/ext/xmlrpc/php_xmlrpc.h @@ -1,33 +1,33 @@ /* - This file is part of, or distributed with, libXMLRPC - a C library for + This file is part of, or distributed with, libXMLRPC - a C library for xml-encoded function calls. Author: Dan Libby (dan@libby.com) Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2001 Epinions, Inc. +/* + Copyright 2001 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -35,7 +35,7 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ @@ -61,6 +61,9 @@ extern zend_module_entry xmlrpc_module_entry; #define phpext_xmlrpc_ptr &xmlrpc_module_entry +#include "php_version.h" +#define PHP_XMLRPC_VERSION PHP_VERSION + PHP_MINIT_FUNCTION(xmlrpc); PHP_MINFO_FUNCTION(xmlrpc); diff --git a/ext/xmlrpc/tests/bug70526.phpt b/ext/xmlrpc/tests/bug70526.phpt new file mode 100644 index 0000000000..6ed3e1b997 --- /dev/null +++ b/ext/xmlrpc/tests/bug70526.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #70526 (xmlrpc_set_type returns false on success) +--SKIPIF-- +<?php +if (!extension_loaded("xmlrpc")) print "skip"; +?> +--FILE-- +<?php +$params = date("Ymd\TH:i:s", time()); +$rv = xmlrpc_set_type($params, 'datetime'); +var_dump($rv); +?> +--EXPECT-- +bool(true) diff --git a/ext/xmlrpc/tests/bug71501.phpt b/ext/xmlrpc/tests/bug71501.phpt new file mode 100644 index 0000000000..950d21d6d4 --- /dev/null +++ b/ext/xmlrpc/tests/bug71501.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #71501 (xmlrpc_encode_request ignores encoding option) +--SKIPIF-- +<?php +if (!extension_loaded("xmlrpc")) print "skip"; +?> +--FILE-- +<?php +$params = 'Lê Trung Hiếu'; +echo xmlrpc_encode_request('foo', $params, ['encoding' => 'UTF-8', 'escaping' => 'markup']); +?> +--EXPECTF-- +<?xml version="1.0" encoding="UTF-8"?> +<methodCall> +<methodName>foo</methodName> +<params> + <param> + <value> + <string>Lê Trung Hiếu</string> + </value> + </param> +</params> +</methodCall> diff --git a/ext/xmlrpc/tests/bug72155.phpt b/ext/xmlrpc/tests/bug72155.phpt new file mode 100644 index 0000000000..5a71423dce --- /dev/null +++ b/ext/xmlrpc/tests/bug72155.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #72155 (use-after-free caused by get_zval_xmlrpc_type) +--SKIPIF-- +<?php +if (!extension_loaded("xmlrpc")) print "skip"; +?> +--FILE-- +<?php +if (false !== strpos(PHP_OS, "WIN")) { + $fl = "c:\\windows\\explorer.exe"; +} else { + $fl = "/etc/passwd"; +} +$var0 = fopen($fl,"r"); +$var1 = xmlrpc_encode($var0); +var_dump($var1); +?> +--EXPECTF-- +string(109) "<?xml version="1.0" encoding="utf-8"?> +<params> +<param> + <value> + <int>5</int> + </value> +</param> +</params> +" diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index e0f3463695..b5dcee8f0d 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -1,33 +1,33 @@ /* - This file is part of, or distributed with, libXMLRPC - a C library for + This file is part of, or distributed with, libXMLRPC - a C library for xml-encoded function calls. Author: Dan Libby (dan@libby.com) Epinions.com may be contacted at feedback@epinions-inc.com */ -/* - Copyright 2001 Epinions, Inc. +/* + Copyright 2001 Epinions, Inc. - Subject to the following 3 conditions, Epinions, Inc. permits you, free - of charge, to (a) use, copy, distribute, modify, perform and display this - software and associated documentation files (the "Software"), and (b) - permit others to whom the Software is furnished to do so as well. + Subject to the following 3 conditions, Epinions, Inc. permits you, free + of charge, to (a) use, copy, distribute, modify, perform and display this + software and associated documentation files (the "Software"), and (b) + permit others to whom the Software is furnished to do so as well. - 1) The above copyright notice and this permission notice shall be included - without modification in all copies or substantial portions of the - Software. + 1) The above copyright notice and this permission notice shall be included + without modification in all copies or substantial portions of the + Software. - 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF - ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY - IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE OR NONINFRINGEMENT. + 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF + ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY + IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE OR NONINFRINGEMENT. - 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, - SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT - OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING - NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH - DAMAGES. + 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, + SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT + OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING + NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH + DAMAGES. */ @@ -35,7 +35,7 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ @@ -73,8 +73,6 @@ #include "php_xmlrpc.h" #include "xmlrpc.h" -#define PHP_EXT_VERSION "0.51" - static int le_xmlrpc_server; /* {{{ arginfo */ @@ -144,7 +142,7 @@ ZEND_END_ARG_INFO() /* }}} */ const zend_function_entry xmlrpc_functions[] = { - PHP_FE(xmlrpc_encode, arginfo_xmlrpc_encode) + PHP_FE(xmlrpc_encode, arginfo_xmlrpc_encode) PHP_FE(xmlrpc_decode, arginfo_xmlrpc_decode) PHP_FE(xmlrpc_decode_request, arginfo_xmlrpc_decode_request) PHP_FE(xmlrpc_encode_request, arginfo_xmlrpc_encode_request) @@ -170,7 +168,7 @@ zend_module_entry xmlrpc_module_entry = { NULL, NULL, PHP_MINFO(xmlrpc), - PHP_EXT_VERSION, + PHP_XMLRPC_VERSION, STANDARD_MODULE_PROPERTIES }; @@ -184,8 +182,8 @@ ZEND_GET_MODULE(xmlrpc) /* per server data */ typedef struct _xmlrpc_server_data { - zval* method_map; - zval* introspection_map; + zval method_map; + zval introspection_map; XMLRPC_SERVER server_ptr; } xmlrpc_server_data; @@ -199,10 +197,10 @@ typedef struct _php_output_options { /* data passed to C callback */ typedef struct _xmlrpc_callback_data { - zval* xmlrpc_method; - zval* php_function; - zval* caller_params; - zval* return_data; + zval xmlrpc_method; + zval php_function; + zval caller_params; + zval return_data; xmlrpc_server_data* server; char php_executed; } xmlrpc_callback_data; @@ -251,10 +249,10 @@ typedef struct _xmlrpc_callback_data { /*********************** * forward declarations * ***********************/ -XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue); +XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue); static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data); int sset_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type); -zval* decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zval* method_name_out); +void decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zval* method_name_out, zval *retval); const char* xmlrpc_type_as_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype); XMLRPC_VALUE_TYPE xmlrpc_str_as_type(const char* str); XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str); @@ -264,16 +262,13 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE type); * startup / shutdown * *********************/ -static void destroy_server_data(xmlrpc_server_data *server TSRMLS_DC) +static void destroy_server_data(xmlrpc_server_data *server) { if (server) { XMLRPC_ServerDestroy(server->server_ptr); - zval_dtor(server->method_map); - FREE_ZVAL(server->method_map); - - zval_dtor(server->introspection_map); - FREE_ZVAL(server->introspection_map); + zval_ptr_dtor(&server->method_map); + zval_ptr_dtor(&server->introspection_map); efree(server); } @@ -281,10 +276,12 @@ static void destroy_server_data(xmlrpc_server_data *server TSRMLS_DC) /* called when server is being destructed. either when xmlrpc_server_destroy * is called, or when request ends. */ -static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void xmlrpc_server_destructor(zend_resource *rsrc) { if (rsrc && rsrc->ptr) { - destroy_server_data((xmlrpc_server_data*) rsrc->ptr TSRMLS_CC); + rsrc->gc.refcount++; + destroy_server_data((xmlrpc_server_data*) rsrc->ptr); + rsrc->gc.refcount--; } } @@ -301,7 +298,7 @@ PHP_MINFO_FUNCTION(xmlrpc) { php_info_print_table_start(); php_info_print_table_row(2, "core library version", XMLRPC_GetVersionString()); - php_info_print_table_row(2, "php extension version", PHP_EXT_VERSION); + php_info_print_table_row(2, "php extension version", PHP_XMLRPC_VERSION); php_info_print_table_row(2, "author", "Dan Libby"); php_info_print_table_row(2, "homepage", "http://xmlrpc-epi.sourceforge.net"); php_info_print_table_row(2, "open sourced by", "Epinions.com"); @@ -326,40 +323,35 @@ static int add_double(zval* list, char* id, double num) { else return add_next_index_double(list, num); } -static int add_string(zval* list, char* id, char* string, int duplicate) { - if(id) return add_assoc_string(list, id, string, duplicate); - else return add_next_index_string(list, string, duplicate); +static int add_string(zval* list, char* id, char* string) { + if(id) return add_assoc_string(list, id, string); + else return add_next_index_string(list, string); } -static int add_stringl(zval* list, char* id, char* string, uint length, int duplicate) { - if(id) return add_assoc_stringl(list, id, string, length, duplicate); - else return add_next_index_stringl(list, string, length, duplicate); +static int add_stringl(zval* list, char* id, char* string, uint length) { + if(id) return add_assoc_stringl(list, id, string, length); + else return add_next_index_stringl(list, string, length); } #endif -static int add_zval(zval* list, const char* id, zval** val) +static void add_zval(zval* list, const char* id, zval* val) { if (list && val) { if (id) { int id_len = strlen(id); if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_LONG) { long index = strtol(id, NULL, 0); - return zend_hash_index_update(Z_ARRVAL_P(list), index, (void *) val, sizeof(zval **), NULL); + zend_hash_index_update(Z_ARRVAL_P(list), index, val); } else { - return zend_hash_update(Z_ARRVAL_P(list), (char*) id, strlen(id) + 1, (void *) val, sizeof(zval **), NULL); + zend_hash_str_update(Z_ARRVAL_P(list), (char*)id, strlen(id), val); } } else { - return zend_hash_next_index_insert(Z_ARRVAL_P(list), (void *) val, sizeof(zval **), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(list), val); } } - /* what is the correct return on error? */ - return 0; } -#define my_zend_hash_get_current_key(ht, my_key, num_index) zend_hash_get_current_key(ht, my_key, num_index, 0) - - /************************* * input / output options * *************************/ @@ -369,7 +361,6 @@ static int add_zval(zval* list, const char* id, zval** val) static void set_output_options(php_output_options* options, zval* output_opts) { if (options) { - /* defaults */ options->b_php_out = 0; options->b_auto_version = 1; @@ -379,91 +370,86 @@ static void set_output_options(php_output_options* options, zval* output_opts) options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping | xml_elem_non_ascii_escaping | xml_elem_non_print_escaping; if (output_opts && Z_TYPE_P(output_opts) == IS_ARRAY) { - zval** val; + zval* val; /* type of output (xml/php) */ - if (zend_hash_find(Z_ARRVAL_P(output_opts), OUTPUT_TYPE_KEY, OUTPUT_TYPE_KEY_LEN + 1, (void**) &val) == SUCCESS) { - if (Z_TYPE_PP(val) == IS_STRING) { - if (!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_PHP)) { + if ((val = zend_hash_str_find(Z_ARRVAL_P(output_opts), OUTPUT_TYPE_KEY, OUTPUT_TYPE_KEY_LEN)) != NULL) { + if (Z_TYPE_P(val) == IS_STRING) { + if (!strcmp(Z_STRVAL_P(val), OUTPUT_TYPE_VALUE_PHP)) { options->b_php_out = 1; - } else if (!strcmp(Z_STRVAL_PP(val), OUTPUT_TYPE_VALUE_XML)) { + } else if (!strcmp(Z_STRVAL_P(val), OUTPUT_TYPE_VALUE_XML)) { options->b_php_out = 0; } } } /* verbosity of generated xml */ - if (zend_hash_find(Z_ARRVAL_P(output_opts), VERBOSITY_KEY, VERBOSITY_KEY_LEN + 1, (void**) &val) == SUCCESS) { - if (Z_TYPE_PP(val) == IS_STRING) { - if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NO_WHITE_SPACE)) { + if ((val = zend_hash_str_find(Z_ARRVAL_P(output_opts), VERBOSITY_KEY, VERBOSITY_KEY_LEN)) != NULL) { + if (Z_TYPE_P(val) == IS_STRING) { + if (!strcmp(Z_STRVAL_P(val), VERBOSITY_VALUE_NO_WHITE_SPACE)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_no_white_space; - } else if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_NEWLINES_ONLY)) { + } else if (!strcmp(Z_STRVAL_P(val), VERBOSITY_VALUE_NEWLINES_ONLY)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_newlines_only; - } else if (!strcmp(Z_STRVAL_PP(val), VERBOSITY_VALUE_PRETTY)) { + } else if (!strcmp(Z_STRVAL_P(val), VERBOSITY_VALUE_PRETTY)) { options->xmlrpc_out.xml_elem_opts.verbosity = xml_elem_pretty; } } } /* version of xml to output */ - if (zend_hash_find(Z_ARRVAL_P(output_opts), VERSION_KEY, VERSION_KEY_LEN + 1, (void**) &val) == SUCCESS) { - if (Z_TYPE_PP(val) == IS_STRING) { + if ((val = zend_hash_str_find(Z_ARRVAL_P(output_opts), VERSION_KEY, VERSION_KEY_LEN)) != NULL) { + if (Z_TYPE_P(val) == IS_STRING) { options->b_auto_version = 0; - if (!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_XMLRPC)) { + if (!strcmp(Z_STRVAL_P(val), VERSION_VALUE_XMLRPC)) { options->xmlrpc_out.version = xmlrpc_version_1_0; - } else if (!strcmp(Z_STRVAL_PP(val), VERSION_VALUE_SIMPLE)) { + } else if (!strcmp(Z_STRVAL_P(val), VERSION_VALUE_SIMPLE)) { options->xmlrpc_out.version = xmlrpc_version_simple; - } else if (!strcmp((*val)->value.str.val, VERSION_VALUE_SOAP11)) { - options->xmlrpc_out.version = xmlrpc_version_soap_1_1; - } else { /* if(!strcmp((*val)->value.str.val, VERSION_VALUE_AUTO)) { */ - options->b_auto_version = 1; + } else if (!strcmp(Z_STRVAL_P(val), VERSION_VALUE_SOAP11)) { + options->xmlrpc_out.version = xmlrpc_version_soap_1_1; + } else { /* if(!strcmp(Z_STRVAL_P(val), VERSION_VALUE_AUTO)) { */ + options->b_auto_version = 1; } } + } /* encoding code set */ - if (zend_hash_find(Z_ARRVAL_P(output_opts), ENCODING_KEY, ENCODING_KEY_LEN + 1, (void**)&val) == SUCCESS) { - if (Z_TYPE_PP(val) == IS_STRING) { - options->xmlrpc_out.xml_elem_opts.encoding = estrdup(Z_STRVAL_PP(val)); + if ((val = zend_hash_str_find(Z_ARRVAL_P(output_opts), ENCODING_KEY, ENCODING_KEY_LEN)) != NULL) { + if (Z_TYPE_P(val) == IS_STRING) { + options->xmlrpc_out.xml_elem_opts.encoding = estrdup(Z_STRVAL_P(val)); } } /* escaping options */ - if (zend_hash_find(Z_ARRVAL_P(output_opts), ESCAPING_KEY, ESCAPING_KEY_LEN + 1, (void**)&val) == SUCCESS) { + if ((val = zend_hash_str_find(Z_ARRVAL_P(output_opts), ESCAPING_KEY, ESCAPING_KEY_LEN)) != NULL) { /* multiple values allowed. check if array */ - if (Z_TYPE_PP(val) == IS_ARRAY) { - zval** iter_val; + if (Z_TYPE_P(val) == IS_ARRAY) { + zval* iter_val; - zend_hash_internal_pointer_reset(Z_ARRVAL_PP(val)); options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_no_escaping; - while (1) { - if (zend_hash_get_current_data(Z_ARRVAL_PP(val), (void**)&iter_val) == SUCCESS) { - if (Z_TYPE_PP(iter_val) == IS_STRING && Z_STRVAL_PP(iter_val)) { - if (!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_CDATA)) { - options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_cdata_escaping; - } else if (!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_ASCII)) { - options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_ascii_escaping; - } else if (!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_NON_PRINT)) { - options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_print_escaping; - } else if (!strcmp(Z_STRVAL_PP(iter_val), ESCAPING_VALUE_MARKUP)) { - options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_markup_escaping; - } + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(val), iter_val) { + if (Z_TYPE_P(iter_val) == IS_STRING && Z_STRVAL_P(iter_val)) { + if (!strcmp(Z_STRVAL_P(iter_val), ESCAPING_VALUE_CDATA)) { + options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_cdata_escaping; + } else if (!strcmp(Z_STRVAL_P(iter_val), ESCAPING_VALUE_NON_ASCII)) { + options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_ascii_escaping; + } else if (!strcmp(Z_STRVAL_P(iter_val), ESCAPING_VALUE_NON_PRINT)) { + options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_non_print_escaping; + } else if (!strcmp(Z_STRVAL_P(iter_val), ESCAPING_VALUE_MARKUP)) { + options->xmlrpc_out.xml_elem_opts.escaping |= xml_elem_markup_escaping; } - } else { - break; } - zend_hash_move_forward(Z_ARRVAL_PP(val)); - } - /* else, check for single value */ - } else if (Z_TYPE_PP(val) == IS_STRING) { - if (!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_CDATA)) { + } ZEND_HASH_FOREACH_END(); + /* else, check for single value */ + } else if (Z_TYPE_P(val) == IS_STRING) { + if (!strcmp(Z_STRVAL_P(val), ESCAPING_VALUE_CDATA)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_cdata_escaping; - } else if (!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_ASCII)) { + } else if (!strcmp(Z_STRVAL_P(val), ESCAPING_VALUE_NON_ASCII)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_ascii_escaping; - } else if (!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_NON_PRINT)) { + } else if (!strcmp(Z_STRVAL_P(val), ESCAPING_VALUE_NON_PRINT)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_non_print_escaping; - } else if (!strcmp(Z_STRVAL_PP(val), ESCAPING_VALUE_MARKUP)) { + } else if (!strcmp(Z_STRVAL_P(val), ESCAPING_VALUE_MARKUP)) { options->xmlrpc_out.xml_elem_opts.escaping = xml_elem_markup_escaping; } } @@ -485,14 +471,11 @@ static void set_output_options(php_output_options* options, zval* output_opts) static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht) { int bArray = 0, bStruct = 0, bMixed = 0; - unsigned long num_index, last_num = 0; - char* my_key; - - zend_hash_internal_pointer_reset(ht); - while (1) { - int res = my_zend_hash_get_current_key(ht, &my_key, &num_index); - - if (res == HASH_KEY_IS_LONG) { + zend_ulong num_index, last_num = 0; + zend_string* my_key; + + ZEND_HASH_FOREACH_KEY(ht, num_index, my_key) { + if (my_key == NULL) { if (bStruct) { bMixed = 1; break; @@ -502,123 +485,111 @@ static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht) } bArray = 1; last_num = num_index; - } else if (res == HASH_KEY_NON_EXISTENT) { - break; - } else if (res == HASH_KEY_IS_STRING) { + } else { if (bArray) { bMixed = 1; break; } bStruct = 1; } - zend_hash_move_forward(ht); - } + } ZEND_HASH_FOREACH_END(); return bMixed ? xmlrpc_vector_mixed : (bStruct ? xmlrpc_vector_struct : xmlrpc_vector_array); } /* recursively convert php values into xmlrpc values */ -static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int depth TSRMLS_DC) +static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int depth) { XMLRPC_VALUE xReturn = NULL; if (in_val) { - zval* val = NULL; - XMLRPC_VALUE_TYPE type = get_zval_xmlrpc_type(in_val, &val); - - if (val) { + zval val; + XMLRPC_VALUE_TYPE type; + + ZVAL_UNDEF(&val); + type = get_zval_xmlrpc_type(in_val, &val); + + if (!Z_ISUNDEF(val)) { switch (type) { case xmlrpc_base64: - if (Z_TYPE_P(val) == IS_NULL) { + if (Z_TYPE(val) == IS_NULL) { xReturn = XMLRPC_CreateValueEmpty(); XMLRPC_SetValueID(xReturn, key, 0); } else { - if (Z_TYPE_P(val) != IS_STRING) { - zval *newvalue; - ALLOC_INIT_ZVAL(newvalue); - MAKE_COPY_ZVAL(&val, newvalue); - convert_to_string(newvalue); - xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL_P(newvalue), Z_STRLEN_P(newvalue)); - zval_ptr_dtor(&newvalue); + if (Z_TYPE(val) != IS_STRING) { + zval newvalue; + ZVAL_DUP(&newvalue, &val); + convert_to_string(&newvalue); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(newvalue), Z_STRLEN(newvalue)); + zval_dtor(&newvalue); } else { - xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL_P(val), Z_STRLEN_P(val)); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRLEN(val)); } } break; case xmlrpc_datetime: - convert_to_string(val); - xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL_P(val)); + convert_to_string(&val); + xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL(val)); break; case xmlrpc_boolean: - convert_to_boolean(val); - xReturn = XMLRPC_CreateValueBoolean(key, Z_LVAL_P(val)); + convert_to_boolean(&val); + xReturn = XMLRPC_CreateValueBoolean(key, Z_TYPE(val) == IS_TRUE); break; case xmlrpc_int: - convert_to_long(val); - xReturn = XMLRPC_CreateValueInt(key, Z_LVAL_P(val)); + ZVAL_LONG(&val, zval_get_long(&val)); + xReturn = XMLRPC_CreateValueInt(key, Z_LVAL(val)); break; case xmlrpc_double: - convert_to_double(val); - xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL_P(val)); + convert_to_double(&val); + xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL(val)); break; case xmlrpc_string: - convert_to_string(val); - xReturn = XMLRPC_CreateValueString(key, Z_STRVAL_P(val), Z_STRLEN_P(val)); + convert_to_string(&val); + xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRLEN(val)); break; case xmlrpc_vector: { - unsigned long num_index; - zval** pIter; - char* my_key; + zend_ulong num_index; + zval* pIter; + zend_string* my_key; HashTable *ht = NULL; - zval *val_arr; + zval val_arr; XMLRPC_VECTOR_TYPE vtype; - ht = HASH_OF(val); - if (ht && ht->nApplyCount > 1) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "XML-RPC doesn't support circular references"); + ht = HASH_OF(&val); + if (ht && ht->u.v.nApplyCount > 1) { + php_error_docref(NULL, E_ERROR, "XML-RPC doesn't support circular references"); return NULL; } - MAKE_STD_ZVAL(val_arr); - MAKE_COPY_ZVAL(&val, val_arr); - convert_to_array(val_arr); - - vtype = determine_vector_type(Z_ARRVAL_P(val_arr)); + ZVAL_COPY(&val_arr, &val); + convert_to_array(&val_arr); + + vtype = determine_vector_type(Z_ARRVAL(val_arr)); xReturn = XMLRPC_CreateVector(key, vtype); - zend_hash_internal_pointer_reset(Z_ARRVAL_P(val_arr)); - while(zend_hash_get_current_data(Z_ARRVAL_P(val_arr), (void**)&pIter) == SUCCESS) { - int res = my_zend_hash_get_current_key(Z_ARRVAL_P(val_arr), &my_key, &num_index); - - switch (res) { - case HASH_KEY_NON_EXISTENT: - break; - case HASH_KEY_IS_STRING: - case HASH_KEY_IS_LONG: - ht = HASH_OF(*pIter); - if (ht) { - ht->nApplyCount++; - } - if (res == HASH_KEY_IS_LONG) { - char *num_str = NULL; - - if (vtype != xmlrpc_vector_array) { - spprintf(&num_str, 0, "%ld", num_index); - } - XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(num_str, *pIter, depth++ TSRMLS_CC)); - if (num_str) { - efree(num_str); - } - } else { - XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(my_key, *pIter, depth++ TSRMLS_CC)); - } - if (ht) { - ht->nApplyCount--; - } - break; + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(val_arr), num_index, my_key, pIter) { + ht = HASH_OF(pIter); + if (ht) { + ht->u.v.nApplyCount++; + } + if (my_key == NULL) { + char *num_str = NULL; + + if (vtype != xmlrpc_vector_array) { + spprintf(&num_str, 0, "%ld", num_index); + } + + XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(num_str, pIter, depth++)); + if (num_str) { + efree(num_str); + } + } else { + XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(ZSTR_VAL(my_key), pIter, depth++)); + } + if (ht) { + ht->u.v.nApplyCount--; } - zend_hash_move_forward(Z_ARRVAL_P(val_arr)); - } + } ZEND_HASH_FOREACH_END(); zval_ptr_dtor(&val_arr); } break; @@ -630,57 +601,45 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep return xReturn; } -static XMLRPC_VALUE PHP_to_XMLRPC(zval* root_val TSRMLS_DC) +static XMLRPC_VALUE PHP_to_XMLRPC(zval* root_val) { - return PHP_to_XMLRPC_worker(NULL, root_val, 0 TSRMLS_CC); + return PHP_to_XMLRPC_worker(NULL, root_val, 0); } /* recursively convert xmlrpc values into php values */ -static zval* XMLRPC_to_PHP(XMLRPC_VALUE el) +static void XMLRPC_to_PHP(XMLRPC_VALUE el, zval *elem) { - zval* elem = NULL; const char* pStr; if (el) { XMLRPC_VALUE_TYPE type = XMLRPC_GetValueType(el); - MAKE_STD_ZVAL(elem); /* init. very important. spent a frustrating day finding this out. */ - - switch(type) { + switch (type) { case xmlrpc_empty: - Z_TYPE_P(elem) = IS_NULL; + ZVAL_NULL(elem); break; case xmlrpc_string: pStr = XMLRPC_GetValueString(el); if (pStr) { - Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); - Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem)); - Z_TYPE_P(elem) = IS_STRING; + ZVAL_STRINGL(elem, pStr, XMLRPC_GetValueStringLen(el)); } break; case xmlrpc_int: - Z_LVAL_P(elem) = XMLRPC_GetValueInt(el); - Z_TYPE_P(elem) = IS_LONG; + ZVAL_LONG(elem, XMLRPC_GetValueInt(el)); break; case xmlrpc_boolean: - Z_LVAL_P(elem) = XMLRPC_GetValueBoolean(el); - Z_TYPE_P(elem) = IS_BOOL; + ZVAL_BOOL(elem, XMLRPC_GetValueBoolean(el)); break; case xmlrpc_double: - Z_DVAL_P(elem) = XMLRPC_GetValueDouble(el); - Z_TYPE_P(elem) = IS_DOUBLE; + ZVAL_DOUBLE(elem, XMLRPC_GetValueDouble(el)); break; case xmlrpc_datetime: - Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); - Z_STRVAL_P(elem) = estrndup(XMLRPC_GetValueDateTime_ISO8601(el), Z_STRLEN_P(elem)); - Z_TYPE_P(elem) = IS_STRING; + ZVAL_STRINGL(elem, XMLRPC_GetValueDateTime_ISO8601(el), XMLRPC_GetValueStringLen(el)); break; case xmlrpc_base64: pStr = XMLRPC_GetValueBase64(el); if (pStr) { - Z_STRLEN_P(elem) = XMLRPC_GetValueStringLen(el); - Z_STRVAL_P(elem) = estrndup(pStr, Z_STRLEN_P(elem)); - Z_TYPE_P(elem) = IS_STRING; + ZVAL_STRINGL(elem, pStr, XMLRPC_GetValueStringLen(el)); } break; case xmlrpc_vector: @@ -689,8 +648,10 @@ static zval* XMLRPC_to_PHP(XMLRPC_VALUE el) XMLRPC_VALUE xIter = XMLRPC_VectorRewind(el); while( xIter ) { - zval *val = XMLRPC_to_PHP(xIter); - if (val) { + zval val; + ZVAL_UNDEF(&val); + XMLRPC_to_PHP(xIter, &val); + if (!Z_ISUNDEF(val)) { add_zval(elem, XMLRPC_GetValueID(xIter), &val); } xIter = XMLRPC_VectorNext(el); @@ -702,7 +663,6 @@ static zval* XMLRPC_to_PHP(XMLRPC_VALUE el) } set_zval_xmlrpc_type(elem, type); } - return elem; } /* {{{ proto string xmlrpc_encode_request(string method, mixed params [, array output_options]) @@ -713,16 +673,16 @@ PHP_FUNCTION(xmlrpc_encode_request) char *outBuf; zval *vals, *out_opts = NULL; char *method = NULL; - int method_len; + size_t method_len; php_output_options out; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!z|a", &method, &method_len, &vals, &out_opts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!z|a", &method, &method_len, &vals, &out_opts) == FAILURE) { return; } set_output_options(&out, out_opts ? out_opts : 0); - if (return_value_used) { + if (USED_RET()) { xRequest = XMLRPC_RequestNew(); if (xRequest) { @@ -734,18 +694,18 @@ PHP_FUNCTION(xmlrpc_encode_request) XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call); } if (Z_TYPE_P(vals) != IS_NULL) { - XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals TSRMLS_CC)); + XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals)); } outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0); if (outBuf) { - RETVAL_STRING(outBuf, 1); + RETVAL_STRING(outBuf); free(outBuf); } XMLRPC_RequestFree(xRequest, 1); } } - + if (strcmp(out.xmlrpc_out.xml_elem_opts.encoding, ENCODING_DEFAULT) != 0) { efree((char *)out.xmlrpc_out.xml_elem_opts.encoding); } @@ -757,23 +717,23 @@ PHP_FUNCTION(xmlrpc_encode_request) PHP_FUNCTION(xmlrpc_encode) { XMLRPC_VALUE xOut = NULL; - zval **arg1; + zval *arg1; char *outBuf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg1) == FAILURE) { return; } - if (return_value_used) { + if (USED_RET()) { /* convert native php type to xmlrpc type */ - xOut = PHP_to_XMLRPC(*arg1 TSRMLS_CC); + xOut = PHP_to_XMLRPC(arg1); /* generate raw xml from xmlrpc data */ outBuf = XMLRPC_VALUE_ToXML(xOut, 0); if (xOut) { if (outBuf) { - RETVAL_STRING(outBuf, 1); + RETVAL_STRING(outBuf); free(outBuf); } /* cleanup */ @@ -783,9 +743,8 @@ PHP_FUNCTION(xmlrpc_encode) } /* }}} */ -zval* decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zval* method_name_out) /* {{{ */ +void decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zval* method_name_out, zval *retval) /* {{{ */ { - zval* retval = NULL; XMLRPC_REQUEST response; STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {{0}}; const char *method_name; @@ -794,20 +753,19 @@ zval* decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zva /* generate XMLRPC_REQUEST from raw xml */ response = XMLRPC_REQUEST_FromXML(xml_in, xml_in_len, &opts); if (response) { + ZVAL_NULL(retval); /* convert xmlrpc data to native php types */ - retval = XMLRPC_to_PHP(XMLRPC_RequestGetData(response)); + XMLRPC_to_PHP(XMLRPC_RequestGetData(response), retval); if (XMLRPC_RequestGetRequestType(response) == xmlrpc_request_call) { if (method_name_out) { method_name = XMLRPC_RequestGetMethodName(response); if (method_name) { - zval_dtor(method_name_out); - Z_TYPE_P(method_name_out) = IS_STRING; - Z_STRVAL_P(method_name_out) = estrdup(method_name); - Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out)); - } else if (retval) { - zval_ptr_dtor(&retval); - retval = NULL; + zval_ptr_dtor(method_name_out); + ZVAL_STRING(method_name_out, method_name); + } else { + zval_ptr_dtor(retval); + ZVAL_NULL(retval); } } } @@ -815,7 +773,6 @@ zval* decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zva /* dust, sweep, and mop */ XMLRPC_RequestFree(response, 1); } - return retval; } /* }}} */ @@ -824,20 +781,15 @@ zval* decode_request_worker(char *xml_in, int xml_in_len, char *encoding_in, zva PHP_FUNCTION(xmlrpc_decode_request) { char *xml, *encoding = NULL; - zval **method; - int xml_len, encoding_len = 0; + zval *method; + size_t xml_len, encoding_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|s", &xml, &xml_len, &method, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz/|s", &xml, &xml_len, &method, &encoding, &encoding_len) == FAILURE) { return; } - - if (return_value_used) { - zval* retval = decode_request_worker(xml, xml_len, encoding_len ? encoding : NULL, *method); - if (retval) { - *return_value = *retval; - FREE_ZVAL(retval); - } + if (USED_RET()) { + decode_request_worker(xml, xml_len, encoding_len ? encoding : NULL, method, return_value); } } /* }}} */ @@ -847,18 +799,14 @@ PHP_FUNCTION(xmlrpc_decode_request) PHP_FUNCTION(xmlrpc_decode) { char *arg1, *arg2 = NULL; - int arg1_len, arg2_len = 0; + size_t arg1_len, arg2_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &arg1, &arg1_len, &arg2, &arg2_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &arg1, &arg1_len, &arg2, &arg2_len) == FAILURE) { return; } - if (return_value_used) { - zval* retval = decode_request_worker(arg1, arg1_len, arg2_len ? arg2 : NULL, NULL); - if (retval) { - *return_value = *retval; - FREE_ZVAL(retval); - } + if (USED_RET()) { + decode_request_worker(arg1, arg1_len, arg2_len ? arg2 : NULL, NULL, return_value); } } /* }}} */ @@ -875,24 +823,18 @@ PHP_FUNCTION(xmlrpc_server_create) return; } - if (return_value_used) { - zval *method_map, *introspection_map; + if (USED_RET()) { xmlrpc_server_data *server = emalloc(sizeof(xmlrpc_server_data)); - MAKE_STD_ZVAL(method_map); - MAKE_STD_ZVAL(introspection_map); - - array_init(method_map); - array_init(introspection_map); - + /* allocate server data. free'd in destroy_server_data() */ - server->method_map = method_map; - server->introspection_map = introspection_map; + array_init(&server->method_map); + array_init(&server->introspection_map); server->server_ptr = XMLRPC_ServerCreate(); XMLRPC_ServerRegisterIntrospectionCallback(server->server_ptr, php_xmlrpc_introspection_callback); /* store for later use */ - ZEND_REGISTER_RESOURCE(return_value,server, le_xmlrpc_server); + RETURN_RES(zend_register_resource(server, le_xmlrpc_server)); } } /* }}} */ @@ -902,68 +844,62 @@ PHP_FUNCTION(xmlrpc_server_create) PHP_FUNCTION(xmlrpc_server_destroy) { zval *arg1; - int bSuccess = FAILURE, type; + int bSuccess = FAILURE; xmlrpc_server_data *server; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) { return; } - server = zend_list_find(Z_LVAL_P(arg1), &type); - - if (server && type == le_xmlrpc_server) { - bSuccess = zend_list_delete(Z_LVAL_P(arg1)); - - /* called by hashtable destructor - * destroy_server_data(server); - */ + if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(arg1), "xmlrpc server", le_xmlrpc_server)) == NULL) { + RETURN_FALSE; } - RETVAL_LONG(bSuccess == SUCCESS); + + bSuccess = zend_list_close(Z_RES_P(arg1)); + /* called by hashtable destructor + * destroy_server_data(server); + */ + RETURN_BOOL(bSuccess == SUCCESS); } /* }}} */ - + /* called by xmlrpc C engine as method handler for all registered methods. * it then calls the corresponding PHP function to handle the method. */ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* data) /* {{{ */ { xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data; - zval** php_function; - zval* xmlrpc_params; - zval* callback_params[3]; - TSRMLS_FETCH(); + zval* php_function; + zval xmlrpc_params; + zval callback_params[3]; - zval_dtor(pData->xmlrpc_method); - zval_dtor(pData->return_data); + zval_ptr_dtor(&pData->xmlrpc_method); + zval_ptr_dtor(&pData->return_data); /* convert xmlrpc to native php types */ - ZVAL_STRING(pData->xmlrpc_method, XMLRPC_RequestGetMethodName(xRequest), 1); - xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest)); - - /* check if the called method has been previous registered */ - if(zend_hash_find(Z_ARRVAL_P(pData->server->method_map), - Z_STRVAL_P(pData->xmlrpc_method), - Z_STRLEN_P(pData->xmlrpc_method) + 1, - (void**)&php_function) == SUCCESS) { + ZVAL_STRING(&pData->xmlrpc_method, XMLRPC_RequestGetMethodName(xRequest)); + XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest), &xmlrpc_params); - pData->php_function = *php_function; + /* check if the called method has been previous registered */ + if ((php_function = zend_hash_find(Z_ARRVAL(pData->server->method_map), Z_STR(pData->xmlrpc_method))) != NULL) { + ZVAL_COPY_VALUE(&pData->php_function, php_function); } /* setup data hoojum */ - callback_params[0] = pData->xmlrpc_method; - callback_params[1] = xmlrpc_params; - callback_params[2] = pData->caller_params; + ZVAL_COPY_VALUE(&callback_params[0], &pData->xmlrpc_method); + ZVAL_COPY_VALUE(&callback_params[1], &xmlrpc_params); + ZVAL_COPY_VALUE(&callback_params[2], &pData->caller_params); /* Use same C function for all methods */ /* php func prototype: function user_func($method_name, $xmlrpc_params, $user_params) */ - call_user_function(CG(function_table), NULL, pData->php_function, pData->return_data, 3, callback_params TSRMLS_CC); + call_user_function(CG(function_table), NULL, &pData->php_function, &pData->return_data, 3, callback_params); pData->php_executed = 1; zval_ptr_dtor(&xmlrpc_params); - return PHP_to_XMLRPC(pData->return_data TSRMLS_CC); + return PHP_to_XMLRPC(&pData->return_data); } /* }}} */ @@ -972,61 +908,53 @@ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRe */ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) /* {{{ */ { - zval retval, **php_function; - zval *callback_params[1]; - char *php_function_name; + zval retval, *php_function; + zval callback_params[1]; + zend_string *php_function_name; xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data; - TSRMLS_FETCH(); /* setup data hoojum */ - callback_params[0] = pData->caller_params; - - /* loop through and call all registered callbacks */ - zend_hash_internal_pointer_reset(Z_ARRVAL_P(pData->server->introspection_map)); - while (1) { - if (zend_hash_get_current_data(Z_ARRVAL_P(pData->server->introspection_map), (void**)&php_function) == SUCCESS) { - if (zend_is_callable(*php_function, 0, &php_function_name TSRMLS_CC)) { - /* php func prototype: function string user_func($user_params) */ - if (call_user_function(CG(function_table), NULL, *php_function, &retval, 1, callback_params TSRMLS_CC) == SUCCESS) { - XMLRPC_VALUE xData; - STRUCT_XMLRPC_ERROR err = {0}; - - /* return value should be a string */ - convert_to_string(&retval); - - xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL(retval), &err); - - if (xData) { - if (!XMLRPC_ServerAddIntrospectionData(server, xData)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", php_function_name); - } - XMLRPC_CleanupValue(xData); - } else { - /* could not create description */ - if (err.xml_elem_error.parser_code) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to add introspection data returned from %s()", - err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, php_function_name); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add introspection data returned from %s()", php_function_name); - } + ZVAL_COPY_VALUE(&callback_params[0], &pData->caller_params); + + ZEND_HASH_FOREACH_VAL(Z_ARRVAL(pData->server->introspection_map), php_function) { + if (zend_is_callable(php_function, 0, &php_function_name)) { + /* php func prototype: function string user_func($user_params) */ + if (call_user_function(CG(function_table), NULL, php_function, &retval, 1, callback_params) == SUCCESS) { + XMLRPC_VALUE xData; + STRUCT_XMLRPC_ERROR err = {0}; + + /* return value should be a string */ + convert_to_string(&retval); + + xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL(retval), &err); + + if (xData) { + if (!XMLRPC_ServerAddIntrospectionData(server, xData)) { + php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", ZSTR_VAL(php_function_name)); } - zval_dtor(&retval); + XMLRPC_CleanupValue(xData); } else { - /* user func failed */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error calling user introspection callback: %s()", php_function_name); + /* could not create description */ + if (err.xml_elem_error.parser_code) { + php_error_docref(NULL, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to add introspection data returned from %s()", + err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, ZSTR_VAL(php_function_name)); + } else { + php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s()", ZSTR_VAL(php_function_name)); + } } + zval_ptr_dtor(&retval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid callback '%s' passed", php_function_name); + /* user func failed */ + php_error_docref(NULL, E_WARNING, "Error calling user introspection callback: %s()", ZSTR_VAL(php_function_name)); } - efree(php_function_name); } else { - break; + php_error_docref(NULL, E_WARNING, "Invalid callback '%s' passed", ZSTR_VAL(php_function_name)); } - zend_hash_move_forward(Z_ARRVAL_P(pData->server->introspection_map)); - } - + zend_string_release(php_function_name); + } ZEND_HASH_FOREACH_END(); + /* so we don't call the same callbacks ever again */ - zend_hash_clean(Z_ARRVAL_P(pData->server->introspection_map)); + zend_hash_clean(Z_ARRVAL(pData->server->introspection_map)); } /* }}} */ @@ -1035,33 +963,32 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) PHP_FUNCTION(xmlrpc_server_register_method) { char *method_key; - int method_key_len; - zval *handle, *method_name_save, **method_name; - int type; + size_t method_key_len; + zval *handle, *method_name; xmlrpc_server_data* server; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZ", &handle, &method_key, &method_key_len, &method_name) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz", &handle, &method_key, &method_key_len, &method_name) == FAILURE) { return; } - server = zend_list_find(Z_LVAL_P(handle), &type); - - if (type == le_xmlrpc_server) { - /* register with C engine. every method just calls our standard callback, - * and it then dispatches to php as necessary - */ - if (XMLRPC_ServerRegisterMethod(server->server_ptr, method_key, php_xmlrpc_callback)) { - /* save for later use */ - ALLOC_ZVAL(method_name_save); - MAKE_COPY_ZVAL(method_name, method_name_save); + if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) { + RETURN_FALSE; + } - /* register our php method */ - add_zval(server->method_map, method_key, &method_name_save); + /* register with C engine. every method just calls our standard callback, + * and it then dispatches to php as necessary + */ + if (XMLRPC_ServerRegisterMethod(server->server_ptr, method_key, php_xmlrpc_callback)) { + /* save for later use */ - RETURN_BOOL(1); + if (Z_REFCOUNTED_P(method_name)) { + Z_ADDREF_P(method_name); } + /* register our php method */ + add_zval(&server->method_map, method_key, method_name); + + RETURN_TRUE; } - RETURN_BOOL(0); } /* }}} */ @@ -1069,27 +996,24 @@ PHP_FUNCTION(xmlrpc_server_register_method) Register a PHP function to generate documentation */ PHP_FUNCTION(xmlrpc_server_register_introspection_callback) { - zval **method_name, *handle, *method_name_save; - int type; + zval *method_name, *handle; xmlrpc_server_data* server; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &handle, &method_name) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &handle, &method_name) == FAILURE) { return; } - server = zend_list_find(Z_LVAL_P(handle), &type); - - if (type == le_xmlrpc_server) { - /* save for later use */ - ALLOC_ZVAL(method_name_save); - MAKE_COPY_ZVAL(method_name, method_name_save); - - /* register our php method */ - add_zval(server->introspection_map, NULL, &method_name_save); + if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) { + RETURN_FALSE; + } - RETURN_BOOL(1); + if (Z_REFCOUNTED_P(method_name)) { + Z_ADDREF_P(method_name); } - RETURN_BOOL(0); + /* register our php method */ + add_zval(&server->introspection_map, NULL, method_name); + + RETURN_TRUE; } /* }}} */ @@ -1099,17 +1023,17 @@ PHP_FUNCTION(xmlrpc_server_register_introspection_callback) Parses XML requests and call methods */ PHP_FUNCTION(xmlrpc_server_call_method) { - xmlrpc_callback_data data = {0}; XMLRPC_REQUEST xRequest; + xmlrpc_callback_data data; STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts; xmlrpc_server_data* server; - zval **caller_params, *handle, *output_opts = NULL; + zval *caller_params, *handle, *output_opts = NULL; char *rawxml; - int rawxml_len, type; + size_t rawxml_len; php_output_options out; - int argc =ZEND_NUM_ARGS(); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZ|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) { + int argc = ZEND_NUM_ARGS(); + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) { return; } /* user output options */ @@ -1119,87 +1043,82 @@ PHP_FUNCTION(xmlrpc_server_call_method) set_output_options(&out, output_opts); } - server = zend_list_find(Z_LVAL_P(handle), &type); + if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) { + RETURN_FALSE; + } + + /* HACK: use output encoding for now */ + input_opts.xml_elem_opts.encoding = utf8_get_encoding_id_from_string(out.xmlrpc_out.xml_elem_opts.encoding); - if (type == le_xmlrpc_server) { - /* HACK: use output encoding for now */ - input_opts.xml_elem_opts.encoding = utf8_get_encoding_id_from_string(out.xmlrpc_out.xml_elem_opts.encoding); + /* generate an XMLRPC_REQUEST from the raw xml input */ + xRequest = XMLRPC_REQUEST_FromXML(rawxml, rawxml_len, &input_opts); - /* generate an XMLRPC_REQUEST from the raw xml input */ - xRequest = XMLRPC_REQUEST_FromXML(rawxml, rawxml_len, &input_opts); + if (xRequest) { + const char* methodname = XMLRPC_RequestGetMethodName(xRequest); + XMLRPC_VALUE xAnswer = NULL; + ZVAL_NULL(&data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */ + ZVAL_NULL(&data.return_data); + ZVAL_NULL(&data.return_data); /* in case value is never init'd, we don't dtor to think it is a string or something */ + ZVAL_NULL(&data.xmlrpc_method); - if (xRequest) { - const char* methodname = XMLRPC_RequestGetMethodName(xRequest); - XMLRPC_VALUE xAnswer = NULL; - MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */ - MAKE_STD_ZVAL(data.return_data); - Z_TYPE_P(data.return_data) = IS_NULL; /* in case value is never init'd, we don't dtor to think it is a string or something */ - Z_TYPE_P(data.xmlrpc_method) = IS_NULL; - - /* setup some data to pass to the callback function */ - data.caller_params = *caller_params; - data.php_executed = 0; - data.server = server; - - /* We could just call the php method directly ourselves at this point, but we do this - * with a C callback in case the xmlrpc library ever implements some cool usage stats, - * or somesuch. - */ - xAnswer = XMLRPC_ServerCallMethod(server->server_ptr, xRequest, &data); - if (xAnswer && out.b_php_out) { - zval_dtor(data.return_data); - FREE_ZVAL(data.return_data); - data.return_data = XMLRPC_to_PHP(xAnswer); - } else if (data.php_executed && !out.b_php_out && !xAnswer) { - xAnswer = PHP_to_XMLRPC(data.return_data TSRMLS_CC); - } + /* setup some data to pass to the callback function */ + ZVAL_COPY_VALUE(&data.caller_params, caller_params); + data.php_executed = 0; + data.server = server; - /* should we return data as xml? */ - if (!out.b_php_out) { - XMLRPC_REQUEST xResponse = XMLRPC_RequestNew(); - if (xResponse) { - char *outBuf = 0; - int buf_len = 0; - - /* automagically determine output serialization type from request type */ - if (out.b_auto_version) { - XMLRPC_REQUEST_OUTPUT_OPTIONS opts = XMLRPC_RequestGetOutputOptions(xRequest); - if (opts) { - out.xmlrpc_out.version = opts->version; - } - } - /* set some required request hoojum */ - XMLRPC_RequestSetOutputOptions(xResponse, &out.xmlrpc_out); - XMLRPC_RequestSetRequestType(xResponse, xmlrpc_request_response); - XMLRPC_RequestSetData(xResponse, xAnswer); - XMLRPC_RequestSetMethodName(xResponse, methodname); - - /* generate xml */ - outBuf = XMLRPC_REQUEST_ToXML(xResponse, &buf_len); - if (outBuf) { - RETVAL_STRINGL(outBuf, buf_len, 1); - free(outBuf); + /* We could just call the php method directly ourselves at this point, but we do this + * with a C callback in case the xmlrpc library ever implements some cool usage stats, + * or somesuch. + */ + xAnswer = XMLRPC_ServerCallMethod(server->server_ptr, xRequest, &data); + if (xAnswer && out.b_php_out) { + XMLRPC_to_PHP(xAnswer, &data.return_data); + } else if (data.php_executed && !out.b_php_out && !xAnswer) { + xAnswer = PHP_to_XMLRPC(&data.return_data); + } + + /* should we return data as xml? */ + if (!out.b_php_out) { + XMLRPC_REQUEST xResponse = XMLRPC_RequestNew(); + if (xResponse) { + char *outBuf = 0; + int buf_len = 0; + + /* automagically determine output serialization type from request type */ + if (out.b_auto_version) { + XMLRPC_REQUEST_OUTPUT_OPTIONS opts = XMLRPC_RequestGetOutputOptions(xRequest); + if (opts) { + out.xmlrpc_out.version = opts->version; } - /* cleanup after ourselves. what a sty! */ - XMLRPC_RequestFree(xResponse, 0); } - } else { /* or as native php types? */ - *return_value = *data.return_data; - zval_copy_ctor(return_value); + /* set some required request hoojum */ + XMLRPC_RequestSetOutputOptions(xResponse, &out.xmlrpc_out); + XMLRPC_RequestSetRequestType(xResponse, xmlrpc_request_response); + XMLRPC_RequestSetData(xResponse, xAnswer); + XMLRPC_RequestSetMethodName(xResponse, methodname); + + /* generate xml */ + outBuf = XMLRPC_REQUEST_ToXML(xResponse, &buf_len); + if (outBuf) { + RETVAL_STRINGL(outBuf, buf_len); + free(outBuf); + } + /* cleanup after ourselves. what a sty! */ + XMLRPC_RequestFree(xResponse, 0); } + } else { /* or as native php types? */ + ZVAL_COPY(return_value, &data.return_data); + } - /* cleanup after ourselves. what a sty! */ - zval_ptr_dtor(&data.xmlrpc_method); - - zval_dtor(data.return_data); - FREE_ZVAL(data.return_data); + /* cleanup after ourselves. what a sty! */ + zval_ptr_dtor(&data.xmlrpc_method); + zval_ptr_dtor(&data.return_data); - if (xAnswer) { - XMLRPC_CleanupValue(xAnswer); - } - - XMLRPC_RequestFree(xRequest, 1); + if (xAnswer) { + XMLRPC_CleanupValue(xAnswer); } + + XMLRPC_RequestFree(xRequest, 1); } } /* }}} */ @@ -1209,22 +1128,22 @@ PHP_FUNCTION(xmlrpc_server_call_method) PHP_FUNCTION(xmlrpc_server_add_introspection_data) { zval *handle, *desc; - int type; xmlrpc_server_data* server; + XMLRPC_VALUE xDesc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &handle, &desc) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &handle, &desc) == FAILURE) { return; } - server = zend_list_find(Z_LVAL_P(handle), &type); + if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) { + RETURN_FALSE; + } - if (type == le_xmlrpc_server) { - XMLRPC_VALUE xDesc = PHP_to_XMLRPC(desc TSRMLS_CC); - if (xDesc) { - int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc); - XMLRPC_CleanupValue(xDesc); - RETURN_LONG(retval); - } + xDesc = PHP_to_XMLRPC(desc); + if (xDesc) { + int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc); + XMLRPC_CleanupValue(xDesc); + RETURN_LONG(retval); } RETURN_LONG(0); } @@ -1234,35 +1153,30 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) Decodes XML into a list of method descriptions */ PHP_FUNCTION(xmlrpc_parse_method_descriptions) { - zval *retval; char *arg1; - int arg1_len; + size_t arg1_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg1, &arg1_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg1, &arg1_len) == FAILURE) { return; } - if (return_value_used) { + if (USED_RET()) { STRUCT_XMLRPC_ERROR err = {0}; XMLRPC_VALUE xVal = XMLRPC_IntrospectionCreateDescription(arg1, &err); if (xVal) { - retval = XMLRPC_to_PHP(xVal); - - if (retval) { - RETVAL_ZVAL(retval, 1, 1); - } + XMLRPC_to_PHP(xVal, return_value); /* dust, sweep, and mop */ XMLRPC_CleanupValue(xVal); } else { /* could not create description */ if (err.xml_elem_error.parser_code) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to create introspection data", + php_error_docref(NULL, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to create introspection data", err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid xml structure. Unable to create introspection data"); + php_error_docref(NULL, E_WARNING, "Invalid xml structure. Unable to create introspection data"); } - php_error_docref(NULL TSRMLS_CC, E_WARNING, "xml parse error. no method description created"); + php_error_docref(NULL, E_WARNING, "xml parse error. no method description created"); } } } @@ -1349,14 +1263,13 @@ XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str) /* {{{ */ } /* }}} */ -/* set a given value to a particular type. +/* set a given value to a particular type. * note: this only works on strings, and only for date and base64, * which do not have native php types. black magic lies herein. */ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ { int bSuccess = FAILURE; - TSRMLS_FETCH(); /* we only really care about strings because they can represent * base64 and datetime. all other types have corresponding php types @@ -1364,29 +1277,22 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ if (Z_TYPE_P(value) == IS_STRING) { if (newtype == xmlrpc_base64 || newtype == xmlrpc_datetime) { const char* typestr = xmlrpc_type_as_str(newtype, xmlrpc_vector_none); - zval* type; - - MAKE_STD_ZVAL(type); + zval type; - Z_TYPE_P(type) = IS_STRING; - Z_STRVAL_P(type) = estrdup(typestr); - Z_STRLEN_P(type) = strlen(typestr); + ZVAL_STRING(&type, typestr); if (newtype == xmlrpc_datetime) { - XMLRPC_VALUE v = XMLRPC_CreateValueDateTime_ISO8601(NULL, value->value.str.val); + XMLRPC_VALUE v = XMLRPC_CreateValueDateTime_ISO8601(NULL, Z_STRVAL_P(value)); if (v) { time_t timestamp = (time_t) php_parse_date((char *)XMLRPC_GetValueDateTime_ISO8601(v), NULL); if (timestamp != -1) { - zval* ztimestamp; - - MAKE_STD_ZVAL(ztimestamp); + zval ztimestamp; - ztimestamp->type = IS_LONG; - ztimestamp->value.lval = timestamp; + ZVAL_LONG(&ztimestamp, timestamp); convert_to_object(value); - if (SUCCESS == zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL)) { - bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR), (void *) &ztimestamp, sizeof(zval *), NULL); + if (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type)) { + bSuccess = (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR) - 1, &ztimestamp) != NULL)? SUCCESS : FAILURE; } } else { zval_ptr_dtor(&type); @@ -1397,7 +1303,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ } } else { convert_to_object(value); - bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL); + bSuccess = (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type) != NULL)? SUCCESS : FAILURE; } } } @@ -1407,10 +1313,9 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ /* }}} */ /* return xmlrpc type of a php value */ -XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue) /* {{{ */ +XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */ { XMLRPC_VALUE_TYPE type = xmlrpc_none; - TSRMLS_FETCH(); if (value) { switch (Z_TYPE_P(value)) { @@ -1420,7 +1325,8 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue) /* {{{ */ #ifndef BOOL_AS_LONG /* Right thing to do, but it breaks some legacy code. */ - case IS_BOOL: + case IS_TRUE: + case IS_FALSE: type = xmlrpc_boolean; break; #else @@ -1444,12 +1350,12 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue) /* {{{ */ break; case IS_OBJECT: { - zval** attr; + zval* attr; type = xmlrpc_vector; - if (zend_hash_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void**) &attr) == SUCCESS) { - if (Z_TYPE_PP(attr) == IS_STRING) { - type = xmlrpc_str_as_type(Z_STRVAL_PP(attr)); + if ((attr = zend_hash_str_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1)) != NULL) { + if (Z_TYPE_P(attr) == IS_STRING) { + type = xmlrpc_str_as_type(Z_STRVAL_P(attr)); } } break; @@ -1458,14 +1364,14 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue) /* {{{ */ /* if requested, return an unmolested (magic removed) copy of the value */ if (newvalue) { - zval** val; + zval* val; if ((type == xmlrpc_base64 && Z_TYPE_P(value) == IS_OBJECT) || type == xmlrpc_datetime) { - if (zend_hash_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR), (void**) &val) == SUCCESS) { - *newvalue = *val; + if ((val = zend_hash_str_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR) - 1)) != NULL) { + ZVAL_COPY_VALUE(newvalue, val); } } else { - *newvalue = value; + ZVAL_COPY_VALUE(newvalue, value); } } } @@ -1478,18 +1384,18 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval** newvalue) /* {{{ */ Sets xmlrpc type, base64 or datetime, for a PHP string value */ PHP_FUNCTION(xmlrpc_set_type) { - zval **arg; + zval *arg; char *type; - int type_len; + size_t type_len; XMLRPC_VALUE_TYPE vtype; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &arg, &type, &type_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/s", &arg, &type, &type_len) == FAILURE) { return; } vtype = xmlrpc_str_as_type(type); if (vtype != xmlrpc_none) { - if (set_zval_xmlrpc_type(*arg, vtype) == SUCCESS) { + if (set_zval_xmlrpc_type(arg, vtype) == SUCCESS) { RETURN_TRUE; } } else { @@ -1503,30 +1409,30 @@ PHP_FUNCTION(xmlrpc_set_type) Gets xmlrpc type for a PHP value. Especially useful for base64 and datetime strings */ PHP_FUNCTION(xmlrpc_get_type) { - zval **arg; + zval *arg; XMLRPC_VALUE_TYPE type; XMLRPC_VECTOR_TYPE vtype = xmlrpc_vector_none; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) { return; } - type = get_zval_xmlrpc_type(*arg, 0); + type = get_zval_xmlrpc_type(arg, 0); if (type == xmlrpc_vector) { - vtype = determine_vector_type((Z_TYPE_PP(arg) == IS_OBJECT) ? Z_OBJPROP_PP(arg) : Z_ARRVAL_PP(arg)); + vtype = determine_vector_type((Z_TYPE_P(arg) == IS_OBJECT) ? Z_OBJPROP_P(arg) : Z_ARRVAL_P(arg)); } - - RETURN_STRING((char*) xmlrpc_type_as_str(type, vtype), 1); + + RETURN_STRING((char*) xmlrpc_type_as_str(type, vtype)); } /* }}} */ -/* {{{ proto bool xmlrpc_is_fault(array) +/* {{{ proto bool xmlrpc_is_fault(array arg) Determines if an array value represents an XMLRPC fault. */ PHP_FUNCTION(xmlrpc_is_fault) { - zval *arg, **val; + zval *arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &arg) == FAILURE) { return; } @@ -1536,8 +1442,8 @@ PHP_FUNCTION(xmlrpc_is_fault) * array, which is rather expensive, especially if it was * a big array. Thus, we resort to this not so clever hackery. */ - if (zend_hash_find(Z_ARRVAL_P(arg), FAULT_CODE, FAULT_CODE_LEN + 1, (void**) &val) == SUCCESS && - zend_hash_find(Z_ARRVAL_P(arg), FAULT_STRING, FAULT_STRING_LEN + 1, (void**) &val) == SUCCESS) { + if (zend_hash_str_exists(Z_ARRVAL_P(arg), FAULT_CODE, FAULT_CODE_LEN) && + zend_hash_str_exists(Z_ARRVAL_P(arg), FAULT_STRING, FAULT_STRING_LEN)) { RETURN_TRUE; } diff --git a/ext/xmlrpc/xmlrpc.dsp b/ext/xmlrpc/xmlrpc.dsp deleted file mode 100644 index 8c455d3fcd..0000000000 --- a/ext/xmlrpc/xmlrpc.dsp +++ /dev/null @@ -1,211 +0,0 @@ -# Microsoft Developer Studio Project File - Name="xmlrpc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlrpc - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak" CFG="xmlrpc - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlrpc - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "_DEBUG"
-# ADD RSC /l 0x1009 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib expat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xmlrpc.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "xmlrpc - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "libxmlrpc" /I "..\..\bundle\expat" /D HAVE_XMLRPC=1 /D "ZEND_WIN32" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D ZTS=1 /D COMPILE_DL_XMLRPC=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLRPC_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x1009 /d "NDEBUG"
-# ADD RSC /l 0x1009 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib expat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xmlrpc.dll" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc - Win32 Debug_TS"
-# Name "xmlrpc - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\xmlrpc-epi-php.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlrpc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "libxmlrpc"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\encodings.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\queue.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\simplestring.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\system_methods_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_element.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_dandarpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_soap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xml_to_xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_introspection_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\libxmlrpc\xmlrpc_private.h
-# End Source File
-# End Group
-# End Target
-# End Project
|