From f87db576ba17091ee03df5a8b64fd7094c40f700 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Fri, 16 Mar 2012 11:51:10 -0300 Subject: [PATCH] Don't use // as comments, it breaks some C compilers Also, really remove the dead code. (forward port of commit e0444b26e63eabebe293d42dbf941c0a6833d54d) --- ixml/src/ixmlparser.c | 5 +---- ixml/src/node.c | 22 ++++++---------------- upnp/src/genlib/net/uri/uri.c | 15 +++++++++++---- upnp/src/inc/ssdplib.h | 2 -- upnp/src/inc/uri.h | 18 ------------------ upnp/src/ssdp/ssdp_device.c | 3 +-- upnp/src/ssdp/ssdp_server.c | 5 +---- 7 files changed, 20 insertions(+), 50 deletions(-) diff --git a/ixml/src/ixmlparser.c b/ixml/src/ixmlparser.c index 8f4d981..c342272 100644 --- a/ixml/src/ixmlparser.c +++ b/ixml/src/ixmlparser.c @@ -2148,8 +2148,6 @@ static int isTopLevelElement( static BOOL Parser_hasDefaultNamespace( /*! [in] The XML parser. */ Parser *xmlParser, - /*! [in] The Node to process. */ - /*IXML_Node *newNode,*/ /*! [in,out] The name space URI. */ char **nsURI ) { @@ -2165,7 +2163,6 @@ static BOOL Parser_hasDefaultNamespace( } return FALSE; - //newNode = newNode; } @@ -2218,7 +2215,7 @@ static int Parser_processElementName( } else { /* does element has default namespace */ /* the node may have default namespace definition */ - if (Parser_hasDefaultNamespace(xmlParser, /*newNode,*/ &nsURI)) { + if (Parser_hasDefaultNamespace(xmlParser, &nsURI)) { Parser_setElementNamespace(newElement, nsURI); } else { switch (xmlParser->state) { diff --git a/ixml/src/node.c b/ixml/src/node.c index b267185..1b79cb1 100644 --- a/ixml/src/node.c +++ b/ixml/src/node.c @@ -766,42 +766,32 @@ static IXML_Element *ixmlNode_cloneElement( /*! - * \brief Returns a clone of a document node. + * \brief Returns a new document node. * * Currently, the IXML_Document struct is just a node, so this function - * just mallocs the IXML_Document, sets the node type and name. Curiously, - * the parameter nodeptr is not actually used. + * just mallocs the IXML_Document, sets the node type and name. * - * \return A clone of a document node. + * \return A new document node. */ -static IXML_Document *ixmlNode_cloneDoc( - /*! [in] The \b Node to clone. */ - /*IXML_Document *nodeptr*/) +static IXML_Document *ixmlNode_newDoc(void) { IXML_Document *newDoc; IXML_Node *docNode; int rc; - //assert(nodeptr != NULL); - newDoc = (IXML_Document *)malloc(sizeof (IXML_Document)); - if (newDoc == NULL) { + if (!newDoc) return NULL; - } - ixmlDocument_init(newDoc); docNode = (IXML_Node *)newDoc; - rc = ixmlNode_setNodeName(docNode, DOCUMENTNODENAME); if (rc != IXML_SUCCESS) { ixmlDocument_free(newDoc); return NULL; } - newDoc->n.nodeType = eDOCUMENT_NODE; return newDoc; - //nodeptr = nodeptr; } /*! @@ -968,7 +958,7 @@ static IXML_Node *ixmlNode_cloneNodeTreeRecursive( break; case eDOCUMENT_NODE: - newDoc = ixmlNode_cloneDoc(/*(IXML_Document *)nodeptr*/); + newDoc = ixmlNode_newDoc(); if (newDoc == NULL) return NULL; newNode = (IXML_Node *)newDoc; diff --git a/upnp/src/genlib/net/uri/uri.c b/upnp/src/genlib/net/uri/uri.c index 9bb2b6a..815ffe9 100644 --- a/upnp/src/genlib/net/uri/uri.c +++ b/upnp/src/genlib/net/uri/uri.c @@ -313,9 +313,18 @@ int token_cmp(token *in1, token *in2) return memcmp(in1->buff, in2->buff, in1->size); } -int parse_hostport( +/*! + * \brief Parses a string representing a host and port (e.g. "127.127.0.1:80" + * or "localhost") and fills out a hostport_type struct with internet address + * and a token representing the full host and port. + * + * Uses gethostbyname. + */ +static int parse_hostport( + /*! [in] String of characters representing host and port. */ const char *in, - /*size_t max,*/ + /*! [out] Output parameter where the host and port are represented as + * an internet address. */ unsigned short int defaultPort, hostport_type *out) { @@ -447,7 +456,6 @@ int parse_hostport( out->text.buff = in; return (int)hostport_size; - //max=max; } /*! @@ -711,7 +719,6 @@ int parse_uri(const char *in, size_t max, uri_type *out) defaultPort = 443; } begin_path = parse_hostport(&in[begin_hostport], - /*max - begin_hostport,*/ defaultPort, &out->hostport); if (begin_path >= 0) { diff --git a/upnp/src/inc/ssdplib.h b/upnp/src/inc/ssdplib.h index 77e7664..b214ab3 100644 --- a/upnp/src/inc/ssdplib.h +++ b/upnp/src/inc/ssdplib.h @@ -501,8 +501,6 @@ int DeviceShutdown( int RootDev, /* [in] Device UDN. */ char *Udn, - /* [in] . */ - /*char *_Server,*/ /* [in] Location URL. */ char *Location, /* [in] Device duration in sec. */ diff --git a/upnp/src/inc/uri.h b/upnp/src/inc/uri.h index 6f8ee71..687aae8 100644 --- a/upnp/src/inc/uri.h +++ b/upnp/src/inc/uri.h @@ -276,24 +276,6 @@ int token_cmp( /*! [in] Second token object used for the comparison. */ token *in2); -/*! - * \brief Parses a string representing a host and port (e.g. "127.127.0.1:80" - * or "localhost") and fills out a hostport_type struct with internet address - * and a token representing the full host and port. - * - * Uses gethostbyname. - */ -int parse_hostport( - /*! [in] String of characters representing host and port. */ - const char *in, - /*! [in] Sets a maximum limit. */ - /*size_t max,*/ - /*! [in] The default port if the port is not specified. */ - unsigned short int defaultPort, - /*! [out] Output parameter where the host and port are represented as - * an internet address. */ - hostport_type *out); - /*! * \brief Removes http escaped characters such as: "%20" and replaces them with * their character representation. i.e. "hello%20foo" -> "hello foo". diff --git a/upnp/src/ssdp/ssdp_device.c b/upnp/src/ssdp/ssdp_device.c index 87580db..d3517cc 100644 --- a/upnp/src/ssdp/ssdp_device.c +++ b/upnp/src/ssdp/ssdp_device.c @@ -831,7 +831,7 @@ error_handler: return RetVal; } -int DeviceShutdown(char *DevType, int RootDev, char *Udn, /*char *_Server,*/ +int DeviceShutdown(char *DevType, int RootDev, char *Udn, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState) { @@ -911,7 +911,6 @@ error_handler: free(msgs[2]); return ret_code; - //_Server = _Server; } #endif /* EXCLUDE_SSDP */ #endif /* INCLUDE_DEVICE_APIS */ diff --git a/upnp/src/ssdp/ssdp_server.c b/upnp/src/ssdp/ssdp_server.c index dfd5125..01c873f 100644 --- a/upnp/src/ssdp/ssdp_server.c +++ b/upnp/src/ssdp/ssdp_server.c @@ -108,7 +108,6 @@ int AdvertiseAndReply(int AdFlag, UpnpDevice_Handle Hnd, IXML_Node *tmpNode2 = NULL; IXML_Node *textNode = NULL; const DOMString tmpStr; - //char SERVER[200]; const DOMString dbgStr; int NumCopy = 0; @@ -126,8 +125,6 @@ int AdvertiseAndReply(int AdFlag, UpnpDevice_Handle Hnd, goto end_function; } defaultExp = SInfo->MaxAge; - /* get server info */ - //get_sdk_info(SERVER); /* parse the device list and send advertisements/replies */ while (NumCopy == 0 || (AdFlag && NumCopy < NUM_SSDP_COPY)) { if (NumCopy != 0) @@ -218,7 +215,7 @@ int AdvertiseAndReply(int AdFlag, UpnpDevice_Handle Hnd, } else { /* AdFlag == -1 */ DeviceShutdown(devType, i == 0lu, UDNstr, - /*SERVER,*/ SInfo->DescURL, + SInfo->DescURL, Exp, SInfo->DeviceAf, SInfo->PowerState, SInfo->SleepPeriod,