#1 Re: mORMot 2 » TDocVariantData issue » 2024-02-23 11:55:23

yes, it is right, thank you!

#2 mORMot 2 » TDocVariantData issue » 2024-02-22 23:39:26

blue
Replies: 2

function TDocVariantData.GetObjectExistingByName(
  const aName: RawUtf8): PDocVariantData;
begin
  // Is this code correct?
  result := GetDocVariantExistingByName(aName, dvArray);
end;

function TDocVariantData.GetArrayExistingByName(
  const aName: RawUtf8): PDocVariantData;
begin
  // and this
  result := GetDocVariantExistingByName(aName, dvObject);
end;

#3 Re: mORMot 2 » THttpAsyncConnections pending overflow with 2.0.stable » 2023-06-26 07:16:00

After 10 days of testing, the bug was not reproduced. I suspect the problem was caused by the use of FastMM4.
Thank you all.

#4 mORMot 2 » THttpAsyncConnections pending overflow with 2.0.stable » 2023-06-11 14:00:41

blue
Replies: 4

IDE: Delphi 2007.
OS: Windows server 2012.

An HTTP server based on THttpServerSocketGeneric, which will probably run for 3 days and then produce such logs:
mormot.net.async.THttpAsyncConnections(ddda490120) Execute: Accept connections=58>7777777 pending=10001>10000 overflow
...

Roll back to 2.0.4383, works fine.

Thanks a lot!

#5 Re: mORMot 2 » TMemoryMapText.LoadFromMap issue » 2023-05-11 07:55:17

For example:

var
  mmt: TMemoryMapText;
begin
  if not FileExists(fileName) then
    Exit;
  mmt := TMemoryMapText.Create(fileName);  // exception
  ...
end;

#6 mORMot 2 » TMemoryMapText.LoadFromMap issue » 2023-05-10 23:53:58

blue
Replies: 2

mormot.core.buffers.pas

procedure TMemoryMapText.LoadFromMap(AverageLineLength: integer = 32);
var
  P: PUtf8Char;
begin
  fLinesMax := fMap.FileSize div AverageLineLength + 8;
  GetMem(fLines, fLinesMax * SizeOf(pointer));
  P := pointer(fMap.Buffer);
  fMapEnd := P + fMap.Size;
  // except when loading a empty file. (P = nil)
  if (PWord(P)^ = $BBEF) and
     (P[2] = #$BF) then
    inc(P, 3); // ignore UTF-8 BOM
  ParseLines(P, fMapEnd, self);
  if fLinesMax > fCount + 16384 then
    Reallocmem(fLines, fCount * SizeOf(pointer)); // size down only if worth it
end;

#8 Re: mORMot 2 » Utf8ToString does not support Chinese » 2023-05-05 20:49:40

getting an incorrect result on Delphi 2007.

fixed patch:

function Unicode_GetWideToAnsiSize(W: PWideChar; LW, CodePage: PtrInt): integer;
begin
  result := WideCharToMultiByte(CodePage, 0, W, LW, nil, 0, nil, nil);
end;

function TSynAnsiConvert.UnicodeBufferToAnsi(Dest: PAnsiChar;
  Source: PWideChar; SourceChars: cardinal): PAnsiChar;
..
    // rely on the Operating System for all remaining ASCII characters
    if SourceChars <> 0 then begin
      inc(Dest,
        Unicode_WideToAnsi(Source, Dest, SourceChars, Unicode_GetWideToAnsiSize(Source, SourceChars, fCodePage), fCodePage));

#9 mORMot 2 » Utf8ToString does not support Chinese » 2023-05-05 16:56:23

blue
Replies: 7

OS: Windows 11
IDE: delphi 2007

procedure Test;
var
  src, dst                              : RawUtf8;
begin
  src := '中文abc';
  dst := StringToUtf8(src);
  Writeln('StringToUtf8: ', dst, ', src length: ', Length(src), ', dst length: ', Length(dst));

  src := Utf8ToString(dst);
  Writeln('Utf8ToString: ', src, ', src length: ', Length(src), ', dst length: ', Length(dst));
end;

Board footer

Powered by FluxBB