--- oup/current/DataAccess/Access_OniArchive.pas 2007/04/01 16:37:25 148 +++ oup/current/DataAccess/Access_OniArchive.pas 2007/05/24 17:48:18 192 @@ -52,7 +52,7 @@ type implementation uses - SysUtils, StrUtils, Data, Functions, RawList, DatLinks; + SysUtils, StrUtils, Data, Functions, RawList, DatLinks, Math; (* @@ -559,7 +559,7 @@ begin Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'), fmOpenReadWrite); Fraw_file.Seek(raw_info.RawAddr, soFromBeginning); - Fraw_file.CopyFrom(Src, raw_info.RawSize); + Fraw_file.CopyFrom(Src, Min(raw_info.RawSize, Src.Size)); if UnloadWhenUnused then begin FRawOpened := False; @@ -646,15 +646,22 @@ begin end; function TAccess_OniArchive.AppendRawFile(LocSep: Boolean; Src: TStream): Integer; +const + EmptyBytes: Array[0..31] of Byte = ( + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ); begin if not LocSep then begin if not FRawOpened then Fraw_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.raw'), fmOpenReadWrite); + if (Fraw_file.Size mod 32) > 0 then + Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32)); Result := Fraw_file.Size; Fraw_file.Seek(0, soFromEnd); Fraw_file.CopyFrom(Src, Src.Size); + if (Fraw_file.Size mod 32) > 0 then + Fraw_file.Write(EmptyBytes[0], 32 - (Fraw_file.Size mod 32)); if UnloadWhenUnused then begin FRawOpened := False; @@ -668,9 +675,13 @@ begin if not FSepOpened then Fsep_file := TFileStream.Create(AnsiReplaceStr(FFileName, '.dat', '.sep'), fmOpenReadWrite); + if (Fsep_file.Size mod 32) > 0 then + Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32)); Result := Fsep_file.Size; Fsep_file.Seek(0, soFromEnd); Fsep_file.CopyFrom(Src, Src.Size); + if (Fsep_file.Size mod 32) > 0 then + Fsep_file.Write(EmptyBytes[0], 32 - (Fsep_file.Size mod 32)); if UnloadWhenUnused then begin FSepOpened := False;