mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: Synchronize abbzip2 unit with Abbrevia 5.0, some fixes
This commit is contained in:
parent
7aac4b973b
commit
5b35c58ea1
3 changed files with 842 additions and 714 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -621,7 +621,6 @@ uses
|
|||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
Math,
|
||||
AbCharset,
|
||||
AbResString,
|
||||
AbExcept,
|
||||
AbVMStrm,
|
||||
|
|
@ -1478,7 +1477,7 @@ begin
|
|||
{$IF DEFINED(MSWINDOWS)}
|
||||
if (GetACP <> GetOEMCP) and (SystemCode = hosDOS) then
|
||||
FFileName := CeOemToUtf8(FItemInfo.FileName)
|
||||
else if (GetACP <> GetOEMCP) and AbTryDecode(FItemInfo.FileName, CP_OEMCP, UnicodeName) then
|
||||
else if (GetACP <> GetOEMCP) and CeTryDecode(FItemInfo.FileName, CP_OEMCP, UnicodeName) then
|
||||
FFileName := UTF8Encode(UnicodeName)
|
||||
else if (SystemCode = hosNTFS) or (SystemCode = hosWinNT) then
|
||||
FFileName := CeAnsiToUtf8(FItemInfo.FileName)
|
||||
|
|
@ -1629,9 +1628,9 @@ begin
|
|||
{$IFDEF MSWINDOWS}
|
||||
FItemInfo.IsUTF8 := False;
|
||||
HostOS := hosDOS;
|
||||
if AbTryEncode(UTF8Decode(Value), CP_OEMCP, False, AnsiName) then
|
||||
if CeTryEncode(UTF8Decode(Value), CP_OEMCP, False, AnsiName) then
|
||||
{no-op}
|
||||
else if (GetACP <> GetOEMCP) and AbTryEncode(UTF8Decode(Value), CP_ACP, False, AnsiName) then
|
||||
else if (GetACP <> GetOEMCP) and CeTryEncode(UTF8Decode(Value), CP_ACP, False, AnsiName) then
|
||||
HostOS := hosWinNT
|
||||
else
|
||||
FItemInfo.IsUTF8 := True;
|
||||
|
|
@ -1642,7 +1641,7 @@ begin
|
|||
{$ENDIF}
|
||||
{$IFDEF UNIX}
|
||||
FItemInfo.FileName := Value;
|
||||
FItemInfo.IsUTF8 := AbSysCharSetIsUTF8;
|
||||
FItemInfo.IsUTF8 := SystemEncodingUtf8;
|
||||
{$ENDIF}
|
||||
|
||||
UseExtraField := False;
|
||||
|
|
@ -2339,7 +2338,7 @@ begin
|
|||
if FOwnsStream then begin
|
||||
{need new stream to write}
|
||||
FreeAndNil(FStream);
|
||||
FStream := TFileStream.Create(FArchiveName,
|
||||
FStream := TFileStreamEx.Create(FArchiveName,
|
||||
fmOpenReadWrite or fmShareDenyWrite);
|
||||
end;
|
||||
FStream.Size := 0;
|
||||
|
|
|
|||
|
|
@ -528,6 +528,38 @@ Index: AbBrowse.pas
|
|||
if Result = atUnknown then
|
||||
Result := VerifyCab(aStream);
|
||||
{$ENDIF}
|
||||
Index: AbBzip2.pas
|
||||
===================================================================
|
||||
--- AbBzip2.pas (revision 512)
|
||||
+++ AbBzip2.pas (working copy)
|
||||
@@ -391,7 +391,7 @@
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
- libbz2 = {$IF DEFINED(MSWINDOWS)}'libbz2.dll'
|
||||
+ libbz2 = {$IF DEFINED(MSWINDOWS)}'bz2.dll'
|
||||
{$ELSEIF DEFINED(DARWIN)}'libbz2.dylib'
|
||||
{$ELSE}'libbz2.so.1'{$IFEND};
|
||||
|
||||
@@ -527,8 +527,7 @@
|
||||
P := OutBuf;
|
||||
Inc(OutBytes, 256);
|
||||
ReallocMem(OutBuf, OutBytes);
|
||||
- strm.next_out := PByte(PtrInt(OutBuf)
|
||||
- + (PtrInt(strm.next_out) - PtrInt(P)));
|
||||
+ strm.next_out := OutBuf + (strm.next_out - P);
|
||||
strm.avail_out := 256;
|
||||
end;
|
||||
finally
|
||||
@@ -571,7 +570,7 @@
|
||||
P := OutBuf;
|
||||
Inc(OutBytes, BufInc);
|
||||
ReallocMem(OutBuf, OutBytes);
|
||||
- strm.next_out := PByte(PtrInt(OutBuf) + (PtrInt(strm.next_out) - PtrInt(P)));
|
||||
+ strm.next_out := OutBuf + (strm.next_out - P);
|
||||
strm.avail_out := BufInc;
|
||||
end;
|
||||
finally
|
||||
Index: AbBzip2Typ.pas
|
||||
===================================================================
|
||||
--- AbBzip2Typ.pas (revision 512)
|
||||
|
|
@ -1542,7 +1574,11 @@ Index: AbZipTyp.pas
|
|||
|
||||
public {properties}
|
||||
property CompressionMethodToUse : TAbZipSupportedMethod
|
||||
@@ -624,7 +625,10 @@
|
||||
@@ -620,11 +621,13 @@
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
Math,
|
||||
- AbCharset,
|
||||
AbResString,
|
||||
AbExcept,
|
||||
AbVMStrm,
|
||||
|
|
@ -1554,7 +1590,7 @@ Index: AbZipTyp.pas
|
|||
|
||||
function VerifyZip(Strm : TStream) : TAbArchiveType;
|
||||
{ determine if stream appears to be in PkZip format }
|
||||
@@ -1407,6 +1411,22 @@
|
||||
@@ -1407,6 +1410,22 @@
|
||||
Result := FItemInfo.FileName;
|
||||
end;
|
||||
{ -------------------------------------------------------------------------- }
|
||||
|
|
@ -1577,7 +1613,7 @@ Index: AbZipTyp.pas
|
|||
function TAbZipItem.GetShannonFanoTreeCount : Byte;
|
||||
begin
|
||||
Result := FItemInfo.ShannonFanoTreeCount;
|
||||
@@ -1428,37 +1448,50 @@
|
||||
@@ -1428,37 +1447,50 @@
|
||||
FieldStream: TStream;
|
||||
InfoZipField: PInfoZipUnicodePathRec;
|
||||
UnicodeName: UnicodeString;
|
||||
|
|
@ -1623,7 +1659,7 @@ Index: AbZipTyp.pas
|
|||
+ {$IF DEFINED(MSWINDOWS)}
|
||||
+ if (GetACP <> GetOEMCP) and (SystemCode = hosDOS) then
|
||||
+ FFileName := CeOemToUtf8(FItemInfo.FileName)
|
||||
+ else if (GetACP <> GetOEMCP) and AbTryDecode(FItemInfo.FileName, CP_OEMCP, UnicodeName) then
|
||||
+ else if (GetACP <> GetOEMCP) and CeTryDecode(FItemInfo.FileName, CP_OEMCP, UnicodeName) then
|
||||
+ FFileName := UTF8Encode(UnicodeName)
|
||||
+ else if (SystemCode = hosNTFS) or (SystemCode = hosWinNT) then
|
||||
+ FFileName := CeAnsiToUtf8(FItemInfo.FileName)
|
||||
|
|
@ -1640,7 +1676,7 @@ Index: AbZipTyp.pas
|
|||
|
||||
{ read ZIP64 extended header }
|
||||
FUncompressedSize := FItemInfo.UncompressedSize;
|
||||
@@ -1586,7 +1619,7 @@
|
||||
@@ -1586,7 +1618,7 @@
|
||||
{$IFDEF MSWINDOWS}
|
||||
AnsiName : AnsiString;
|
||||
{$ENDIF}
|
||||
|
|
@ -1649,15 +1685,15 @@ Index: AbZipTyp.pas
|
|||
FieldSize : Word;
|
||||
I : Integer;
|
||||
InfoZipField : PInfoZipUnicodePathRec;
|
||||
@@ -1596,23 +1629,19 @@
|
||||
@@ -1596,24 +1628,20 @@
|
||||
{$IFDEF MSWINDOWS}
|
||||
FItemInfo.IsUTF8 := False;
|
||||
HostOS := hosDOS;
|
||||
- if AbTryEncode(Value, CP_OEMCP, False, AnsiName) then
|
||||
+ if AbTryEncode(UTF8Decode(Value), CP_OEMCP, False, AnsiName) then
|
||||
+ if CeTryEncode(UTF8Decode(Value), CP_OEMCP, False, AnsiName) then
|
||||
{no-op}
|
||||
- else if (GetACP <> GetOEMCP) and AbTryEncode(Value, CP_ACP, False, AnsiName) then
|
||||
+ else if (GetACP <> GetOEMCP) and AbTryEncode(UTF8Decode(Value), CP_ACP, False, AnsiName) then
|
||||
+ else if (GetACP <> GetOEMCP) and CeTryEncode(UTF8Decode(Value), CP_ACP, False, AnsiName) then
|
||||
HostOS := hosWinNT
|
||||
- else if AbTryEncode(Value, CP_OEMCP, True, AnsiName) then
|
||||
- {no-op}
|
||||
|
|
@ -1673,11 +1709,13 @@ Index: AbZipTyp.pas
|
|||
{$ENDIF}
|
||||
{$IFDEF UNIX}
|
||||
- FItemInfo.FileName := AnsiString(Value);
|
||||
- FItemInfo.IsUTF8 := AbSysCharSetIsUTF8;
|
||||
+ FItemInfo.FileName := Value;
|
||||
FItemInfo.IsUTF8 := AbSysCharSetIsUTF8;
|
||||
+ FItemInfo.IsUTF8 := SystemEncodingUtf8;
|
||||
{$ENDIF}
|
||||
|
||||
@@ -1626,7 +1655,7 @@
|
||||
UseExtraField := False;
|
||||
@@ -1626,7 +1654,7 @@
|
||||
end;
|
||||
|
||||
if UseExtraField then begin
|
||||
|
|
@ -1686,7 +1724,7 @@ Index: AbZipTyp.pas
|
|||
FieldSize := SizeOf(TInfoZipUnicodePathRec) + Length(UTF8Name) - 1;
|
||||
GetMem(InfoZipField, FieldSize);
|
||||
try
|
||||
@@ -1762,20 +1791,28 @@
|
||||
@@ -1762,20 +1790,28 @@
|
||||
inherited Destroy;
|
||||
end;
|
||||
{ -------------------------------------------------------------------------- }
|
||||
|
|
@ -1720,7 +1758,7 @@ Index: AbZipTyp.pas
|
|||
end;
|
||||
end;
|
||||
{ -------------------------------------------------------------------------- }
|
||||
@@ -1930,8 +1967,8 @@
|
||||
@@ -1930,8 +1966,8 @@
|
||||
AbStripDots( lValue );
|
||||
|
||||
for i := 1 to Length( lValue ) do
|
||||
|
|
@ -1731,7 +1769,7 @@ Index: AbZipTyp.pas
|
|||
Result := lValue;
|
||||
end;
|
||||
{ -------------------------------------------------------------------------- }
|
||||
@@ -1983,7 +2020,7 @@
|
||||
@@ -1983,7 +2019,7 @@
|
||||
FStatus := asInvalid; //TODO: Status updates are extremely inconsistent
|
||||
raise EAbUserAbort.Create;
|
||||
end;
|
||||
|
|
@ -1740,3 +1778,12 @@ Index: AbZipTyp.pas
|
|||
TailPosition := FindCentralDirectoryTail( FStream );
|
||||
end;
|
||||
end;
|
||||
@@ -2302,7 +2338,7 @@
|
||||
if FOwnsStream then begin
|
||||
{need new stream to write}
|
||||
FreeAndNil(FStream);
|
||||
- FStream := TFileStream.Create(FArchiveName,
|
||||
+ FStream := TFileStreamEx.Create(FArchiveName,
|
||||
fmOpenReadWrite or fmShareDenyWrite);
|
||||
end;
|
||||
FStream.Size := 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue