소스 검색

fcl-js: fixed TBufferWriter on nodejs

mattias 1 년 전
부모
커밋
c90503812a
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      packages/fcl-js/src/jswriter.pp

+ 5 - 0
packages/fcl-js/src/jswriter.pp

@@ -384,9 +384,14 @@ end;
 procedure TBufferWriter.SetCapacity(AValue: Cardinal);
 begin
   if FCapacity=AValue then Exit;
+  {$ifdef pas2js}
+  // capacity not needed, FBuffer is an JS array
+  FCapacity:=AValue;
+  {$else}
   SetLength(FBuffer,AValue);
   if (FBufPos>Capacity) then
     FBufPos:=Capacity;
+  {$endif}
 end;
 
 function TBufferWriter.DoWrite(const S: TJSWriterString): integer;