summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-05-16 14:59:08 (GMT)
committerTobias Markmann <tm@ayena.de>2017-05-17 06:36:48 (GMT)
commitedf519a67a28f9acb61af6d442d94f1aa43df688 (patch)
tree802269050d3db7c13c763550269f663172938b96 /3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c
parent6644c207c879f33dac40c02ab6787a0c4184728d (diff)
downloadswift-edf519a67a28f9acb61af6d442d94f1aa43df688.zip
swift-edf519a67a28f9acb61af6d442d94f1aa43df688.tar.bz2
Update 3rdParty/LibMiniUPnPc to miniupnpc-2.0.20170509
Test-Information: Builds on macOS 10.12.5 with Qt 5.4.2 and all unit and integration tests pass. Change-Id: I491c0f78bf8773056feb3825d21989d6c7a2aeab
Diffstat (limited to '3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c')
-rw-r--r--3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c b/3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c
index eb4d7d9..3e201ec 100644
--- a/3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c
+++ b/3rdParty/LibMiniUPnPc/src/miniupnpc/minixml.c
@@ -1,37 +1,37 @@
-/* $Id: minixml.c,v 1.10 2012/03/05 19:42:47 nanard Exp $ */
+/* $Id: minixml.c,v 1.11 2014/02/03 15:54:12 nanard Exp $ */
/* minixml.c : the minimum size a xml parser can be ! */
/* Project : miniupnp
* webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* Author : Thomas Bernard
-Copyright (c) 2005-2011, Thomas BERNARD
+Copyright (c) 2005-2014, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <string.h>
#include "minixml.h"
/* parseatt : used to parse the argument list
* return 0 (false) in case of success and -1 (true) if the end
@@ -86,61 +86,74 @@ static int parseatt(struct xmlparser * p)
else
{
attvalue = p->xml;
attvaluelen = 0;
while( !IS_WHITE_SPACE(*p->xml)
&& *p->xml != '>' && *p->xml != '/')
{
attvaluelen++; p->xml++;
if(p->xml >= p->xmlend)
return -1;
}
}
/*printf("%.*s='%.*s'\n",
attnamelen, attname, attvaluelen, attvalue);*/
if(p->attfunc)
p->attfunc(p->data, attname, attnamelen, attvalue, attvaluelen);
}
p->xml++;
}
return -1;
}
/* parseelt parse the xml stream and
* call the callback functions when needed... */
static void parseelt(struct xmlparser * p)
{
int i;
const char * elementname;
while(p->xml < (p->xmlend - 1))
{
- if((p->xml)[0]=='<' && (p->xml)[1]!='?')
+ if((p->xml + 4) <= p->xmlend && (0 == memcmp(p->xml, "<!--", 4)))
+ {
+ p->xml += 3;
+ /* ignore comments */
+ do
+ {
+ p->xml++;
+ if ((p->xml + 3) >= p->xmlend)
+ return;
+ }
+ while(memcmp(p->xml, "-->", 3) != 0);
+ p->xml += 3;
+ }
+ else if((p->xml)[0]=='<' && (p->xml)[1]!='?')
{
i = 0; elementname = ++p->xml;
while( !IS_WHITE_SPACE(*p->xml)
&& (*p->xml!='>') && (*p->xml!='/')
)
{
i++; p->xml++;
if (p->xml >= p->xmlend)
return;
/* to ignore namespace : */
if(*p->xml==':')
{
i = 0;
elementname = ++p->xml;
}
}
if(i>0)
{
if(p->starteltfunc)
p->starteltfunc(p->data, elementname, i);
if(parseatt(p))
return;
if(*p->xml!='/')
{
const char * data;
i = 0; data = ++p->xml;
if (p->xml >= p->xmlend)
return;
while( IS_WHITE_SPACE(*p->xml) )
{