summaryrefslogtreecommitdiff
path: root/textproc/rxp/files/patch-warnings
blob: 2e9d48276e02be73f6e892bc9c39328d0bb8499e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
--- catalog/catalog_dtd.c	2003-06-24 09:15:55.000000000 -0400
+++ catalog/catalog_dtd.c	2021-02-25 15:07:41.462399000 -0500
@@ -23,9 +23,9 @@
  */
 
-static char *xml_catalog_public_id = "-//OASIS//DTD XML Catalogs V1.0//EN";
-static char *xml_catalog_system_id = 
+static const char *xml_catalog_public_id = "-//OASIS//DTD XML Catalogs V1.0//EN";
+static const char *xml_catalog_system_id = 
     "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";
 
-static char xml_catalog_dtd[] =
+static const char xml_catalog_dtd[] =
 "<!ENTITY % pubIdChars \"CDATA\">\n"
 "<!ENTITY % publicIdentifier \"%pubIdChars;\">\n"
--- catalog/catalog.c	2004-10-11 08:28:31.000000000 -0400
+++ catalog/catalog.c	2021-02-25 15:07:41.463274000 -0500
@@ -20,5 +20,5 @@ static Parser OpenXMLDocument(char *uri)
 static void CloseXMLDocument(Parser p);
 static int SkipElement(XBit bit, Parser p);
-static InputSource special_opener(Entity ent, void *arg);
+static EntityOpenerProc special_opener;
 
 typedef enum catalog_entry_type {
@@ -36,5 +36,5 @@ const char *PreferName[PR_enum_count] =
 /* An empty catalog file, returned if a file cannot be read because of
    a resource error */
-struct catalog_entry_file catalog_resource_error_data;
+static struct catalog_entry_file catalog_resource_error_data;
 CatalogEntryFile catalog_resource_error = &catalog_resource_error_data;
 
@@ -131,10 +131,11 @@ void FreeCatalogEntryFile(CatalogEntryFi
  */
 
-CatalogEntryFile ReadCatalogEntryFile(char *catalog_uri)
+CatalogEntryFile ReadCatalogEntryFile(const char *catalog_uri)
 {
     Parser p;
     CatalogEntryFile c;
+    char *normalized;
 
-    if(!(catalog_uri = NormalizeSystem8(catalog_uri)))
+    if(!(normalized = NormalizeSystem8(catalog_uri)))
 	return 0;
 
@@ -143,5 +144,5 @@ CatalogEntryFile ReadCatalogEntryFile(ch
 #endif
 
-    if(!(p = OpenXMLDocument(catalog_uri)))
+    if(!(p = OpenXMLDocument(normalized)))
 	return catalog_resource_error;
     
@@ -166,9 +167,9 @@ CatalogEntryFile ReadCatalogEntryFile(ch
 	{
 	case XBIT_eof:
-	    Free(catalog_uri);
+	    Free(normalized);
 	    CloseXMLDocument(p);
 	    return c;
 	case XBIT_error:
-	    Free(catalog_uri);
+	    Free(normalized);
 	    ParserPerror(p, bit);
 	    FreeXBit(bit);
@@ -183,5 +184,5 @@ CatalogEntryFile ReadCatalogEntryFile(ch
 	    {
 		c = (p->state == PS_error) ? catalog_resource_error : 0;
-		Free(catalog_uri);
+		Free(normalized);
 		FreeCatalogEntryFile(c);
 		CloseXMLDocument(p);
@@ -196,10 +197,10 @@ CatalogEntryFile ReadCatalogEntryFile(ch
 }
 
-struct entry_info
+static struct entry_info
 {
-    char *name;
+    const char *name;
     CatalogEntryType type;
-    char *match_attr;
-    char *value_attr;
+    const char *match_attr;
+    const char *value_attr;
     enum {norm_public, norm_system, norm_prefer, norm_none} norm_match;
 } elements[] =
@@ -217,5 +218,5 @@ struct entry_info
     {"group", CN_group, "prefer", 0, norm_prefer},
 };
-int nelements = sizeof(elements) / sizeof(elements[0]);
+static int nelements = sizeof(elements) / sizeof(elements[0]);
 
 static int DoElement(XBit bit, Parser p, CatalogEntryFile c, 
@@ -469,5 +470,5 @@ static Parser OpenXMLDocument(char *uri)
 #include "catalog_dtd.c"
 
-static InputSource special_opener(Entity ent, void *arg)
+static InputSource special_opener(Entity ent, void *arg __unused)
 {
     if((ent->publicid && strcmp(ent->publicid, xml_catalog_public_id) == 0) ||
@@ -607,5 +608,5 @@ void FreeCatalog(Catalog catalog)
 
 /* NB not thread safe! */
-CatalogEntryFile GetCatalogEntryFile(Catalog catalog, char *catalog_uri)
+CatalogEntryFile GetCatalogEntryFile(Catalog catalog, const char *catalog_uri)
 {
     int i;
--- catalog/catalog.h	2003-08-28 12:13:19.000000000 -0400
+++ catalog/catalog.h	2021-02-25 15:07:41.463639000 -0500
@@ -48,13 +48,13 @@ extern void FreeCatalogEntry(CatalogEntr
 
 extern CatalogEntryFile catalog_resource_error;
-extern CatalogEntryFile ReadCatalogEntryFile(char *catalog_uri);
+extern CatalogEntryFile ReadCatalogEntryFile(const char *catalog_uri);
 extern void FreeCatalogEntryFile(CatalogEntryFile c);
 
-extern CatalogEntryFile GetCatalogEntryFile(Catalog catalog, char *catalog_uri);
+extern CatalogEntryFile GetCatalogEntryFile(Catalog catalog, const char *catalog_uri);
 
 extern char *ResolveExternalIdentifier(Catalog catalog, 
 				       const char *public, const char *system,
 				       Prefer prefer);
-extern char *ResolveURI(Catalog catalog, const char *uri);
+extern const char *ResolveURI(Catalog catalog, const char *uri);
 
 extern void CatalogEnable(Parser p);
--- catalog/catutil.c	2003-06-24 11:55:27.000000000 -0400
+++ catalog/catutil.c	2021-02-25 15:07:41.464062000 -0500
@@ -35,5 +35,5 @@ char *norm_pub(const char8 *public8, con
 {
     int len = public8 ? strlen(public8) : strlen16(public16);
-    int i, j, c, in_space;
+    int i, j, in_space;
     char *new_public;
 
@@ -75,5 +75,5 @@ char *norm_pub(const char8 *public8, con
     while(j > 0)
     {
-	c = new_public[j-1];
+	int c = new_public[j-1];
 	if(c == ' ' || c == '\t' || c == '\r' || c == '\n')
 	    j--;
@@ -280,9 +280,9 @@ int percent_escape(int c, char *buf)
 int IsPublicidUrn(const char *id)
 {
-#if 0
+#if 1
     return id && strncasecmp(id, "urn:publicid:", 13) == 0;
 #else
     /* guess who doesn't provide strncasecmp */
-    static char *p = "urn:publicid:";
+    static const char *p = "urn:publicid:";
     int i;
 
--- src/dtd.c	2004-11-02 13:20:20.000000000 -0500
+++ src/dtd.c	2021-02-25 15:07:41.475773000 -0500
@@ -173,12 +173,11 @@ void FreeDtd(Dtd dtd)
  */
 
-Entity NewExternalEntity(const Char *name, const char8 *publicid,
-			  const char8 *systemid, NotationDefinition notation,
-			  Entity parent)
+Entity NewExternalEntity(const Char *name, char8 *publicid,
+			 const char8 *systemid, NotationDefinition notation,
+			 Entity parent)
 {
-    if(systemid && !(systemid = strdup8(systemid)))
-	return 0;
-    if(publicid && !(publicid = strdup8(publicid)))
+    if(publicid && !(publicid = strdup8(publicid))) {
 	return 0;
+    }
     return NewExternalEntityN(name, name ? Strlen(name) : 0, publicid,
 			      systemid, notation, parent);
@@ -187,5 +186,5 @@ Entity NewExternalEntity(const Char *nam
 /* NB doesn't copy IDs */
 
-Entity NewExternalEntityN(const Char *name, int namelen, const char8 *publicid,
+Entity NewExternalEntityN(const Char *name, int namelen, char8 *publicid,
 			  const char8 *systemid, NotationDefinition notation,
 			  Entity parent)
@@ -193,11 +192,13 @@ Entity NewExternalEntityN(const Char *na
     Entity e;
 
-    if(!(e = Malloc(sizeof(*e))))
-	return 0;
-    if(name && !(name = Strndup(name, namelen)))
-	    return 0;
+    if (!(e = Malloc(sizeof(*e))))
+	return NULL;
+    if (name) {
+	if (!(e->name = Strndup(name, namelen)))
+	    return NULL;
+    } else
+    	e->name = NULL;
 
     e->type = ET_external;
-    e->name = name;
     e->base_url = 0;
     e->encoding = CE_unknown;
@@ -233,10 +234,11 @@ Entity NewInternalEntityN(const Char *na
     if(!(e = Malloc(sizeof(*e))))
 	return 0;
-    if(name)
-	if(!(name = Strndup(name, namelen)))
-	    return 0;
+    if(name) {
+	if(!(e->name = Strndup(name, namelen)))
+	    return NULL;
+    } else
+        e->name = NULL;
 
     e->type = ET_internal;
-    e->name = name;
     e->base_url = 0;
     e->encoding = InternalCharacterEncoding;
@@ -276,18 +278,19 @@ void FreeEntity(Entity e)
 	return;
 
-    Free((void *)e->name);	/* The casts are to get rid of the const */
-    Free((void *)e->base_url);
-    Free((void *)e->url);
+    if (e->name)
+	Free(e->name);
+    Free(e->base_url);
+    Free(e->url);
     
     switch(e->type)
     {
     case ET_internal:
-	Free((void *)e->text);
+	Free((void *)e->atext);
 	break;
     case ET_external:
-	Free((void *)e->systemid);
-	Free((void *)e->publicid);
-	Free((void *)e->version_decl);
-	Free((void *)e->ddb_filename);
+	/* Free((void *)e->systemid); XXX const string passed by client */
+	Free(e->publicid);
+	Free(e->version_decl);
+	Free(e->ddb_filename);
 	break;
     }
@@ -416,5 +419,5 @@ ElementDefinition DefineElementN(Dtd dtd
 {
     ElementDefinition e;
-    Char *t;
+    const Char *t;
 #ifdef FOR_LT
     RHTEntry *entry;
@@ -448,10 +451,9 @@ ElementDefinition DefineElementN(Dtd dtd
     name = (Char *)dtd->doctype->elements+entry->keyptr;
 #else
-    if(!(name = Strndup(name, namelen)))
+    if(!(e->name = Strndup(name, namelen)))
 	return 0;
 #endif
 
     e->tentative = 0;
-    e->name = name;
     e->namelen = namelen;
     e->type = type;
@@ -624,5 +626,5 @@ AttributeDefinition
     DefineAttributeN(ElementDefinition element, const Char *name, int namelen,
 		     AttributeType type, Char **allowed_values,
-		     DefaultType default_type, const Char *default_value,
+		     DefaultType default_type, Char *default_value,
 		     int declared)
 {
@@ -637,5 +639,5 @@ AttributeDefinition
     static Char xml_id[] = {'x','m','l',':','i','d',0};
     static Char xmlns[] = {'x','m','l','n','s',0};
-    Char *t;
+    const Char *t;
 
     if(!(a= Malloc(sizeof(*a))))
@@ -670,9 +672,8 @@ AttributeDefinition
     a->attrsum = FindAttrSpec(element->eltsum, doctype, name);
 #else
-    if(!(name = Strndup(name, namelen)))
+    if(!(a->name = Strndup(name, namelen)))
 	return 0;
 #endif
 
-    a->name = name;
     a->namelen = namelen;
     a->type = type;
@@ -836,13 +837,12 @@ void FreeAttributeDefinition(AttributeDe
 
 NotationDefinition DefineNotationN(Dtd dtd, const Char *name, int namelen, 
-				  const char8 *publicid, const char8 *systemid,
+				   char8 *publicid, char8 *systemid,
 				   Entity parent)
 {
     NotationDefinition n;
 
-    if(!(n = Malloc(sizeof(*n))) || !(name = Strndup(name, namelen)))
+    if(!(n = Malloc(sizeof(*n))) || !(n->name = Strndup(name, namelen)))
 	return 0;
 
-    n->name = name;
     n->tentative = 0;
     n->systemid = systemid;
@@ -870,5 +870,5 @@ NotationDefinition TentativelyDefineNota
 
 NotationDefinition RedefineNotation(NotationDefinition n,
-				  const char8 *publicid, const char8 *systemid,
+				    char8 *publicid, char8 *systemid,
 				    Entity parent)
 {
--- include/dtd.h	2004-11-02 12:46:07.000000000 -0500
+++ include/dtd.h	2021-02-25 15:07:41.465041000 -0500
@@ -48,11 +48,11 @@ struct entity {
     /* All entities */
 
-    const Char *name;		/* The name in the entity declaration */
+    Char *name;		/* The name in the entity declaration */
     EntityType type;		/* ET_external or ET_internal */
-    const char8 *base_url;	/* If different from expected */
+    char8 *base_url;	/* If different from expected */
     struct entity *next;	/* For chaining a document's entity defns */
     CharacterEncoding encoding;	/* The character encoding of the entity */
     Entity parent;		/* The entity in which it is defined */
-    const char8 *url;		/* URL of entity */
+    char8 *url;		/* URL of entity */
     int is_externally_declared;	/* True if declared outside document entity */
     int is_internal_subset;	/* True if this is the internal subset */
@@ -60,5 +60,8 @@ struct entity {
     /* Internal entities */
 
-    const Char *text;		/* Text of the entity */
+    union {
+	const Char *text;	/* Text of the entity */
+	Char *atext;	/* We may need to free() it, depending on type */
+    };
     int line_offset;		/* Line offset of definition */
     int line1_char_offset;	/* Char offset on first line */ 
@@ -67,12 +70,12 @@ struct entity {
     /* External entities */
 
-    const char8 *systemid;	/* Declared public ID */
-    const char8 *publicid;	/* Declared public ID */
+    const char8 *systemid;	/* Declared system ID */
+    char8 *publicid;	/* Declared public ID */
     NotationDefinition notation; /* Binary entity's declared notation */
     MarkupLanguage ml_decl;	/* XML, NSL or not specified */
-    const char8 *version_decl;	/* XML declarations found in entity, if any  */
+    char8 *version_decl;	/* XML declarations found in entity, if any  */
     CharacterEncoding encoding_decl;
     StandaloneDeclaration standalone_decl;
-    const char8 *ddb_filename;	/* filename in NSL declaration */
+    char8 *ddb_filename;	/* filename in NSL declaration */
     XMLVersion xml_version;
 };
@@ -133,5 +136,5 @@ struct element_definition {
     NSL_ElementSummary_I *eltsum;
 #endif
-    const Char *name;		/* The element name */
+    Char *name;		/* The element name */
     int namelen;
     int tentative;
@@ -150,5 +153,6 @@ struct element_definition {
     AttributeDefinition notation_attribute; /* NOTATION attribute, if it has one */
     NSElementDefinition cached_nsdef;
-    const Char *prefix, *local;
+    Char *prefix;
+    const Char *local;
     int is_externally_declared;	/* True if declared outside document entity */
     int eltnum;
@@ -180,14 +184,15 @@ struct attribute_definition {
     NSL_AttributeSummary attrsum;
 #endif
-    const Char *name;		/* The attribute name */
+    Char *name;		/* The attribute name */
     int namelen;
     AttributeType type;		/* The declared type */
     Char **allowed_values;	/* List of allowed values, argv style */
     DefaultType default_type;	/* The type of the declared default */
-    const Char *default_value;	/* The declared default value */
+    Char *default_value;	/* The declared default value */
     int declared;		/* Was there a declaration for this? */
     const Char *ns_attr_prefix;	/* Prefix it defines if a namespace attr */
     NSAttributeDefinition cached_nsdef;
-    const Char *prefix, *local;
+    Char *prefix;
+    const Char *local;
     int is_externally_declared;	/* True if declared outside document entity */
     int attrnum;
@@ -197,9 +202,9 @@ struct attribute_definition {
 
 struct notation_definition {
-    const Char *name;		/* The notation name */
+    Char *name;		/* The notation name */
     int tentative;
-    const char8 *systemid;	/* System identifier */
-    const char8 *publicid;	/* Public identifier */
-    const char8 *url;
+    char8 *systemid;	/* System identifier */
+    char8 *publicid;	/* Public identifier */
+    char8 *url;
     Entity parent;		/* Entity that declares it (for base URL) */
     struct notation_definition *next;
@@ -209,5 +214,5 @@ struct notation_definition {
 
 struct dtd {
-    const Char *name;		/* The doctype name */
+    Char *name;		/* The doctype name */
     Entity internal_part, external_part;
     Entity entities;
@@ -230,9 +235,9 @@ XML_API void FreeDtd(Dtd dtd);
 
 XML_API Entity NewExternalEntity(const Char *name,
-			  const char8 *publicid, const char8 *systemid,
+			  char8 *publicid, const char8 *systemid,
 			  NotationDefinition notation,
 			  Entity parent);
 XML_API Entity NewExternalEntityN(const Char *name, int namelen,
-			  const char8 *publicid, const char8 *systemid,
+			  char8 *publicid, const char8 *systemid,
 			  NotationDefinition notation,
 			  Entity parent);
@@ -281,5 +286,5 @@ XML_API AttributeDefinition DefineAttrib
 				     AttributeType type, Char **allowed_values,
 				     DefaultType default_type, 
-				     const Char *default_value,
+				     Char *default_value,
 					     int declared);
 XML_API AttributeDefinition FindAttributeN(ElementDefinition element,
@@ -295,10 +300,10 @@ XML_API void FreeAttributeDefinition(Att
 
 XML_API NotationDefinition DefineNotationN(Dtd dtd, const Char *name, int namelen,
-				 const char8 *publicid, const char8 *systemid,
+				 char8 *publicid, char8 *systemid,
 					   Entity parent);
 XML_API NotationDefinition TentativelyDefineNotationN(Dtd dtd,
 					      const Char *name, int namelen);
 XML_API NotationDefinition RedefineNotation(NotationDefinition n,
-				  const char8 *publicid, const char8 *systemid,
+				  char8 *publicid, char8 *systemid,
 					    Entity parent);
 XML_API NotationDefinition FindNotationN(Dtd dtd, const Char *name, int namelen);
--- catalog/entityopener.c	2003-11-27 09:06:38.000000000 -0500
+++ catalog/entityopener.c	2021-02-25 15:07:41.465352000 -0500
@@ -9,5 +9,5 @@
 #include "dtd.h"
 
-InputSource catalog_entity_open(Entity ent, void *arg)
+static InputSource catalog_entity_open(Entity ent, void *arg)
 {
     Catalog catalog = arg;
--- src/http.c	2001-05-01 10:29:34.000000000 -0400
+++ src/http.c	2021-02-25 15:33:16.444375000 -0500
@@ -139,5 +139,5 @@ FILE16 *http_open(const char *url,
     int server_port;
     char buf[100];
-    int i;
+    unsigned u;
     struct http_headers *hs;
 
@@ -220,5 +220,7 @@ FILE16 *http_open(const char *url,
     SetCloseUnderlying(f16, 1);
     SetFileEncoding(f16, CE_unspecified_ascii_superset);
+#if defined(WIN32)
     SetNormalizeLineEnd(f16, 0);
+#endif
 
     /* Send the request */
@@ -246,5 +248,5 @@ FILE16 *http_open(const char *url,
     /* Read the status line */
 
-    i = 0;
+    u = 0;
     while(1)
     {
@@ -252,5 +254,5 @@ FILE16 *http_open(const char *url,
 	{
 	case '\n':
-	    buf[i] = 0;
+	    buf[u] = 0;
 	    goto done_status;
 	case '\r':
@@ -263,6 +265,6 @@ FILE16 *http_open(const char *url,
 	    return 0;
 	default:
-	    if(i < sizeof(buf) - 1)
-		buf[i++] = c;
+	    if(u < sizeof(buf) - 1)
+		buf[u++] = c;
 	}
     }
@@ -307,4 +309,5 @@ FILE16 *http_open(const char *url,
     {
 	char *final_url;
+	int i;
 
 	for(i=0; i<VectorCount(hs->header); i++)
@@ -370,5 +373,5 @@ static struct http_headers *read_headers
 	    if(VectorCount(text) == 0 || VectorLast(text) == LF)
 		goto done;
-	    /* otherwise fall through */
+	    /* fall through */
 	default:
 	    if(!VectorPush(text, c))
--- src/infoset-print.c	2021-06-14 13:42:14.000000000 -0400
+++ src/infoset-print.c	2024-01-22 00:58:08.195742000 -0500
@@ -23,5 +23,5 @@
 		     HashTable id_table);
 static void notations(FILE16 *f, int level, Dtd dtd);
-static void unparsed_entities(FILE16 *f, int level, Dtd dtd, Entity docent);
+static void unparsed_entities(FILE16 *f, int level, Dtd dtd);
 static void baseURI(FILE16 *f, int level, const char8 *uri);
 static void standalone(FILE16 *f, int level, StandaloneDeclaration sd);
@@ -33,11 +33,11 @@
 		    HashTable id_table);
 static void pi(FILE16 *f, int level, Dtd dtd, XBit bit);
-static void cdsect(FILE16 *f, int level, Dtd dtd, XBit bit);
-static void pcdata(FILE16 *f, int level, Dtd dtd, XBit bit);
-static void comment(FILE16 *f, int level, Dtd dtd, XBit bit);
+static void cdsect(FILE16 *f, int level, XBit bit);
+static void pcdata(FILE16 *f, int level, XBit bit);
+static void comment(FILE16 *f, int level, XBit bit);
 static void name(FILE16 *f, int level, 
 		 const Char *nsname, const Char *local, const Char *prefix);
 static void document_element(FILE16 *f, int level, XBit bit);
-static void character(FILE16 *f, int level, Dtd dtd, char *ecw, int c);
+static void character(FILE16 *f, int level, const char *ecw, int c);
 static void attributes(FILE16 *f, int level, Dtd dtd, XBit bit, 
 		       HashTable id_table);
@@ -46,5 +46,5 @@
 static void namespace_attributes(FILE16 *f, int level, Dtd dtd, XBit bit,
 				 HashTable id_table);
-static void inscope_namespaces(FILE16 *f, int level, Dtd dtd, XBit bit);
+static void inscope_namespaces(FILE16 *f, int level, XBit bit);
 #if 0
 static void internal_entity(FILE16 *f, int level, Entity entity);
@@ -53,7 +53,7 @@
 static void unparsed_entity(FILE16 *f, int level, Entity entity);
 
-static void simple(FILE16 *f, int level, char *name, const char *value);
-static void Simple(FILE16 *f, int level, char *name, const Char *value);
-static void pointer(FILE16 *f, int level, char *name, Char *id);
+static void simple(FILE16 *f, int level, const char *name, const char *value);
+static void Simple(FILE16 *f, int level, const char *name, const Char *value);
+static void pointer(FILE16 *f, int level, const char *name, Char *id);
 static Char *make_id(const char *type, const Char *name, int count);
 static void indent(FILE16 *f, int level);
@@ -67,5 +67,5 @@
 		     int *counter);
 
-struct xbit bogus_bit;
+static struct xbit bogus_bit;
 
 static Char xmlns_ns[] = {'h','t','t','p',':','/','/','w','w','w','.','w', '3',
@@ -93,5 +93,5 @@
     notations(f, 1, dtd);
 
-    unparsed_entities(f, 1, dtd, p->document_entity);
+    unparsed_entities(f, 1, dtd);
 
     baseURI(f, 1, EntityBaseURL(p->document_entity));
@@ -172,5 +172,5 @@
 }
 
-static void unparsed_entities(FILE16 *f, int level, Dtd dtd, Entity docent)
+static void unparsed_entities(FILE16 *f, int level, Dtd dtd)
 {
     Entity e;
@@ -280,5 +280,5 @@
 }
 
-static void simple(FILE16 *f, int level, char *name, const char *value)
+static void simple(FILE16 *f, int level, const char *name, const char *value)
 {
     indent(f, level);
@@ -294,5 +294,5 @@
 }
 
-static void Simple(FILE16 *f, int level, char *name, const Char *value)
+static void Simple(FILE16 *f, int level, const char *name, const Char *value)
 {
     indent(f, level);
@@ -308,5 +308,5 @@
 }
 
-static void pointer(FILE16 *f, int level, char *name, Char *id)
+static void pointer(FILE16 *f, int level, const char *name, Char *id)
 {
     indent(f, level);
@@ -342,11 +342,11 @@
 	    break;
 	case XBIT_cdsect:
-	    cdsect(f, level, dtd, bit);
+	    cdsect(f, level, bit);
 	    break;
 	case XBIT_pcdata:
-	    pcdata(f, level, dtd, bit);
+	    pcdata(f, level, bit);
 	    break;
 	case XBIT_comment:
-	    comment(f, level, dtd, bit);
+	    comment(f, level, bit);
 	    break;
 	default:
@@ -396,5 +396,5 @@
     namespace_attributes(f, level+1, dtd, bit, id_table);
 
-    inscope_namespaces(f, level+1, dtd, bit);
+    inscope_namespaces(f, level + 1, bit);
 
     baseURI(f, 1, EntityBaseURL(bit->entity)); /* XXX xml:base */
@@ -433,5 +433,5 @@
 }
 
-static void cdsect(FILE16 *f, int level, Dtd dtd, XBit bit)
+static void cdsect(FILE16 *f, int level, XBit bit)
 {
     Char *p;
@@ -443,5 +443,5 @@
 
     for(p=bit->pcdata_chars; *p; p++)
-	character(f, level, dtd, "false", *p);
+	character(f, level, "false", *p);
 
 #if 0
@@ -451,8 +451,8 @@
 }
 
-static void pcdata(FILE16 *f, int level, Dtd dtd, XBit bit)
+static void pcdata(FILE16 *f, int level, XBit bit)
 {
     Char *p;
-    char *ecw;
+    const char *ecw;
 
     ecw = !bit->parent->element_definition->declared ? 0 :
@@ -461,8 +461,8 @@
 
     for(p=bit->pcdata_chars; *p; p++)
-	character(f, level, dtd, is_xml_whitespace_16(*p) ? ecw : "false", *p);
+	character(f, level, is_xml_whitespace_16(*p) ? ecw : "false", *p);
 }
 
-static void character(FILE16 *f, int level, Dtd dtd, char *ecw, int c)
+static void character(FILE16 *f, int level, const char *ecw, int c)
 {
     indent(f, level);
@@ -478,5 +478,5 @@
 }
 
-static void comment(FILE16 *f, int level, Dtd dtd, XBit bit)
+static void comment(FILE16 *f, int level, XBit bit)
 {
     indent(f, level);
@@ -615,4 +615,5 @@
 	free(token);
 	free(id);
+	/* FALLTHROUGH */
     default:
 	simple(f, level+1, "references", 0);
@@ -640,5 +641,5 @@
 }
 
-static void inscope_namespaces(FILE16 *f, int level, Dtd dtd, XBit bit)
+static void inscope_namespaces(FILE16 *f, int level, XBit bit)
 {
     NamespaceBinding nsb, nsb2;
--- src/input.c	2005-01-14 11:10:00.000000000 -0500
+++ src/input.c	2021-02-25 15:07:41.467694000 -0500
@@ -79,5 +79,5 @@ InputSource EntityOpen(Entity e)
     else
     {
-	f16 = MakeFILE16FromString((char *)e->text, -1, "r");
+	f16 = MakeFILE16FromString(e->text, -1, "r");
     }
 
@@ -288,11 +288,5 @@ static void internal_reader(InputSource 
     struct _FILE16 *f16 = (struct _FILE16 *)s->file16;
 
-    if(!*(Char *)((char *)f16->handle + f16->handle2))
-    {
-	s->line_length = 0;
-	return;
-    }
-
-    s->line = (Char *)((char *)f16->handle + f16->handle2);
+    s->line = (void *)((char *)f16->handle + f16->handle2);
     for(p=s->line; *p && *p != '\n'; p++)
 	;
@@ -467,6 +461,4 @@ static int translate_latin(InputSource s
     }
 
-    MORE_BYTES;
-
     END_OF_LINE;
 }
@@ -495,6 +487,4 @@ static int translate_latin1(InputSource 
     }
 
-    MORE_BYTES;
-
     END_OF_LINE;
 }
--- src/namespaces.c	2003-06-02 12:56:35.000000000 -0400
+++ src/namespaces.c	2021-02-25 15:07:41.468014000 -0500
@@ -25,5 +25,5 @@ static void FreeNSElementDefinition(NSEl
 static void FreeNSAttributeDefinition(NSAttributeDefinition attribute);
 
-NamespaceUniverse global_universe = 0;
+static NamespaceUniverse global_universe = 0;
 
 int init_namespaces(void)
@@ -139,5 +139,5 @@ static void FreeNSElementDefinition(NSEl
 
     Free(element->attributes);
-    Free((Char *)element->name); /* cast to get rid of const */
+    Free(element->name);
     Free(element);
 }
@@ -182,5 +182,5 @@ NSAttributeDefinition
 static void FreeNSAttributeDefinition(NSAttributeDefinition attribute)
 {
-    Free((Char *)attribute->name); /* cast to get rid of const */
+    Free(attribute->name);
     Free(attribute);
 }
--- include/namespaces.h	2003-06-02 12:56:35.000000000 -0400
+++ include/namespaces.h	2021-02-25 15:07:41.468292000 -0500
@@ -30,5 +30,5 @@ struct RXP_NAMESPACE {
 
 struct ns_element_definition {
-    const Char *name;
+    Char *name;
     Namespace RXP_NAMESPACE;
     Vector(NSAttributeDefinition, attributes);
@@ -39,5 +39,5 @@ struct ns_attribute_definition {
     Namespace RXP_NAMESPACE;
     NSElementDefinition element;
-    const Char *name;
+    Char *name;
     int attrnum;
 };
--- src/nf16check.c	2003-09-02 10:02:45.000000000 -0400
+++ src/nf16check.c	2021-02-25 15:07:41.468701000 -0500
@@ -7,4 +7,6 @@
 
 #include <stdlib.h>
+#include <stdint.h>
+
 #include "nf16check.h"
 #include "nf16data.h"
@@ -69,11 +71,11 @@ void nf16checkNoStart (NF16Checker check
 static int recombines (unsigned int b, unsigned int f)
 {
-    int low  = 0;                     /* lowest inside non-checked area */
-    int high = recombinerCount;       /* lowest outside    checked area */
+    unsigned low  = 0;                     /* lowest inside non-checked area */
+    unsigned high = recombinerCount;       /* lowest outside    checked area */
     while (low < high) {
-        int middle  = (low+high) / 2;  /* binary search */
-        int middleB = recombiners[middle].base;
+        unsigned middle  = (low + high) / 2;  /* binary search */
+        unsigned middleB = recombiners[middle].base;
         if (b == middleB) {
-            int middleF = recombiners[middle].follow;
+            unsigned middleF = recombiners[middle].follow;
             if (f == middleF)      return 1;
             else if (f < middleF)  high = middle;
@@ -106,5 +108,5 @@ static int getclass (unsigned int c)
 }
 
-
+#if 0 /* This function is broken and unused */
 /* general check function, s is null-delimited */
 nf16res nf16check (NF16Checker checker, char16* s)
@@ -215,5 +217,5 @@ nf16res nf16check (NF16Checker checker, 
     return NF16wrong;
 }
-
+#endif
 
 /* variant of nf16check, s_length gives length of s */
@@ -226,4 +228,5 @@ nf16res nf16checkL (NF16Checker checker,
     int          lastclass   = checker->lastclass;
     unsigned int c;		/* changed from char16 (RMT) */
+    uint32_t     C;
     flag         f;
     int          class;
@@ -243,18 +246,19 @@ nf16res nf16checkL (NF16Checker checker,
           case loww:  /* low surrogate */
             /* combine with high surrogate */
-            c = ((checker->high-0xD800)<<10) + (c-0xDC00) + 0x10000;
+            C = ((checker->high-0xD800)<<10) + (c-0xDC00) + 0x10000;
+	    c = C;
             /* check in pieces */
-            if      (c < 0x10900)  goto GETFLAG; /* still in main table */
-            else if (c < 0x1D000)  f = NoNo;
-            else if (c < 0x1D800)  f = getflag(c-(0x1D000-0x10900));
-            else if (c < 0x20000)  f = NoNo;
-            else if (c < 0x2A6D7)  f = simp;
-            else if (c < 0x2F800)  f = NoNo;
-            else if (c < 0x2FA1D)  f = NOFC;
-            else if (c ==0xE0001)  f = simp;
-            else if (c < 0xE0020)  f = NoNo;
-            else if (c < 0xE0080)  f = simp;
-            else if (c < 0xE0100)  f = NoNo;
-            else if (c < 0xE01F0)  f = simp;
+            if      (C < 0x10900)  goto GETFLAG; /* still in main table */
+            else if (C < 0x1D000)  f = NoNo;
+            else if (C < 0x1D800)  f = getflag(c-(0x1D000-0x10900));
+            else if (C < 0x20000)  f = NoNo;
+            else if (C < 0x2A6D7)  f = simp;
+            else if (C < 0x2F800)  f = NoNo;
+            else if (C < 0x2FA1D)  f = NOFC;
+            else if (C ==0xE0001)  f = simp;
+            else if (C < 0xE0020)  f = NoNo;
+            else if (C < 0xE0080)  f = simp;
+            else if (C < 0xE0100)  f = NoNo;
+            else if (C < 0xE01F0)  f = simp;
             else                   f = NoNo;
             goto NEWFLAG;   /* start again with switch */
--- catalog/resolve.c	2003-08-28 12:13:12.000000000 -0400
+++ catalog/resolve.c	2021-02-25 15:07:41.469245000 -0500
@@ -8,11 +8,11 @@
 #include "string.h"
 
-static char *res_ext(Catalog catalog, char *file,
+static char *res_ext(Catalog catalog, const char *file,
 		     const char *public, const char *system, Prefer prefer);
-static char *res_uri(Catalog catalog, char *file, const char *uri);
+static const char *res_uri(Catalog catalog, const char *file, const char *uri);
 static int entry_compare(const void *a, const void *b);
 
 /* used internally to indicate failure */
-static char *fail = "fail";
+static char *fail = (void *)-1;
 
 char *ResolveExternalIdentifier(Catalog catalog, 
@@ -35,16 +35,18 @@ char *ResolveExternalIdentifier(Catalog 
 	if(!(temp = UnwrapPublicidUrn(public)) ||
 	   !(public = NormalizePublic8(temp)))
-	    return 0;
+	    return NULL;
 	Free(temp);
     }
     else
 	if(public && !(public = NormalizePublic8(public)))
-	    return 0;
+	    return NULL;
 
     if(IsPublicidUrn(system))
     {
+	char *normalized_system;
+
 	if(!(temp = UnwrapPublicidUrn(system)) ||
 	   /* NB normalize as public because that's what it will end up as! */
-	   !(system = NormalizePublic8(temp)))
+	   !(normalized_system = NormalizePublic8(temp)))
 	    return 0;
 	Free(temp);
@@ -52,21 +54,18 @@ char *ResolveExternalIdentifier(Catalog 
 	if(public)
 	{
-	    if(strcmp(public, system) == 0)
+	    if(strcmp(public, normalized_system) == 0)
 	    {
-		Free((void *)system);
-		system = 0;
+		Free(normalized_system);
 	    }
 	    else
 	    {
 		Fprintf(Stderr, "Unwrapped publicid-urn system id %s does not match public id %s, discarding\n",
-			system, public);
-		Free((void *)system);
-		system = 0;
+			normalized_system, public);
+		Free(normalized_system);
 	    }
 	}
 	else
 	{
-	    public = system;
-	    system = 0;
+	    public = normalized_system;
 	}
     }
@@ -96,10 +95,10 @@ char *ResolveExternalIdentifier(Catalog 
 }
 
-static char *res_ext(Catalog catalog, char *file,
+static char *res_ext(Catalog catalog, const char *file,
 		     const char *public, const char *system, Prefer prefer)
 {
     int i;
     int len, best_length, prefix_length, nmatches;
-    char *best_value = 0, *result = 0; /* init to please gcc */
+    char *best_value = NULL, *result = NULL; /* init to please gcc */
     CatalogEntryFile cef;
     CatalogEntry entry;
@@ -114,5 +113,5 @@ static char *res_ext(Catalog catalog, ch
 
     if(!(cef = GetCatalogEntryFile(catalog, file)))
-	return fail;
+	return (char *)fail;
 
     if(!system)
@@ -157,13 +156,14 @@ static char *res_ext(Catalog catalog, ch
     if(best_length > 0)
     {
+	char *buf;
 	prefix_length = strlen(best_value);
-	if(!(result = Malloc(prefix_length + strlen(system+best_length) + 1)))
+	if(!(buf = Malloc(prefix_length + strlen(system+best_length) + 1)))
 	    return fail;
-	strcpy(result, best_value);
-	strcpy(result+prefix_length, system+best_length);
+	strcpy(buf, best_value);
+	strcpy(buf+prefix_length, system+best_length);
 	if(catalog_debug)
 	    fprintf(stderr, "best match %s (%d), returning %s\n",
-		    best_value, prefix_length, result);
-	return result;
+		    best_value, prefix_length, buf);
+	return buf; /* XXX anything ever frees this? */
     }
 
@@ -299,5 +299,5 @@ static char *res_ext(Catalog catalog, ch
 }
 
-char *ResolveURI(Catalog catalog, const char *uri)
+const char *ResolveURI(Catalog catalog, const char *uri)
 {
     int i, is_publicid_urn;
@@ -327,5 +327,5 @@ char *ResolveURI(Catalog catalog, const 
     for(i=0; i<VectorCount(catalog->path); i++)
     {
-	char *result;
+	const char *result;
 
 	if(is_publicid_urn)
@@ -333,7 +333,7 @@ char *ResolveURI(Catalog catalog, const 
 	else
 	    result = res_uri(catalog, catalog->path[i], uri);
-	if(result == fail)
-	    return 0;
-	if(result)
+	if (result == fail)
+	    return NULL;
+	if (result)
 	    return result;
     }
@@ -342,9 +342,10 @@ char *ResolveURI(Catalog catalog, const 
 }
 
-static char *res_uri(Catalog catalog, char *file, const char *uri)
+static const char *res_uri(Catalog catalog, const char *file, const char *uri)
 {
     int i;
     int len, best_length, prefix_length, nmatches;
-    char *best_value = 0, *result = 0; /* init to please gcc */
+    char *best_value = NULL;
+    const char *result = NULL; /* init to please gcc */
     CatalogEntryFile cef;
     CatalogEntry entry;
@@ -395,13 +396,14 @@ static char *res_uri(Catalog catalog, ch
     if(best_length > 0)
     {
+	char *buf;
 	prefix_length = strlen(best_value);
-	if(!(result = Malloc(prefix_length + strlen(uri+best_length) + 1)))
+	if(!(buf = Malloc(prefix_length + strlen(uri+best_length) + 1)))
 	    return fail;
-	strcpy(result, best_value);
-	strcpy(result+prefix_length, uri+best_length);
+	strcpy(buf, best_value);
+	strcpy(buf + prefix_length, uri + best_length);
 	if(catalog_debug)
 	    fprintf(stderr, "best match %s (%d), returning %s\n",
-		    best_value, prefix_length, result);
-	return result;
+		    best_value, prefix_length, buf);
+	return buf; /* XXX Is this ever freed? */
     }
 
@@ -468,5 +470,5 @@ static int entry_compare(const void *a, 
 {
     /* longest first, i.e. long < short */
-    return strlen((*(CatalogEntry *)b)->match) - 
-	   strlen((*(CatalogEntry *)a)->match);
+    return strlen((*(const CatalogEntry *)b)->match) - 
+	   strlen((*(const CatalogEntry *)a)->match);
 }
--- src/rxp.c	2019-10-24 14:23:25.000000000 -0400
+++ src/rxp.c	2024-10-20 22:09:28.202835000 -0400
@@ -33,40 +33,39 @@
 #include "catalog.h"
 
-int attr_compare(const void *a, const void *b);
-void print_tree(Parser p, XBit bit);
-void print_bit(Parser p, XBit bit);
-void print_ns_attrs(NamespaceBinding ns, int count);
-void print_namespaces(NamespaceBinding ns);
-void print_attrs(ElementDefinition e, Attribute a);
-void print_text(Char *text, int is_attr);
-int printable(int c);
-void print_special(int c);
-void print_text_bit(Char *text);
-void dtd_cb(XBit bit, void *arg);
-void dtd_cb2(XBit bit, void *arg);
-void print_canonical_dtd(Parser p, const Char *name);
-InputSource entity_open(Entity ent, void *arg);
+static int attr_compare(const void *a, const void *b);
+static void print_tree(Parser p, XBit bit);
+static void print_bit(Parser p, XBit bit);
+static void print_ns_attrs(NamespaceBinding ns, int count);
+static void print_namespaces(NamespaceBinding ns);
+static void print_attrs(Attribute a);
+static void print_text(const Char *text, int is_attr);
+static int printable(int c);
+static void print_special(int c);
+static void print_text_bit(Char *text);
+static void dtd_cb(XBit bit, void *arg);
+static void dtd_cb2(XBit bit, void *arg);
+static void print_canonical_dtd(Parser p, const Char *name);
 static const char8 *minimal_uri(const char8 *uri, const char8 *base);
 
-int verbose = 0, expand = 1, nsgml = 0,
+static int verbose = 0, expand = 1, nsgml = 0,
     attr_defaults = 0, merge = 0, strict_xml = 0, tree = 0, validate = 0,
     xml_space = 0, namespaces = 0, simple_error = 0, experiment = 0,
     read_dtd = 0, unicode_check = 0, xml_id = 0, pre_105 = 0;
-enum {o_unspec, o_none, o_bits, o_plain, o_can1, o_can2, o_can3, o_infoset, o_diff, o_diff2} output_format = o_unspec;
-char *enc_name = 0, *base_uri = 0, *my_dtd_name, *my_dtd_sysid = 0;
-CharacterEncoding encoding = CE_unknown;
-InputSource source = 0;
-int need_canonical_dtd = 0;
-int xml_version;
+static enum {o_unspec, o_none, o_bits, o_plain, o_can1, o_can2, o_can3, o_infoset, o_diff, o_diff2} output_format = o_unspec;
+static char *enc_name = NULL, *base_uri = NULL, *my_dtd_name, *my_dtd_sysid = NULL;
+static CharacterEncoding encoding = CE_unknown;
+static InputSource source = NULL;
+static int need_canonical_dtd = 0;
+static int xml_version;
 
 #ifdef TIME_LIMIT
-void time_exceeded(int sig);
-int time_limit = 0;
+static void time_exceeded(int sig);
+static int time_limit = 0;
 #endif
 
 #define canonical_output (output_format >= o_can1)
 
-Vector(XBit, bits);
-Vector(XBit, dtd_bits);
+StaticVector(XBit, bits);
+StaticVector(XBit, dtd_bits);
 
 int main(int argc, char **argv)
@@ -581,5 +580,5 @@
 {
     const char *sys, *pub;
-    char *ws[] = {"u", "d", "p"};
+    const char *ws[] = {"u", "d", "p"};
 
     if(output_format == o_none && bit->type != XBIT_error)
@@ -617,5 +616,5 @@
 	    if(xml_space)
 		Printf("(ws=%s) ", ws[bit->wsm]);
-	    print_attrs(0, bit->attributes);
+	    print_attrs(bit->attributes);
 	    print_namespaces(bit->ns_dict);
 	    Printf("\n");
@@ -630,5 +629,5 @@
 	    if(xml_space)
 		Printf("(ws=%s) ", ws[bit->wsm]);
-	    print_attrs(0, bit->attributes);
+	    print_attrs(bit->attributes);
 	    print_namespaces(bit->ns_dict);
 	    Printf("\n");
@@ -701,5 +700,5 @@
 		print_canonical_dtd(p, bit->element_definition->name);
 	    Printf("<%S", bit->element_definition->name);
-	    print_attrs(bit->element_definition, bit->attributes);
+	    print_attrs(bit->attributes);
 	    print_ns_attrs(bit->ns_dict, bit->nsc);
 	    if(bit->type == XBIT_start)
@@ -769,9 +768,9 @@
 int attr_compare(const void *a, const void *b)
 {
-    return Strcmp((*(Attribute *)a)->definition->name,
-		  (*(Attribute *)b)->definition->name);
+    return Strcmp((*(const Attribute *)a)->definition->name,
+		  (*(const Attribute *)b)->definition->name);
 }
 
-void print_attrs(ElementDefinition e, Attribute a)
+void print_attrs(Attribute a)
 {
     Attribute b;
@@ -826,5 +825,5 @@
 }
 	
-void dtd_cb2(XBit bit, void *arg)
+void dtd_cb2(XBit bit, void *arg __unused)
 {
     XBit copy;
@@ -839,7 +838,7 @@
 }
 	
-void print_text(Char *text, int is_attr)
+void print_text(const Char *text, int is_attr)
 {
-    Char *pc, *last;
+    const Char *pc, *last;
     
     if(output_format == o_bits  || !expand)
@@ -875,5 +874,5 @@
 	   (xml_version > XV_1_0 && type == 3))
 	{
-	    Char *end = (c > 0xffff ? pc-1 : pc); /* if it's a surrogate pair, before the first  */
+	    const Char *end = (c > 0xffff ? pc-1 : pc); /* if it's a surrogate pair, before the first  */
 	    if(end > last)
 		Printf("%.*S", end - last, last);
@@ -949,25 +948,4 @@
 }
 
-InputSource entity_open(Entity ent, void *arg)
-{
-    if(ent->publicid && 
-       strcmp(ent->publicid, "-//RMT//DTD just a test//EN") == 0)
-    {
-	FILE *f;
-	FILE16 *f16;
-
-	if((f = fopen("/tmp/mydtd", "r")))
-	{
-	    if(!(f16 = MakeFILE16FromFILE(f, "r")))
-		return 0;
-	    SetCloseUnderlying(f16, 1);
-
-	    return NewInputSource(ent, f16);
-	}
-    }
-
-    return EntityOpen(ent);
-}
-
 void print_ns_attrs(NamespaceBinding ns, int count)
 {
@@ -1017,13 +995,13 @@
 }
 
-int notation_compare(const void *a, const void *b)
+static int notation_compare(const void *a, const void *b)
 {
-    return Strcmp((*(NotationDefinition *)a)->name,
-		  (*(NotationDefinition *)b)->name);
+    return Strcmp((*(const NotationDefinition *)a)->name,
+		  (*(const NotationDefinition *)b)->name);
 }
 
-int entity_compare(const void *a, const void *b)
+static int entity_compare(const void *a, const void *b)
 {
-    return Strcmp((*(Entity *)a)->name, (*(Entity *)b)->name);
+    return Strcmp((*(const Entity *)a)->name, (*(const Entity *)b)->name);
 }
 
@@ -1147,5 +1125,5 @@
 
 #ifdef TIME_LIMIT
-void time_exceeded(int sig)
+void time_exceeded(int sig __unused)
 {
     fprintf(stderr, "CPU time limit (%d seconds) exceeded, sorry\n", 
--- include/rxputil.h	2003-11-27 09:06:57.000000000 -0500
+++ include/rxputil.h	2021-02-25 15:07:41.470232000 -0500
@@ -6,4 +6,8 @@
     type *name
 
+#define StaticVector(type, name) \
+    static int name##_count, name##_alloc; \
+    static type *name
+
 #define VectorInit(v) \
     ((v##_count) = (v##_alloc) = 0, (v) = 0)
--- src/stdio16.c	2005-01-14 11:10:54.000000000 -0500
+++ src/stdio16.c	2021-02-25 15:32:25.156652000 -0500
@@ -15,4 +15,5 @@
 #include <string.h>
 #include <stdarg.h>
+#include <err.h>
 
 #ifdef FOR_LT
@@ -63,5 +64,8 @@ typedef int CloseProc(FILE16 *file);
 
 struct _FILE16 {
-    void *handle;
+    union {
+	void *handle;
+	const void *chandle;
+    };
     int handle2, handle3;
     ReadProc *read;
@@ -222,5 +226,5 @@ static int ConvertASCII(const char8 *buf
 	}
 	else
-	    return Writeu(file, (unsigned char *)buf, count);
+	    return Writeu(file, (const unsigned char *)buf, count);
 
     case CE_UTF_8:
@@ -418,5 +422,5 @@ int Readu(FILE16 *file, unsigned char *b
 #endif
 
-int Writeu(FILE16 *file, unsigned char *buf, int count)
+int Writeu(FILE16 *file, const unsigned char *buf, int count)
 {
     int ret;
@@ -548,13 +552,13 @@ CharacterEncoding GetFileEncoding(FILE16
 }
 
+#if defined(WIN32)
 void SetNormalizeLineEnd(FILE16 *file, int nle)
 {
-#if defined(WIN32)
     if(nle)
 	file->flags |= FILE16_crlf;
     else
 	file->flags &= ~FILE16_crlf;
-#endif
 }
+#endif
 
 int Fprintf(FILE16 *file, const char *format, ...)
@@ -596,5 +600,6 @@ int Vsprintf(void *buf, CharacterEncodin
 {
     int nchars;
-    FILE16 file = {0, 0, -1, 0, StringWrite, 0, StringFlush, StringClose, FILE16_write};
+    FILE16 file = {.handle3 = -1, .write = StringWrite, .flush = StringFlush,
+        .close = StringClose, .flags = FILE16_write};
 
     file.handle = buf;
@@ -611,5 +616,6 @@ int Vsnprintf(void *buf, size_t size, Ch
 {
     int nchars;
-    FILE16 file = {0, 0, -1, 0, StringWriteTrunc, 0, StringFlush, StringClose, FILE16_write};
+    FILE16 file = {.handle3 = -1, .write = StringWriteTrunc,
+        .flush = StringFlush, .close = StringClose, .flags = FILE16_write};
 
     file.handle = buf;
@@ -639,5 +645,5 @@ int Vfprintf(FILE16 *file, const char *f
     char16 cbuf[1];
 #endif
-    int mflag, pflag, sflag, hflag, zflag;
+    int mflag;
     int l, h, L, ll;
     int nchars = 0;
@@ -654,5 +660,5 @@ int Vfprintf(FILE16 *file, const char *f
 	width = 0;
 	prec = -1;
-	mflag=0, pflag=0, sflag=0, hflag=0, zflag=0;
+	mflag=0;
 	l=0, h=0, L=0, ll=0;
 
@@ -664,16 +670,4 @@ int Vfprintf(FILE16 *file, const char *f
 		mflag = 1;
 		break;
-	    case '+':
-		pflag = 1;
-		break;
-	    case ' ':
-		sflag = 1;
-		break;
-	    case '#':
-		hflag = 1;
-		break;
-	    case '0':
-		zflag = 1;
-		break;
 	    default:
 		goto flags_done;
@@ -738,5 +732,5 @@ int Vfprintf(FILE16 *file, const char *f
 	}
 
-	if(format - start + 1 > sizeof(fmt))
+	if (format - start + 1 > (int)sizeof(fmt))
 	{
 	  ERR("Printf: format specifier too long");
@@ -956,5 +950,5 @@ static int FDClose(FILE16 *file)
 }
 
-static int FDFlush(FILE16 *file)
+static int FDFlush(FILE16 *file __unused)
 {
     return 0;
@@ -1067,5 +1061,5 @@ static int FileFlush(FILE16 *file)
 }
 
-FILE16 *MakeFILE16FromString(void *buf, long size, const char *type)
+FILE16 *MakeFILE16FromString(const void *buf, long size, const char *type)
 {
     FILE16 *file;
@@ -1080,5 +1074,5 @@ FILE16 *MakeFILE16FromString(void *buf, 
     file->flush = StringFlush;
 
-    file->handle = buf;
+    file->chandle = buf;
     file->handle2 = 0;
     file->handle3 = size;
@@ -1170,5 +1164,5 @@ static int StringClose(FILE16 *file)
 }
 
-static int StringFlush(FILE16 *file)
+static int StringFlush(FILE16 *file __unused)
 {
     return 0;
@@ -1268,6 +1262,8 @@ static int GzipRead(FILE16 *file, unsign
 
     errorString = gzerror(f, &gzerr);
-    if(gzerr != 0 && gzerr != Z_STREAM_END)
+    if (gzerr != 0 && gzerr != Z_STREAM_END) {
+	warnx("%s: %s", __func__, errorString);
 	return -1;
+    }
     
     return count;
@@ -1280,14 +1276,16 @@ static int GzipWrite(FILE16 *file, const
     const char *errorString;
 
-    count = gzwrite(f, (char *)buf, count);
+    count = gzwrite(f, buf, count);
 
     errorString = gzerror(f, &gzerr);
-    if(gzerr != 0 && gzerr != Z_STREAM_END)
+    if (gzerr != 0 && gzerr != Z_STREAM_END) {
+	warnx("%s: %s", __func__, errorString);
 	return -1;
+    }
     
     return count;
 }
 
-static int GzipSeek(FILE16 *file, long offset, int ptrname)
+static int GzipSeek(FILE16 *file __unused, long offset __unused, int ptrname __unused)
 {
     return -1;
@@ -1301,5 +1299,5 @@ static int GzipClose(FILE16 *file)
 }
 
-static int GzipFlush(FILE16 *file)
+static int GzipFlush(FILE16 *file __unused)
 {
     return 0;
--- include/stdio16.h	2002-10-03 10:37:44.000000000 -0400
+++ include/stdio16.h	2021-02-25 15:28:59.692044000 -0500
@@ -5,5 +5,5 @@
 #include <stdio.h>
 #ifdef HAVE_LIBZ
-#include "zlib.h"
+#include <zlib.h>
 #endif
 #include "charset.h"
@@ -15,5 +15,5 @@ extern STD_API FILE16 *Stdin, *Stdout, *
 STD_API FILE16 *MakeFILE16FromFILE(FILE *f, const char *type);
 STD_API FILE16 *MakeFILE16FromFD(int fd, const char *type);
-STD_API FILE16 *MakeFILE16FromString(void *buf, long size, const char *type);
+STD_API FILE16 *MakeFILE16FromString(const void *buf, long size, const char *type);
 #ifdef WIN32
 #ifdef SOCKETS_IMPLEMENTED
@@ -26,5 +26,5 @@ STD_API FILE16 *MakeFILE16FromGzip(gzFil
 
 STD_API int Readu(FILE16 *file, unsigned char *buf, int max_count);
-STD_API int Writeu(FILE16 *file, unsigned char *buf, int count);
+STD_API int Writeu(FILE16 *file, const unsigned char *buf, int count);
 STD_API int Fclose(FILE16 *file);
 STD_API int Fflush(FILE16 *file);
@@ -38,5 +38,7 @@ STD_API void SetCloseUnderlying(FILE16 *
 STD_API void SetFileEncoding(FILE16 *file, CharacterEncoding encoding);
 STD_API CharacterEncoding GetFileEncoding(FILE16 *file);
+#if defined(WIN32)
 STD_API void SetNormalizeLineEnd(FILE16 *file, int nle);
+#endif
 
 STD_API int Fprintf(FILE16 *file, const char *format, ...);
--- src/string16.c	2004-10-11 12:18:29.000000000 -0400
+++ src/string16.c	2021-02-25 15:07:41.471817000 -0500
@@ -171,9 +171,9 @@ size_t strlen16(const char16 *s)
 }
 
-char16 *strchr16(const char16 *s, int c)
+const char16 *strchr16(const char16 *s, int c)
 {
     for( ; *s; s++)
 	if(*s == c)
-	    return (char16 *)s;	/* Is const bogus or what? */
+	    return s;
 
     return 0;
@@ -311,5 +311,5 @@ char16 *strncat16(char16 *s1, const char
 /* A very naive implementation */
 
-char16 *strstr16(const char16 *s1, const char16 *s2)
+const char16 *strstr16(const char16 *s1, const char16 *s2)
 {
     int len, first;
@@ -317,5 +317,5 @@ char16 *strstr16(const char16 *s1, const
     first = s2[0];
     if(first == 0)
-	return (char16 *)s1;
+	return s1;
 
     len = strlen16(s2);
@@ -324,5 +324,5 @@ char16 *strstr16(const char16 *s1, const
     {
 	if(strncmp16(s1, s2, len) == 0)
-	    return (char16 *)s1;
+	    return s1;
 	else
 	    s1++;
@@ -331,3 +331,2 @@ char16 *strstr16(const char16 *s1, const
     return 0;
 }
-
--- include/string16.h	1999-05-28 08:08:38.000000000 -0400
+++ include/string16.h	2021-02-25 15:07:41.472166000 -0500
@@ -23,5 +23,5 @@ STD_API int strncasecmp8(const char8 *, 
 
 STD_API char16 *strdup16(const char16 *s);
-STD_API char16 *strchr16(const char16 *, int);
+STD_API const char16 *strchr16(const char16 *, int);
 STD_API size_t strlen16(const char16 *);
 STD_API int strcmp16(const char16 *, const char16 *);
@@ -33,5 +33,5 @@ STD_API char16 *strncat16(char16 *, cons
 STD_API int strcasecmp16(const char16 *, const char16 *);
 STD_API int strncasecmp16(const char16 *, const char16 *, size_t);
-STD_API char16 *strstr16(const char16 *, const char16 *);
+STD_API const char16 *strstr16(const char16 *, const char16 *);
 
 STD_API void translate_latin1_utf16(const char8 *from, char16 *to);
--- include/system.h	2003-05-19 20:17:27.000000000 -0400
+++ include/system.h	2021-02-25 15:10:55.417342000 -0500
@@ -1,3 +1,5 @@
+#ifndef _RXP_SYSTEM_H
+#define _RXP_SYSTEM_H
 #define HAVE_LONG_LONG
 
 #define SOCKETS_IMPLEMENTED
@@ -11,2 +14,4 @@ void *Malloc(int bytes);
 void *Realloc(void *mem, int bytes);
 void Free(void *mem);
+
+#endif
--- src/url.c	2004-06-11 07:39:17.000000000 -0400
+++ src/url.c	2021-02-25 15:07:41.472694000 -0500
@@ -80,10 +80,10 @@ static int hexval(int hex);
 /* Mapping of scheme names to opening functions */
 
-struct {
-    char *scheme; 
+static struct {
+    const char *scheme; 
     FILE16 *(*open)(const char *, const char *, int, const char *, const char *, char **);
 } schemes[] = {
-    {(char *)"http", http_open},
-    {(char *)"file", file_open},
+    {"http", http_open},
+    {"file", file_open},
 };
 #define NSCHEME (sizeof(schemes) / sizeof(schemes[0]))
@@ -372,5 +372,6 @@ FILE16 *url_open(const char *url, const 
 {
     char *scheme, *host, *path, *m_url, *r_url;
-    int port, i;
+    int port;
+    unsigned i;
     FILE16 *f;
 #ifdef HAVE_LIBZ
@@ -464,5 +465,6 @@ FILE16 *url_open(const char *url, const 
 
 static FILE16 *file_open(const char *url,
-			 const char *host, int port, const char *path, 
+			 const char *host __unused,
+			 int port __unused, const char *path, 
 			 const char *type, char **redirected_url)
 {
@@ -554,5 +556,6 @@ static void parse_url(const char *url, 
 		      char **scheme, char **host, int *port, char **path)
 {
-    char *p, *q;
+    const char *p, *q;
+    char *r;
     int warned = 0;
 
@@ -562,5 +565,5 @@ static void parse_url(const char *url, 
     /* Does it start with a scheme? */
     
-    for(p = (char *)url; *p; p++)
+    for(p = url; *p; p++)
 	if(*p == ':' || *p == '/')
 	    break;
@@ -580,5 +583,5 @@ static void parse_url(const char *url, 
 	url += 2;
 
-	for(p = (char *)url; *p; p++)
+	for(p = url; *p; p++)
 	    if(*p == '/')
 		break;
@@ -610,6 +613,6 @@ static void parse_url(const char *url, 
     /* Windoze users have a tendency to use backslashes instead of slashes */
 
-    for(p=*path; *p; p++)
-	if(*p == '\\')
+    for(r = *path; *r; r++)
+	if(*r == '\\')
 	{
 	    if(!warned)
@@ -620,5 +623,5 @@ static void parse_url(const char *url, 
 	    }
 
-	    *p = '/';
+	    *r = '/';
 	}
 }
--- src/version.c	2008-05-29 06:51:54.000000000 -0400
+++ src/version.c	2024-01-22 01:11:34.603161000 -0500
@@ -1,4 +1,5 @@
 #include "config.h"
+#include "version.h"
 
-char *rxp_version_string = 
+const char *rxp_version_string = 
     "RXP " PACKAGE_VERSION " Copyright Richard Tobin, LTG, HCRC, University of Edinburgh";
--- include/version.h	1999-02-17 09:43:19.000000000 -0500
+++ include/version.h	2021-02-25 15:07:41.473163000 -0500
@@ -1 +1 @@
-extern char *rxp_version_string;
+extern const char *rxp_version_string;
--- src/xmlparser.c	2021-06-14 14:02:03.000000000 -0400
+++ src/xmlparser.c	2024-01-22 00:53:35.001099000 -0500
@@ -4,7 +4,6 @@
 #define DEBUG_FSM 0
 
-#ifndef lint
-static char vcid[] = "$Id: xmlparser.c,v 1.137 2021/06/14 18:02:03 richard Exp $";
-#endif /* lint */
+#include <sys/cdefs.h>
+__RCSID("$Id: xmlparser.c,v 1.137 2021/06/14 18:02:03 richard Exp $");
 
 /* 
@@ -142,6 +141,6 @@
 };
 static int parse_string(Parser p, const char8 *where, enum literal_type type, int *normalised);
-static int parse_pi(Parser p, Entity ent);
-static int parse_comment(Parser p, int skip, Entity ent);
+static int parse_pi(Parser p);
+static int parse_comment(Parser p, int skip);
 static int parse_pcdata(Parser p);
 static int parse_starttag(Parser p);
@@ -150,5 +149,5 @@
 			     AttributeDefinition d, const Char *value);
 static int parse_attribute(Parser p);
-static WhiteSpaceMode process_xml_space(Parser p, const Char *value);
+static WhiteSpaceMode process_xml_space(const Char *value);
 static int parse_endtag(Parser p);
 static int parse_markup(Parser p);
@@ -159,5 +158,7 @@
 static HashMapRetType check_id(const HashEntryStruct *id_entry, void *p);
 static int validate_attribute(Parser p, AttributeDefinition a, ElementDefinition e, const Char *value);
+#if 0
 static int validate_xml_lang_attribute(Parser p, ElementDefinition e, const Char *value);
+#endif
 static int check_attribute_syntax(Parser p, AttributeDefinition a, ElementDefinition e, const Char *value, const char *message, int real_use);
 static int check_attribute_token(Parser p, AttributeDefinition a, ElementDefinition e, const Char *value, int length, const char *message, int real_use);
@@ -167,5 +168,5 @@
 
 static struct element_definition pcdata_element;
-const ElementDefinition Epsilon = 0, PCDataElement = &pcdata_element;
+static const ElementDefinition Epsilon = 0, PCDataElement = &pcdata_element;
 
 static FSM NewFSM(void);
@@ -1207,8 +1208,8 @@
 	{
 	    if(ParserGetFlag(p, ReturnComments))
-		return parse_comment(p, 0, 0);
+		return parse_comment(p, 0);
 	    else
 	    {
-		require(parse_comment(p, 1, 0));
+		require(parse_comment(p, 1));
 		/* XXX avoid recursion here */
 		return parse(p);
@@ -1228,5 +1229,5 @@
 
     case '?':
-	return parse_pi(p, 0);
+	return parse_pi(p);
 
     case BADCHAR:
@@ -1326,5 +1327,5 @@
 static int check_qualname_syntax(Parser p, const Char *name, const char *type)
 {
-    Char *t;
+    const Char *t;
 
     t = Strchr(name, ':'); 
@@ -1358,5 +1359,8 @@
 static int parse_starttag(Parser p)
 {
-    int c, is_top_level = 0;
+    int c;
+#if not_yet
+    is_top_level = 0;
+#endif
     ElementDefinition e;
     AttributeDefinition d;
@@ -1374,5 +1378,7 @@
 	    require(validate_dtd(p));
 	}
+#if not_yet
 	is_top_level = 1;
+#endif
     }
 
@@ -1545,7 +1551,4 @@
 	/* check for required attributes */
 
-	AttributeDefinition d;
-	Attribute a;
-
 	for(d=NextAttributeDefinition(e, 0);
 	    d;
@@ -1662,5 +1665,5 @@
 		if(a->definition == d)
 		{
-		    p->xbit.wsm = process_xml_space(p, a->value);
+		    p->xbit.wsm = process_xml_space(a->value);
 		    goto done;
 		}
@@ -1668,5 +1671,5 @@
 	    if(d->default_type == DT_none || d->default_type == DT_fixed)
 	    {
-		p->xbit.wsm = process_xml_space(p, d->default_value);
+		p->xbit.wsm = process_xml_space(d->default_value);
 		goto done;
 	    }
@@ -2090,9 +2093,8 @@
 }
 
-static WhiteSpaceMode process_xml_space(Parser p, const Char *value)
+static WhiteSpaceMode process_xml_space(const Char *value)
 {
     static Char _preserve[9] = {'p','r','e','s','e','r','v','e',0};
     static Char _default[8] = {'d','e','f','a','u','l','t',0};
-    Char buf[9];
     const Char *v;
     int i;
@@ -2106,7 +2108,5 @@
 	if(!v[i] || is_xml_whitespace_16(v[i]))
 	    break;
-	buf[i] = v[i];
     }
-    buf[i] = '\0';
     for(; v[i]; i++)
 	if(!is_xml_whitespace_16(v[i]))
@@ -2208,5 +2208,5 @@
 	    {
 		s->next = next + 3;
-		require(parse_comment(p, 1, 0));
+		require(parse_comment(p, 1));
                 NF16StartCheck(p);
 		buflen = s->line_length;
@@ -2352,5 +2352,5 @@
 /* Called after reading '<!--'.  Won't go over an entity end. */
 
-static int parse_comment(Parser p, int skip, Entity ent)
+static int parse_comment(Parser p, int skip)
 {
     InputSource s = p->source;
@@ -2421,5 +2421,5 @@
 }
 
-static int parse_pi(Parser p, Entity ent)
+static int parse_pi(Parser p)
 {
     InputSource s = p->source;
@@ -3002,5 +3002,5 @@
     char8 *value;
     CharacterEncoding enc = CE_unknown;
-    Char c;
+    int c;
 
     /* 
@@ -3344,5 +3344,5 @@
 	else if(looking_at(p, "?"))
 	{
-	    require(parse_pi(p, cur_ent));
+	    require(parse_pi(p));
 	    if(p->dtd_callback)
 		p->dtd_callback(&p->xbit, p->dtd_callback_arg);
@@ -3355,5 +3355,5 @@
 	    if(ParserGetFlag(p, ReturnComments))
 	    {
-		require(parse_comment(p, 0, cur_ent));
+		require(parse_comment(p, 0));
 		if(p->dtd_callback)
 		    p->dtd_callback(&p->xbit, p->dtd_callback_arg);
@@ -3363,5 +3363,5 @@
 	    }
 	    else
-		return parse_comment(p, 1, cur_ent);
+		return parse_comment(p, 1);
 	}
 	else if(p->state == PS_error)	/* looking_at may have set it */
@@ -5387,17 +5387,19 @@
 	}
 
+#if 0
     if(a == e->xml_lang_attribute)
     {
 	require(validate_xml_lang_attribute(p, e, value));
     }
+#endif
 
     return 0;
 }
 
+#if 0
 static int validate_xml_lang_attribute(Parser p, ElementDefinition e, const Char *value)
 {
     /* 1.1 will allow empty xml:lang values (and maybe 1.0 will be amended
        to), and it no longer seems worth checking anything here. */
-#if 0
     const Char *t;
 
@@ -5440,7 +5442,7 @@
     /* Not a validity error since erratum 73 */
     warn(p, "Dubious xml:lang attribute for element %S", e->name);
-#endif
     return 0;
 }
+#endif
 
 /* Check an attribute matches Name[s] or Nmtoken[s].