Skip to content

Commit

Permalink
Merge branch 'main' into extract7zippage
Browse files Browse the repository at this point in the history
# Conflicts:
#	Components/Lzma2/Util/7z/7zMain.c
#	Projects/Src/Compression.SevenZipDecoder/7zDecode/IS7zDec.c
#	Projects/Src/Compression.SevenZipDecoder/7zDecode/IS7zDec.obj
  • Loading branch information
martijnlaan committed Nov 14, 2024
2 parents 8155714 + d78d5dd commit b7efc08
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 120 deletions.
25 changes: 25 additions & 0 deletions Components/Lzma2/Util/7z/7zMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
-Add specific error text for SZ_ERROR_ARCHIVE, SZ_ERROR_NO_ARCHIVE, and SZ_ERROR_PROGRESS
-Return res on errors instead of always returning 1
-Add optional progress reporting with abort option
-Add optional output of SzArEx_Extract's output buffer sizes
Otherwise unchanged */

#include "Precomp.h"
Expand Down Expand Up @@ -535,6 +536,19 @@ static void PrintError_WRes(const char *message, WRes wres)
PrintLF();
}

#ifdef REPORT_OUTBUFFERSIZE
static void PrintInt(const char *message, UInt64 value)
{
Print(message);
{
char s[32];
UInt64ToStr(value, s, 1);
Print(s);
}
PrintLF();
}
#endif

static void GetAttribString(UInt32 wa, BoolInt isDir, char *s)
{
#ifdef USE_WINDOWS_FILE
Expand Down Expand Up @@ -674,6 +688,9 @@ int Z7_CDECL mainW(int numargs, WCHAR *args[])
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
#ifdef REPORT_OUTBUFFERSIZE
size_t prevOutBufferSize = -1; /* it must be -1 before first call for each new archive. */
#endif

for (i = 0; i < db.NumFiles; i++)
{
Expand Down Expand Up @@ -768,6 +785,14 @@ int Z7_CDECL mainW(int numargs, WCHAR *args[])
&allocImp, &allocTempImp);
if (res != SZ_OK)
break;
#ifdef REPORT_OUTBUFFERSIZE
if (prevOutBufferSize == -1 || outBufferSize != prevOutBufferSize)
{
PrintLF();
PrintInt("Used new buffer size ", outBufferSize);
prevOutBufferSize = outBufferSize;
}
#endif
}

if (!testCommand)
Expand Down
Binary file modified Files/islzma32.exe
Binary file not shown.
Binary file modified Files/islzma64.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion ISHelp/isxfunc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ end;</pre>
<prototype>function Extract7ZipFile(const FileName, DestDir: String; const FullPaths: Boolean): Integer;</prototype>
<description><p>Extracts the specified 7-Zip archive to the specified directory, with or without using path names. Returns zero if successful, nonzero otherwise</p>
<p>The archive must not be encrypted.</p></description>
<remarks><p>Uses an embedded version of the &quot;7z ANSI-C Decoder&quot; from the LZMA SDK by Igor Pavlov, as-is, except that Unicode support was improved.</p>
<remarks><p>Uses an embedded version of the &quot;7z ANSI-C Decoder&quot; from the LZMA SDK by Igor Pavlov, as-is, except that Unicode support and error messages were improved and that it outputs memory requirements.</p>
<p>All output of the decoder is logged if logging is enabled, including error messages but excluding empty lines.</p>
<p>The decoder has the following limitations, as written by Igor Pavlov in the LZMA SDK:<br /><br />
-It reads only &quot;FileName&quot;, &quot;Size&quot;, &quot;LastWriteTime&quot; and &quot;CRC&quot; information for each file in archive.<br />
Expand Down
18 changes: 9 additions & 9 deletions Projects/Src/Compiler.CompressionHandler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ procedure TCompressionHandler.NewChunk(const ACompressorClass: TCustomCompressor

procedure TCompressionHandler.EndChunk;
begin
if Assigned(FCompressor) then begin
FCompressor.Finish;
{ In case we didn't get a ProgressProc call after the final block: }
FCompiler.SetBytesCompressedSoFar(FInitialBytesCompressedSoFar);
FCompiler.AddBytesCompressedSoFar(FChunkBytesRead);
FCompiler.CallIdleProc;
end;

if not FChunkStarted then
Exit;
FChunkStarted := False;

FCompressor.Finish;
{ In case we didn't get a ProgressProc call after the final block: }
FCompiler.SetBytesCompressedSoFar(FInitialBytesCompressedSoFar);
FCompiler.AddBytesCompressedSoFar(FChunkBytesRead);
FCompiler.CallIdleProc;
end;

procedure TCompressionHandler.CompressFile(const SourceFile: TFile;
Expand Down Expand Up @@ -315,4 +315,4 @@ procedure TCompressionHandler.ProgressProc(BytesProcessed: Cardinal);
FCompiler.CallIdleProc;
end;

end.
end.
Loading

0 comments on commit b7efc08

Please sign in to comment.