From kwaclaw at users.sourceforge.net Sun May 2 13:31:15 2004 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Sun May 2 13:31:20 2004 Subject: [Expat-checkins] expat/lib xmlparse.c,1.132,1.133 Message-ID: Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24606 Modified Files: xmlparse.c Log Message: Fix for bug #946506: PublicId for DOCTYPE not checked & normalized. Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- xmlparse.c 29 Apr 2004 17:53:34 -0000 1.132 +++ xmlparse.c 2 May 2004 17:31:13 -0000 1.133 @@ -3675,28 +3675,31 @@ case XML_ROLE_DOCTYPE_PUBLIC_ID: #ifdef XML_DTD useForeignDTD = XML_FALSE; + declEntity = (ENTITY *)lookup(&dtd->paramEntities, + externalSubsetName, + sizeof(ENTITY)); + if (!declEntity) + return XML_ERROR_NO_MEMORY; #endif /* XML_DTD */ dtd->hasParamEntityRefs = XML_TRUE; if (startDoctypeDeclHandler) { + if (!XmlIsPublicId(enc, s, next, eventPP)) + return XML_ERROR_SYNTAX; doctypePubid = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!doctypePubid) return XML_ERROR_NO_MEMORY; + normalizePublicId((XML_Char *)doctypePubid); poolFinish(&tempPool); handleDefault = XML_FALSE; + goto alreadyChecked; } -#ifdef XML_DTD - declEntity = (ENTITY *)lookup(&dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; -#endif /* XML_DTD */ /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_SYNTAX; + alreadyChecked: if (dtd->keepProcessing && declEntity) { XML_Char *tem = poolStoreString(&dtd->pool, enc, From kwaclaw at users.sourceforge.net Thu May 6 09:55:52 2004 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Thu May 6 09:55:59 2004 Subject: [Expat-checkins] expat/lib expat_external.h, NONE, 1.1 expat.dsp, 1.11, 1.12 expat.h, 1.67, 1.68 expat_static.dsp, 1.3, 1.4 expatw.dsp, 1.4, 1.5 expatw_static.dsp, 1.3, 1.4 xmlrole.c, 1.18, 1.19 xmltok.c, 1.31, 1.32 external.h, 1.1, NONE Message-ID: Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32649 Modified Files: expat.dsp expat.h expat_static.dsp expatw.dsp expatw_static.dsp xmlrole.c xmltok.c Added Files: expat_external.h Removed Files: external.h Log Message: Renamed exrternal.h to expat_external.h. Fixed up references to this file. --- NEW FILE: expat_external.h --- /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* External API definitions */ #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) #define XML_USE_MSC_EXTENSIONS 1 #endif /* Expat tries very hard to make the API boundary very specifically defined. There are two macros defined to control this boundary; each of these can be defined before including this header to achieve some different behavior, but doing so it not recommended or tested frequently. XMLCALL - The calling convention to use for all calls across the "library boundary." This will default to cdecl, and try really hard to tell the compiler that's what we want. XMLIMPORT - Whatever magic is needed to note that a function is to be imported from a dynamically loaded library (.dll, .so, or .sl, depending on your platform). The XMLCALL macro was added in Expat 1.95.7. The only one which is expected to be directly useful in client code is XMLCALL. Note that on at least some Unix versions, the Expat library must be compiled with the cdecl calling convention as the default since system headers may assume the cdecl convention. */ #ifndef XMLCALL #if defined(XML_USE_MSC_EXTENSIONS) #define XMLCALL __cdecl #elif defined(__GNUC__) && defined(__i386) #define XMLCALL __attribute__((cdecl)) #else /* For any platform which uses this definition and supports more than one calling convention, we need to extend this definition to declare the convention used on that platform, if it's possible to do so. If this is the case for your platform, please file a bug report with information on how to identify your platform via the C pre-processor and how to specify the same calling convention as the platform's malloc() implementation. */ #define XMLCALL #endif #endif /* not defined XMLCALL */ #if !defined(XML_STATIC) && !defined(XMLIMPORT) #ifndef XML_BUILDING_EXPAT /* using Expat from an application */ #ifdef XML_USE_MSC_EXTENSIONS #define XMLIMPORT __declspec(dllimport) #endif #endif #endif /* not defined XML_STATIC */ /* If we didn't define it above, define it away: */ #ifndef XMLIMPORT #define XMLIMPORT #endif #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL #ifdef __cplusplus extern "C" { #endif #ifdef XML_UNICODE_WCHAR_T #define XML_UNICODE #endif #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ #ifdef XML_UNICODE_WCHAR_T typedef wchar_t XML_Char; typedef wchar_t XML_LChar; #else typedef unsigned short XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE_WCHAR_T */ #else /* Information is UTF-8 encoded. */ typedef char XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE */ Index: expat.dsp =================================================================== RCS file: /cvsroot/expat/expat/lib/expat.dsp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- expat.dsp 26 Mar 2004 14:24:09 -0000 1.11 +++ expat.dsp 6 May 2004 13:55:49 -0000 1.12 @@ -133,7 +133,7 @@ # End Source File # Begin Source File -SOURCE=.\external.h +SOURCE=.\expat_external.h # End Source File # Begin Source File Index: expat.h =================================================================== RCS file: /cvsroot/expat/expat/lib/expat.h,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- expat.h 27 Apr 2004 00:49:34 -0000 1.67 +++ expat.h 6 May 2004 13:55:49 -0000 1.68 @@ -15,7 +15,7 @@ #endif #include -#include "external.h" +#include "expat_external.h" struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; Index: expat_static.dsp =================================================================== RCS file: /cvsroot/expat/expat/lib/expat_static.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- expat_static.dsp 26 Mar 2004 14:24:10 -0000 1.3 +++ expat_static.dsp 6 May 2004 13:55:49 -0000 1.4 @@ -115,7 +115,7 @@ # End Source File # Begin Source File -SOURCE=.\external.h +SOURCE=.\expat_external.h # End Source File # Begin Source File Index: expatw.dsp =================================================================== RCS file: /cvsroot/expat/expat/lib/expatw.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- expatw.dsp 26 Mar 2004 14:24:10 -0000 1.4 +++ expatw.dsp 6 May 2004 13:55:49 -0000 1.5 @@ -134,7 +134,7 @@ # End Source File # Begin Source File -SOURCE=.\external.h +SOURCE=.\expat_external.h # End Source File # Begin Source File Index: expatw_static.dsp =================================================================== RCS file: /cvsroot/expat/expat/lib/expatw_static.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- expatw_static.dsp 26 Mar 2004 14:24:10 -0000 1.3 +++ expatw_static.dsp 6 May 2004 13:55:49 -0000 1.4 @@ -115,7 +115,7 @@ # End Source File # Begin Source File -SOURCE=.\external.h +SOURCE=.\expat_external.h # End Source File # Begin Source File Index: xmlrole.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlrole.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- xmlrole.c 24 Apr 2004 23:56:41 -0000 1.18 +++ xmlrole.c 6 May 2004 13:55:49 -0000 1.19 @@ -14,7 +14,7 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include "external.h" +#include "expat_external.h" #include "internal.h" #include "xmlrole.h" #include "ascii.h" Index: xmltok.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmltok.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- xmltok.c 24 Apr 2004 23:56:41 -0000 1.31 +++ xmltok.c 6 May 2004 13:55:49 -0000 1.32 @@ -14,7 +14,7 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include "external.h" +#include "expat_external.h" #include "internal.h" #include "xmltok.h" #include "nametab.h" --- external.h DELETED --- From kwaclaw at users.sourceforge.net Fri May 7 16:00:53 2004 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Fri May 7 16:00:58 2004 Subject: [Expat-checkins] expat Makefile.in,1.45,1.46 Message-ID: Update of /cvsroot/expat/expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19305 Modified Files: Makefile.in Log Message: Added expat_external.h Index: Makefile.in =================================================================== RCS file: /cvsroot/expat/expat/Makefile.in,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- Makefile.in 30 Apr 2004 03:18:08 -0000 1.45 +++ Makefile.in 7 May 2004 20:00:48 -0000 1.46 @@ -41,7 +41,7 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs MANFILE = $(srcdir)/doc/xmlwf.1 -APIHEADER = $(srcdir)/lib/expat.h +APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h LIBRARY = libexpat.la @@ -118,15 +118,15 @@ $(LINK_LIB) $(LIB_OBJS) lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ - $(top_builddir)/expat_config.h lib/internal.h + $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ - $(top_builddir)/expat_config.h lib/internal.h + $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \ lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \ lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \ - $(top_builddir)/expat_config.h + $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o From kwaclaw at users.sourceforge.net Tue May 18 09:50:16 2004 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Tue May 18 10:52:48 2004 Subject: [Expat-checkins] expat/lib expat.h, 1.68, 1.69 xmlparse.c, 1.133, 1.134 Message-ID: Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv431 Modified Files: expat.h xmlparse.c Log Message: Added a few more meaningful error codes (and messages). Index: expat.h =================================================================== RCS file: /cvsroot/expat/expat/lib/expat.h,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- expat.h 6 May 2004 13:55:49 -0000 1.68 +++ expat.h 18 May 2004 13:50:13 -0000 1.69 @@ -76,6 +76,11 @@ XML_ERROR_FEATURE_REQUIRES_XML_DTD, XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, XML_ERROR_UNBOUND_PREFIX, + XML_ERROR_UNDECLARING_PREFIX, + XML_ERROR_INCOMPLETE_PE, + XML_ERROR_XML_DECL, + XML_ERROR_TEXT_DECL, + XML_ERROR_PUBLICID, XML_ERROR_SUSPENDED, XML_ERROR_NOT_SUSPENDED, XML_ERROR_ABORTED, Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.133 retrieving revision 1.134 diff -u -d -r1.133 -r1.134 --- xmlparse.c 2 May 2004 17:31:13 -0000 1.133 +++ xmlparse.c 18 May 2004 13:50:13 -0000 1.134 @@ -1863,6 +1863,11 @@ XML_L("requested feature requires XML_DTD support in Expat"), XML_L("cannot change setting once parsing has begun"), XML_L("unbound prefix"), + XML_L("must not undeclare prefix"), + XML_L("incomplete markup in parameter entity"), + XML_L("XML declaration not well-formed"), + XML_L("text declaration not well-formed"), + XML_L("illegal character(s) in public id"), XML_L("parser suspended"), XML_L("parser not suspended"), XML_L("parsing aborted"), @@ -2916,9 +2921,9 @@ BINDING *b; int len; - /* empty string is only valid when there is no prefix per XML NS 1.0 */ + /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */ if (*uri == XML_T('\0') && prefix->name) - return XML_ERROR_SYNTAX; + return XML_ERROR_UNDECLARING_PREFIX; for (len = 0; uri[len]; len++) ; @@ -3242,8 +3247,12 @@ &versionend, &encodingName, &newEncoding, - &standalone)) - return XML_ERROR_SYNTAX; + &standalone)) { + if (isGeneralTextEntity) + return XML_ERROR_TEXT_DECL; + else + return XML_ERROR_XML_DECL; + } if (!isGeneralTextEntity && standalone == 1) { _dtd->standalone = XML_TRUE; #ifdef XML_DTD @@ -3618,7 +3627,7 @@ if (isParamEntity || enc != encoding) { if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) == XML_ROLE_ERROR) - return XML_ERROR_SYNTAX; + return XML_ERROR_INCOMPLETE_PE; *nextPtr = s; return XML_ERROR_NONE; } @@ -3684,7 +3693,7 @@ dtd->hasParamEntityRefs = XML_TRUE; if (startDoctypeDeclHandler) { if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; + return XML_ERROR_PUBLICID; doctypePubid = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); @@ -3698,7 +3707,7 @@ /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; + return XML_ERROR_PUBLICID; alreadyChecked: if (dtd->keepProcessing && declEntity) { XML_Char *tem = poolStoreString(&dtd->pool, @@ -4122,7 +4131,7 @@ break; case XML_ROLE_NOTATION_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; + return XML_ERROR_PUBLICID; if (declNotationName) { /* means notationDeclHandler != NULL */ XML_Char *tem = poolStoreString(&tempPool, enc, From kwaclaw at users.sourceforge.net Thu May 27 13:38:55 2004 From: kwaclaw at users.sourceforge.net (Karl Waclawek) Date: Thu May 27 13:38:59 2004 Subject: [Expat-checkins] expat/lib xmlparse.c,1.134,1.135 Message-ID: Update of /cvsroot/expat/expat/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14668 Modified Files: xmlparse.c Log Message: Applied patch for bug #961698 supplied by Anders Carlsson. Index: xmlparse.c =================================================================== RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- xmlparse.c 18 May 2004 13:50:13 -0000 1.134 +++ xmlparse.c 27 May 2004 17:38:52 -0000 1.135 @@ -5758,8 +5758,10 @@ table->size = (size_t)1 << INIT_POWER; tsize = table->size * sizeof(NAMED *); table->v = (NAMED **)table->mem->malloc_fcn(tsize); - if (!table->v) + if (!table->v) { + table->size = 0; return NULL; + } memset(table->v, 0, tsize); i = hash(name) & ((unsigned long)table->size - 1); }