From 358af7d5d7f0d66d769514089af81cb2989a5380 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 27 Aug 2006 21:19:38 +0000 Subject: [PATCH] fixed xml writer to use current line endings git-svn-id: trunk@9758 - --- components/codetools/laz_xmlread.pas | 4 +++- components/codetools/laz_xmlwrite.pas | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/codetools/laz_xmlread.pas b/components/codetools/laz_xmlread.pas index de8bb88868..23b38f6ef0 100644 --- a/components/codetools/laz_xmlread.pas +++ b/components/codetools/laz_xmlread.pas @@ -263,9 +263,11 @@ begin x := 1; y := 1; while apos < buf do begin - if apos[0] = #10 then begin + if apos^ in [#10,#13] then begin Inc(y); x := 1; + if (apos[1] in [#10,#13]) and (apos[0]<>apos[1]) then + inc(apos); end else Inc(x); Inc(apos); diff --git a/components/codetools/laz_xmlwrite.pas b/components/codetools/laz_xmlwrite.pas index c96e3ed895..8843dfd0a4 100644 --- a/components/codetools/laz_xmlwrite.pas +++ b/components/codetools/laz_xmlwrite.pas @@ -65,6 +65,7 @@ const (@WriteElement, @WriteAttribute, @WriteText, @WriteCDATA, @WriteEntityRef, @WriteEntity, @WritePI, @WriteComment, @WriteDocument, @WriteDocumentType, @WriteDocumentFragment, @WriteNotation); + LineEnd: shortstring = LineEnding; procedure WriteNode(node: TDOMNode); begin @@ -116,7 +117,7 @@ procedure Stream_WriteLn(const Buffer; Count: Longint); begin if Count > 0 then begin stream.Write(Buffer, Count); - stream.WriteByte(10); + stream.Write(LineEnd[1],length(LineEnd)); end; end; @@ -139,7 +140,7 @@ end; procedure wrtLineEnd; begin - wrt(#10,1); + wrt(LineEnd[1],length(LineEnd)); end; // -------------------------------------------------------------------