Skip to content

Commit

Permalink
Extract7ZipFile: improve output/log memory requirements.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnlaan committed Nov 14, 2024
1 parent d78d5dd commit 2d3b2f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Components/Lzma2/Util/7z/7zMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,18 @@ static void PrintError_WRes(const char *message, WRes wres)
}

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

Expand Down Expand Up @@ -759,10 +762,19 @@ int Z7_CDECL mainW(int numargs, WCHAR *args[])
if (res != SZ_OK)
break;
#ifdef REPORT_OUTBUFFERSIZE
if (prevOutBufferSize == -1 || outBufferSize != prevOutBufferSize)
if (prevOutBufferSize == -1 || outBufferSize > prevOutBufferSize) /* only report increasing buffer sizes */
{
PrintLF();
PrintInt("Used new buffer size ", outBufferSize);
PrintInt("Used new increased buffer size: ", outBufferSize, " bytes", False);
if (outBufferSize > 1024)
{
size_t friendlySize = (outBufferSize + 512) / 1024;
if (friendlySize > 1024)
PrintInt(" (", (friendlySize + 512 ) / 1024, " mb)", False);
else
PrintInt(" (", friendlySize, " kb)", False);
}
PrintLF();
prevOutBufferSize = outBufferSize;
}
#endif
Expand Down
Binary file modified Projects/Src/Compression.SevenZipDecoder/7zDecode/IS7zDec.obj
Binary file not shown.

0 comments on commit 2d3b2f4

Please sign in to comment.