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10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/expat/src/xmltok_ns.c (Version 11.3.0) and /externals/expat/src/xmltok_ns.c (Version 9.5.p1)


  1 /* This file is included!                      <<   1 /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
  2                             __  __             <<   2    See the file COPYING for copying permission.
  3                          ___\ \/ /_ __   __ _| << 
  4                         / _ \\  /| '_ \ / _` | << 
  5                        |  __//  \| |_) | (_| | << 
  6                         \___/_/\_\ .__/ \__,_| << 
  7                                  |_| XML parse << 
  8                                                << 
  9    Copyright (c) 1997-2000 Thai Open Source So << 
 10    Copyright (c) 2000      Clark Cooper <coope << 
 11    Copyright (c) 2002      Greg Stein <gstein@ << 
 12    Copyright (c) 2002      Fred L. Drake, Jr.  << 
 13    Copyright (c) 2002-2006 Karl Waclawek <karl << 
 14    Copyright (c) 2017-2021 Sebastian Pipping < << 
 15    Licensed under the MIT license:             << 
 16                                                << 
 17    Permission is  hereby granted,  free of cha << 
 18    a  copy  of  this  software   and  associat << 
 19    "Software"),  to  deal in  the  Software  w << 
 20    without  limitation the  rights  to use,  c << 
 21    distribute, sublicense, and/or sell copies  << 
 22    persons  to whom  the Software  is  furnish << 
 23    following conditions:                       << 
 24                                                << 
 25    The above copyright  notice and this permis << 
 26    in all copies or substantial portions of th << 
 27                                                << 
 28    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WIT << 
 29    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT L << 
 30    MERCHANTABILITY, FITNESS FOR A PARTICULAR P << 
 31    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HO << 
 32    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN << 
 33    OTHERWISE, ARISING FROM, OUT OF OR IN CONNE << 
 34    USE OR OTHER DEALINGS IN THE SOFTWARE.      << 
 35 */                                                  3 */
 36                                                     4 
                                                   >>   5 /* This file is included! */
 37 #ifdef XML_TOK_NS_C                                 6 #ifdef XML_TOK_NS_C
 38                                                     7 
 39 const ENCODING *                                    8 const ENCODING *
 40 NS(XmlGetUtf8InternalEncoding)(void) {         <<   9 NS(XmlGetUtf8InternalEncoding)(void)
                                                   >>  10 {
 41   return &ns(internal_utf8_encoding).enc;          11   return &ns(internal_utf8_encoding).enc;
 42 }                                                  12 }
 43                                                    13 
 44 const ENCODING *                                   14 const ENCODING *
 45 NS(XmlGetUtf16InternalEncoding)(void) {        <<  15 NS(XmlGetUtf16InternalEncoding)(void)
 46 #  if BYTEORDER == 1234                        <<  16 {
                                                   >>  17 #if BYTEORDER == 1234
 47   return &ns(internal_little2_encoding).enc;       18   return &ns(internal_little2_encoding).enc;
 48 #  elif BYTEORDER == 4321                      <<  19 #elif BYTEORDER == 4321
 49   return &ns(internal_big2_encoding).enc;          20   return &ns(internal_big2_encoding).enc;
 50 #  else                                        <<  21 #else
 51   const short n = 1;                               22   const short n = 1;
 52   return (*(const char *)&n ? &ns(internal_lit <<  23   return (*(const char *)&n
 53                             : &ns(internal_big <<  24           ? &ns(internal_little2_encoding).enc
 54 #  endif                                       <<  25           : &ns(internal_big2_encoding).enc);
                                                   >>  26 #endif
 55 }                                                  27 }
 56                                                    28 
 57 static const ENCODING *const NS(encodings)[] = <<  29 static const ENCODING * const NS(encodings)[] = {
 58     &ns(latin1_encoding).enc, &ns(ascii_encodi <<  30   &ns(latin1_encoding).enc,
 59     &ns(utf8_encoding).enc,   &ns(big2_encodin <<  31   &ns(ascii_encoding).enc,
 60     &ns(big2_encoding).enc,   &ns(little2_enco <<  32   &ns(utf8_encoding).enc,
 61     &ns(utf8_encoding).enc /* NO_ENC */        <<  33   &ns(big2_encoding).enc,
                                                   >>  34   &ns(big2_encoding).enc,
                                                   >>  35   &ns(little2_encoding).enc,
                                                   >>  36   &ns(utf8_encoding).enc /* NO_ENC */
 62 };                                                 37 };
 63                                                    38 
 64 static int PTRCALL                                 39 static int PTRCALL
 65 NS(initScanProlog)(const ENCODING *enc, const      40 NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
 66                    const char **nextTokPtr) {  <<  41                    const char **nextTokPtr)
 67   return initScan(NS(encodings), (const INIT_E <<  42 {
 68                   ptr, end, nextTokPtr);       <<  43   return initScan(NS(encodings), (const INIT_ENCODING *)enc,
                                                   >>  44                   XML_PROLOG_STATE, ptr, end, nextTokPtr);
 69 }                                                  45 }
 70                                                    46 
 71 static int PTRCALL                                 47 static int PTRCALL
 72 NS(initScanContent)(const ENCODING *enc, const     48 NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
 73                     const char **nextTokPtr) { <<  49                     const char **nextTokPtr)
 74   return initScan(NS(encodings), (const INIT_E <<  50 {
 75                   ptr, end, nextTokPtr);       <<  51   return initScan(NS(encodings), (const INIT_ENCODING *)enc,
                                                   >>  52                   XML_CONTENT_STATE, ptr, end, nextTokPtr);
 76 }                                                  53 }
 77                                                    54 
 78 int                                                55 int
 79 NS(XmlInitEncoding)(INIT_ENCODING *p, const EN     56 NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
 80                     const char *name) {        <<  57                     const char *name)
                                                   >>  58 {
 81   int i = getEncodingIndex(name);                  59   int i = getEncodingIndex(name);
 82   if (i == UNKNOWN_ENC)                            60   if (i == UNKNOWN_ENC)
 83     return 0;                                      61     return 0;
 84   SET_INIT_ENC_INDEX(p, i);                        62   SET_INIT_ENC_INDEX(p, i);
 85   p->initEnc.scanners[XML_PROLOG_STATE] = NS(i     63   p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
 86   p->initEnc.scanners[XML_CONTENT_STATE] = NS(     64   p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
 87   p->initEnc.updatePosition = initUpdatePositi     65   p->initEnc.updatePosition = initUpdatePosition;
 88   p->encPtr = encPtr;                              66   p->encPtr = encPtr;
 89   *encPtr = &(p->initEnc);                         67   *encPtr = &(p->initEnc);
 90   return 1;                                        68   return 1;
 91 }                                                  69 }
 92                                                    70 
 93 static const ENCODING *                            71 static const ENCODING *
 94 NS(findEncoding)(const ENCODING *enc, const ch <<  72 NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
 95 #  define ENCODING_MAX 128                     <<  73 {
 96   char buf[ENCODING_MAX] = "";                 <<  74 #define ENCODING_MAX 128
                                                   >>  75   char buf[ENCODING_MAX];
 97   char *p = buf;                                   76   char *p = buf;
 98   int i;                                           77   int i;
 99   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCOD     78   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
100   if (ptr != end)                                  79   if (ptr != end)
101     return 0;                                      80     return 0;
102   *p = 0;                                          81   *p = 0;
103   if (streqci(buf, KW_UTF_16) && enc->minBytes     82   if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
104     return enc;                                    83     return enc;
105   i = getEncodingIndex(buf);                       84   i = getEncodingIndex(buf);
106   if (i == UNKNOWN_ENC)                            85   if (i == UNKNOWN_ENC)
107     return 0;                                      86     return 0;
108   return NS(encodings)[i];                         87   return NS(encodings)[i];
109 }                                                  88 }
110                                                    89 
111 int                                                90 int
112 NS(XmlParseXmlDecl)(int isGeneralTextEntity, c <<  91 NS(XmlParseXmlDecl)(int isGeneralTextEntity,
113                     const char *ptr, const cha <<  92                     const ENCODING *enc,
114                     const char **versionPtr, c <<  93                     const char *ptr,
115                     const char **encodingName, <<  94                     const char *end,
116                     int *standalone) {         <<  95                     const char **badPtr,
117   return doParseXmlDecl(NS(findEncoding), isGe <<  96                     const char **versionPtr,
118                         badPtr, versionPtr, ve <<  97                     const char **versionEndPtr,
119                         encoding, standalone); <<  98                     const char **encodingName,
                                                   >>  99                     const ENCODING **encoding,
                                                   >> 100                     int *standalone)
                                                   >> 101 {
                                                   >> 102   return doParseXmlDecl(NS(findEncoding),
                                                   >> 103                         isGeneralTextEntity,
                                                   >> 104                         enc,
                                                   >> 105                         ptr,
                                                   >> 106                         end,
                                                   >> 107                         badPtr,
                                                   >> 108                         versionPtr,
                                                   >> 109                         versionEndPtr,
                                                   >> 110                         encodingName,
                                                   >> 111                         encoding,
                                                   >> 112                         standalone);
120 }                                                 113 }
121                                                   114 
122 #endif /* XML_TOK_NS_C */                         115 #endif /* XML_TOK_NS_C */
123                                                   116