On Thu, 6 Jan 2022, Ozz Nixon via fpc-devel wrote:
Procedure Make_Language_File( Description,MenuPath,TextPath,QuestPath:String; Enabled:Boolean;SecurityLevel:Byte;Flags:Longint); Var FileSize:Longint; Begin Writeln('Language_File empty size is ',SizeOf(L)); FileSize:=0; Description:=Description+#0; Inc(FileSize,Length(Description)); MenuPath:=MenuPath+#0; Inc(FileSize,Length(MenuPath)); TextPath:=TextPath+#0; Inc(FileSize,Length(TextPath)); QuestPath:=QuestPath+#0; Inc(FileSize,Length(QuestPath)); SetLength(L.Description,Length(Description)); SetLength(L.MenuPath,Length(MenuPath)); SetLength(L.TextPath,Length(TextPath)); SetLength(L.QuestPath,Length(QuestPath)); Move(Description[1],L.Description,Length(Description));
This code is wrong. That must be Move(Description[1],L.Description[0],Length(Description));
Move(MenuPath[1],L.MenuPath,Length(MenuPath));
Same here. Move(MenuPath[1],L.MenuPath[0],Length(MenuPath));
Move(TextPath[1],L.TextPath,Length(TextPath));
Same here Move(TextPath[1],L.TextPath[0],Length(TextPath));
Move(QuestPath[1],L.QuestPath,Length(QuestPath));
Same here. Move(QuestPath[1],L.QuestPath[0],Length(QuestPath)); These fields are dynamic arrays, in essence pointers to a memory block. Your code writes to the memory area for pointer, not to the memory area the pointer points to. Michael. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel