svn commit: r566565 - in head/textproc/rxp: . files

Mikhail Teterin mi at FreeBSD.org
Thu Feb 25 21:49:34 UTC 2021


Author: mi
Date: Thu Feb 25 21:49:33 2021
New Revision: 566565
URL: https://svnweb.freebsd.org/changeset/ports/566565

Log:
  Fix compiler warnings, use bsd.lib.mk to build and install a shared
  library in addition to static one.

Added:
  head/textproc/rxp/files/BSDmakefile.lib   (contents, props changed)
  head/textproc/rxp/files/BSDmakefile.rxp   (contents, props changed)
  head/textproc/rxp/files/patch-warnings   (contents, props changed)
Deleted:
  head/textproc/rxp/files/patch-Makefile
Modified:
  head/textproc/rxp/Makefile
  head/textproc/rxp/pkg-plist

Modified: head/textproc/rxp/Makefile
==============================================================================
--- head/textproc/rxp/Makefile	Thu Feb 25 21:37:25 2021	(r566564)
+++ head/textproc/rxp/Makefile	Thu Feb 25 21:49:33 2021	(r566565)
@@ -3,21 +3,31 @@
 
 PORTNAME=	rxp
 PORTVERSION=	1.4.4
+PORTREVISION=	1
 CATEGORIES=	textproc
 MASTER_SITES=	ftp://ftp.cogsci.ed.ac.uk/pub/richard/
 
-MAINTAINER=	ports at FreeBSD.org
+MAINTAINER=	mi at aldan.algebra.com
 COMMENT=	Validating XML parser written in C
 
-RXP_HEADERS=	charset.h ctype16.h dtd.h hash.h input.h namespaces.h \
-		rxputil.h stdio16.h string16.h system.h url.h version.h \
-		xmlparser.h
+LICENSE=	GPLv2
 
-do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/rxp ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/librxp.a ${STAGEDIR}${PREFIX}/lib
-	${INSTALL_MAN} ${WRKSRC}/rxp.1 ${STAGEDIR}${PREFIX}/man/man1
-	@${MKDIR} ${STAGEDIR}${PREFIX}/include/rxp
-	${INSTALL_DATA} ${RXP_HEADERS:S,^,${WRKSRC}/,} ${STAGEDIR}${PREFIX}/include/rxp
+USES=	uidfix
+
+USE_LDCONFIG=	yes
+PATCH_WRKSRC=	${WRKSRC}/${PORTNAME}-${PORTVERSION}
+WRKSRC=		${WRKDIR}
+MAKE_ARGS+=	VPATH=${PATCH_WRKSRC}
+
+do-configure:
+.for s in lib rxp
+	${MKDIR} ${WRKDIR}/$s
+	${LN} -s ${FILESDIR}/BSDmakefile.$s ${WRKDIR}/$s/Makefile
+	${PRINTF} "SUBDIR+=\t%s\n" $s >> ${WRKDIR}/Makefile
+.endfor
+	${PRINTF} "\n.include <bsd.subdir.mk>\n" >> ${WRKDIR}/Makefile
+
+post-build:
+	${MKDIR} ${STAGEDIR}${PREFIX}/include/rxp
 
 .include <bsd.port.mk>

Added: head/textproc/rxp/files/BSDmakefile.lib
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/rxp/files/BSDmakefile.lib	Thu Feb 25 21:49:33 2021	(r566565)
@@ -0,0 +1,22 @@
+LIB=	rxp
+SHLIB_MAJOR=	1
+SHLIB_MINOR=	4
+MK_PROFILE=	no
+
+CFLAGS+=	-DCHAR_SIZE=16 -DHAVE_LIBZ
+CFLAGS+=	-Werror
+WARNS=		6
+LDADD=		-lz
+
+SRCS=	catalog.c catutil.c resolve.c entityopener.c xmlparser.c	\
+	url.c charset.c ctype16.c dtd.c input.c stdio16.c string16.c	\
+	system.c hash.c version.c namespaces.c http.c http.c		\
+	nf16check.c nf16data.c
+INCS=	charset.h ctype16.h dtd.h hash.h input.h namespaces.h \
+	rxputil.h stdio16.h string16.h system.h url.h version.h \
+	xmlparser.h
+
+LIBDIR=	${PREFIX}/lib
+INCSDIR=${PREFIX}/include/rxp
+
+.include <bsd.lib.mk>

Added: head/textproc/rxp/files/BSDmakefile.rxp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/rxp/files/BSDmakefile.rxp	Thu Feb 25 21:49:33 2021	(r566565)
@@ -0,0 +1,12 @@
+PROG=	rxp
+
+SRCS=	rxp.c infoset-print.c
+CFLAGS+=	-DCHAR_SIZE=16 -DHAVE_LIBZ
+CFLAGS+=	-Werror
+WARNS=		6
+
+BINDIR=	${PREFIX}/bin
+MANDIR=	${MANPREFIX}/man/man
+LDADD=	-L${.CURDIR:H}/lib -lrxp
+
+.include <bsd.prog.mk>

Added: head/textproc/rxp/files/patch-warnings
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/rxp/files/patch-warnings	Thu Feb 25 21:49:33 2021	(r566565)
@@ -0,0 +1,1779 @@
+--- catalog_dtd.c	2003-06-24 09:15:55.000000000 -0400
++++ 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.c	2004-10-11 08:28:31.000000000 -0400
++++ 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.h	2003-08-28 12:13:19.000000000 -0400
++++ 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);
+--- catutil.c	2003-06-24 11:55:27.000000000 -0400
++++ 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;
+ 
+--- ctype16.h	2004-03-17 10:53:21.000000000 -0500
++++ ctype16.h	2021-02-25 15:07:41.464419000 -0500
+@@ -49,13 +49,13 @@ extern STD_API unsigned char xml_char_ma
+ 
+ #define is_xml_namestart(c,map) \
+-  (c < 0x10000 ? (map[c] & xml_namestart) : (map[c >> 16] & xml_nameblock))
++  ((sizeof(c) <= 2 || c < 0x10000) ? (map[c] & xml_namestart) : (map[c >> 16] & xml_nameblock))
+ 
+ #define is_xml_namechar(c,map) \
+-  (c < 0x10000 ? (map[c] & xml_namechar)  : (map[c >> 16] & xml_nameblock))
++  ((sizeof(c) <= 2 || c < 0x10000) ? (map[c] & xml_namechar)  : (map[c >> 16] & xml_nameblock))
+ 
+ /* NB whitespace map is the same for 1.0 and 1.1 */
+ 
+ #define is_xml_whitespace(c) \
+-  (c < 0x10000 && (xml_char_map[c] & xml_whitespace))
++  ((sizeof(c) <= 2 || c < 0x10000) && (xml_char_map[c] & xml_whitespace))
+ 
+ #endif
+--- dtd.c	2004-11-02 13:20:20.000000000 -0500
++++ 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)
+ {
+--- dtd.h	2004-11-02 12:46:07.000000000 -0500
++++ 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);
+--- entityopener.c	2003-11-27 09:06:38.000000000 -0500
++++ 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;
+--- http.c	2001-05-01 10:29:34.000000000 -0400
++++ 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))
+--- infoset-print.c	2004-11-03 12:17:06.000000000 -0500
++++ infoset-print.c	2021-02-25 15:33:58.693693000 -0500
+@@ -23,5 +23,5 @@ static void children(FILE16 *f, int leve
+ 		     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 @@ static void element(FILE16 *f, int level
+ 		    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 attribute(FILE16 *f, int lev
+ 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 external_entity(FILE16 *f, i
+ 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 @@ static void find_ids(Dtd dtd, XBit *bits
+ 		     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 @@ void infoset_print(FILE16 *f, Parser p, 
+     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 notations(FILE16 *f, int lev
+ }
+ 
+-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 version(FILE16 *f, int level
+ }
+ 
+-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,
+ }
+ 
+-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 Simple(FILE16 *f, int level,
+ }
+ 
+-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 @@ static void item(FILE16 *f, int level, D
+ 	    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 @@ static void element(FILE16 *f, int level
+     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 pi(FILE16 *f, int level, Dtd
+ }
+ 
+-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 @@ static void cdsect(FILE16 *f, int level,
+ 
+     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 cdsect(FILE16 *f, int level,
+ }
+ 
+-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 @@ static void pcdata(FILE16 *f, int level,
+ 
+     for(p=bit->pcdata_chars; *p; p++)
+-	character(f, level, dtd, is_xml_whitespace(*p) ? ecw : "false", *p);
++	character(f, level, is_xml_whitespace(*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 character(FILE16 *f, int lev
+ }
+ 
+-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 @@ static void attribute(FILE16 *f, int lev
+ 	free(token);
+ 	free(id);
++	/* FALLTHROUGH */
+     default:
+ 	simple(f, level+1, "references", 0);
+@@ -640,5 +641,5 @@ static void attribute(FILE16 *f, int lev
+ }
+ 
+-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;
+--- input.c	2005-01-14 11:10:00.000000000 -0500
++++ 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;
+ }
+--- namespaces.c	2003-06-02 12:56:35.000000000 -0400
++++ 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);
+ }
+--- namespaces.h	2003-06-02 12:56:35.000000000 -0400
++++ 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;
+ };
+--- nf16check.c	2003-09-02 10:02:45.000000000 -0400
++++ 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;
+     char16       c;
++    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 */
+--- resolve.c	2003-08-28 12:13:12.000000000 -0400
++++ 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)
+ {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-ports-all mailing list