瀏覽代碼

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;