From 232ff6e28d1fce08472a2f7a965d83d3e008d84c Mon Sep 17 00:00:00 2001 From: snowdrop Date: Fri, 27 May 2005 19:28:04 +0000 Subject: patch from mailinglist --- configure.ac | 2 +- libcsoap/soap-client.c | 3 +-- libcsoap/soap-ctx.c | 5 +++-- nanohttp/nanohttp-client.c | 8 +++++--- nanohttp/nanohttp-common.c | 3 ++- nanohttp/nanohttp-mime.c | 3 ++- nanohttp/nanohttp-request.c | 4 +++- nanohttp/nanohttp-response.c | 3 ++- nanohttp/nanohttp-server.c | 16 +++++++++++----- nanohttp/nanohttp-socket.c | 14 +++++++++----- nanohttp/nanohttp-stream.c | 4 +++- wsdl2c/wsdl2c.c | 6 +++--- xsd2c/formatter.c | 24 ++++++++++++------------ xsd2c/tr.c | 4 +++- xsd2c/util.c | 3 ++- 15 files changed, 62 insertions(+), 40 deletions(-) diff --git a/configure.ac b/configure.ac index dba9df7..d0f8b89 100644 --- a/configure.ac +++ b/configure.ac @@ -231,7 +231,7 @@ AC_SUBST(LIBXML_LIBS) AC_SUBST(LIBXML_CFLAGS) AC_SUBST(CFLAGS) -dnl AC_SUBST(CPPFLAGS) +#dnl AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c index b704766..e12317c 100644 --- a/libcsoap/soap-client.c +++ b/libcsoap/soap-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-client.c,v 1.15 2005/04/18 20:52:26 snowdrop Exp $ +* $Id: soap-client.c,v 1.16 2005/05/27 19:28:14 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -92,7 +92,6 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha char start_id[150]; static int counter=1; part_t *part; - int file_count=0; /* for copy attachments */ char href[MAX_HREF_SIZE]; diff --git a/libcsoap/soap-ctx.c b/libcsoap/soap-ctx.c index 5fe0685..291a161 100755 --- a/libcsoap/soap-ctx.c +++ b/libcsoap/soap-ctx.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-ctx.c,v 1.4 2004/11/02 23:09:26 snowdrop Exp $ + * $Id: soap-ctx.c,v 1.5 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003-2004 Ferhat Ayaz @@ -23,6 +23,7 @@ ******************************************************************/ #include +#include SoapCtx* soap_ctx_new(SoapEnv *env) /* should only be used internally */ { @@ -86,7 +87,7 @@ part_t *soap_ctx_get_file(SoapCtx* ctx, xmlNodePtr node) prop = xmlGetProp(node, "href"); - if (!prop) NULL; + if (!prop) return NULL; strcpy(href, (const char*)prop); if (!strncmp(href, "cid:", 4)) { diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c index 2f79bc0..b1d101f 100644 --- a/nanohttp/nanohttp-client.c +++ b/nanohttp/nanohttp-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-client.c,v 1.26 2004/11/02 23:09:26 snowdrop Exp $ +* $Id: nanohttp-client.c,v 1.27 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -32,17 +32,19 @@ #include #include #include +#include #ifdef MEM_DEBUG #include #endif +#if 0 static int httpc_send_data(httpc_conn_t *conn, const unsigned char* data, size_t size) { return -1; } - +#endif /*-------------------------------------------------- FUNCTION: httpc_init DESC: Initialize http client connection @@ -188,7 +190,7 @@ httpc_header_add_date(httpc_conn_t * conn) /* Set date */ nw = time(NULL); localtime_r(&nw, &stm); - strftime(buffer, 255, "%a, %d %b %y %T GMT", &stm); + strftime(buffer, 255, "%a, %d %b %Y %T GMT", &stm); httpc_set_header(conn, HEADER_DATE, buffer); } diff --git a/nanohttp/nanohttp-common.c b/nanohttp/nanohttp-common.c index a6d02e6..b59a4d4 100644 --- a/nanohttp/nanohttp-common.c +++ b/nanohttp/nanohttp-common.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-common.c,v 1.17 2004/11/02 23:09:26 snowdrop Exp $ +* $Id: nanohttp-common.c,v 1.18 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef MEM_DEBUG #include diff --git a/nanohttp/nanohttp-mime.c b/nanohttp/nanohttp-mime.c index 2cf059c..f4ff487 100755 --- a/nanohttp/nanohttp-mime.c +++ b/nanohttp/nanohttp-mime.c @@ -3,7 +3,7 @@ * | \/ | | | | \/ | | _/ * |_''_| |_| |_''_| |_'/ PARSER * -* $Id: nanohttp-mime.c,v 1.6 2004/11/02 23:09:26 snowdrop Exp $ +* $Id: nanohttp-mime.c,v 1.7 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003-2004 Ferhat Ayaz @@ -30,6 +30,7 @@ #include #include +#include /*---------------------------------------------------------------- Buffered Reader. A helper object to read bytes from a source diff --git a/nanohttp/nanohttp-request.c b/nanohttp/nanohttp-request.c index 16e74cb..6597c10 100755 --- a/nanohttp/nanohttp-request.c +++ b/nanohttp/nanohttp-request.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-request.c,v 1.4 2004/11/02 23:09:26 snowdrop Exp $ +* $Id: nanohttp-request.c,v 1.5 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -25,6 +25,8 @@ #include #include +#include + #ifdef MEM_DEBUG #include #endif diff --git a/nanohttp/nanohttp-response.c b/nanohttp/nanohttp-response.c index 5432898..1447345 100755 --- a/nanohttp/nanohttp-response.c +++ b/nanohttp/nanohttp-response.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-response.c,v 1.4 2004/11/02 23:09:27 snowdrop Exp $ +* $Id: nanohttp-response.c,v 1.5 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003-2004 Ferhat Ayaz @@ -25,6 +25,7 @@ #include #include +#include #ifdef MEM_DEBUG #include diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c index d50c434..742ecc3 100644 --- a/nanohttp/nanohttp-server.c +++ b/nanohttp/nanohttp-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-server.c,v 1.31 2004/11/02 23:09:27 snowdrop Exp $ +* $Id: nanohttp-server.c,v 1.32 2005/05/27 19:28:15 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include @@ -41,6 +42,10 @@ #include #include +#ifdef HAVE_SOCKET +#include +#endif + #else #include @@ -51,6 +56,8 @@ #include #endif +#include + typedef struct _conndata { hsocket_t sock; @@ -71,7 +78,9 @@ typedef struct _conndata */ static int _httpd_port = 10000; static int _httpd_max_connections = 20; +#ifdef WIN32 static int _httpd_max_idle = 120; +#endif static hsocket_t _httpd_socket; static hservice_t *_httpd_services_head = NULL; static hservice_t *_httpd_services_tail = NULL; @@ -267,7 +276,7 @@ httpd_send_header (httpd_conn_t * res, int code, const char *text) /* set date */ nw = time (NULL); localtime_r (&nw, &stm); - strftime (buffer, 255, "Date: %a, %d %b %y %T GMT", &stm); + strftime (buffer, 255, "Date: %a, %d %b %Y %T GMT", &stm); strcat (header, buffer); strcat (header, "\r\n"); @@ -386,11 +395,9 @@ httpd_session_main (void *data) int len = strlen (msg); char buffer[256]; /* temp buffer for recv() */ char header[4064]; /* received header */ - int headerreached = 0; /* whether reach header * "\n\n" */ hrequest_t *req = NULL; /* only for test */ httpd_conn_t *rconn; hservice_t *service = NULL; - long content_length = 0; herror_t status; header[0] = '\0'; @@ -754,7 +761,6 @@ httpd_get_postdata (httpd_conn_t * conn, hrequest_t * req, long *received, { char *content_length_str; long content_length = 0; - long total = 0; unsigned char *postdata = NULL; if (req->method == HTTP_REQUEST_POST) diff --git a/nanohttp/nanohttp-socket.c b/nanohttp/nanohttp-socket.c index 869bc40..468f3b9 100644 --- a/nanohttp/nanohttp-socket.c +++ b/nanohttp/nanohttp-socket.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-socket.c,v 1.32 2004/11/02 23:09:27 snowdrop Exp $ +* $Id: nanohttp-socket.c,v 1.33 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -63,6 +63,7 @@ #include #include +#include #ifdef MEM_DEBUG #include @@ -257,7 +258,7 @@ hsocket_listen (hsocket_t sock) return H_OK; } - +#if 0 static void _hsocket_wait_until_receive(hsocket_t sock) { @@ -294,6 +295,7 @@ void _hsocket_wait_until_receive(hsocket_t sock) } } } +#endif /*-------------------------------------------------- FUNCTION: hsocket_close @@ -327,7 +329,7 @@ hsocket_close (hsocket_t sock) log_verbose1 ("closed"); } - +#if 0 static int _test_send_to_file(const char* filename, const byte_t* bytes,int n) { int size; @@ -337,7 +339,7 @@ static int _test_send_to_file(const char* filename, const byte_t* bytes,int n) fclose(f); return size; } - +#endif /*-------------------------------------------------- FUNCTION: hsocket_send ----------------------------------------------------*/ @@ -391,7 +393,9 @@ hsocket_read (hsocket_t sock, byte_t *buffer, int total, int force, int *receive { int status; int totalRead; - int wsa_error; +#ifdef WIN32 + int wsa_error = 0; +#endif totalRead = 0; /* log_verbose3("Entering hsocket_read(total=%d,force=%d)", total, force); diff --git a/nanohttp/nanohttp-stream.c b/nanohttp/nanohttp-stream.c index 3f0a9e9..1440e63 100755 --- a/nanohttp/nanohttp-stream.c +++ b/nanohttp/nanohttp-stream.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-stream.c,v 1.6 2004/11/02 23:09:27 snowdrop Exp $ +* $Id: nanohttp-stream.c,v 1.7 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003-2004 Ferhat Ayaz @@ -24,6 +24,8 @@ #include +#include + #ifdef MEM_DEBUG #include #endif diff --git a/wsdl2c/wsdl2c.c b/wsdl2c/wsdl2c.c index 55a2e71..23dac48 100755 --- a/wsdl2c/wsdl2c.c +++ b/wsdl2c/wsdl2c.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: wsdl2c.c,v 1.8 2004/10/15 13:34:47 snowdrop Exp $ + * $Id: wsdl2c.c,v 1.9 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -135,7 +135,7 @@ xmlNodePtr findPortType(xmlDocPtr doc, const char *name) root = xmlDocGetRootElement(doc); if (root == NULL) { fprintf(stderr, "Empty document!\n"); - return; + return NULL; } cur = root->xmlChildrenNode; @@ -180,7 +180,7 @@ xmlNodePtr findMessage(xmlDocPtr doc, const char *name) root = xmlDocGetRootElement(doc); if (root == NULL) { fprintf(stderr, "Empty document!\n"); - return; + return NULL; } cur = root->xmlChildrenNode; diff --git a/xsd2c/formatter.c b/xsd2c/formatter.c index 6264fdf..c574b1a 100644 --- a/xsd2c/formatter.c +++ b/xsd2c/formatter.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: formatter.c,v 1.5 2004/10/15 13:35:39 snowdrop Exp $ + * $Id: formatter.c,v 1.6 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -21,6 +21,8 @@ * * Email: ayaz@jprogrammer.net ******************************************************************/ +#include + #include "formatter.h" #include "tr.h" #include "util.h" @@ -42,8 +44,9 @@ static int genFunctionNameCreate(HCOMPLEXTYPE obj, char *buffer); static int genFunctionNameFree(HCOMPLEXTYPE obj, char *buffer); static int genFunctionNameSaxSerialize(HCOMPLEXTYPE obj, char *buffer); static int genFunctionNameDeserialize(HCOMPLEXTYPE obj, char *buffer); +#if 0 static int genFunctionNameSimpleMinMaxSetter(HCOMPLEXTYPE obj, char *buffer); - +#endif /* ------------------------------------------------------------- */ static void writeFieldDeclare(FILE* f, HFIELD field); @@ -117,7 +120,7 @@ void writeComplexTypeHeaderFile(FILE* f, HCOMPLEXTYPE obj) fprintf(f, "\n#define TO_%s(derived) (derived->__base) \n\n", buffer); /* write extern "C" for __cplusplus linking */ - fprintf(f, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif \n\n", buffer); + fprintf(f, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif \n\n"); /* write primitive type list structs */ enumFields(f, obj, writeFieldPrimitiveList); @@ -170,7 +173,7 @@ void writeComplexTypeHeaderFile(FILE* f, HCOMPLEXTYPE obj) } /* write extern "C" for __cplusplus linking */ - fprintf(f, "\n\n#ifdef __cplusplus\n};\n#endif /*__cplusplus*/\n\n", buffer); + fprintf(f, "\n\n#ifdef __cplusplus\n};\n#endif /*__cplusplus*/\n\n"); fprintf(f, "\n\n#endif\n"); } @@ -504,8 +507,6 @@ static void enumFields(FILE* f, HCOMPLEXTYPE obj, FieldEnumCallBack callb) void writeComplexTypeSourceFile(FILE* f, HCOMPLEXTYPE obj) { - HFIELD field; - char buffer[1054]; if (obj == NULL) { @@ -514,9 +515,9 @@ void writeComplexTypeSourceFile(FILE* f, HCOMPLEXTYPE obj) } fprintf(f, "/** Generated by xsd2c */\n"); - fprintf(f, "#include \n", obj->type); - fprintf(f, "#include \n", obj->type); - fprintf(f, "#include \n", obj->type); + fprintf(f, "#include \n"); + fprintf(f, "#include \n"); + fprintf(f, "#include \n"); fprintf(f, "#include \"%s.h\"\n\n\n", obj->type); /* _xsd*/ @@ -641,7 +642,6 @@ static void writeCodeSetter(FILE* f, HFIELD field) char ns[255]; char type[255]; char ctype[1054]; - char defvalue[255]; if (field->maxOccurs > 1 || field->maxOccurs == -1) return; @@ -659,7 +659,8 @@ static void writeCodeSetter(FILE* f, HFIELD field) { fprintf(f, "\tif (obj->%s != NULL) free(obj->%s);\n", field->name, field->name); - fprintf(f, "\tobj->%s = (char*)malloc(strlen(%s)+1);\n"); + fprintf(f, "\tobj->%s = (char*)malloc(strlen(%s)+1);\n", + field->name, field->name); fprintf(f, "\tstrcpy(obj->%s, %s);\n", field->name, field->name); } @@ -762,7 +763,6 @@ static void writeCodeFieldFree(FILE* f, HFIELD field) { char ns[255]; char type[255]; - char defvalue[255]; parseNS(field->type, ns, type); diff --git a/xsd2c/tr.c b/xsd2c/tr.c index 3e5bd75..56d3fb9 100644 --- a/xsd2c/tr.c +++ b/xsd2c/tr.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: tr.c,v 1.4 2004/10/15 13:35:39 snowdrop Exp $ + * $Id: tr.c,v 1.5 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -24,6 +24,8 @@ #include "tr.h" #include +#include +#include #define XSD2C_MAP(xsdtype, ctype, builtin) \ trRegisterType(xsdtype, ctype, builtin); diff --git a/xsd2c/util.c b/xsd2c/util.c index 7083c5d..20db840 100644 --- a/xsd2c/util.c +++ b/xsd2c/util.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: util.c,v 1.1 2004/06/02 11:17:03 snowdrop Exp $ + * $Id: util.c,v 1.2 2005/05/27 19:28:16 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -24,6 +24,7 @@ #include #include +#include int parseNS(const char* fullname, char *ns, char *name) { -- cgit v1.1-32-gdbae