[PATCH] libxmlrpc warning fixes

php.internals

Joe Orton

22 years ago
Hi, this patch fixes compiler warnings in the version of libxmlrpc included in the PHP 4.3 branch. (unspecified return value, format string bugs, missing includes, unused function/variables) Index: ext/xmlrpc/libxmlrpc/simplestring.c =================================================================== RCS file: /repository/php-src/ext/xmlrpc/libxmlrpc/simplestring.c,v retrieving revision 1.3 diff -u -r1.3 simplestring.c --- ext/xmlrpc/libxmlrpc/simplestring.c 22 Aug 2002 01:25:50 -0000 1.3 +++ ext/xmlrpc/libxmlrpc/simplestring.c 27 Oct 2003 12:27:21 -0000 @@ -79,6 +79,7 @@ ******/ #include <stdlib.h> +#include <string.h> #include "simplestring.h" #define my_free(thing) if(thing) {free(thing); thing = 0;} Index: ext/xmlrpc/libxmlrpc/xml_element.c =================================================================== RCS file: /repository/php-src/ext/xmlrpc/libxmlrpc/xml_element.c,v retrieving revision 1.3.4.1 diff -u -r1.3.4.1 xml_element.c --- ext/xmlrpc/libxmlrpc/xml_element.c 27 Nov 2002 04:07:00 -0000 1.3.4.1 +++ ext/xmlrpc/libxmlrpc/xml_element.c 27 Oct 2003 12:27:21 -0000 @@ -471,18 +471,20 @@ } /* print buf to file */ -static file_out_fptr(void *f, const char *text, int size) +static int file_out_fptr(void *f, const char *text, int size) { fputs(text, (FILE *)f); + return 0; } /* print buf to simplestring */ -static simplestring_out_fptr(void *f, const char *text, int size) +static int simplestring_out_fptr(void *f, const char *text, int size) { simplestring* buf = (simplestring*)f; if(buf) { simplestring_addn(buf, text, size); } + return 0; } /****f* xml_element/xml_elem_serialize_to_string @@ -696,7 +698,7 @@ if(byte_idx >= 0) { snprintf(buf, sizeof(buf), - "\n\tdata beginning %i before byte index: %s\n", + "\n\tdata beginning %ld before byte index: %s\n", byte_idx > 10 ? 10 : byte_idx, in_buf + (byte_idx > 10 ? byte_idx - 10 : byte_idx)); } @@ -705,7 +707,7 @@ "\tdescription: %s\n" "\tline: %i\n" "\tcolumn: %i\n" - "\tbyte index: %i\n" + "\tbyte index: %ld\n" "\ttotal bytes: %i\n%s ", err_code, error_str, line_num, col_num, byte_idx, byte_total, buf); Index: ext/xmlrpc/libxmlrpc/xmlrpc.c =================================================================== RCS file: /repository/php-src/ext/xmlrpc/libxmlrpc/xmlrpc.c,v retrieving revision 1.4 diff -u -r1.4 xmlrpc.c --- ext/xmlrpc/libxmlrpc/xmlrpc.c 5 Jul 2002 04:43:53 -0000 1.4 +++ ext/xmlrpc/libxmlrpc/xmlrpc.c 27 Oct 2003 12:27:22 -0000 @@ -122,6 +122,7 @@ #include <string.h> #include <stdarg.h> #include <time.h> +#include <ctype.h> #include "queue.h" #include "xmlrpc.h" @@ -704,7 +705,7 @@ XMLRPC_ERROR_CODE code; char buf[1024]; snprintf(buf, sizeof(buf), - "error occurred at line %i, column %i, byte index %i", + "error occurred at line %ld, column %ld, byte index %ld", error->line, error->column, error->byte_index); /* expat specific errors */ @@ -815,13 +816,6 @@ return v; } -static const char* get_string(const char* buf, int bDup) { - if(bDup) { - return strdup(buf); - } - return buf; -} - /*******/ /****f* VALUE/XMLRPC_SetValueID_Case @@ -1047,8 +1041,6 @@ val = XMLRPC_CreateValueEmpty(); if(val) { - XMLRPC_VECTOR *pSIV = NULL; - if(XMLRPC_SetIsVector(val, type)) { if(id) { const char *pSVI = NULL; @@ -1609,6 +1601,8 @@ } } break; + default: + break; } } return xReturn; @@ -2447,6 +2441,7 @@ return "struct"; } } + return "unknown"; } /****f* VALUE/XMLRPC_ServerFindMethod Index: ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c =================================================================== RCS file: /repository/php-src/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c,v retrieving revision 1.3 diff -u -r1.3 xmlrpc_introspection.c --- ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c 5 Jul 2002 04:43:53 -0000 1.3 +++ ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c 27 Oct 2003 12:27:22 -0000 @@ -346,7 +346,7 @@ const char* ptype = !strcmp(el->name, "value") ? type : basetype; if(ptype) { if(Q_Size(&el->children) && - !strcmp(ptype, "array") || !strcmp(ptype, "struct") || !strcmp(ptype, "mixed")) { + (!strcmp(ptype, "array") || !strcmp(ptype, "struct") || !strcmp(ptype, "mixed"))) { xSubList = XMLRPC_CreateVector("member", xmlrpc_vector_array); if(xSubList) {

Jani Taskinen

22 years ago
Committed with some missing ctype.h includes. --Jani On Mon, 27 Oct 2003, Joe Orton wrote: