Skip to content

Commit

Permalink
Merge branch 'doublecmd:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-soft authored Sep 7, 2024
2 parents f4408e1 + 65b46ae commit f27b84f
Show file tree
Hide file tree
Showing 16 changed files with 463 additions and 1,225 deletions.
9 changes: 9 additions & 0 deletions components/doublecmd/dcosutils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function mbFileCreate(const FileName: String): System.THandle; overload; inline;
function mbFileCreate(const FileName: String; Mode: LongWord): System.THandle; overload; inline;
function mbFileCreate(const FileName: String; Mode, Rights: LongWord): System.THandle; overload;
function mbFileAge(const FileName: String): DCBasicTypes.TFileTime;
function mbFileGetTime(const FileName: String): DCBasicTypes.TFileTimeEx;
// On success returns True.
// nanoseconds supported
function mbFileGetTime(const FileName: String;
Expand Down Expand Up @@ -956,6 +957,14 @@ function mbFileAge(const FileName: String): DCBasicTypes.TFileTime;
end;
{$ENDIF}

function mbFileGetTime(const FileName: String): DCBasicTypes.TFileTimeEx;
var
CreationTime, LastAccessTime: DCBasicTypes.TFileTimeEx;
begin
if not mbFileGetTime(FileName, Result, CreationTime, LastAccessTime) then
Result:= TFileTimeExNull;
end;

function mbFileGetTime(const FileName: String;
var ModificationTime: DCBasicTypes.TFileTimeEx;
var CreationTime : DCBasicTypes.TFileTimeEx;
Expand Down
203 changes: 0 additions & 203 deletions components/kascrypt/Hashes/DCPhaval3.inc

This file was deleted.

272 changes: 0 additions & 272 deletions components/kascrypt/Hashes/DCPhaval4.inc

This file was deleted.

339 changes: 0 additions & 339 deletions components/kascrypt/Hashes/DCPhaval5.inc

This file was deleted.

14 changes: 7 additions & 7 deletions components/kascrypt/Hashes/blake3_sse2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ asm
pshufd xmm15, xmm11, $93
shl rax, $20
or rax, $40
movQ xmm3, rax
movq xmm3, rax
movdqa xmmword ptr [rsp+$20], xmm3
movaps xmm3, xmmword ptr [rsp]
movaps xmm11, xmmword ptr [rsp+$10]
Expand Down Expand Up @@ -2173,10 +2173,10 @@ asm
por xmm9, xmm8
movdqa xmm8, xmm7
punpcklqdq xmm8, xmm5
movdqa xmm10, xmm6
movdqa xmm14, xmm6
pand xmm8, xmmword ptr [PBLENDW_0x3F_MASK+rip]
pand xmm10, xmmword ptr [PBLENDW_0xC0_MASK+rip]
por xmm8, xmm10
pand xmm14, xmmword ptr [PBLENDW_0xC0_MASK+rip]
por xmm8, xmm14
pshufd xmm8, xmm8, $78
punpckhdq xmm5, xmm7
punpckldq xmm6, xmm5
Expand Down Expand Up @@ -2321,10 +2321,10 @@ asm
por xmm9, xmm8
movdqa xmm8, xmm7
punpcklqdq xmm8, xmm5
movdqa xmm10, xmm6
movdqa xmm14, xmm6
pand xmm8, xmmword ptr [PBLENDW_0x3F_MASK+rip]
pand xmm10, xmmword ptr [PBLENDW_0xC0_MASK+rip]
por xmm8, xmm10
pand xmm14, xmmword ptr [PBLENDW_0xC0_MASK+rip]
por xmm8, xmm14
pshufd xmm8, xmm8, $78
punpckhdq xmm5, xmm7
punpckldq xmm6, xmm5
Expand Down
700 changes: 367 additions & 333 deletions components/kascrypt/Hashes/dcphaval.pas

Large diffs are not rendered by default.

83 changes: 36 additions & 47 deletions components/kascrypt/kascrypt.lpk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<Package Version="5">
<Name Value="kascrypt"/>
<Author Value="David Barton, Barko &amp; Graeme Geldenhuys, Alexander Koblov"/>
<CompilerOptions>
Expand Down Expand Up @@ -37,8 +37,8 @@
"/>
<License Value="KAScrypt is open source software (released under the MIT license) and as such there is no charge for inclusion in other software.
"/>
<Version Major="3" Minor="1"/>
<Files Count="33">
<Version Major="3" Minor="1" Release="1"/>
<Files Count="30">
<Item1>
<Filename Value="dcpbase64.pas"/>
<UnitName Value="DCPbase64"/>
Expand Down Expand Up @@ -92,86 +92,75 @@
<UnitName Value="DCPtiger"/>
</Item13>
<Item14>
<Filename Value="Hashes/DCPhaval3.inc"/>
<Type Value="Include"/>
<Filename Value="Hashes/dcpcrc32.pas"/>
<UnitName Value="DCPcrc32"/>
</Item14>
<Item15>
<Filename Value="Hashes/DCPhaval4.inc"/>
<Filename Value="Hashes/DCPtiger.inc"/>
<Type Value="Include"/>
</Item15>
<Item16>
<Filename Value="Hashes/DCPhaval5.inc"/>
<Type Value="Include"/>
</Item16>
<Item17>
<Filename Value="Hashes/dcpcrc32.pas"/>
<UnitName Value="DCPcrc32"/>
</Item17>
<Item18>
<Filename Value="Hashes/DCPtiger.inc"/>
<Type Value="Include"/>
</Item18>
<Item19>
<Filename Value="Hashes/dccrc32.pp"/>
<UnitName Value="DCcrc32"/>
</Item19>
<Item20>
</Item16>
<Item17>
<Filename Value="Hashes/dcblake2.pp"/>
<UnitName Value="DCblake2"/>
</Item20>
<Item21>
</Item17>
<Item18>
<Filename Value="Hashes/dcpblake2.pas"/>
<UnitName Value="DCPblake2"/>
</Item21>
<Item22>
</Item18>
<Item19>
<Filename Value="Hashes/dcpsha3.pas"/>
<UnitName Value="DCPsha3"/>
</Item22>
<Item23>
</Item19>
<Item20>
<Filename Value="Hashes/Private/hmac.pas"/>
<UnitName Value="HMAC"/>
</Item23>
<Item24>
</Item20>
<Item21>
<Filename Value="Hashes/Private/sha3.pas"/>
<UnitName Value="SHA3"/>
</Item24>
<Item25>
</Item21>
<Item22>
<Filename Value="Hashes/Private/sha3_512.pas"/>
<UnitName Value="SHA3_512"/>
</Item25>
<Item26>
</Item22>
<Item23>
<Filename Value="Random/isaac.pas"/>
<UnitName Value="ISAAC"/>
</Item26>
<Item27>
</Item23>
<Item24>
<Filename Value="Hashes/Private/scrypt.pas"/>
<UnitName Value="scrypt"/>
</Item27>
<Item28>
</Item24>
<Item25>
<Filename Value="Ciphers/DCPrijndael.inc"/>
<Type Value="Include"/>
</Item28>
<Item29>
</Item25>
<Item26>
<Filename Value="Ciphers/dcprijndael.pas"/>
<UnitName Value="DCPrijndael"/>
</Item29>
<Item30>
</Item26>
<Item27>
<Filename Value="Hashes/Private/sha1.pas"/>
<UnitName Value="SHA1"/>
</Item30>
<Item31>
</Item27>
<Item28>
<Filename Value="Hashes/argon2.pas"/>
<UnitName Value="Argon2"/>
</Item31>
<Item32>
</Item28>
<Item29>
<Filename Value="Hashes/dcpblake3.pas"/>
<UnitName Value="DCPblake3"/>
</Item32>
<Item33>
</Item29>
<Item30>
<Filename Value="Hashes/dcpchecksum32.pas"/>
<UnitName Value="dcpchecksum32"/>
</Item33>
</Item30>
</Files>
<CompatibilityMode Value="True"/>
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="multithreadprocslaz"/>
Expand Down
7 changes: 5 additions & 2 deletions src/filesources/filesystem/ufilesystemcombineoperation.pas
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ implementation

uses
//Lazarus, Free-Pascal, etc.
LCLProc, LazUTF8, crc,
LCLProc, LazUTF8, DCcrc32,

//DC
uOSUtils, DCOSUtils, uLng, uFileSystemUtil, uFileSystemFileSource,
Expand Down Expand Up @@ -297,7 +297,10 @@ function TFileSystemCombineOperation.Combine(aSourceFile: TFile;
TotalBytesToRead := TotalBytesToRead - BytesRead;
BytesWritten := 0;

if BytesRead>0 then CurrentCRC32:=crc32(CurrentCRC32,FBuffer,BytesRead);
if BytesRead > 0 then
begin
CurrentCRC32:= crc32_16bytes(FBuffer, BytesRead, CurrentCRC32);
end;

repeat
try
Expand Down
7 changes: 5 additions & 2 deletions src/filesources/filesystem/ufilesystemsplitoperation.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

uses
//Lazarus, Free-Pascal, etc.
LCLProc, LazUTF8, crc,
LCLProc, LazUTF8, DCcrc32,

//DC
DCConvertEncoding, uOSUtils, DCOSUtils, uLng, uFileProcs;
Expand Down Expand Up @@ -262,7 +262,10 @@ function TFileSystemSplitOperation.Split(aSourceFileStream: TFileStreamEx; Targe
if (BytesRead = 0) then
Raise EReadError.Create(mbSysErrorMessage(GetLastOSError));

if RequireACRC32VerificationFile then CurrentCRC32:=crc32(CurrentCRC32,FBuffer,BytesRead);
if RequireACRC32VerificationFile then
begin
CurrentCRC32:= crc32_16bytes(FBuffer, BytesRead, CurrentCRC32);
end;

TotalBytesToRead := TotalBytesToRead - BytesRead;
BytesWritten := 0;
Expand Down
5 changes: 3 additions & 2 deletions src/filesources/filesystem/ufilesystemutil.pas
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ implementation
uses
uDebug, uDCUtils, uOSUtils, DCStrUtils, FileUtil, uFindEx, DCClassesUtf8, uFileProcs, uLng,
DCBasicTypes, uFileSource, uFileSystemFileSource, uFileProperty, uAdministrator,
StrUtils, DCDateTimeUtils, uShowMsg, Forms, LazUTF8, uHash, uFileCopyEx, SysConst
StrUtils, DCDateTimeUtils, uShowMsg, Forms, LazUTF8, uHash, uFileCopyEx, SysConst,
Math, DateUtils
{$IFDEF UNIX}
, BaseUnix, Unix, DCUnix
{$ENDIF}
Expand Down Expand Up @@ -1733,7 +1734,7 @@ function TFileSystemOperationHelper.FileExists(aFile: TFile;

function OverwriteOlder: TFileSourceOperationOptionFileExists;
begin
if aFile.ModificationTime > FileTimeToDateTime(mbFileAge(AbsoluteTargetFileName)) then
if CompareDateTime(aFile.ModificationTime, FileTimeToDateTimeEx(mbFileGetTime(AbsoluteTargetFileName))) = GreaterThanValue then
Result := fsoofeOverwrite
else
Result := fsoofeSkip;
Expand Down
4 changes: 2 additions & 2 deletions src/filesources/wcxarchive/uwcxarchivecopyoutoperation.pas
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ implementation

uses
Forms, LazUTF8, FileUtil, contnrs, DCOSUtils, DCStrUtils, uDCUtils,
fWcxArchiveCopyOperationOptions, uFileSystemUtil,
Math, DateUtils, fWcxArchiveCopyOperationOptions, uFileSystemUtil,
uFileProcs, uLng, DCDateTimeUtils, DCBasicTypes, uShowMsg, DCConvertEncoding;

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -627,7 +627,7 @@ function TWcxArchiveCopyOutOperation.DoFileExists(Header: TWcxHeader;

function OverwriteOlder: TFileSourceOperationOptionFileExists;
begin
if Header.DateTime > FileTimeToDateTime(mbFileAge(AbsoluteTargetFileName)) then
if CompareDateTime(Header.DateTime, FileTimeToDateTimeEx(mbFileGetTime(AbsoluteTargetFileName))) = GreaterThanValue then
Result := fsoofeOverwrite
else
Result := fsoofeSkip;
Expand Down
2 changes: 1 addition & 1 deletion src/filesources/wcxarchive/uwcxarchivefilesource.pas
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ function TWcxArchiveFileSource.ReadArchive(anArchiveHandle: TArcHandle): Boolean
if FOpenResult <> E_SUCCESS then Exit;
end; // while

ArchiveTime:= FileTimeToDateTime(mbFileAge(ArchiveFileName));
ArchiveTime:= FileTimeToDateTimeEx(mbFileGetTime(ArchiveFileName));

(* if plugin does not give a list of folders *)
for I := 0 to AllDirsList.Count - 1 do
Expand Down
10 changes: 5 additions & 5 deletions src/fmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface
{$ELSEIF DEFINED(LCLGTK2)}
, Glib2, Gtk2
{$ELSEIF DEFINED(DARWIN)}
, CocoaMenus
, CocoaConfig
, uMyDarwin
{$ENDIF}
, Types, LMessages;
Expand Down Expand Up @@ -769,7 +769,6 @@ TfrmMain = class(TAloneForm, IFormCommands)
function FindMatchingDrive(Address, Path: String): Integer;
procedure UpdateDriveToolbarSelection(DriveToolbar: TKAStoolBar; FileView: TFileView);
procedure UpdateDriveButtonSelection(DriveButton: TSpeedButton; FileView: TFileView);
procedure UpdateSelectedDrive(ANoteBook: TFileViewNotebook);
{$IF DEFINED(MSWINDOWS)}
procedure OnDriveIconLoaded(Data: PtrInt);
{$ENDIF}
Expand Down Expand Up @@ -872,6 +871,7 @@ TfrmMain = class(TAloneForm, IFormCommands)
procedure UpdateGUIFunctionKeys;
procedure UpdateMainTitleBar;
procedure CreateDiskPanel(dskPanel : TKASToolBar);
procedure UpdateSelectedDrive(ANoteBook: TFileViewNotebook);
procedure SetPanelDrive(aPanel: TFilePanelSelect; Drive: PDrive; ActivateIfNeeded: Boolean);
function CreateFileView(sType: String; Page: TFileViewPage; AConfig: TXmlConfig; ANode: TXmlNode): TFileView;
procedure AssignEvents(AFileView: TFileView);
Expand Down Expand Up @@ -2953,8 +2953,8 @@ constructor TfrmMain.Create(TheOwner: TComponent);
{$IF DEFINED(DARWIN)}
procedure setMacOSAppMenu();
begin
macOS_AppMenuIntf.aboutItem:= mnuHelpAbout;
macOS_AppMenuIntf.preferencesItem:= mnuConfigOptions;
CocoaConfigMenu.appMenu.aboutItem:= mnuHelpAbout;
CocoaConfigMenu.appMenu.preferencesItem:= mnuConfigOptions;
end;

procedure setMacOSDockMenu();
Expand All @@ -2967,7 +2967,7 @@ constructor TfrmMain.Create(TheOwner: TComponent);
newItem.Caption:= rsMnuNewWindow;
newItem.OnClick:= @OpenNewWindow;
dockMenu.Add(newItem);
macOS_DockMenuIntf.customMenus:= dockMenu;
CocoaConfigMenu.dockMenu.customMenus:= dockMenu;
end;
{$ENDIF}
begin
Expand Down
18 changes: 13 additions & 5 deletions src/ubinarydiffviewer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TBinaryCompare = class(TThread)
implementation

uses
Math;
Math, LazUTF8;

const
cHexWidth = 16;
Expand All @@ -87,6 +87,7 @@ procedure TBinaryDiffViewer.WriteCustom;
I: Integer;
X, Y: Integer;
yIndex: Integer;
CharLen: Integer;
P1, P2: PAnsiChar;
CurrentPos, SecondPos: PtrInt;
Mine, Foreign, WordHex: String;
Expand Down Expand Up @@ -144,12 +145,19 @@ procedure TBinaryDiffViewer.WriteCustom;
end;
Inc(X, SymbolWidth);
// Write ASCII part
WordHex:= Copy(Mine, cHexStartAscii + 1, cHexWidth);
for I:= 1 to Length(WordHex) do
WordHex:= Copy(Mine, cHexStartAscii + 1, MaxInt);
I:= 0;
P1:= PAnsiChar(WordHex);
P2:= P1 + Length(WordHex);
while (P1 < P2) do
begin
Canvas.Font.Color := SymbolColor[I - 1];
Canvas.TextOut(X, Y, WordHex[I]);
CharLen := UTF8CodepointSize(P1);
if (CharLen = 0) then Break;
Canvas.Font.Color := SymbolColor[I];
Canvas.TextOut(X, Y, Copy(P1, 1, CharLen));
Inc(X, SymbolWidth);
Inc(P1, CharLen);
Inc(I);
end;
Canvas.Font.Color := clWindowText;
end;
Expand Down
Loading

0 comments on commit f27b84f

Please sign in to comment.