mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Revert r2106 and a similar change. Fixes issue #1092.
This commit is contained in:
@ -1533,12 +1533,6 @@ function escChars(Text: WideString; EscChar, Char1, Char2, Char3, Char4: WideCha
|
||||
const
|
||||
// Attempt to match whatever the CPU cache will hold.
|
||||
block: Cardinal = 65536;
|
||||
NLold1 = #13;
|
||||
NLold2 = #10;
|
||||
NullOld = #0;
|
||||
NLnew1 = 'r';
|
||||
NLnew2 = 'n';
|
||||
NullNew = '0';
|
||||
var
|
||||
bstart, bend, matches, i: Cardinal;
|
||||
// These could be bumped to uint64 if necessary.
|
||||
@ -1557,37 +1551,20 @@ begin
|
||||
(Text[i] = Char1) or
|
||||
(Text[i] = Char2) or
|
||||
(Text[i] = Char3) or
|
||||
(Text[i] = Char4) or
|
||||
(Text[i] = NLold1) or
|
||||
(Text[i] = NLold2) or
|
||||
(Text[i] = NullOld)
|
||||
(Text[i] = Char4)
|
||||
then Inc(matches);
|
||||
SetLength(Result, bend + 1 - bstart + matches + respos);
|
||||
for i := bstart to bend do begin
|
||||
Inc(respos);
|
||||
if
|
||||
(Text[i] = Char1) or
|
||||
(Text[i] = Char2) or
|
||||
(Text[i] = Char3) or
|
||||
(Text[i] = Char4) or
|
||||
(Text[i] = NLold1) or
|
||||
(Text[i] = NLold2) or
|
||||
(Text[i] = NullOld)
|
||||
(Text[i] = Char4)
|
||||
then begin
|
||||
Result[respos] := EscChar;
|
||||
Inc(respos);
|
||||
// Special cases for new line chars
|
||||
if Text[i] = NLold1 then begin
|
||||
Result[respos] := NLnew1;
|
||||
continue;
|
||||
end else if Text[i] = NLold2 then begin
|
||||
Result[respos] := NLnew2;
|
||||
continue;
|
||||
end else if Text[i] = NullOld then begin
|
||||
Result[respos] := NullNew;
|
||||
continue;
|
||||
end;
|
||||
Result[respos] := EscChar;
|
||||
end;
|
||||
Inc(respos);
|
||||
Result[respos] := Text[i];
|
||||
end;
|
||||
until bend = len;
|
||||
|
Reference in New Issue
Block a user