summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/expat/xmlwf/xmlmime.c
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-10-15 04:28:42 +1100
committer Vas Crabb <vas@vastheman.com>2020-10-15 04:28:42 +1100
commitd256f069a5aa30bf5ffcfc4b73047ce0f372ea10 (patch)
tree8df1bd2e70d7e15e59928203d0eb687c82307bff /3rdparty/expat/xmlwf/xmlmime.c
parent13850f3011e000307925aefd918efe2f0ce6649d (diff)
-3rdparty/expat: Update to 2.2.10."
-Fixed tiny build (missing s11c_bg_device) and unused lambda capture in emu/rendlay.cpp.
Diffstat (limited to '3rdparty/expat/xmlwf/xmlmime.c')
-rw-r--r--3rdparty/expat/xmlwf/xmlmime.c70
1 files changed, 49 insertions, 21 deletions
diff --git a/3rdparty/expat/xmlwf/xmlmime.c b/3rdparty/expat/xmlwf/xmlmime.c
index 56a0e7f40e4..39160d7198c 100644
--- a/3rdparty/expat/xmlwf/xmlmime.c
+++ b/3rdparty/expat/xmlwf/xmlmime.c
@@ -1,9 +1,40 @@
+/*
+ __ __ _
+ ___\ \/ /_ __ __ _| |_
+ / _ \\ /| '_ \ / _` | __|
+ | __// \| |_) | (_| | |_
+ \___/_/\_\ .__/ \__,_|\__|
+ |_| XML parser
+
+ Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
+ Copyright (c) 2000-2017 Expat development team
+ Licensed under the MIT license:
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the
+ following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
#include <string.h>
#include "xmlmime.h"
static const char *
-getTok(const char **pp)
-{
+getTok(const char **pp) {
/* inComment means one level of nesting; inComment+1 means two levels etc */
enum { inAtom, inString, init, inComment };
int state = init;
@@ -74,9 +105,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */
static int
-matchkey(const char *start, const char *end, const char *key)
-{
- if (!start)
+matchkey(const char *start, const char *end, const char *key) {
+ if (! start)
return 0;
for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a'))
@@ -85,8 +115,7 @@ matchkey(const char *start, const char *end, const char *key)
}
void
-getXMLCharset(const char *buf, char *charset)
-{
+getXMLCharset(const char *buf, char *charset) {
const char *next, *p;
charset[0] = '\0';
@@ -94,16 +123,18 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next);
if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii");
- else if (!matchkey(p, next, "application"))
+ else if (! matchkey(p, next, "application"))
return;
p = getTok(&next);
- if (!p || *p != '/')
+ if (! p || *p != '/')
return;
p = getTok(&next);
-#if 0
- if (!matchkey(p, next, "xml") && charset[0] == '\0')
- return;
-#endif
+ /* BEGIN disabled code */
+ if (0) {
+ if (! matchkey(p, next, "xml") && charset[0] == '\0')
+ return;
+ }
+ /* END disabled code */
p = getTok(&next);
while (p) {
if (*p == ';') {
@@ -125,8 +156,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p;
}
*s++ = '\0';
- }
- else {
+ } else {
if (next - p > CHARSET_MAX - 1)
break;
while (p != next)
@@ -138,19 +168,17 @@ getXMLCharset(const char *buf, char *charset)
}
break;
}
- }
- else
- p = getTok(&next);
+ } else
+ p = getTok(&next);
}
}
#ifdef TEST
-#include <stdio.h>
+# include <stdio.h>
int
-main(int argc, char *argv[])
-{
+main(int argc, char *argv[]) {
char buf[CHARSET_MAX];
if (argc <= 1)
return 1;