diff options
author | Steve Huston <shuston@riverace.com> | 2003-01-29 00:07:18 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2003-01-29 00:07:18 +0000 |
commit | e6ab763e2ff8d9611a3e1545d5c0899199ef7dca (patch) | |
tree | d53fbab90a4c955937515b5762a1562ad7132f40 | |
parent | 46da28f44301c444b053f35ff1699c2e6cc73e70 (diff) | |
download | ATCD-e6ab763e2ff8d9611a3e1545d5c0899199ef7dca.tar.gz |
ChangeLogTag:Tue Jan 28 18:46:41 2003 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ACEXML/parser/parser/Parser.cpp | 2 | ||||
-rw-r--r-- | ACEXML/tests/ContentHandler_Test.cpp | 84 | ||||
-rw-r--r-- | ACEXML/tests/ContentHandler_Test.dsp | 104 | ||||
-rw-r--r-- | ACEXML/tests/Makefile | 5 | ||||
-rw-r--r-- | ACEXML/tests/Makefile.bor | 4 | ||||
-rw-r--r-- | ACEXML/tests/Tests.dsw | 14 | ||||
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 16 | ||||
-rw-r--r-- | THANKS | 1 |
9 files changed, 242 insertions, 4 deletions
diff --git a/ACEXML/parser/parser/Parser.cpp b/ACEXML/parser/parser/Parser.cpp index 4b49b5ed895..3c94ce538a9 100644 --- a/ACEXML/parser/parser/Parser.cpp +++ b/ACEXML/parser/parser/Parser.cpp @@ -736,7 +736,7 @@ ACEXML_Parser::parse_element (int is_root ACEXML_ENV_ARG_DECL) // if (this->try_grow_cdata (replace->length (), // cdata_length, xmlenv) == 0) // { - cdata_length = replace->length (); + cdata_length += replace->length (); for (size_t i = 0; i < replace->length (); ++i) this->obstack_.grow ((*replace)[i]); // } diff --git a/ACEXML/tests/ContentHandler_Test.cpp b/ACEXML/tests/ContentHandler_Test.cpp new file mode 100644 index 00000000000..ac4f6f324d6 --- /dev/null +++ b/ACEXML/tests/ContentHandler_Test.cpp @@ -0,0 +1,84 @@ +//============================================================================= +/** + * @file ContentHandler_Test.cpp + * + * $Id$ + * + * @author Steve Huston <shuston@riverace.com> + */ +//============================================================================= + +#include "ACEXML/common/DefaultHandler.h" +#include "ACEXML/common/InputSource.h" +#include "ACEXML/common/StrCharStream.h" +#include "ACEXML/parser/parser/Parser.h" + +class Basic_Content_Tester : public ACEXML_DefaultHandler +{ +public: + Basic_Content_Tester (void) : status_ (0) {} + + /** + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + const ACEXML_Char *get_test_string (void) + { return Basic_Content_Tester::test_string_; } + + int get_status (void) { return this->status_; } + +private: + int status_; + static const ACEXML_Char *test_string_; +}; + +const ACEXML_Char * Basic_Content_Tester::test_string_ = + ACE_TEXT ("<?xml version=\"1.0\"?>") + ACE_TEXT ("<translation type=\"unfinished\">Example\n") + ACE_TEXT ("d'internationalisation</translation></xml>"); + +void +Basic_Content_Tester::characters (const ACEXML_Char *ch, + int start, + int length ACEXML_ENV_ARG_DECL) +{ + static int already_called = 0; + static ACEXML_Char *expect = + ACE_TEXT ("Example\nd'internationalisation"); + + if (already_called) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Basic_Content_Tester::characters called too much\n") + )); + return; + } + + already_called = 1; + + int expected_len = ACE_static_cast (int, ACE_OS::strlen (expect)); + if (length != expected_len) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("characters() expected len %d (%*s); ") + ACE_TEXT ("got %d (%*s)\n"), + expected_len, expected_len, ch + start, + length, length, ch + start)); + return; +} + +int +ACE_TMAIN (int, ACE_TCHAR *[]) +{ + Basic_Content_Tester tester; + ACEXML_StrCharStream *test_stream = + new ACEXML_StrCharStream (tester.get_test_string ()); + ACEXML_InputSource input (test_stream); + ACEXML_Parser parser; + parser.setContentHandler (&tester); + parser.parse (&input); + return tester.get_status (); +} diff --git a/ACEXML/tests/ContentHandler_Test.dsp b/ACEXML/tests/ContentHandler_Test.dsp new file mode 100644 index 00000000000..84ab3108878 --- /dev/null +++ b/ACEXML/tests/ContentHandler_Test.dsp @@ -0,0 +1,104 @@ +# Microsoft Developer Studio Project File - Name="ContentHandler_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ContentHandler_Test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ContentHandler_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ContentHandler_Test.mak" CFG="ContentHandler_Test - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ContentHandler_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ContentHandler_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ContentHandler_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib ACEXML_Parser.lib ACEXML.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\ace" /libpath:"..\Common" /libpath:"..\parser\parser"
+
+!ELSEIF "$(CFG)" == "ContentHandler_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib ACEXML_Parserd.lib ACEXMLd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\ace" /libpath:"..\Common" /libpath:"..\parser\parser"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ContentHandler_Test - Win32 Release"
+# Name "ContentHandler_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\ContentHandler_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/ACEXML/tests/Makefile b/ACEXML/tests/Makefile index 3e60bf3faa7..a144083d88d 100644 --- a/ACEXML/tests/Makefile +++ b/ACEXML/tests/Makefile @@ -8,10 +8,11 @@ # Local macros #---------------------------------------------------------------------------- -LDLIBS = -lACEXML +LDLIBS = -lACEXML_Parser -lACEXML BIN = Transcoder_Test \ NamespaceSupport_Test \ - HttpCharStream_Test + HttpCharStream_Test \ + ContentHandler_Test LSRC = $(addsuffix .cpp,$(BIN)) LOBJ = $(LSRC:%.cpp=$(VDIR)%.o) diff --git a/ACEXML/tests/Makefile.bor b/ACEXML/tests/Makefile.bor index b7de8ddaea5..d2bc13a9dc2 100644 --- a/ACEXML/tests/Makefile.bor +++ b/ACEXML/tests/Makefile.bor @@ -6,7 +6,8 @@ NAMES = \ NamespaceSupport_Test \ Transcoder_Test \ - HttpCharStream_Test + HttpCharStream_Test \ + ContentHandler_Test OBJFILES = $(OBJDIR)\$(NAME).obj @@ -18,6 +19,7 @@ CPPDIR = . LIBFILES = \ $(ACE_LIB) \ + $(ACE_XML_PARSER_LIB) \ $(ACE_XML_LIB) !include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/ACEXML/tests/Tests.dsw b/ACEXML/tests/Tests.dsw index 0e59bdd969f..176ab08e31c 100644 --- a/ACEXML/tests/Tests.dsw +++ b/ACEXML/tests/Tests.dsw @@ -3,6 +3,20 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ###############################################################################
+Project: "ContentHandler_Test"=.\ContentHandler_Test.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+###############################################################################
+
Project: "HttpCharStream_Test"=.\HttpCharStream_Test.dsp - Package Owner=<4>
Package=<5>
diff --git a/ChangeLog b/ChangeLog index f92658d5b29..271a9114040 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Tue Jan 28 18:46:41 2003 Steve Huston <shuston@riverace.com> + + * ACEXML/parser/parser/Parser.cpp (parse_element): When converting + an escape sequence, add its length, don't lose the length of + already-parsed content. Thanks to Emmanuel Thevenot Beaufort + <emmanuel.thevenot-beaufort@jci.com> for this fix. + + * ACEXML/tests/ContentHandler_Test.{cpp dsp}: New test that + illustrates the problem above and validates the fix. + + * ACEXML/tests/Tests.dsw: + * ACEXML/Makefile: + * ACEXML/Makefile.bor: Added ContentHandler_Test. + + * THANKS: Added Emmanuel Thevenot Beaufort to the Hall of Fame. + Tue Jan 28 15:47:29 2003 Steve Huston <shuston@riverace.com> * include/makeinclude/platform_hpux_aCC.GNU: For distrib builds, diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index f92658d5b29..271a9114040 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,19 @@ +Tue Jan 28 18:46:41 2003 Steve Huston <shuston@riverace.com> + + * ACEXML/parser/parser/Parser.cpp (parse_element): When converting + an escape sequence, add its length, don't lose the length of + already-parsed content. Thanks to Emmanuel Thevenot Beaufort + <emmanuel.thevenot-beaufort@jci.com> for this fix. + + * ACEXML/tests/ContentHandler_Test.{cpp dsp}: New test that + illustrates the problem above and validates the fix. + + * ACEXML/tests/Tests.dsw: + * ACEXML/Makefile: + * ACEXML/Makefile.bor: Added ContentHandler_Test. + + * THANKS: Added Emmanuel Thevenot Beaufort to the Hall of Fame. + Tue Jan 28 15:47:29 2003 Steve Huston <shuston@riverace.com> * include/makeinclude/platform_hpux_aCC.GNU: For distrib builds, @@ -1656,6 +1656,7 @@ Volodymyr Orlenko <vorlenko@jaalam.com> Grigory <grig@plesk.com> Michael Soden <soden@ikv.de> Dennis Sporcic <dennis@hsa.com.au> +Emmanuel Thevenot Beaufort <emmanuel.thevenot-beaufort@jci.com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile |