Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1545)

Side by Side Diff: third_party/libxml/src/testSchemas.c

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no iconv Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxml/src/testSAX.c ('k') | third_party/libxml/src/testThreads.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * testSchemas.c : a small tester program for Schema validation 2 * testSchemas.c : a small tester program for Schema validation
3 * 3 *
4 * See Copyright for the status of this software. 4 * See Copyright for the status of this software.
5 * 5 *
6 * Daniel.Veillard@w3.org 6 * Daniel.Veillard@w3.org
7 */ 7 */
8 8
9 #include "libxml.h" 9 #include "libxml.h"
10 #ifdef LIBXML_SCHEMAS_ENABLED 10 #ifdef LIBXML_SCHEMAS_ENABLED
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 #include <libxml/xmlmemory.h> 43 #include <libxml/xmlmemory.h>
44 #include <libxml/debugXML.h> 44 #include <libxml/debugXML.h>
45 #include <libxml/xmlschemas.h> 45 #include <libxml/xmlschemas.h>
46 #include <libxml/xmlschemastypes.h> 46 #include <libxml/xmlschemastypes.h>
47 47
48 #ifdef LIBXML_DEBUG_ENABLED 48 #ifdef LIBXML_DEBUG_ENABLED
49 static int debug = 0; 49 static int debug = 0;
50 #endif 50 #endif
51 static int noout = 0; 51 static int noout = 0;
52 #ifdef HAVE_SYS_MMAN_H 52 #ifdef HAVE_MMAP
53 static int memory = 0; 53 static int memory = 0;
54 #endif 54 #endif
55 55
56 56
57 int main(int argc, char **argv) { 57 int main(int argc, char **argv) {
58 int i; 58 int i;
59 int files = 0; 59 int files = 0;
60 xmlSchemaPtr schema = NULL; 60 xmlSchemaPtr schema = NULL;
61 61
62 for (i = 1; i < argc ; i++) { 62 for (i = 1; i < argc ; i++) {
63 #ifdef LIBXML_DEBUG_ENABLED 63 #ifdef LIBXML_DEBUG_ENABLED
64 if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) 64 if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
65 debug++; 65 debug++;
66 else 66 else
67 #endif 67 #endif
68 #ifdef HAVE_SYS_MMAN_H 68 #ifdef HAVE_MMAP
69 if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) { 69 if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) {
70 memory++; 70 memory++;
71 } else 71 } else
72 #endif 72 #endif
73 if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) { 73 if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) {
74 noout++; 74 noout++;
75 } 75 }
76 } 76 }
77 xmlLineNumbersDefault(1); 77 xmlLineNumbersDefault(1);
78 for (i = 1; i < argc ; i++) { 78 for (i = 1; i < argc ; i++) {
79 if (argv[i][0] != '-') { 79 if (argv[i][0] != '-') {
80 if (schema == NULL) { 80 if (schema == NULL) {
81 xmlSchemaParserCtxtPtr ctxt; 81 xmlSchemaParserCtxtPtr ctxt;
82 82
83 #ifdef HAVE_SYS_MMAN_H 83 #ifdef HAVE_MMAP
84 if (memory) { 84 if (memory) {
85 int fd; 85 int fd;
86 struct stat info; 86 struct stat info;
87 const char *base; 87 const char *base;
88 » » if (stat(argv[i], &info) < 0) 88 » » if (stat(argv[i], &info) < 0)
89 break; 89 break;
90 if ((fd = open(argv[i], O_RDONLY)) < 0) 90 if ((fd = open(argv[i], O_RDONLY)) < 0)
91 break; 91 break;
92 base = mmap(NULL, info.st_size, PROT_READ, 92 base = mmap(NULL, info.st_size, PROT_READ,
93 MAP_SHARED, fd, 0) ; 93 MAP_SHARED, fd, 0) ;
94 if (base == (void *) MAP_FAILED) 94 if (base == (void *) MAP_FAILED)
95 break; 95 break;
96 96
97 ctxt = xmlSchemaNewMemParserCtxt((char *)base,info.st_size); 97 ctxt = xmlSchemaNewMemParserCtxt((char *)base,info.st_size);
98 98
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (schema != NULL) 157 if (schema != NULL)
158 xmlSchemaFree(schema); 158 xmlSchemaFree(schema);
159 if (files == 0) { 159 if (files == 0) {
160 printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n", 160 printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n",
161 argv[0]); 161 argv[0]);
162 printf("\tParse the HTML files and output the result of the parsing\n"); 162 printf("\tParse the HTML files and output the result of the parsing\n");
163 #ifdef LIBXML_DEBUG_ENABLED 163 #ifdef LIBXML_DEBUG_ENABLED
164 printf("\t--debug : dump a debug tree of the in-memory document\n"); 164 printf("\t--debug : dump a debug tree of the in-memory document\n");
165 #endif 165 #endif
166 printf("\t--noout : do not print the result\n"); 166 printf("\t--noout : do not print the result\n");
167 #ifdef HAVE_SYS_MMAN_H 167 #ifdef HAVE_MMAP
168 printf("\t--memory : test the schemas in memory parsing\n"); 168 printf("\t--memory : test the schemas in memory parsing\n");
169 #endif 169 #endif
170 } 170 }
171 failed_schemas: 171 failed_schemas:
172 xmlSchemaCleanupTypes(); 172 xmlSchemaCleanupTypes();
173 xmlCleanupParser(); 173 xmlCleanupParser();
174 xmlMemoryDump(); 174 xmlMemoryDump();
175 175
176 return(0); 176 return(0);
177 } 177 }
178 178
179 #else 179 #else
180 #include <stdio.h> 180 #include <stdio.h>
181 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { 181 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
182 printf("%s : Schemas support not compiled in\n", argv[0]); 182 printf("%s : Schemas support not compiled in\n", argv[0]);
183 return(0); 183 return(0);
184 } 184 }
185 #endif /* LIBXML_SCHEMAS_ENABLED */ 185 #endif /* LIBXML_SCHEMAS_ENABLED */
OLDNEW
« no previous file with comments | « third_party/libxml/src/testSAX.c ('k') | third_party/libxml/src/testThreads.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698