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 2001/06/15 23:16:09 UTC
cvs commit: xml-xalan/c/src/PlatformSupport XalanOutputStream.hpp XalanOutputStream.cpp
dbertoni 01/06/15 14:16:08
Modified: c/src/PlatformSupport XalanOutputStream.hpp
XalanOutputStream.cpp
Log:
Removed code that required null-terminated buffers.
Revision Changes Path
1.5 +2 -16 xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp
Index: XalanOutputStream.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanOutputStream.hpp 2001/06/15 20:13:44 1.4
+++ XalanOutputStream.hpp 2001/06/15 21:16:07 1.5
@@ -273,7 +273,7 @@
private:
- const XalanDOMString& m_encoding;
+ const XalanDOMString m_encoding;
};
class XALAN_PLATFORMSUPPORT_EXPORT TranscoderInternalFailureException : public XalanOutputStreamException
@@ -293,7 +293,7 @@
private:
- const XalanDOMString& m_encoding;
+ const XalanDOMString m_encoding;
};
class XALAN_PLATFORMSUPPORT_EXPORT TranscodingException : public XalanOutputStreamException
@@ -310,17 +310,6 @@
protected:
/**
- * Transcode a null-terminated wide string.
- *
- * @param theBuffer The string to transcode.
- * @param theDestination The destination vector.
- */
- void
- transcode(
- const XalanDOMChar* theBuffer,
- TranscodeVectorType& theDestination);
-
- /**
* Transcode a wide string.
*
* @param theBuffer The string to transcode.
@@ -354,9 +343,6 @@
// Utility functions...
void
flushBuffer();
-
- void
- doWrite(const XalanDOMChar* theBuffer);
void
doWrite(
1.11 +7 -49 xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp
Index: XalanOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XalanOutputStream.cpp 2001/06/15 20:13:43 1.10
+++ XalanOutputStream.cpp 2001/06/15 21:16:07 1.11
@@ -125,33 +125,6 @@
void
XalanOutputStream::transcode(
const XalanDOMChar* theBuffer,
- TranscodeVectorType& theDestination)
-{
- // This is a special version that will short-cut when
- // transocding to the local code page. On platforms
- // where XalanDOMChar == wchar_t, it saves copying
- // to a temporary buffer for the purposes of null-
- // terminating the string.
- if (m_transcoder == 0)
- {
- if (TranscodeToLocalCodePage(
- theBuffer,
- theDestination) == false)
- {
- throw TranscodingException();
- }
- }
- else
- {
- transcode(theBuffer, length(theBuffer), theDestination);
- }
-}
-
-
-
-void
-XalanOutputStream::transcode(
- const XalanDOMChar* theBuffer,
unsigned long theBufferLength,
TranscodeVectorType& theDestination)
{
@@ -317,9 +290,7 @@
{
if (m_buffer.size() > 0)
{
- m_buffer.push_back(0);
-
- doWrite(&*m_buffer.begin());
+ doWrite(&*m_buffer.begin(), m_buffer.size());
m_buffer.clear();
}
@@ -328,7 +299,9 @@
void
-XalanOutputStream::doWrite(const XalanDOMChar* theBuffer)
+XalanOutputStream::doWrite(
+ const XalanDOMChar* theBuffer,
+ unsigned long theBufferLength)
{
assert(theBuffer != 0);
@@ -341,14 +314,14 @@
// This is a hack to write UTF-16 through as if it
// were just chars. Saves lots of time "transcoding."
#if defined(XALAN_OLD_STYLE_CASTS)
- writeData((const char*)theBuffer, length(theBuffer) * 2);
+ writeData((const char*)theBuffer, theBufferLength * 2);
#else
- writeData(reinterpret_cast<const char*>(theBuffer), length(theBuffer) * 2);
+ writeData(reinterpret_cast<const char*>(theBuffer), theBufferLength * 2);
#endif
}
else
{
- transcode(theBuffer, m_transcodingBuffer);
+ transcode(theBuffer, theBufferLength, m_transcodingBuffer);
assert(&m_transcodingBuffer[0] != 0);
@@ -363,21 +336,6 @@
throw;
}
-}
-
-
-
-void
-XalanOutputStream::doWrite(
- const XalanDOMChar* theBuffer,
- unsigned long theBufferLength)
-{
- // $$$ ToDo: Revisit this!!!
- BufferType theLocalBuffer(theBuffer, theBuffer + theBufferLength);
-
- theLocalBuffer.push_back(0);
-
- doWrite(&theLocalBuffer[0]);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org