[Expat-checkins] expat/xmlwf codepage.c,1.10,1.11 codepage.h,1.7,1.8 ct.c,1.3,1.4 filemap.h,1.7,1.8 readfilemap.c,1.8,1.9 unixfilemap.c,1.7,1.8 win32filemap.c,1.10,1.11 xmlfile.c,1.10,1.11 xmlfile.h,1.5,1.6 xmlmime.c,1.3,1.4 xmlmime.h,1.3,1.4 xmlwf.c,1.59,1.60
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Mon Jul 1 08:14:01 2002
Update of /cvsroot/expat/expat/xmlwf
In directory usw-pr-cvs1:/tmp/cvs-serv3235
Modified Files:
codepage.c codepage.h ct.c filemap.h readfilemap.c
unixfilemap.c win32filemap.c xmlfile.c xmlfile.h xmlmime.c
xmlmime.h xmlwf.c
Log Message:
De-tabify; minor code-style consistency changes.
Index: codepage.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/codepage.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- codepage.c 15 May 2002 15:57:22 -0000 1.10
+++ codepage.c 1 Jul 2002 15:13:00 -0000 1.11
@@ -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 "codepage.h"
@@ -11,7 +10,8 @@
#include <windows.h>
-int codepageMap(int cp, int *map)
+int
+codepageMap(int cp, int *map)
{
int i;
CPINFO info;
@@ -26,7 +26,7 @@
break;
lim = info.LeadByte[i + 1];
for (j = info.LeadByte[i]; j < lim; j++)
- map[j] = -2;
+ map[j] = -2;
}
}
for (i = 0; i < 256; i++) {
@@ -34,30 +34,33 @@
char c = (char)i;
unsigned short n;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
- &c, 1, &n, 1) == 1)
+ &c, 1, &n, 1) == 1)
map[i] = n;
}
}
return 1;
}
-int codepageConvert(int cp, const char *p)
+int
+codepageConvert(int cp, const char *p)
{
unsigned short c;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
- p, 2, &c, 1) == 1)
+ p, 2, &c, 1) == 1)
return c;
return -1;
}
#else /* not WIN32 */
-int codepageMap(int cp, int *map)
+int
+codepageMap(int cp, int *map)
{
return 0;
}
-int codepageConvert(int cp, const char *p)
+int
+codepageConvert(int cp, const char *p)
{
return -1;
}
Index: codepage.h
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/codepage.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- codepage.h 21 Sep 2000 21:20:18 -0000 1.7
+++ codepage.h 1 Jul 2002 15:13:01 -0000 1.8
@@ -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.
*/
int codepageMap(int cp, int *map);
Index: ct.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/ct.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ct.c 21 Apr 2000 04:20:31 -0000 1.3
+++ ct.c 1 Jul 2002 15:13:01 -0000 1.4
@@ -1,7 +1,7 @@
#define CHARSET_MAX 41
-static
-const char *getTok(const char **pp)
+static const char *
+getTok(const char **pp)
{
enum { inAtom, inString, init, inComment };
int state = init;
@@ -15,50 +15,50 @@
case '\t':
case '\n':
if (state == inAtom)
- return tokStart;
+ return tokStart;
break;
case '(':
if (state == inAtom)
- return tokStart;
+ return tokStart;
if (state != inString)
- state++;
+ state++;
break;
case ')':
if (state > init)
- --state;
+ --state;
else if (state != inString)
- return 0;
+ return 0;
break;
case ';':
case '/':
case '=':
if (state == inAtom)
- return tokStart;
+ return tokStart;
if (state == init)
- return (*pp)++;
+ return (*pp)++;
break;
case '\\':
++*pp;
if (**pp == '\0')
- return 0;
+ return 0;
break;
case '"':
switch (state) {
case inString:
- ++*pp;
- return tokStart;
+ ++*pp;
+ return tokStart;
case inAtom:
- return tokStart;
+ return tokStart;
case init:
- tokStart = *pp;
- state = inString;
- break;
+ tokStart = *pp;
+ state = inString;
+ break;
}
break;
default:
if (state == init) {
- tokStart = *pp;
- state = inAtom;
+ tokStart = *pp;
+ state = inAtom;
}
break;
}
@@ -69,8 +69,8 @@
/* key must be lowercase ASCII */
-static
-int matchkey(const char *start, const char *end, const char *key)
+static int
+matchkey(const char *start, const char *end, const char *key)
{
if (!start)
return 0;
@@ -80,7 +80,8 @@
return *key == '\0';
}
-void getXMLCharset(const char *buf, char *charset)
+void
+getXMLCharset(const char *buf, char *charset)
{
const char *next, *p;
@@ -102,33 +103,33 @@
if (*p == ';') {
p = getTok(&next);
if (matchkey(p, next, "charset")) {
- p = getTok(&next);
- if (p && *p == '=') {
- p = getTok(&next);
- if (p) {
- char *s = charset;
- if (*p == '"') {
- while (++p != next - 1) {
- if (*p == '\\')
- ++p;
- if (s == charset + CHARSET_MAX - 1) {
- charset[0] = '\0';
- break;
- }
- *s++ = *p;
- }
- *s++ = '\0';
- }
- else {
- if (next - p > CHARSET_MAX - 1)
- break;
- while (p != next)
- *s++ = *p++;
- *s = 0;
- break;
- }
- }
- }
+ p = getTok(&next);
+ if (p && *p == '=') {
+ p = getTok(&next);
+ if (p) {
+ char *s = charset;
+ if (*p == '"') {
+ while (++p != next - 1) {
+ if (*p == '\\')
+ ++p;
+ if (s == charset + CHARSET_MAX - 1) {
+ charset[0] = '\0';
+ break;
+ }
+ *s++ = *p;
+ }
+ *s++ = '\0';
+ }
+ else {
+ if (next - p > CHARSET_MAX - 1)
+ break;
+ while (p != next)
+ *s++ = *p++;
+ *s = 0;
+ break;
+ }
+ }
+ }
}
}
else
@@ -136,7 +137,8 @@
}
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
char buf[CHARSET_MAX];
getXMLCharset(argv[1], buf);
Index: filemap.h
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/filemap.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- filemap.h 21 Sep 2000 21:20:18 -0000 1.7
+++ filemap.h 1 Jul 2002 15:13:01 -0000 1.8
@@ -1,17 +1,17 @@
-/*
-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 <stddef.h>
#ifdef XML_UNICODE
int filemap(const wchar_t *name,
- void (*processor)(const void *, size_t, const wchar_t *, void *arg),
- void *arg);
+ void (*processor)(const void *, size_t,
+ const wchar_t *, void *arg),
+ void *arg);
#else
int filemap(const char *name,
- void (*processor)(const void *, size_t, const char *, void *arg),
- void *arg);
+ void (*processor)(const void *, size_t,
+ const char *, void *arg),
+ void *arg);
#endif
Index: readfilemap.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/readfilemap.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- readfilemap.c 9 Nov 2001 04:08:51 -0000 1.8
+++ readfilemap.c 1 Jul 2002 15:13:01 -0000 1.9
@@ -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 <sys/types.h>
@@ -29,9 +28,10 @@
#include "filemap.h"
-int filemap(const char *name,
- void (*processor)(const void *, size_t, const char *, void *arg),
- void *arg)
+int
+filemap(const char *name,
+ void (*processor)(const void *, size_t, const char *, void *arg),
+ void *arg)
{
size_t nbytes;
int fd;
Index: unixfilemap.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/unixfilemap.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- unixfilemap.c 25 Jul 2001 17:13:34 -0000 1.7
+++ unixfilemap.c 1 Jul 2002 15:13:01 -0000 1.8
@@ -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 <sys/types.h>
@@ -18,9 +17,10 @@
#include "filemap.h"
-int filemap(const char *name,
- void (*processor)(const void *, size_t, const char *, void *arg),
- void *arg)
+int
+filemap(const char *name,
+ void (*processor)(const void *, size_t, const char *, void *arg),
+ void *arg)
{
int fd;
size_t nbytes;
@@ -42,10 +42,10 @@
fprintf(stderr, "%s: not a regular file\n", name);
return 0;
}
-
+
nbytes = sb.st_size;
p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ,
- MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
+ MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
if (p == (void *)-1) {
perror(name);
close(fd);
Index: win32filemap.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/win32filemap.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- win32filemap.c 21 Sep 2000 21:20:18 -0000 1.10
+++ win32filemap.c 1 Jul 2002 15:13:01 -0000 1.11
@@ -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.
*/
#define STRICT 1
@@ -23,9 +22,10 @@
static void win32perror(const TCHAR *);
-int filemap(const TCHAR *name,
- void (*processor)(const void *, size_t, const TCHAR *, void *arg),
- void *arg)
+int
+filemap(const TCHAR *name,
+ void (*processor)(const void *, size_t, const TCHAR *, void *arg),
+ void *arg)
{
HANDLE f;
HANDLE m;
@@ -34,7 +34,7 @@
void *p;
f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
- FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (f == INVALID_HANDLE_VALUE) {
win32perror(name);
return 0;
@@ -75,17 +75,18 @@
return 1;
}
-static
-void win32perror(const TCHAR *s)
+static void
+win32perror(const TCHAR *s)
{
LPVOID buf;
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buf,
- 0,
- NULL)) {
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
+ | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &buf,
+ 0,
+ NULL)) {
_ftprintf(stderr, _T("%s: %s"), s, buf);
fflush(stderr);
LocalFree(buf);
Index: xmlfile.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlfile.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- xmlfile.c 13 Jun 2002 02:52:09 -0000 1.10
+++ xmlfile.c 1 Jul 2002 15:13:01 -0000 1.11
@@ -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>
@@ -41,7 +40,6 @@
#endif
-
typedef struct {
XML_Parser parser;
int *retPtr;
@@ -54,17 +52,17 @@
const XML_Char *message = XML_ErrorString(code);
if (message)
ftprintf(stdout, T("%s:%d:%d: %s\n"),
- filename,
- XML_GetErrorLineNumber(parser),
- XML_GetErrorColumnNumber(parser),
- message);
+ filename,
+ XML_GetErrorLineNumber(parser),
+ XML_GetErrorColumnNumber(parser),
+ message);
else
ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code);
}
static void
processFile(const void *data, size_t size,
- const XML_Char *filename, void *args)
+ const XML_Char *filename, void *args)
{
XML_Parser parser = ((PROCESS_ARGS *)args)->parser;
int *retPtr = ((PROCESS_ARGS *)args)->retPtr;
@@ -88,7 +86,7 @@
static const XML_Char *
resolveSystemId(const XML_Char *base, const XML_Char *systemId,
- XML_Char **toFree)
+ XML_Char **toFree)
{
XML_Char *s;
*toFree = 0;
@@ -101,7 +99,7 @@
)
return systemId;
*toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)
- * sizeof(XML_Char));
+ * sizeof(XML_Char));
if (!*toFree)
return systemId;
tcscpy(*toFree, base);
@@ -118,10 +116,10 @@
static int
externalEntityRefFilemap(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *context,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId)
{
int result;
XML_Char *s;
@@ -157,27 +155,27 @@
char *buf = XML_GetBuffer(parser, READ_SIZE);
if (!buf) {
if (filename != NULL)
- close(fd);
+ close(fd);
ftprintf(stderr, T("%s: out of memory\n"),
- filename != NULL ? filename : "xmlwf");
+ filename != NULL ? filename : "xmlwf");
return 0;
}
nread = read(fd, buf, READ_SIZE);
if (nread < 0) {
tperror(filename != NULL ? filename : "STDIN");
if (filename != NULL)
- close(fd);
+ close(fd);
return 0;
}
if (!XML_ParseBuffer(parser, nread, nread == 0)) {
reportError(parser, filename != NULL ? filename : "STDIN");
if (filename != NULL)
- close(fd);
+ close(fd);
return 0;
}
if (nread == 0) {
if (filename != NULL)
- close(fd);
+ close(fd);
break;;
}
}
@@ -186,10 +184,10 @@
static int
externalEntityRefStream(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *context,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId)
{
XML_Char *s;
const XML_Char *filename;
@@ -205,8 +203,8 @@
int
XML_ProcessFile(XML_Parser parser,
- const XML_Char *filename,
- unsigned flags)
+ const XML_Char *filename,
+ unsigned flags)
{
int result;
@@ -217,9 +215,9 @@
if (flags & XML_EXTERNAL_ENTITIES)
XML_SetExternalEntityRefHandler(parser,
- (flags & XML_MAP_FILE)
- ? externalEntityRefFilemap
- : externalEntityRefStream);
+ (flags & XML_MAP_FILE)
+ ? externalEntityRefFilemap
+ : externalEntityRefStream);
if (flags & XML_MAP_FILE) {
PROCESS_ARGS args;
args.retPtr = &result;
Index: xmlfile.h
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlfile.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xmlfile.h 21 Sep 2000 21:20:18 -0000 1.5
+++ xmlfile.h 1 Jul 2002 15:13:01 -0000 1.6
@@ -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.
*/
#define XML_MAP_FILE 01
Index: xmlmime.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlmime.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xmlmime.c 21 Apr 2000 04:20:31 -0000 1.3
+++ xmlmime.c 1 Jul 2002 15:13:02 -0000 1.4
@@ -1,8 +1,8 @@
#include <string.h>
#include "xmlmime.h"
-static
-const char *getTok(const char **pp)
+static const char *
+getTok(const char **pp)
{
/* inComment means one level of nesting; inComment+1 means two levels etc */
enum { inAtom, inString, init, inComment };
@@ -12,57 +12,57 @@
switch (**pp) {
case '\0':
if (state == inAtom)
- return tokStart;
+ return tokStart;
return 0;
case ' ':
case '\r':
case '\t':
case '\n':
if (state == inAtom)
- return tokStart;
+ return tokStart;
break;
case '(':
if (state == inAtom)
- return tokStart;
+ return tokStart;
if (state != inString)
- state++;
+ state++;
break;
case ')':
if (state > init)
- --state;
+ --state;
else if (state != inString)
- return 0;
+ return 0;
break;
case ';':
case '/':
case '=':
if (state == inAtom)
- return tokStart;
+ return tokStart;
if (state == init)
- return (*pp)++;
+ return (*pp)++;
break;
case '\\':
++*pp;
if (**pp == '\0')
- return 0;
+ return 0;
break;
case '"':
switch (state) {
case inString:
- ++*pp;
- return tokStart;
+ ++*pp;
+ return tokStart;
case inAtom:
- return tokStart;
+ return tokStart;
case init:
- tokStart = *pp;
- state = inString;
- break;
+ tokStart = *pp;
+ state = inString;
+ break;
}
break;
default:
if (state == init) {
- tokStart = *pp;
- state = inAtom;
+ tokStart = *pp;
+ state = inAtom;
}
break;
}
@@ -73,8 +73,8 @@
/* key must be lowercase ASCII */
-static
-int matchkey(const char *start, const char *end, const char *key)
+static int
+matchkey(const char *start, const char *end, const char *key)
{
if (!start)
return 0;
@@ -84,7 +84,8 @@
return *key == '\0';
}
-void getXMLCharset(const char *buf, char *charset)
+void
+getXMLCharset(const char *buf, char *charset)
{
const char *next, *p;
@@ -108,34 +109,34 @@
if (*p == ';') {
p = getTok(&next);
if (matchkey(p, next, "charset")) {
- p = getTok(&next);
- if (p && *p == '=') {
- p = getTok(&next);
- if (p) {
- char *s = charset;
- if (*p == '"') {
- while (++p != next - 1) {
- if (*p == '\\')
- ++p;
- if (s == charset + CHARSET_MAX - 1) {
- charset[0] = '\0';
- break;
- }
- *s++ = *p;
- }
- *s++ = '\0';
- }
- else {
- if (next - p > CHARSET_MAX - 1)
- break;
- while (p != next)
- *s++ = *p++;
- *s = 0;
- break;
- }
- }
- }
- break;
+ p = getTok(&next);
+ if (p && *p == '=') {
+ p = getTok(&next);
+ if (p) {
+ char *s = charset;
+ if (*p == '"') {
+ while (++p != next - 1) {
+ if (*p == '\\')
+ ++p;
+ if (s == charset + CHARSET_MAX - 1) {
+ charset[0] = '\0';
+ break;
+ }
+ *s++ = *p;
+ }
+ *s++ = '\0';
+ }
+ else {
+ if (next - p > CHARSET_MAX - 1)
+ break;
+ while (p != next)
+ *s++ = *p++;
+ *s = 0;
+ break;
+ }
+ }
+ }
+ break;
}
}
else
@@ -147,7 +148,8 @@
#include <stdio.h>
-int main(int argc, char **argv)
+int
+main(int argc, char *argv[])
{
char buf[CHARSET_MAX];
if (argc <= 1)
Index: xmlmime.h
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlmime.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xmlmime.h 21 Apr 2000 04:20:31 -0000 1.3
+++ xmlmime.h 1 Jul 2002 15:13:02 -0000 1.4
@@ -1,4 +1,3 @@
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -8,9 +7,10 @@
#define CHARSET_MAX 41
/* Figure out the charset to use from the ContentType.
-buf contains the body of the header field (the part after "Content-Type:").
-charset gets the charset to use. It must be at least CHARSET_MAX chars long.
-charset will be empty if the default charset should be used. */
+ buf contains the body of the header field (the part after "Content-Type:").
+ charset gets the charset to use. It must be at least CHARSET_MAX chars
+ long. charset will be empty if the default charset should be used.
+*/
void getXMLCharset(const char *buf, char *charset);
Index: xmlwf.c
===================================================================
RCS file: /cvsroot/expat/expat/xmlwf/xmlwf.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- xmlwf.c 17 May 2002 17:21:51 -0000 1.59
+++ xmlwf.c 1 Jul 2002 15:13:02 -0000 1.60
@@ -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>
@@ -230,7 +229,7 @@
static void
processingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
+ const XML_Char *data)
{
FILE *fp = userData;
puttc(T('<'), fp);
@@ -252,7 +251,7 @@
static void
defaultStartElement(XML_Parser parser, const XML_Char *name,
- const XML_Char **atts)
+ const XML_Char **atts)
{
XML_DefaultCurrent(parser);
}
@@ -265,7 +264,7 @@
static void
defaultProcessingInstruction(XML_Parser parser, const XML_Char *target,
- const XML_Char *data)
+ const XML_Char *data)
{
XML_DefaultCurrent(parser);
}
@@ -287,7 +286,7 @@
static void
nopProcessingInstruction(XML_Parser parser, const XML_Char *target,
- const XML_Char *data)
+ const XML_Char *data)
{
}
@@ -307,10 +306,10 @@
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
@@ -327,7 +326,7 @@
static void
metaStartElement(XML_Parser parser, const XML_Char *name,
- const XML_Char **atts)
+ const XML_Char **atts)
{
FILE *fp = XML_GetUserData(parser);
const XML_Char **specifiedAttsEnd
@@ -347,11 +346,11 @@
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);
}
@@ -370,7 +369,7 @@
static void
metaProcessingInstruction(XML_Parser parser, const XML_Char *target,
- const XML_Char *data)
+ const XML_Char *data)
{
FILE *fp = XML_GetUserData(parser);
ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
@@ -422,10 +421,10 @@
static void
metaStartDoctypeDecl(XML_Parser parser,
- const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset)
+ const XML_Char *doctypeName,
+ const XML_Char *sysid,
+ const XML_Char *pubid,
+ int has_internal_subset)
{
FILE *fp = XML_GetUserData(parser);
ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
@@ -444,10 +443,10 @@
static void
metaNotationDecl(XML_Parser parser,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *notationName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId)
{
FILE *fp = XML_GetUserData(parser);
ftprintf(fp, T("<notation name=\"%s\""), notationName);
@@ -465,14 +464,14 @@
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)
+ 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)
{
FILE *fp = XML_GetUserData(parser);
@@ -508,8 +507,8 @@
static void
metaStartNamespaceDecl(XML_Parser parser,
- const XML_Char *prefix,
- const XML_Char *uri)
+ const XML_Char *prefix,
+ const XML_Char *uri)
{
FILE *fp = XML_GetUserData(parser);
fputts(T("<startns"), fp);
@@ -599,8 +598,8 @@
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);
+ T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] "
+ "[-e encoding] file ...\n"), prog);
exit(rc);
}
@@ -627,10 +626,10 @@
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++;
}
@@ -673,23 +672,23 @@
break;
case T('d'):
if (argv[i][j + 1] == T('\0')) {
- if (++i == argc)
- usage(argv[0], 2);
- 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], 2);
- 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;
@@ -701,9 +700,9 @@
return 0;
case T('\0'):
if (j > 1) {
- i++;
- j = 0;
- break;
+ i++;
+ j = 0;
+ break;
}
/* fall through */
default:
@@ -729,7 +728,7 @@
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);
@@ -738,20 +737,20 @@
else if (outputDir) {
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));
+ * 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
@@ -760,39 +759,39 @@
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)
@@ -800,10 +799,10 @@
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);