You are not logged in.
Pages: 1
yes, it is right, thank you!
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;
After 10 days of testing, the bug was not reproduced. I suspect the problem was caused by the use of FastMM4.
Thank you all.
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!
For example:
var
mmt: TMemoryMapText;
begin
if not FileExists(fileName) then
Exit;
mmt := TMemoryMapText.Create(fileName); // exception
...
end;
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;
test passed.
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));
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;
Pages: 1