Skip to content

Commit

Permalink
did not compile under FPC
Browse files Browse the repository at this point in the history
  • Loading branch information
maximmasiutin committed Apr 6, 2023
1 parent 5b30308 commit c935e41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
13 changes: 11 additions & 2 deletions SRC/SrvMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ function StrToFileTime(AStr: AnsiString): DWORD;
if v = INVALID_VALUE then
Exit;
d.wSecond := v;
Clear(T, SizeOf(T));
if not SystemTimeToFileTime(d, T) then
Exit;
Result := uCvtGetFileTime(T.dwLowDateTime, T.dwHighDateTime);
Expand Down Expand Up @@ -833,6 +834,8 @@ function ExecuteScript(const AExecutable, APath, AScript, AQueryParam, AEnvStr,
CreatePipe(so_r, so_w, @Security, 0);
CreatePipe(se_r, se_w, @Security, 0);

FillChar(PI, SizeOf(PI), 0);

FillChar(SI, SizeOf(SI), 0);
SI.CB := SizeOf(SI);
SI.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
Expand Down Expand Up @@ -1645,6 +1648,8 @@ function WebServerHttpResponse(thr: THTTPServerThread; d: THTTPData)
IsCGI: Boolean;
CheckedURI, CDoubleDot, CDoubleBackslash, CDotEncosed: AnsiString;
begin
Result := nil; // to avoid the uninitialized warning

CBackSlash := '\';
CForwardSlash := '/';
ResponseEntityHeader := nil;
Expand Down Expand Up @@ -1952,6 +1957,7 @@ procedure THTTPServerThread.Execute;
if s <> '' then
begin
k := s;
z := '';
GetWrd(k, z, ' ');
v := Vl(z);
if (v <> INVALID_VALUE) and (v < 1000) and (v > 0) then
Expand Down Expand Up @@ -2036,6 +2042,7 @@ procedure THTTPServerThread.Execute;
Socket.WriteStr(s);
FPOS := 0;
repeat
Actually := 0;
ReadFile(FHandle, Buffer, CHTTPServerThreadBufSize, Actually, nil);
Inc(FPOS, Actually);
if FPOS > FileNfo.Size then
Expand Down Expand Up @@ -2316,11 +2323,13 @@ procedure THTTPServerThread.Execute;
FSetProcessWorkingSetSize: TSetProcessWorkingSetSizeFunc;

procedure FreeWorkingSetMemory;
var
P: Pointer;
begin
if not Assigned(FSetProcessWorkingSetSize) then
begin
FSetProcessWorkingSetSize := GetProcAddress(GetModuleHandle(kernel32),
'SetProcessWorkingSetSize');
P := GetProcAddress(GetModuleHandle(kernel32), 'SetProcessWorkingSetSize');
FSetProcessWorkingSetSize := TSetProcessWorkingSetSizeFunc(P);
end;
if Assigned(FSetProcessWorkingSetSize) then
begin
Expand Down
10 changes: 7 additions & 3 deletions SRC/xBase.pas
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function __unsafe(c: AnsiChar): Boolean;
{ --- Basic Routines }

function Buf2Str(const Buffer): AnsiString;
procedure Clear(var Buf; Count: Integer);
procedure Clear(out Buf; Count: Integer);
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;
procedure FreeObject(var O);
procedure LowerPrec(var a, B: Integer; Bits: Byte);
Expand Down Expand Up @@ -1167,7 +1167,7 @@ procedure DeleteLeft(var S: AnsiString; I: Integer);
// //
/// /////////////////////////////////////////////////////////////////////

procedure Clear(var Buf; Count: Integer);
procedure Clear(out Buf; Count: Integer);
begin
FillChar(Buf, Count, 0);
end;
Expand Down Expand Up @@ -1538,6 +1538,7 @@ function OpenRegKeyEx(const AName: AnsiString; AMode: DWORD): HKey;
Result := INVALID_REGISTRY_KEY;
Exit;
end;
Result := 0;
if RegOpenKeyExA(HKEY_LOCAL_MACHINE, // handle of an open key
@(AName[1]), // subkey name
0, // Reserved
Expand All @@ -1559,6 +1560,7 @@ function CreateRegKey(const AFName: AnsiString): HKey;
Result := INVALID_REGISTRY_KEY;
Exit;
end;
Result := 0;
if RegCreateKeyExA(HKEY_LOCAL_MACHINE, // handle of an open key
@(AFName[1]), // subkey name
0, // reserved, must be zero
Expand Down Expand Up @@ -1702,6 +1704,7 @@ function SysErrorMsg(ErrorCode: DWORD): AnsiString;
Len: Integer;
Buffer: array [0 .. 255] of AnsiChar;
begin
Clear(Buffer, SizeOf(Buffer));
Len := FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM or
FORMAT_MESSAGE_ARGUMENT_ARRAY, nil, ErrorCode, 0, Buffer,
SizeOf(Buffer), nil);
Expand Down Expand Up @@ -2278,6 +2281,7 @@ function GetEnvVariable(const Name: AnsiString): AnsiString;
Result := '';
Exit;
end;
Clear(Buf, SizeOf(Buf));
I := GetEnvironmentVariableA(@(Name[1]), Buf, BufSize);
case I of
1 .. BufSize:
Expand Down Expand Up @@ -3249,7 +3253,7 @@ procedure TResetterThread.Execute;
until Terminated;
end;

constructor TFileFlusherThread.Create;
constructor TFileFlusherThread.Create(AFileHandle: THandle; ACriticalSection: PRTLCriticalSection);
begin
inherited Create(True);
FileHandle := AFileHandle;
Expand Down

0 comments on commit c935e41

Please sign in to comment.