apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1002549 [14/14] - in /apr/apr-util/vendor/expat/current: ./ bcb5/ conftools/ doc/ examples/ lib/ tests/ vms/ win32/ xmlwf/
Date Wed, 29 Sep 2010 09:59:07 GMT
Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlwf.c
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlwf.c?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlwf.c (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlwf.c Wed Sep 29 09:59:04 2010
@@ -1,6 +1,5 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
+/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+   See the file COPYING for copying permission.
 */
 
 #include <stdio.h>
@@ -21,7 +20,8 @@ See the file COPYING for copying permiss
 
 #define NSSEP T('\001')
 
-static void characterData(void *userData, const XML_Char *s, int len)
+static void XMLCALL
+characterData(void *userData, const XML_Char *s, int len)
 {
   FILE *fp = userData;
   for (; len > 0; --len, ++s) {
@@ -56,7 +56,8 @@ static void characterData(void *userData
   }
 }
 
-static void attributeValue(FILE *fp, const XML_Char *s)
+static void
+attributeValue(FILE *fp, const XML_Char *s)
 {
   puttc(T('='), fp);
   puttc(T('"'), fp);
@@ -106,12 +107,14 @@ static void attributeValue(FILE *fp, con
 /* Lexicographically comparing UTF-8 encoded attribute values,
 is equivalent to lexicographically comparing based on the character number. */
 
-static int attcmp(const void *att1, const void *att2)
+static int
+attcmp(const void *att1, const void *att2)
 {
   return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
 }
 
-static void startElement(void *userData, const XML_Char *name, const XML_Char **atts)
+static void XMLCALL
+startElement(void *userData, const XML_Char *name, const XML_Char **atts)
 {
   int nAtts;
   const XML_Char **p;
@@ -134,7 +137,8 @@ static void startElement(void *userData,
   puttc(T('>'), fp);
 }
 
-static void endElement(void *userData, const XML_Char *name)
+static void XMLCALL
+endElement(void *userData, const XML_Char *name)
 {
   FILE *fp = userData;
   puttc(T('<'), fp);
@@ -143,7 +147,8 @@ static void endElement(void *userData, c
   puttc(T('>'), fp);
 }
 
-static int nsattcmp(const void *p1, const void *p2)
+static int
+nsattcmp(const void *p1, const void *p2)
 {
   const XML_Char *att1 = *(const XML_Char **)p1;
   const XML_Char *att2 = *(const XML_Char **)p2;
@@ -154,7 +159,8 @@ static int nsattcmp(const void *p1, cons
   return tcscmp(att1, att2);
 }
 
-static void startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
+static void XMLCALL
+startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
 {
   int nAtts;
   int nsi;
@@ -202,7 +208,8 @@ static void startElementNS(void *userDat
   puttc(T('>'), fp);
 }
 
-static void endElementNS(void *userData, const XML_Char *name)
+static void XMLCALL
+endElementNS(void *userData, const XML_Char *name)
 {
   FILE *fp = userData;
   const XML_Char *sep;
@@ -220,7 +227,9 @@ static void endElementNS(void *userData,
 
 #ifndef W3C14N
 
-static void processingInstruction(void *userData, const XML_Char *target, const XML_Char
*data)
+static void XMLCALL
+processingInstruction(void *userData, const XML_Char *target,
+                      const XML_Char *data)
 {
   FILE *fp = userData;
   puttc(T('<'), fp);
@@ -234,78 +243,92 @@ static void processingInstruction(void *
 
 #endif /* not W3C14N */
 
-static void defaultCharacterData(XML_Parser parser, const XML_Char *s, int len)
+static void XMLCALL
+defaultCharacterData(void *userData, const XML_Char *s, int len)
 {
-  XML_DefaultCurrent(parser);
+  XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void defaultStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
+static void XMLCALL
+defaultStartElement(void *userData, const XML_Char *name,
+                    const XML_Char **atts)
 {
-  XML_DefaultCurrent(parser);
+  XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void defaultEndElement(XML_Parser parser, const XML_Char *name)
+static void XMLCALL
+defaultEndElement(void *userData, const XML_Char *name)
 {
-  XML_DefaultCurrent(parser);
+  XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void defaultProcessingInstruction(XML_Parser parser, const XML_Char *target, const
XML_Char *data)
+static void XMLCALL
+defaultProcessingInstruction(void *userData, const XML_Char *target,
+                             const XML_Char *data)
 {
-  XML_DefaultCurrent(parser);
+  XML_DefaultCurrent((XML_Parser) userData);
 }
 
-static void nopCharacterData(XML_Parser parser, const XML_Char *s, int len)
+static void XMLCALL
+nopCharacterData(void *userData, const XML_Char *s, int len)
 {
 }
 
-static void nopStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
+static void XMLCALL
+nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
 {
 }
 
-static void nopEndElement(XML_Parser parser, const XML_Char *name)
+static void XMLCALL
+nopEndElement(void *userData, const XML_Char *name)
 {
 }
 
-static void nopProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char
*data)
+static void XMLCALL
+nopProcessingInstruction(void *userData, const XML_Char *target,
+                         const XML_Char *data)
 {
 }
 
-static void markup(XML_Parser parser, const XML_Char *s, int len)
+static void XMLCALL
+markup(void *userData, const XML_Char *s, int len)
 {
-  FILE *fp = XML_GetUserData(parser);
+  FILE *fp = XML_GetUserData((XML_Parser) userData);
   for (; len > 0; --len, ++s)
     puttc(*s, fp);
 }
 
-static
-void metaLocation(XML_Parser parser)
+static void
+metaLocation(XML_Parser parser)
 {
   const XML_Char *uri = XML_GetBase(parser);
   if (uri)
     ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri);
   ftprintf(XML_GetUserData(parser),
            T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""),
-	   XML_GetCurrentByteIndex(parser),
-	   XML_GetCurrentByteCount(parser),
-	   XML_GetCurrentLineNumber(parser),
-	   XML_GetCurrentColumnNumber(parser));
+           XML_GetCurrentByteIndex(parser),
+           XML_GetCurrentByteCount(parser),
+           XML_GetCurrentLineNumber(parser),
+           XML_GetCurrentColumnNumber(parser));
 }
 
-static
-void metaStartDocument(XML_Parser parser)
+static void
+metaStartDocument(void *userData)
 {
-  fputts(T("<document>\n"), XML_GetUserData(parser));
+  fputts(T("<document>\n"), XML_GetUserData((XML_Parser) userData));
 }
 
-static
-void metaEndDocument(XML_Parser parser)
+static void
+metaEndDocument(void *userData)
 {
-  fputts(T("</document>\n"), XML_GetUserData(parser));
+  fputts(T("</document>\n"), XML_GetUserData((XML_Parser) userData));
 }
 
-static
-void metaStartElement(XML_Parser parser, const XML_Char *name, const XML_Char **atts)
+static void XMLCALL
+metaStartElement(void *userData, const XML_Char *name,
+                 const XML_Char **atts)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   const XML_Char **specifiedAttsEnd
     = atts + XML_GetSpecifiedAttributeCount(parser);
@@ -324,11 +347,11 @@ void metaStartElement(XML_Parser parser,
       ftprintf(fp, T("<attribute name=\"%s\" value=\""), atts[0]);
       characterData(fp, atts[1], tcslen(atts[1]));
       if (atts >= specifiedAttsEnd)
-	fputts(T("\" defaulted=\"yes\"/>\n"), fp);
+        fputts(T("\" defaulted=\"yes\"/>\n"), fp);
       else if (atts == idAttPtr)
-	fputts(T("\" id=\"yes\"/>\n"), fp);
+        fputts(T("\" id=\"yes\"/>\n"), fp);
       else
-	fputts(T("\"/>\n"), fp);
+        fputts(T("\"/>\n"), fp);
     } while (*(atts += 2));
     fputts(T("</starttag>\n"), fp);
   }
@@ -336,18 +359,21 @@ void metaStartElement(XML_Parser parser,
     fputts(T("/>\n"), fp);
 }
 
-static
-void metaEndElement(XML_Parser parser, const XML_Char *name)
+static void XMLCALL
+metaEndElement(void *userData, const XML_Char *name)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   ftprintf(fp, T("<endtag name=\"%s\""), name);
   metaLocation(parser);
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaProcessingInstruction(XML_Parser parser, const XML_Char *target, const XML_Char
*data)
+static void XMLCALL
+metaProcessingInstruction(void *userData, const XML_Char *target,
+                          const XML_Char *data)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
   characterData(fp, data, tcslen(data));
@@ -356,9 +382,10 @@ void metaProcessingInstruction(XML_Parse
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaComment(XML_Parser parser, const XML_Char *data)
+static void XMLCALL
+metaComment(void *userData, const XML_Char *data)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   fputts(T("<comment data=\""), fp);
   characterData(fp, data, tcslen(data));
@@ -367,27 +394,30 @@ void metaComment(XML_Parser parser, cons
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaStartCdataSection(XML_Parser parser)
+static void XMLCALL
+metaStartCdataSection(void *userData)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   fputts(T("<startcdata"), fp);
   metaLocation(parser);
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaEndCdataSection(XML_Parser parser)
+static void XMLCALL
+metaEndCdataSection(void *userData)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   fputts(T("<endcdata"), fp);
   metaLocation(parser);
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaCharacterData(XML_Parser parser, const XML_Char *s, int len)
+static void XMLCALL
+metaCharacterData(void *userData, const XML_Char *s, int len)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   fputts(T("<chars str=\""), fp);
   characterData(fp, s, len);
@@ -396,35 +426,38 @@ void metaCharacterData(XML_Parser parser
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaStartDoctypeDecl(XML_Parser parser,
-			  const XML_Char *doctypeName,
-			  const XML_Char *sysid,
-			  const XML_Char *pubid,
-			  int has_internal_subset)
+static void XMLCALL
+metaStartDoctypeDecl(void *userData,
+                     const XML_Char *doctypeName,
+                     const XML_Char *sysid,
+                     const XML_Char *pubid,
+                     int has_internal_subset)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
   metaLocation(parser);
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaEndDoctypeDecl(XML_Parser parser)
+static void XMLCALL
+metaEndDoctypeDecl(void *userData)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   fputts(T("<enddoctype"), fp);
   metaLocation(parser);
   fputts(T("/>\n"), fp);
 }
 
-static
-void metaNotationDecl(XML_Parser parser,
-		      const XML_Char *notationName,
-		      const XML_Char *base,
-		      const XML_Char *systemId,
-		      const XML_Char *publicId)
+static void XMLCALL
+metaNotationDecl(void *userData,
+                 const XML_Char *notationName,
+                 const XML_Char *base,
+                 const XML_Char *systemId,
+                 const XML_Char *publicId)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   ftprintf(fp, T("<notation name=\"%s\""), notationName);
   if (publicId)
@@ -439,17 +472,18 @@ void metaNotationDecl(XML_Parser parser,
 }
 
 
-static
-void metaEntityDecl(XML_Parser parser,
-		    const XML_Char *entityName,
-		    int  is_param,
-		    const XML_Char *value,
-		    int  value_length,
-		    const XML_Char *base,
-		    const XML_Char *systemId,
-		    const XML_Char *publicId,
-		    const XML_Char *notationName)
+static void XMLCALL
+metaEntityDecl(void *userData,
+               const XML_Char *entityName,
+               int  is_param,
+               const XML_Char *value,
+               int  value_length,
+               const XML_Char *base,
+               const XML_Char *systemId,
+               const XML_Char *publicId,
+               const XML_Char *notationName)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
 
   if (value) {
@@ -482,11 +516,12 @@ void metaEntityDecl(XML_Parser parser,
   }
 }
 
-static
-void metaStartNamespaceDecl(XML_Parser parser,
-			    const XML_Char *prefix,
-			    const XML_Char *uri)
+static void XMLCALL
+metaStartNamespaceDecl(void *userData,
+                       const XML_Char *prefix,
+                       const XML_Char *uri)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   fputts(T("<startns"), fp);
   if (prefix)
@@ -500,9 +535,10 @@ void metaStartNamespaceDecl(XML_Parser p
     fputts(T("/>\n"), fp);
 }
 
-static
-void metaEndNamespaceDecl(XML_Parser parser, const XML_Char *prefix)
+static void XMLCALL
+metaEndNamespaceDecl(void *userData, const XML_Char *prefix)
 {
+  XML_Parser parser = (XML_Parser) userData;
   FILE *fp = XML_GetUserData(parser);
   if (!prefix)
     fputts(T("<endns/>\n"), fp);
@@ -510,16 +546,14 @@ void metaEndNamespaceDecl(XML_Parser par
     ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
 }
 
-static
-int unknownEncodingConvert(void *data, const char *p)
+static int XMLCALL
+unknownEncodingConvert(void *data, const char *p)
 {
   return codepageConvert(*(int *)data, p);
 }
 
-static
-int unknownEncoding(void *userData,
-		    const XML_Char *name,
-		    XML_Encoding *info)
+static int XMLCALL
+unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
 {
   int cp;
   static const XML_Char prefixL[] = T("windows-");
@@ -554,30 +588,65 @@ int unknownEncoding(void *userData,
   return 1;
 }
 
-static
-int notStandalone(void *userData)
+static int XMLCALL
+notStandalone(void *userData)
 {
   return 0;
 }
 
-static
-void usage(const XML_Char *prog)
+static void
+showVersion(XML_Char *prog)
 {
-  ftprintf(stderr, T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] [-e encoding]
file ...\n"), prog);
-  exit(1);
+  XML_Char *s = prog;
+  XML_Char ch;
+  const XML_Feature *features = XML_GetFeatureList();
+  while ((ch = *s) != 0) {
+    if (ch == '/'
+#ifdef WIN32
+        || ch == '\\'
+#endif
+        )
+      prog = s + 1;
+    ++s;
+  }
+  ftprintf(stdout, T("%s using %s\n"), prog, XML_ExpatVersion());
+  if (features != NULL && features[0].feature != XML_FEATURE_END) {
+    int i = 1;
+    ftprintf(stdout, T("%s"), features[0].name);
+    if (features[0].value)
+      ftprintf(stdout, T("=%ld"), features[0].value);
+    while (features[i].feature != XML_FEATURE_END) {
+      ftprintf(stdout, T(", %s"), features[i].name);
+      if (features[i].value)
+        ftprintf(stdout, T("=%ld"), features[i].value);
+      ++i;
+    }
+    ftprintf(stdout, T("\n"));
+  }
 }
 
-int tmain(int argc, XML_Char **argv)
+static void
+usage(const XML_Char *prog, int rc)
+{
+  ftprintf(stderr,
+           T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] "
+             "[-e encoding] file ...\n"), prog);
+  exit(rc);
+}
+
+int
+tmain(int argc, XML_Char **argv)
 {
   int i, j;
-  const XML_Char *outputDir = 0;
-  const XML_Char *encoding = 0;
+  const XML_Char *outputDir = NULL;
+  const XML_Char *encoding = NULL;
   unsigned processFlags = XML_MAP_FILE;
   int windowsCodePages = 0;
   int outputType = 0;
   int useNamespaces = 0;
   int requireStandalone = 0;
   int paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
+  int useStdin = 0;
 
 #ifdef _MSC_VER
   _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
@@ -588,10 +657,10 @@ int tmain(int argc, XML_Char **argv)
   while (i < argc) {
     if (j == 0) {
       if (argv[i][0] != T('-'))
-	break;
+        break;
       if (argv[i][1] == T('-') && argv[i][2] == T('\0')) {
-	i++;
-	break;
+        i++;
+        break;
       }
       j++;
     }
@@ -634,39 +703,48 @@ int tmain(int argc, XML_Char **argv)
       break;
     case T('d'):
       if (argv[i][j + 1] == T('\0')) {
-	if (++i == argc)
-	  usage(argv[0]);
-	outputDir = argv[i];
+        if (++i == argc)
+          usage(argv[0], 2);
+        outputDir = argv[i];
       }
       else
-	outputDir = argv[i] + j + 1;
+        outputDir = argv[i] + j + 1;
       i++;
       j = 0;
       break;
     case T('e'):
       if (argv[i][j + 1] == T('\0')) {
-	if (++i == argc)
-	  usage(argv[0]);
-	encoding = argv[i];
+        if (++i == argc)
+          usage(argv[0], 2);
+        encoding = argv[i];
       }
       else
-	encoding = argv[i] + j + 1;
+        encoding = argv[i] + j + 1;
       i++;
       j = 0;
       break;
+    case T('h'):
+      usage(argv[0], 0);
+      return 0;
+    case T('v'):
+      showVersion(argv[0]);
+      return 0;
     case T('\0'):
       if (j > 1) {
-	i++;
-	j = 0;
-	break;
+        i++;
+        j = 0;
+        break;
       }
       /* fall through */
     default:
-      usage(argv[0]);
+      usage(argv[0], 2);
     }
   }
-  if (i == argc)
-    usage(argv[0]);
+  if (i == argc) {
+    useStdin = 1;
+    processFlags &= ~XML_MAP_FILE;
+    i--;
+  }
   for (; i < argc; i++) {
     FILE *fp = 0;
     XML_Char *outName = 0;
@@ -681,28 +759,29 @@ int tmain(int argc, XML_Char **argv)
     XML_SetParamEntityParsing(parser, paramEntityParsing);
     if (outputType == 't') {
       /* This is for doing timings; this gives a more realistic estimate of
-	 the parsing time. */
+         the parsing time. */
       outputDir = 0;
       XML_SetElementHandler(parser, nopStartElement, nopEndElement);
       XML_SetCharacterDataHandler(parser, nopCharacterData);
       XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
     }
     else if (outputDir) {
-      const XML_Char *file = argv[i];
+      const XML_Char *file = useStdin ? T("STDIN") : argv[i];
       if (tcsrchr(file, T('/')))
-	file = tcsrchr(file, T('/')) + 1;
+        file = tcsrchr(file, T('/')) + 1;
 #ifdef WIN32
       if (tcsrchr(file, T('\\')))
-	file = tcsrchr(file, T('\\')) + 1;
+        file = tcsrchr(file, T('\\')) + 1;
 #endif
-      outName = malloc((tcslen(outputDir) + tcslen(file) + 2) * sizeof(XML_Char));
+      outName = malloc((tcslen(outputDir) + tcslen(file) + 2)
+                       * sizeof(XML_Char));
       tcscpy(outName, outputDir);
       tcscat(outName, T("/"));
       tcscat(outName, file);
       fp = tfopen(outName, T("wb"));
       if (!fp) {
-	tperror(outName);
-	exit(1);
+        tperror(outName);
+        exit(1);
       }
       setvbuf(fp, NULL, _IOFBF, 16384);
 #ifdef XML_UNICODE
@@ -711,46 +790,50 @@ int tmain(int argc, XML_Char **argv)
       XML_SetUserData(parser, fp);
       switch (outputType) {
       case 'm':
-	XML_UseParserAsHandlerArg(parser);
-	XML_SetElementHandler(parser, metaStartElement, metaEndElement);
-	XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction);
-	XML_SetCommentHandler(parser, metaComment);
-	XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection);
-	XML_SetCharacterDataHandler(parser, metaCharacterData);
-	XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, metaEndDoctypeDecl);
-	XML_SetEntityDeclHandler(parser, metaEntityDecl);
-	XML_SetNotationDeclHandler(parser, metaNotationDecl);
-	XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl);
-	metaStartDocument(parser);
-	break;
+        XML_UseParserAsHandlerArg(parser);
+        XML_SetElementHandler(parser, metaStartElement, metaEndElement);
+        XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction);
+        XML_SetCommentHandler(parser, metaComment);
+        XML_SetCdataSectionHandler(parser, metaStartCdataSection,
+                                   metaEndCdataSection);
+        XML_SetCharacterDataHandler(parser, metaCharacterData);
+        XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl,
+                                  metaEndDoctypeDecl);
+        XML_SetEntityDeclHandler(parser, metaEntityDecl);
+        XML_SetNotationDeclHandler(parser, metaNotationDecl);
+        XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl,
+                                    metaEndNamespaceDecl);
+        metaStartDocument(parser);
+        break;
       case 'c':
-	XML_UseParserAsHandlerArg(parser);
-	XML_SetDefaultHandler(parser, markup);
-	XML_SetElementHandler(parser, defaultStartElement, defaultEndElement);
-	XML_SetCharacterDataHandler(parser, defaultCharacterData);
-	XML_SetProcessingInstructionHandler(parser, defaultProcessingInstruction);
-	break;
+        XML_UseParserAsHandlerArg(parser);
+        XML_SetDefaultHandler(parser, markup);
+        XML_SetElementHandler(parser, defaultStartElement, defaultEndElement);
+        XML_SetCharacterDataHandler(parser, defaultCharacterData);
+        XML_SetProcessingInstructionHandler(parser,
+                                            defaultProcessingInstruction);
+        break;
       default:
-	if (useNamespaces)
-	  XML_SetElementHandler(parser, startElementNS, endElementNS);
-	else
-	  XML_SetElementHandler(parser, startElement, endElement);
-	XML_SetCharacterDataHandler(parser, characterData);
+        if (useNamespaces)
+          XML_SetElementHandler(parser, startElementNS, endElementNS);
+        else
+          XML_SetElementHandler(parser, startElement, endElement);
+        XML_SetCharacterDataHandler(parser, characterData);
 #ifndef W3C14N
-	XML_SetProcessingInstructionHandler(parser, processingInstruction);
+        XML_SetProcessingInstructionHandler(parser, processingInstruction);
 #endif /* not W3C14N */
-	break;
+        break;
       }
     }
     if (windowsCodePages)
       XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0);
-    result = XML_ProcessFile(parser, argv[i], processFlags);
+    result = XML_ProcessFile(parser, useStdin ? NULL : argv[i], processFlags);
     if (outputDir) {
       if (outputType == 'm')
-	metaEndDocument(parser);
+        metaEndDocument(parser);
       fclose(fp);
       if (!result)
-	tremove(outName);
+        tremove(outName);
       free(outName);
     }
     XML_ParserFree(parser);

Modified: apr/apr-util/vendor/expat/current/xmlwf/xmlwin32url.cxx
URL: http://svn.apache.org/viewvc/apr/apr-util/vendor/expat/current/xmlwf/xmlwin32url.cxx?rev=1002549&r1=1002548&r2=1002549&view=diff
==============================================================================
--- apr/apr-util/vendor/expat/current/xmlwf/xmlwin32url.cxx (original)
+++ apr/apr-util/vendor/expat/current/xmlwf/xmlwin32url.cxx Wed Sep 29 09:59:04 2010
@@ -1,4 +1,4 @@
-#include "xmlparse.h"
+#include "expat.h"
 #ifdef XML_UNICODE
 #define UNICODE
 #endif
@@ -10,8 +10,8 @@
 #include "xmlurl.h"
 #include "xmlmime.h"
 
-static
-int processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url);
+static int
+processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url);
 
 typedef void (*StopHandler)(void *, HRESULT);
 
@@ -32,7 +32,8 @@ public:
   STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *);
   Callback(XML_Parser, IMoniker *, StopHandler, void *);
   ~Callback();
-  int externalEntityRef(const XML_Char *context, const XML_Char *systemId, const XML_Char
*publicId);
+  int externalEntityRef(const XML_Char *context,
+                        const XML_Char *systemId, const XML_Char *publicId);
 private:
   XML_Parser parser_;
   IMoniker *baseMoniker_;
@@ -43,12 +44,14 @@ private:
   void *stopArg_;
 };
 
-STDMETHODIMP_(ULONG) Callback::AddRef()
+STDMETHODIMP_(ULONG)
+Callback::AddRef()
 { 
   return ref_++;
 }
 
-STDMETHODIMP_(ULONG) Callback::Release()
+STDMETHODIMP_(ULONG)
+Callback::Release()
 { 
   if (--ref_ == 0) {
     delete this;
@@ -57,7 +60,8 @@ STDMETHODIMP_(ULONG) Callback::Release()
   return ref_;
 }
 
-STDMETHODIMP Callback::QueryInterface(REFIID riid, void** ppv)
+STDMETHODIMP
+Callback::QueryInterface(REFIID riid, void** ppv)
 { 
   if (IsEqualGUID(riid, IID_IUnknown))
     *ppv = (IUnknown *)this;
@@ -69,29 +73,34 @@ STDMETHODIMP Callback::QueryInterface(RE
   return S_OK;
 }
 
-STDMETHODIMP Callback::OnStartBinding(DWORD, IBinding* pBinding)
+STDMETHODIMP
+Callback::OnStartBinding(DWORD, IBinding* pBinding)
 {
   pBinding_ = pBinding;
   pBinding->AddRef();
   return S_OK;
 }
 
-STDMETHODIMP Callback::GetPriority(LONG *)
+STDMETHODIMP
+Callback::GetPriority(LONG *)
 {
   return E_NOTIMPL;
 }
 
-STDMETHODIMP Callback::OnLowResource(DWORD)
+STDMETHODIMP
+Callback::OnLowResource(DWORD)
 {
   return E_NOTIMPL;
 }
 
-STDMETHODIMP Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR)
+STDMETHODIMP
+Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR)
 {
   return S_OK;
 }
 
-STDMETHODIMP Callback::OnStopBinding(HRESULT hr, LPCWSTR szError)
+STDMETHODIMP
+Callback::OnStopBinding(HRESULT hr, LPCWSTR szError)
 {
   if (pBinding_) {
     pBinding_->Release();
@@ -105,14 +114,15 @@ STDMETHODIMP Callback::OnStopBinding(HRE
   return S_OK;
 }
 
-STDMETHODIMP Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo)
+STDMETHODIMP
+Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo)
 {
   *pgrfBINDF = BINDF_ASYNCHRONOUS;
   return S_OK;
 }
 
-static
-void reportError(XML_Parser parser)
+static void
+reportError(XML_Parser parser)
 {
   int code = XML_GetErrorCode(parser);
   const XML_Char *message = XML_ErrorString(code);
@@ -123,23 +133,27 @@ void reportError(XML_Parser parser)
 	     XML_GetErrorColumnNumber(parser),
 	     message);
   else
-    _ftprintf(stderr, _T("%s: (unknown message %d)\n"), XML_GetBase(parser), code);
+    _ftprintf(stderr, _T("%s: (unknown message %d)\n"),
+              XML_GetBase(parser), code);
 }
 
-STDMETHODIMP Callback::OnDataAvailable(DWORD grfBSCF,
-				       DWORD dwSize,
-				       FORMATETC *pfmtetc,
-				       STGMEDIUM* pstgmed)
+STDMETHODIMP
+Callback::OnDataAvailable(DWORD grfBSCF,
+                          DWORD dwSize,
+                          FORMATETC *pfmtetc,
+                          STGMEDIUM* pstgmed)
 {
   if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) {
     IWinInetHttpInfo *hp;
-    HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo, (void **)&hp);
+    HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo,
+                                           (void **)&hp);
     if (SUCCEEDED(hr)) {
       char contentType[1024];
       DWORD bufSize = sizeof(contentType);
       DWORD flags = 0;
       contentType[0] = 0;
-      hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType, &bufSize, 0, NULL);
+      hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType,
+                         &bufSize, 0, NULL);
       if (SUCCEEDED(hr)) {
 	char charset[CHARSET_MAX];
 	getXMLCharset(contentType, charset);
@@ -189,12 +203,16 @@ STDMETHODIMP Callback::OnDataAvailable(D
   return S_OK;
 }
 
-STDMETHODIMP Callback::OnObjectAvailable(REFIID, IUnknown *)
+STDMETHODIMP
+Callback::OnObjectAvailable(REFIID, IUnknown *)
 {
   return S_OK;
 }
 
-int Callback::externalEntityRef(const XML_Char *context, const XML_Char *systemId, const
XML_Char *publicId)
+int
+Callback::externalEntityRef(const XML_Char *context,
+                            const XML_Char *systemId,
+                            const XML_Char *publicId)
 {
   XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0);
   XML_SetBase(entParser, systemId);
@@ -203,7 +221,8 @@ int Callback::externalEntityRef(const XM
   return ret;
 }
 
-Callback::Callback(XML_Parser parser, IMoniker *baseMoniker, StopHandler stopHandler, void
*stopArg)
+Callback::Callback(XML_Parser parser, IMoniker *baseMoniker,
+                   StopHandler stopHandler, void *stopArg)
 : parser_(parser),
   baseMoniker_(baseMoniker),
   ref_(0),
@@ -224,22 +243,22 @@ Callback::~Callback()
     baseMoniker_->Release();
 }
 
-static
-int externalEntityRef(void *arg,
-		      const XML_Char *context,
-		      const XML_Char *base,
-		      const XML_Char *systemId,
-		      const XML_Char *publicId)
+static int
+externalEntityRef(void *arg,
+                  const XML_Char *context,
+                  const XML_Char *base,
+                  const XML_Char *systemId,
+                  const XML_Char *publicId)
 {
   return ((Callback *)arg)->externalEntityRef(context, systemId, publicId);
 }
 
 
-static
-HRESULT openStream(XML_Parser parser,
-		   IMoniker *baseMoniker,
-		   const XML_Char *uri,
-		   StopHandler stopHandler, void *stopArg)
+static HRESULT
+openStream(XML_Parser parser,
+           IMoniker *baseMoniker,
+           const XML_Char *uri,
+           StopHandler stopHandler, void *stopArg)
 {
   if (!XML_SetBase(parser, uri))
     return E_OUTOFMEMORY;
@@ -289,8 +308,8 @@ struct QuitInfo {
   int stop;
 };
 
-static
-void winPerror(const XML_Char *url, HRESULT hr)
+static void
+winPerror(const XML_Char *url, HRESULT hr)
 {
   LPVOID buf;
   if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
@@ -318,7 +337,8 @@ void winPerror(const XML_Char *url, HRES
     _ftprintf(stderr, _T("%s: error %x\n"), url, hr);
 }
 
-static void threadQuit(void *p, HRESULT hr)
+static void
+threadQuit(void *p, HRESULT hr)
 {
   QuitInfo *qi = (QuitInfo *)p;
   qi->hr = hr;
@@ -326,19 +346,22 @@ static void threadQuit(void *p, HRESULT 
 }
 
 extern "C"
-int XML_URLInit()
+int
+XML_URLInit(void)
 {
   return SUCCEEDED(CoInitialize(0));
 }
 
 extern "C"
-void XML_URLUninit()
+void
+XML_URLUninit(void)
 {
   CoUninitialize();
 }
 
-static
-int processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url)
+static int
+processURL(XML_Parser parser, IMoniker *baseMoniker,
+           const XML_Char *url)
 {
   QuitInfo qi;
   qi.stop = 0;
@@ -363,9 +386,10 @@ int processURL(XML_Parser parser, IMonik
 }
 
 extern "C"
-int XML_ProcessURL(XML_Parser parser,
-		   const XML_Char *url,
-		   unsigned flags)
+int
+XML_ProcessURL(XML_Parser parser,
+               const XML_Char *url,
+               unsigned flags)
 {
   return processURL(parser, 0, url);
 }



Mime
View raw message