Skip to content

Commit c935e41

Browse files
committed
did not compile under FPC
1 parent 5b30308 commit c935e41

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

SRC/SrvMain.pas

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ function StrToFileTime(AStr: AnsiString): DWORD;
380380
if v = INVALID_VALUE then
381381
Exit;
382382
d.wSecond := v;
383+
Clear(T, SizeOf(T));
383384
if not SystemTimeToFileTime(d, T) then
384385
Exit;
385386
Result := uCvtGetFileTime(T.dwLowDateTime, T.dwHighDateTime);
@@ -833,6 +834,8 @@ function ExecuteScript(const AExecutable, APath, AScript, AQueryParam, AEnvStr,
833834
CreatePipe(so_r, so_w, @Security, 0);
834835
CreatePipe(se_r, se_w, @Security, 0);
835836

837+
FillChar(PI, SizeOf(PI), 0);
838+
836839
FillChar(SI, SizeOf(SI), 0);
837840
SI.CB := SizeOf(SI);
838841
SI.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
@@ -1645,6 +1648,8 @@ function WebServerHttpResponse(thr: THTTPServerThread; d: THTTPData)
16451648
IsCGI: Boolean;
16461649
CheckedURI, CDoubleDot, CDoubleBackslash, CDotEncosed: AnsiString;
16471650
begin
1651+
Result := nil; // to avoid the uninitialized warning
1652+
16481653
CBackSlash := '\';
16491654
CForwardSlash := '/';
16501655
ResponseEntityHeader := nil;
@@ -1952,6 +1957,7 @@ procedure THTTPServerThread.Execute;
19521957
if s <> '' then
19531958
begin
19541959
k := s;
1960+
z := '';
19551961
GetWrd(k, z, ' ');
19561962
v := Vl(z);
19571963
if (v <> INVALID_VALUE) and (v < 1000) and (v > 0) then
@@ -2036,6 +2042,7 @@ procedure THTTPServerThread.Execute;
20362042
Socket.WriteStr(s);
20372043
FPOS := 0;
20382044
repeat
2045+
Actually := 0;
20392046
ReadFile(FHandle, Buffer, CHTTPServerThreadBufSize, Actually, nil);
20402047
Inc(FPOS, Actually);
20412048
if FPOS > FileNfo.Size then
@@ -2316,11 +2323,13 @@ procedure THTTPServerThread.Execute;
23162323
FSetProcessWorkingSetSize: TSetProcessWorkingSetSizeFunc;
23172324

23182325
procedure FreeWorkingSetMemory;
2326+
var
2327+
P: Pointer;
23192328
begin
23202329
if not Assigned(FSetProcessWorkingSetSize) then
23212330
begin
2322-
FSetProcessWorkingSetSize := GetProcAddress(GetModuleHandle(kernel32),
2323-
'SetProcessWorkingSetSize');
2331+
P := GetProcAddress(GetModuleHandle(kernel32), 'SetProcessWorkingSetSize');
2332+
FSetProcessWorkingSetSize := TSetProcessWorkingSetSizeFunc(P);
23242333
end;
23252334
if Assigned(FSetProcessWorkingSetSize) then
23262335
begin

SRC/xBase.pas

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ function __unsafe(c: AnsiChar): Boolean;
420420
{ --- Basic Routines }
421421

422422
function Buf2Str(const Buffer): AnsiString;
423-
procedure Clear(var Buf; Count: Integer);
423+
procedure Clear(out Buf; Count: Integer);
424424
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;
425425
procedure FreeObject(var O);
426426
procedure LowerPrec(var a, B: Integer; Bits: Byte);
@@ -1167,7 +1167,7 @@ procedure DeleteLeft(var S: AnsiString; I: Integer);
11671167
// //
11681168
/// /////////////////////////////////////////////////////////////////////
11691169

1170-
procedure Clear(var Buf; Count: Integer);
1170+
procedure Clear(out Buf; Count: Integer);
11711171
begin
11721172
FillChar(Buf, Count, 0);
11731173
end;
@@ -1538,6 +1538,7 @@ function OpenRegKeyEx(const AName: AnsiString; AMode: DWORD): HKey;
15381538
Result := INVALID_REGISTRY_KEY;
15391539
Exit;
15401540
end;
1541+
Result := 0;
15411542
if RegOpenKeyExA(HKEY_LOCAL_MACHINE, // handle of an open key
15421543
@(AName[1]), // subkey name
15431544
0, // Reserved
@@ -1559,6 +1560,7 @@ function CreateRegKey(const AFName: AnsiString): HKey;
15591560
Result := INVALID_REGISTRY_KEY;
15601561
Exit;
15611562
end;
1563+
Result := 0;
15621564
if RegCreateKeyExA(HKEY_LOCAL_MACHINE, // handle of an open key
15631565
@(AFName[1]), // subkey name
15641566
0, // reserved, must be zero
@@ -1702,6 +1704,7 @@ function SysErrorMsg(ErrorCode: DWORD): AnsiString;
17021704
Len: Integer;
17031705
Buffer: array [0 .. 255] of AnsiChar;
17041706
begin
1707+
Clear(Buffer, SizeOf(Buffer));
17051708
Len := FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM or
17061709
FORMAT_MESSAGE_ARGUMENT_ARRAY, nil, ErrorCode, 0, Buffer,
17071710
SizeOf(Buffer), nil);
@@ -2278,6 +2281,7 @@ function GetEnvVariable(const Name: AnsiString): AnsiString;
22782281
Result := '';
22792282
Exit;
22802283
end;
2284+
Clear(Buf, SizeOf(Buf));
22812285
I := GetEnvironmentVariableA(@(Name[1]), Buf, BufSize);
22822286
case I of
22832287
1 .. BufSize:
@@ -3249,7 +3253,7 @@ procedure TResetterThread.Execute;
32493253
until Terminated;
32503254
end;
32513255

3252-
constructor TFileFlusherThread.Create;
3256+
constructor TFileFlusherThread.Create(AFileHandle: THandle; ACriticalSection: PRTLCriticalSection);
32533257
begin
32543258
inherited Create(True);
32553259
FileHandle := AFileHandle;

0 commit comments

Comments
 (0)