mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 11:06:19 +02:00
fcl-js: jswriter: allow overriding Writing, less grows(faster and less allocations)
git-svn-id: trunk@36599 -
This commit is contained in:
parent
22ae3cd186
commit
a66eaa4769
@ -38,7 +38,7 @@ Type
|
|||||||
protected
|
protected
|
||||||
Function DoWrite(Const S : AnsiString) : Integer; virtual; abstract;
|
Function DoWrite(Const S : AnsiString) : Integer; virtual; abstract;
|
||||||
Function DoWrite(Const S : UnicodeString) : Integer; virtual; abstract;
|
Function DoWrite(Const S : UnicodeString) : Integer; virtual; abstract;
|
||||||
Procedure Writing; // called before adding new characters
|
Procedure Writing; virtual; // called before adding new characters
|
||||||
Public
|
Public
|
||||||
// All functions return the number of bytes copied to output stream.
|
// All functions return the number of bytes copied to output stream.
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -268,7 +268,7 @@ begin
|
|||||||
MinLen:=Result+FBufPos;
|
MinLen:=Result+FBufPos;
|
||||||
If (MinLen>Capacity) then
|
If (MinLen>Capacity) then
|
||||||
begin
|
begin
|
||||||
DesLen:=(FCapacity*5) div 4;
|
DesLen:=(FCapacity*3) div 2;
|
||||||
if DesLen>MinLen then
|
if DesLen>MinLen then
|
||||||
MinLen:=DesLen;
|
MinLen:=DesLen;
|
||||||
Capacity:=MinLen;
|
Capacity:=MinLen;
|
||||||
@ -288,7 +288,7 @@ begin
|
|||||||
MinLen:=Result+FBufPos;
|
MinLen:=Result+FBufPos;
|
||||||
If (MinLen>Capacity) then
|
If (MinLen>Capacity) then
|
||||||
begin
|
begin
|
||||||
DesLen:=(FCapacity*5) div 4;
|
DesLen:=(FCapacity*3) div 2;
|
||||||
if DesLen>MinLen then
|
if DesLen>MinLen then
|
||||||
MinLen:=DesLen;
|
MinLen:=DesLen;
|
||||||
Capacity:=MinLen;
|
Capacity:=MinLen;
|
||||||
|
Loading…
Reference in New Issue
Block a user