make it compile again and nuke most warnings

This commit is contained in:
Thies C. Arntzen 2001-10-25 06:51:13 +00:00
parent 18ccd87eb9
commit 2977edaacd
6 changed files with 52 additions and 38 deletions

View file

@ -158,7 +158,7 @@ typedef struct _xml_element {
void xml_elem_free(xml_element* root); void xml_elem_free(xml_element* root);
void xml_elem_free_non_recurse(xml_element* root); void xml_elem_free_non_recurse(xml_element* root);
xml_element* xml_elem_new(); xml_element* xml_elem_new(void);
char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len); char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len);
void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options); void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options);
xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error); xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error);

View file

@ -274,9 +274,9 @@ typedef XMLRPC_VALUE (*XMLRPC_Callback)(XMLRPC_SERVER server, XMLRPC_REQUEST inp
/******/ /******/
/* ID Case Defaults */ /* ID Case Defaults */
XMLRPC_CASE XMLRPC_GetDefaultIdCase(); XMLRPC_CASE XMLRPC_GetDefaultIdCase(void);
XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case); XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case);
XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison(); XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison(void);
XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case); XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case);
/* Vector manipulation */ /* Vector manipulation */
@ -298,7 +298,7 @@ XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s);
XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f); XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f);
XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i); XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i);
XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len); XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len);
XMLRPC_VALUE XMLRPC_CreateValueEmpty(); XMLRPC_VALUE XMLRPC_CreateValueEmpty(void);
XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type); XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type);
/* Cleanup values */ /* Cleanup values */
@ -340,7 +340,7 @@ char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len);
/* Request manipulation funcs */ /* Request manipulation funcs */
const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName); const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName);
const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request); const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request);
XMLRPC_REQUEST XMLRPC_RequestNew(); XMLRPC_REQUEST XMLRPC_RequestNew(void);
void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO); void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO);
XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output); XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output);
XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request); XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request);
@ -350,8 +350,8 @@ XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_
XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request); XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request);
/* Server Creation/Destruction; Method Registration and Invocation */ /* Server Creation/Destruction; Method Registration and Invocation */
XMLRPC_SERVER XMLRPC_ServerCreate(); XMLRPC_SERVER XMLRPC_ServerCreate(void);
XMLRPC_SERVER XMLRPC_GetGlobalServer(); /* better to use XMLRPC_ServerCreate if you can */ XMLRPC_SERVER XMLRPC_GetGlobalServer(void); /* better to use XMLRPC_ServerCreate if you can */
void XMLRPC_ServerDestroy(XMLRPC_SERVER server); void XMLRPC_ServerDestroy(XMLRPC_SERVER server);
int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb); int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb);
XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName); XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName);
@ -362,7 +362,7 @@ XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST reques
/* Public Utility funcs */ /* Public Utility funcs */
XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string); XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string);
void XMLRPC_Free(void* mem); void XMLRPC_Free(void* mem);
const char* XMLRPC_GetVersionString(); const char* XMLRPC_GetVersionString(void);
/****d* VALUE/XMLRPC_MACROS /****d* VALUE/XMLRPC_MACROS
* NAME * NAME

View file

@ -53,6 +53,7 @@
*/ */
#include "php.h" #include "php.h"
#include "ext/standard/info.h"
#include "php_ini.h" #include "php_ini.h"
#include "php_xmlrpc.h" #include "php_xmlrpc.h"
#include "xmlrpc.h" #include "xmlrpc.h"
@ -178,6 +179,12 @@ typedef struct _xmlrpc_callback_data {
***********************/ ***********************/
XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue); XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue);
static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data); static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data);
int sset_pval_xmlrpc_type(pval* value, XMLRPC_VALUE_TYPE type);
pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_out);
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);
int set_pval_xmlrpc_type(pval* value, XMLRPC_VALUE_TYPE type);
/********************* /*********************
* startup / shutdown * * startup / shutdown *
@ -206,7 +213,7 @@ static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc) {
} }
} }
static void xmlrpc_init_globals(TSRMLS_D) static void xmlrpc_init_globals(php_xmlrpc_globals *xmlrpc_globals)
{ {
return; return;
} }
@ -267,6 +274,7 @@ PHP_MINFO_FUNCTION(xmlrpc)
/* Utility functions for adding data types to arrays, with or without key (assoc, non-assoc). /* Utility functions for adding data types to arrays, with or without key (assoc, non-assoc).
* Could easily be further generalized to work with objects. * Could easily be further generalized to work with objects.
*/ */
#if 0
static int add_long(pval* list, char* id, int num) { static int add_long(pval* list, char* id, int num) {
if(id) return add_assoc_long(list, id, num); if(id) return add_assoc_long(list, id, num);
else return add_next_index_long(list, num); else return add_next_index_long(list, num);
@ -287,6 +295,8 @@ static int add_stringl(pval* list, char* id, char* string, uint length, int dupl
else return add_next_index_stringl(list, string, length, duplicate); else return add_next_index_stringl(list, string, length, duplicate);
} }
#endif
static int add_pval(pval* list, const char* id, pval** val) { static int add_pval(pval* list, const char* id, pval** val) {
if(list && val) { if(list && val) {
if(id) return zend_hash_update(Z_ARRVAL_P(list), (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL); if(id) return zend_hash_update(Z_ARRVAL_P(list), (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL);
@ -552,7 +562,6 @@ static XMLRPC_VALUE PHP_to_XMLRPC(pval* root_val) {
/* recursively convert xmlrpc values into php values */ /* recursively convert xmlrpc values into php values */
static pval* XMLRPC_to_PHP(XMLRPC_VALUE el) { static pval* XMLRPC_to_PHP(XMLRPC_VALUE el) {
pval* elem = NULL; pval* elem = NULL;
char* pBuf;
const char* pStr; const char* pStr;
if(el) { if(el) {
@ -664,8 +673,7 @@ PHP_FUNCTION(xmlrpc_encode_request) {
PHP_FUNCTION(xmlrpc_encode) PHP_FUNCTION(xmlrpc_encode)
{ {
XMLRPC_VALUE xOut = NULL; XMLRPC_VALUE xOut = NULL;
pval* arg1, *out_opts; pval* arg1;
php_output_options out;
char* outBuf; char* outBuf;
if( !(ARG_COUNT(ht) == 1) || if( !(ARG_COUNT(ht) == 1) ||
@ -697,7 +705,7 @@ PHP_FUNCTION(xmlrpc_encode)
pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_out) { pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_out) {
pval* retval = NULL; pval* retval = NULL;
XMLRPC_REQUEST response; XMLRPC_REQUEST response;
STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {0}; STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {{0}};
opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT; opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT;
/* generate XMLRPC_REQUEST from raw xml */ /* generate XMLRPC_REQUEST from raw xml */
@ -844,7 +852,6 @@ PHP_FUNCTION(xmlrpc_server_destroy) {
* it then calls the corresponding PHP function to handle the method. * 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) { static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* data) {
pval *retval_ptr;
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data; xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
pval* xmlrpc_params; pval* xmlrpc_params;
pval* callback_params[3]; pval* callback_params[3];
@ -971,7 +978,7 @@ PHP_FUNCTION(xmlrpc_server_register_method) {
Register a PHP function to generate documentation */ Register a PHP function to generate documentation */
PHP_FUNCTION(xmlrpc_server_register_introspection_callback) { PHP_FUNCTION(xmlrpc_server_register_introspection_callback) {
pval* method_key, *method_name, *handle, *method_name_save; pval* method_name, *handle, *method_name_save;
int type; int type;
xmlrpc_server_data* server; xmlrpc_server_data* server;
@ -1045,7 +1052,7 @@ PHP_FUNCTION(xmlrpc_server_call_method) {
/* check if we have a method name -- indicating success and all manner of good things */ /* check if we have a method name -- indicating success and all manner of good things */
if(XMLRPC_RequestGetMethodName(xRequest)) { if(XMLRPC_RequestGetMethodName(xRequest)) {
pval** php_function, *returned = NULL; pval** php_function;
XMLRPC_VALUE xAnswer = NULL; XMLRPC_VALUE xAnswer = NULL;
MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */ MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */
MAKE_STD_ZVAL(data.return_data); MAKE_STD_ZVAL(data.return_data);
@ -1136,7 +1143,7 @@ PHP_FUNCTION(xmlrpc_server_call_method) {
Adds introspection documentation */ Adds introspection documentation */
PHP_FUNCTION(xmlrpc_server_add_introspection_data) { PHP_FUNCTION(xmlrpc_server_add_introspection_data) {
pval *method, *handle, *desc; pval *handle, *desc;
int type; int type;
xmlrpc_server_data* server; xmlrpc_server_data* server;
@ -1163,7 +1170,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) {
Decodes XML into a list of method descriptions */ Decodes XML into a list of method descriptions */
PHP_FUNCTION(xmlrpc_parse_method_descriptions) PHP_FUNCTION(xmlrpc_parse_method_descriptions)
{ {
pval* arg1, *arg2, *retval; pval* arg1, *retval;
if( !(ARG_COUNT(ht) == 1) || getParameters(ht, ARG_COUNT(ht), &arg1) == FAILURE) { if( !(ARG_COUNT(ht) == 1) || getParameters(ht, ARG_COUNT(ht), &arg1) == FAILURE) {
WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ WRONG_PARAM_COUNT; /* prints/logs a warning and returns */
@ -1209,7 +1216,7 @@ PHP_FUNCTION(xmlrpc_parse_method_descriptions)
#define TYPE_STR_MAP_SIZE (XMLRPC_TYPE_COUNT + XMLRPC_VECTOR_TYPE_COUNT) #define TYPE_STR_MAP_SIZE (XMLRPC_TYPE_COUNT + XMLRPC_VECTOR_TYPE_COUNT)
/* return a string matching a given xmlrpc type */ /* return a string matching a given xmlrpc type */
static const char** get_type_str_mapping() { static const char** get_type_str_mapping(void) {
static const char* str_mapping[TYPE_STR_MAP_SIZE]; static const char* str_mapping[TYPE_STR_MAP_SIZE];
static int first = 1; static int first = 1;
if(first) { if(first) {

View file

@ -158,7 +158,7 @@ typedef struct _xml_element {
void xml_elem_free(xml_element* root); void xml_elem_free(xml_element* root);
void xml_elem_free_non_recurse(xml_element* root); void xml_elem_free_non_recurse(xml_element* root);
xml_element* xml_elem_new(); xml_element* xml_elem_new(void);
char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len); char* xml_elem_serialize_to_string(xml_element *el, XML_ELEM_OUTPUT_OPTIONS options, int *buf_len);
void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options); void xml_elem_serialize_to_stream(xml_element *el, FILE *output, XML_ELEM_OUTPUT_OPTIONS options);
xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error); xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTIONS options, XML_ELEM_ERROR error);

View file

@ -274,9 +274,9 @@ typedef XMLRPC_VALUE (*XMLRPC_Callback)(XMLRPC_SERVER server, XMLRPC_REQUEST inp
/******/ /******/
/* ID Case Defaults */ /* ID Case Defaults */
XMLRPC_CASE XMLRPC_GetDefaultIdCase(); XMLRPC_CASE XMLRPC_GetDefaultIdCase(void);
XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case); XMLRPC_CASE XMLRPC_SetDefaultIdCase(XMLRPC_CASE id_case);
XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison(); XMLRPC_CASE_COMPARISON XMLRPC_GetDefaultIdCaseComparison(void);
XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case); XMLRPC_CASE_COMPARISON XMLRPC_SetDefaultIdCaseComparison(XMLRPC_CASE_COMPARISON id_case);
/* Vector manipulation */ /* Vector manipulation */
@ -298,7 +298,7 @@ XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s);
XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f); XMLRPC_VALUE XMLRPC_CreateValueDouble(const char* id, double f);
XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i); XMLRPC_VALUE XMLRPC_CreateValueInt(const char* id, int i);
XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len); XMLRPC_VALUE XMLRPC_CreateValueString(const char* id, const char* s, int len);
XMLRPC_VALUE XMLRPC_CreateValueEmpty(); XMLRPC_VALUE XMLRPC_CreateValueEmpty(void);
XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type); XMLRPC_VALUE XMLRPC_CreateVector(const char* id, XMLRPC_VECTOR_TYPE type);
/* Cleanup values */ /* Cleanup values */
@ -340,7 +340,7 @@ char* XMLRPC_VALUE_ToXML(XMLRPC_VALUE val, int* buf_len);
/* Request manipulation funcs */ /* Request manipulation funcs */
const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName); const char* XMLRPC_RequestSetMethodName(XMLRPC_REQUEST request, const char* methodName);
const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request); const char* XMLRPC_RequestGetMethodName(XMLRPC_REQUEST request);
XMLRPC_REQUEST XMLRPC_RequestNew(); XMLRPC_REQUEST XMLRPC_RequestNew(void);
void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO); void XMLRPC_RequestFree(XMLRPC_REQUEST request, int bFreeIO);
XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output); XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestSetOutputOptions(XMLRPC_REQUEST request, XMLRPC_REQUEST_OUTPUT_OPTIONS output);
XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request); XMLRPC_REQUEST_OUTPUT_OPTIONS XMLRPC_RequestGetOutputOptions(XMLRPC_REQUEST request);
@ -350,8 +350,8 @@ XMLRPC_REQUEST_TYPE XMLRPC_RequestSetRequestType(XMLRPC_REQUEST request, XMLRPC_
XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request); XMLRPC_REQUEST_TYPE XMLRPC_RequestGetRequestType(XMLRPC_REQUEST request);
/* Server Creation/Destruction; Method Registration and Invocation */ /* Server Creation/Destruction; Method Registration and Invocation */
XMLRPC_SERVER XMLRPC_ServerCreate(); XMLRPC_SERVER XMLRPC_ServerCreate(void);
XMLRPC_SERVER XMLRPC_GetGlobalServer(); /* better to use XMLRPC_ServerCreate if you can */ XMLRPC_SERVER XMLRPC_GetGlobalServer(void); /* better to use XMLRPC_ServerCreate if you can */
void XMLRPC_ServerDestroy(XMLRPC_SERVER server); void XMLRPC_ServerDestroy(XMLRPC_SERVER server);
int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb); int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb);
XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName); XMLRPC_Callback XMLRPC_ServerFindMethod(XMLRPC_SERVER server, const char* callName);
@ -362,7 +362,7 @@ XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST reques
/* Public Utility funcs */ /* Public Utility funcs */
XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string); XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string);
void XMLRPC_Free(void* mem); void XMLRPC_Free(void* mem);
const char* XMLRPC_GetVersionString(); const char* XMLRPC_GetVersionString(void);
/****d* VALUE/XMLRPC_MACROS /****d* VALUE/XMLRPC_MACROS
* NAME * NAME

View file

@ -53,6 +53,7 @@
*/ */
#include "php.h" #include "php.h"
#include "ext/standard/info.h"
#include "php_ini.h" #include "php_ini.h"
#include "php_xmlrpc.h" #include "php_xmlrpc.h"
#include "xmlrpc.h" #include "xmlrpc.h"
@ -178,6 +179,12 @@ typedef struct _xmlrpc_callback_data {
***********************/ ***********************/
XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue); XMLRPC_VALUE_TYPE get_pval_xmlrpc_type(pval* value, pval** newvalue);
static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data); static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data);
int sset_pval_xmlrpc_type(pval* value, XMLRPC_VALUE_TYPE type);
pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_out);
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);
int set_pval_xmlrpc_type(pval* value, XMLRPC_VALUE_TYPE type);
/********************* /*********************
* startup / shutdown * * startup / shutdown *
@ -206,7 +213,7 @@ static void xmlrpc_server_destructor(zend_rsrc_list_entry *rsrc) {
} }
} }
static void xmlrpc_init_globals(TSRMLS_D) static void xmlrpc_init_globals(php_xmlrpc_globals *xmlrpc_globals)
{ {
return; return;
} }
@ -267,6 +274,7 @@ PHP_MINFO_FUNCTION(xmlrpc)
/* Utility functions for adding data types to arrays, with or without key (assoc, non-assoc). /* Utility functions for adding data types to arrays, with or without key (assoc, non-assoc).
* Could easily be further generalized to work with objects. * Could easily be further generalized to work with objects.
*/ */
#if 0
static int add_long(pval* list, char* id, int num) { static int add_long(pval* list, char* id, int num) {
if(id) return add_assoc_long(list, id, num); if(id) return add_assoc_long(list, id, num);
else return add_next_index_long(list, num); else return add_next_index_long(list, num);
@ -287,6 +295,8 @@ static int add_stringl(pval* list, char* id, char* string, uint length, int dupl
else return add_next_index_stringl(list, string, length, duplicate); else return add_next_index_stringl(list, string, length, duplicate);
} }
#endif
static int add_pval(pval* list, const char* id, pval** val) { static int add_pval(pval* list, const char* id, pval** val) {
if(list && val) { if(list && val) {
if(id) return zend_hash_update(Z_ARRVAL_P(list), (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL); if(id) return zend_hash_update(Z_ARRVAL_P(list), (char*)id, strlen(id)+1, (void *) val, sizeof(pval **), NULL);
@ -552,7 +562,6 @@ static XMLRPC_VALUE PHP_to_XMLRPC(pval* root_val) {
/* recursively convert xmlrpc values into php values */ /* recursively convert xmlrpc values into php values */
static pval* XMLRPC_to_PHP(XMLRPC_VALUE el) { static pval* XMLRPC_to_PHP(XMLRPC_VALUE el) {
pval* elem = NULL; pval* elem = NULL;
char* pBuf;
const char* pStr; const char* pStr;
if(el) { if(el) {
@ -664,8 +673,7 @@ PHP_FUNCTION(xmlrpc_encode_request) {
PHP_FUNCTION(xmlrpc_encode) PHP_FUNCTION(xmlrpc_encode)
{ {
XMLRPC_VALUE xOut = NULL; XMLRPC_VALUE xOut = NULL;
pval* arg1, *out_opts; pval* arg1;
php_output_options out;
char* outBuf; char* outBuf;
if( !(ARG_COUNT(ht) == 1) || if( !(ARG_COUNT(ht) == 1) ||
@ -697,7 +705,7 @@ PHP_FUNCTION(xmlrpc_encode)
pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_out) { pval* decode_request_worker(pval* xml_in, pval* encoding_in, pval* method_name_out) {
pval* retval = NULL; pval* retval = NULL;
XMLRPC_REQUEST response; XMLRPC_REQUEST response;
STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {0}; STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {{0}};
opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT; opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(Z_STRVAL_P(encoding_in)) : ENCODING_DEFAULT;
/* generate XMLRPC_REQUEST from raw xml */ /* generate XMLRPC_REQUEST from raw xml */
@ -844,7 +852,6 @@ PHP_FUNCTION(xmlrpc_server_destroy) {
* it then calls the corresponding PHP function to handle the method. * 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) { static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRequest, void* data) {
pval *retval_ptr;
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data; xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
pval* xmlrpc_params; pval* xmlrpc_params;
pval* callback_params[3]; pval* callback_params[3];
@ -971,7 +978,7 @@ PHP_FUNCTION(xmlrpc_server_register_method) {
Register a PHP function to generate documentation */ Register a PHP function to generate documentation */
PHP_FUNCTION(xmlrpc_server_register_introspection_callback) { PHP_FUNCTION(xmlrpc_server_register_introspection_callback) {
pval* method_key, *method_name, *handle, *method_name_save; pval* method_name, *handle, *method_name_save;
int type; int type;
xmlrpc_server_data* server; xmlrpc_server_data* server;
@ -1045,7 +1052,7 @@ PHP_FUNCTION(xmlrpc_server_call_method) {
/* check if we have a method name -- indicating success and all manner of good things */ /* check if we have a method name -- indicating success and all manner of good things */
if(XMLRPC_RequestGetMethodName(xRequest)) { if(XMLRPC_RequestGetMethodName(xRequest)) {
pval** php_function, *returned = NULL; pval** php_function;
XMLRPC_VALUE xAnswer = NULL; XMLRPC_VALUE xAnswer = NULL;
MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */ MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very important. spent a frustrating day finding this out. */
MAKE_STD_ZVAL(data.return_data); MAKE_STD_ZVAL(data.return_data);
@ -1136,7 +1143,7 @@ PHP_FUNCTION(xmlrpc_server_call_method) {
Adds introspection documentation */ Adds introspection documentation */
PHP_FUNCTION(xmlrpc_server_add_introspection_data) { PHP_FUNCTION(xmlrpc_server_add_introspection_data) {
pval *method, *handle, *desc; pval *handle, *desc;
int type; int type;
xmlrpc_server_data* server; xmlrpc_server_data* server;
@ -1163,7 +1170,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) {
Decodes XML into a list of method descriptions */ Decodes XML into a list of method descriptions */
PHP_FUNCTION(xmlrpc_parse_method_descriptions) PHP_FUNCTION(xmlrpc_parse_method_descriptions)
{ {
pval* arg1, *arg2, *retval; pval* arg1, *retval;
if( !(ARG_COUNT(ht) == 1) || getParameters(ht, ARG_COUNT(ht), &arg1) == FAILURE) { if( !(ARG_COUNT(ht) == 1) || getParameters(ht, ARG_COUNT(ht), &arg1) == FAILURE) {
WRONG_PARAM_COUNT; /* prints/logs a warning and returns */ WRONG_PARAM_COUNT; /* prints/logs a warning and returns */
@ -1209,7 +1216,7 @@ PHP_FUNCTION(xmlrpc_parse_method_descriptions)
#define TYPE_STR_MAP_SIZE (XMLRPC_TYPE_COUNT + XMLRPC_VECTOR_TYPE_COUNT) #define TYPE_STR_MAP_SIZE (XMLRPC_TYPE_COUNT + XMLRPC_VECTOR_TYPE_COUNT)
/* return a string matching a given xmlrpc type */ /* return a string matching a given xmlrpc type */
static const char** get_type_str_mapping() { static const char** get_type_str_mapping(void) {
static const char* str_mapping[TYPE_STR_MAP_SIZE]; static const char* str_mapping[TYPE_STR_MAP_SIZE];
static int first = 1; static int first = 1;
if(first) { if(first) {