diff --git a/components/lazutils/html2textrender.pas b/components/lazutils/html2textrender.pas
index e2178f94a6..cccdc07ec9 100644
--- a/components/lazutils/html2textrender.pas
+++ b/components/lazutils/html2textrender.pas
@@ -101,7 +101,7 @@ constructor THTML2TextRenderer.Create(const Stream: TStream);
var
s: string;
begin
- SetLength(s,Stream.Size);
+ SetLength(s{%H-},Stream.Size);
if s<>'' then
Stream.Read(s[1],length(s));
Create(s); // Call the constructor above.
diff --git a/components/lazutils/lazfileutils.pas b/components/lazutils/lazfileutils.pas
index 8cda46a252..cd09da1139 100644
--- a/components/lazutils/lazfileutils.pas
+++ b/components/lazutils/lazfileutils.pas
@@ -300,9 +300,9 @@ begin
exit;
end;
{$IFDEF NotLiteralFilenames}
- SetLength(File1,Len1);
+ SetLength(File1{%H-},Len1);
System.Move(Filename1^,File1[1],Len1);
- SetLength(File2,Len2);
+ SetLength(File2{%H-},Len2);
System.Move(Filename2^,File2[1],Len2);
Result:=CompareFilenames(File1,File2);
{$ELSE}
diff --git a/components/lazutils/winfileutil.inc b/components/lazutils/winfileutil.inc
index 09481f86a9..be8c5ff14d 100644
--- a/components/lazutils/winfileutil.inc
+++ b/components/lazutils/winfileutil.inc
@@ -12,7 +12,7 @@ begin
if Win32MajorVersion >= 5 then
begin
WideFileName := UTF8ToUTF16(FileName);
- SetLength(WideResult,Max_Path);
+ SetLength(WideResult{%H-},MAX_PATH);
lPathSize := GetShortPathNameW(PWideChar(WideFileName), PWideChar(WideResult), Length(WideResult));
SetLength(WideResult,lPathSize);
Result := UTF16ToUTF8(WideResult);
diff --git a/components/lazutils/winlazfileutils.inc b/components/lazutils/winlazfileutils.inc
index 92b20f25e9..82bb2a0e59 100644
--- a/components/lazutils/winlazfileutils.inc
+++ b/components/lazutils/winlazfileutils.inc
@@ -204,7 +204,7 @@ begin
if SHGetFolderPathW(0,ID or CSIDL_FLAG_CREATE,0,0,@APATH[0]) = S_OK then
begin
Len := StrLen(APath);
- SetLength(WS, Len);
+ SetLength(WS{%H-}, Len);
System.Move(APath[0], WS[1], Len * SizeOf(WideChar));
Result := AppendPathDelim(Utf16ToUtf8(WS));
end;
diff --git a/components/lazutils/winlazutf8.inc b/components/lazutils/winlazutf8.inc
index 83201b2b7f..883c50c574 100644
--- a/components/lazutils/winlazutf8.inc
+++ b/components/lazutils/winlazutf8.inc
@@ -94,7 +94,7 @@ begin
//writeln('StrLen(PCmdLineW) = ',CmdLen);
- SetLength(CmdLineW, CmdLen);
+ SetLength(CmdLineW{%H-}, CmdLen);
Move(PCmdLineW^, CmdLineW[1], CmdLen * SizeOf(WChar));
@@ -357,7 +357,7 @@ begin
// this will null-terminate
if UTF16WordCnt>0 then
begin
- setlength(UTF16Str, UTF16WordCnt);
+ setlength(UTF16Str{%H-}, UTF16WordCnt);
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Pointer(s), length(s), @UTF16Str[1], UTF16WordCnt);
Result:=UTF8Encode(UTF16Str);
{$ifdef FPC_HAS_CPSTRING}
@@ -569,9 +569,9 @@ var
U1, U2: String;
begin
if Count>0 then begin
- SetLength(U1,Count);
+ SetLength(U1{%H-},Count);
Move(S1^,PByte(U1)^,Count);
- SetLength(U2,Count);
+ SetLength(U2{%H-},Count);
Move(S2^,PByte(U2)^,Count);
Result:=UTF8CompareText(U1,U2);
end else