From e9c02eb095bef3aa3d1181423519decf5b2c55c4 Mon Sep 17 00:00:00 2001 From: alex roldugin <2838600+alexroldugin@users.noreply.github.com> Date: Sun, 5 Jan 2020 19:14:47 +0300 Subject: [PATCH 1/2] use platform-non-specific function: IncludeTrailingBackslash -> IncludeTrailingPathDelimiter --- KaZip.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KaZip.pas b/KaZip.pas index d0fcbc6..7e93a79 100644 --- a/KaZip.pas +++ b/KaZip.pas @@ -2836,7 +2836,7 @@ procedure TKAZipEntries.CreateFolder(FolderName: string; FolderDate: TDateTime); var FN: string; begin - FN := IncludeTrailingBackslash(FolderName); + FN := IncludeTrailingPathDelimiter(FolderName); AddFolderChain(FN, faDirectory, FolderDate); FParent.FIsDirty := True; end; @@ -2849,8 +2849,8 @@ procedure TKAZipEntries.RenameFolder(FolderName: string; NewFolderName: string); X: Integer; L: Integer; begin - FN := ToZipName(IncludeTrailingBackslash(FolderName)); - NFN := ToZipName(IncludeTrailingBackslash(NewFolderName)); + FN := ToZipName(IncludeTrailingPathDelimiter(FolderName)); + NFN := ToZipName(IncludeTrailingPathDelimiter(NewFolderName)); L := Length(FN); if IndexOf(NFN) = -1 then begin From 809ba54bafe3a39dab537fff08a688b02a622e73 Mon Sep 17 00:00:00 2001 From: alex roldugin <2838600+alexroldugin@users.noreply.github.com> Date: Sun, 5 Jan 2020 19:17:49 +0300 Subject: [PATCH 2/2] suppress platform-specific consts warnings for faArchive, faSysFile, and so on --- KaZip.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/KaZip.pas b/KaZip.pas index 7e93a79..3489571 100644 --- a/KaZip.pas +++ b/KaZip.pas @@ -1477,7 +1477,9 @@ function TKAZipEntries.ParseLocalHeaders(MS: TStream): Boolean; CDFile.FileCommentLength := 0; CDFile.DiskNumberStart := 0; CDFile.InternalFileAttributes := LocalFile.VersionNeededToExtract; +{$WARN SYMBOL_PLATFORM OFF} CDFile.ExternalFileAttributes := faArchive; +{$WARN SYMBOL_PLATFORM ON} CDFile.RelativeOffsetOfLocalHeader := Poz; CDFile.FileName := LocalFile.FileName; L := Length(CDFile.FileName); @@ -2364,7 +2366,9 @@ function TKAZipEntries.AddStream(FileName: string; FileAttr: Word; FileDate: TDa function TKAZipEntries.AddStream(FileName: string; Stream: TStream): TKAZipEntriesEntry; begin +{$WARN SYMBOL_PLATFORM OFF} Result := AddStream(FileName, faArchive, Now, Stream); +{$WARN SYMBOL_PLATFORM ON} end; function TKAZipEntries.AddFile(FileName, NewFileName: string): TKAZipEntriesEntry; @@ -2627,6 +2631,7 @@ procedure TKAZipEntries.InternalExtractToFile(Item: TKAZipEntriesEntry; FileName end; if FParent.FApplyAttributes then begin +{$WARN SYMBOL_PLATFORM OFF} Attr := faArchive; if Item.FCentralDirectoryFile.ExternalFileAttributes and faHidden > 0 then Attr := Attr or faHidden; @@ -2635,6 +2640,7 @@ procedure TKAZipEntries.InternalExtractToFile(Item: TKAZipEntriesEntry; FileName if Item.FCentralDirectoryFile.ExternalFileAttributes and faReadOnly > 0 then Attr := Attr or faReadOnly; FileSetAttr(FileName, Attr); +{$WARN SYMBOL_PLATFORM ON} end; end; end; @@ -3740,7 +3746,9 @@ function TKAZip.AddEntryThroughStream(FileName: string): TStream; stm.Free; end; } +{$WARN SYMBOL_PLATFORM OFF} Result := Entries.AddEntryThroughStream(FileName, Now, faArchive); +{$WARN SYMBOL_PLATFORM ON} end; { TCRC32Stream }