You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2003/08/07 07:43:26 UTC

cvs commit: xml-xalan/c/src/xalanc/PlatformSupport XalanOutputStream.hpp XalanOutputStreamPrintWriter.cpp XalanOutputStreamPrintWriter.hpp

dbertoni    2003/08/06 22:43:26

  Modified:    c/src/xalanc/PlatformSupport XalanOutputStream.hpp
                        XalanOutputStreamPrintWriter.cpp
                        XalanOutputStreamPrintWriter.hpp
  Log:
  Make sure XalanOutputStreamPrintWriter does not mix wide and narrow character writes without flushing as required.  Fixes Bugzilla 22197.
  
  Revision  Changes    Path
  1.3       +8 -4      xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStream.hpp
  
  Index: XalanOutputStream.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStream.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanOutputStream.hpp	2 Jul 2003 22:43:33 -0000	1.2
  +++ XalanOutputStream.hpp	7 Aug 2003 05:43:26 -0000	1.3
  @@ -142,6 +142,14 @@
   	getNewlineString() const;
   
   	/**
  +	 * Flush the stream's transcoding buffer, but do not request
  +	 * the implementation class to flush its buffer.
  +	 * .
  +	 */
  +	void
  +	flushBuffer();
  +
  +	/**
   	 * Flush the stream's buffer.
   	 */
   	void
  @@ -438,10 +446,6 @@
   
   	bool
   	operator==(const XalanOutputStream&) const;
  -
  -	// Utility functions...
  -	void
  -	flushBuffer();
   
   	void
   	doWrite(
  
  
  
  1.2       +26 -6     xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStreamPrintWriter.cpp
  
  Index: XalanOutputStreamPrintWriter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStreamPrintWriter.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanOutputStreamPrintWriter.cpp	29 Jun 2003 03:57:55 -0000	1.1
  +++ XalanOutputStreamPrintWriter.cpp	7 Aug 2003 05:43:26 -0000	1.2
  @@ -81,7 +81,8 @@
   			bool				fAutoFlush) :
   	PrintWriter(fAutoFlush),
   	m_outputStream(theOutputStream),
  -	m_buffer()
  +	m_buffer(),
  +	m_flushWideChars(false)
   {
   }
   
  @@ -94,6 +95,19 @@
   
   
   
  +void
  +XalanOutputStreamPrintWriter::flushWideChars()
  +{
  +	if (m_flushWideChars == true)
  +	{
  +		m_outputStream.flushBuffer();
  +
  +		m_flushWideChars = false;
  +	}
  +}
  +
  +
  +
   bool
   XalanOutputStreamPrintWriter::checkError() const
   {
  @@ -141,6 +155,8 @@
   {
   	assert(s != 0);
   
  +	flushWideChars();
  +
   	if (theLength == npos)
   	{
   		if (theOffset == 0)
  @@ -183,6 +199,8 @@
   	{
   		m_outputStream.write(s + theOffset, theLength);
   	}
  +
  +	m_flushWideChars = true;
   }
   
   
  @@ -191,6 +209,8 @@
   XalanOutputStreamPrintWriter::write(XalanDOMChar	c)
   {
   	m_outputStream.write(c);
  +
  +	m_flushWideChars = true;
   }
   
   
  @@ -264,7 +284,7 @@
   
   	DoubleToDOMString(d, m_buffer);
   
  -	m_outputStream.write(c_wstr(m_buffer), length(m_buffer));
  +	print(m_buffer);
   }
   
   
  @@ -276,7 +296,7 @@
   
   	LongToDOMString(i, m_buffer);
   
  -	m_outputStream.write(c_wstr(m_buffer), length(m_buffer));
  +	print(m_buffer);
   }
   
   
  @@ -288,7 +308,7 @@
   
   	LongToDOMString(l, m_buffer);
   
  -	m_outputStream.write(c_wstr(m_buffer), length(m_buffer));
  +	print(m_buffer);
   }
   
   
  @@ -296,7 +316,7 @@
   void
   XalanOutputStreamPrintWriter::print(const XalanDOMString&	s)
   {
  -	m_outputStream.write(c_wstr(s), length(s));
  +	write(c_wstr(s), 0, length(s));
   }
   
   
  @@ -304,7 +324,7 @@
   void
   XalanOutputStreamPrintWriter::println()
   {
  -	m_outputStream.write(c_wstr(s_newlineString), length(s_newlineString));
  +	write(c_wstr(s_newlineString), 0, length(s_newlineString));
   
   	flush();
   }
  
  
  
  1.2       +6 -1      xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStreamPrintWriter.hpp
  
  Index: XalanOutputStreamPrintWriter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStreamPrintWriter.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanOutputStreamPrintWriter.hpp	29 Jun 2003 03:57:55 -0000	1.1
  +++ XalanOutputStreamPrintWriter.hpp	7 Aug 2003 05:43:26 -0000	1.2
  @@ -200,6 +200,10 @@
   
   private:
   
  +	void
  +	flushWideChars();
  +
  +
   	// Not implemented
   	XalanOutputStreamPrintWriter(const XalanOutputStreamPrintWriter&);
   
  @@ -209,11 +213,12 @@
   	bool
   	operator==(const XalanOutputStreamPrintWriter&);
   
  -
   	// Data members...
   	XalanOutputStream&	m_outputStream;
   
   	XalanDOMString		m_buffer;
  +
  +	bool				m_flushWideChars;
   };
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org