dbertoni 00/10/04 10:51:18
Modified: c/src/XMLSupport FormatterToText.cpp
Log:
Do LF to CR/LF translation on platforms that need it.
Revision Changes Path
1.9 +22 -2 xml-xalan/c/src/XMLSupport/FormatterToText.cpp
Index: FormatterToText.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToText.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FormatterToText.cpp 2000/06/30 21:29:21 1.8
+++ FormatterToText.cpp 2000/10/04 17:51:17 1.9
@@ -64,6 +64,9 @@
#include <PlatformSupport/Writer.hpp>
+#if defined(XALAN_NEWLINE_IS_CRLF)
+#include <PlatformSupport/XalanUnicode.hpp>
+#endif
@@ -130,9 +133,26 @@
const XMLCh* const chars,
const unsigned int length)
{
- m_pw.write(chars, 0, length);
+#if defined(XALAN_NEWLINE_IS_CRLF)
+ for (unsigned int i = 0; i < length; ++i)
+ {
+ // Normalize LF to CR/LF...
+ if (chars[i] == XalanUnicode::charLF &&
+ (i == 0 ||
+ chars[i - 1] != XalanUnicode::charCR))
+ {
+ m_pw.write(XalanUnicode::charCR);
+ }
+
+ m_pw.write(chars[i]);
+ }
+#else
+ m_pw.write(chars, 0, length);
+#endif
}
+
+
void
FormatterToText::charactersRaw(
const XMLCh* const chars,
@@ -191,5 +211,5 @@
const XMLCh* const ch,
const unsigned int length)
{
- m_pw.write(ch, 0, length);
+ characters(ch, length);
}