aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/UI/GUI/CompressDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/UI/GUI/CompressDialog.cpp')
-rw-r--r--CPP/7zip/UI/GUI/CompressDialog.cpp67
1 files changed, 38 insertions, 29 deletions
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index fd53062..58f863e 100644
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -211,11 +211,13 @@ static const EMethodID g_ZstdMethods[] =
211}; 211};
212*/ 212*/
213 213
214/*
214static const EMethodID g_SwfcMethods[] = 215static const EMethodID g_SwfcMethods[] =
215{ 216{
216 kDeflate 217 kDeflate
217 // kLZMA 218 // kLZMA
218}; 219};
220*/
219 221
220static const EMethodID g_TarMethods[] = 222static const EMethodID g_TarMethods[] =
221{ 223{
@@ -278,7 +280,8 @@ static const CFormatInfo g_Formats[] =
278 }, 280 },
279 { 281 {
280 "7z", 282 "7z",
281 (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), 283 // (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
284 (1 << 10) - 1,
282 METHODS_PAIR(g_7zMethods), 285 METHODS_PAIR(g_7zMethods),
283 kFF_Filter | kFF_Solid | kFF_MultiThread | kFF_Encrypt | 286 kFF_Filter | kFF_Solid | kFF_MultiThread | kFF_Encrypt |
284 kFF_EncryptFileNames | kFF_MemUse | kFF_SFX 287 kFF_EncryptFileNames | kFF_MemUse | kFF_SFX
@@ -306,7 +309,8 @@ static const CFormatInfo g_Formats[] =
306 }, 309 },
307 { 310 {
308 "xz", 311 "xz",
309 (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), 312 // (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
313 (1 << 10) - 1 - (1 << 0), // store (1 << 0) is not supported
310 METHODS_PAIR(g_XzMethods), 314 METHODS_PAIR(g_XzMethods),
311 kFF_Solid | kFF_MultiThread | kFF_MemUse 315 kFF_Solid | kFF_MultiThread | kFF_MemUse
312 }, 316 },
@@ -321,12 +325,14 @@ static const CFormatInfo g_Formats[] =
321 | kFF_MemUse 325 | kFF_MemUse
322 }, 326 },
323 */ 327 */
328/*
324 { 329 {
325 "Swfc", 330 "Swfc",
326 (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), 331 (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
327 METHODS_PAIR(g_SwfcMethods), 332 METHODS_PAIR(g_SwfcMethods),
328 0 333 0
329 }, 334 },
335*/
330 { 336 {
331 "Tar", 337 "Tar",
332 (1 << 0), 338 (1 << 0),
@@ -429,22 +435,23 @@ bool CCompressDialog::OnInit()
429 #endif 435 #endif
430 436
431 { 437 {
432 UInt64 size = (UInt64)(sizeof(size_t)) << 29; 438 size_t size = (size_t)sizeof(size_t) << 29;
433 _ramSize_Defined = NSystem::GetRamSize(size); 439 _ramSize_Defined = NSystem::GetRamSize(size);
434 // size = (UInt64)3 << 62; // for debug only; 440 // size = (UInt64)3 << 62; // for debug only;
435 _ramSize = size;
436 const UInt64 kMinUseSize = (1 << 26);
437 if (size < kMinUseSize)
438 size = kMinUseSize;
439
440 unsigned bits = sizeof(size_t) * 8;
441 if (bits == 32)
442 { 441 {
443 const UInt32 limit2 = (UInt32)7 << 28; 442 // we use reduced limit for 32-bit version:
444 if (size > limit2) 443 unsigned bits = sizeof(size_t) * 8;
445 size = limit2; 444 if (bits == 32)
445 {
446 const UInt32 limit2 = (UInt32)7 << 28;
447 if (size > limit2)
448 size = limit2;
449 }
446 } 450 }
447 451 _ramSize = size;
452 const size_t kMinUseSize = 1 << 26;
453 if (size < kMinUseSize)
454 size = kMinUseSize;
448 _ramSize_Reduced = size; 455 _ramSize_Reduced = size;
449 456
450 // 80% - is auto usage limit in handlers 457 // 80% - is auto usage limit in handlers
@@ -1580,24 +1587,26 @@ void CCompressDialog::SetLevel2()
1580 1587
1581 for (unsigned i = 0; i < sizeof(UInt32) * 8; i++) 1588 for (unsigned i = 0; i < sizeof(UInt32) * 8; i++)
1582 { 1589 {
1583 const UInt32 mask = (UInt32)1 << i; 1590 const UInt32 mask = fi.LevelsMask >> i;
1584 if ((fi.LevelsMask & mask) != 0) 1591 // if (mask == 0) break;
1592 if (mask & 1)
1585 { 1593 {
1586 const UInt32 langID = g_Levels[i];
1587 UString s; 1594 UString s;
1588 s.Add_UInt32(i); 1595 s.Add_UInt32(i);
1589 // if (fi.LevelsMask < (1 << (MY_ZSTD_LEVEL_MAX + 1)) - 1) 1596 if (i < Z7_ARRAY_SIZE(g_Levels))
1590 if (langID)
1591 if (i != 0 || !isZstd)
1592 { 1597 {
1593 s += " - "; 1598 const UInt32 langID = g_Levels[i];
1594 s += LangString(langID); 1599 // if (fi.LevelsMask < (1 << (MY_ZSTD_LEVEL_MAX + 1)) - 1)
1600 if (langID)
1601 if (i != 0 || !isZstd)
1602 {
1603 s += " - ";
1604 AddLangString(s, langID);
1605 }
1595 } 1606 }
1596 const int index = (int)m_Level.AddString(s); 1607 const int index = (int)m_Level.AddString(s);
1597 m_Level.SetItemData(index, (LPARAM)i); 1608 m_Level.SetItemData(index, (LPARAM)i);
1598 } 1609 }
1599 if (fi.LevelsMask <= mask)
1600 break;
1601 } 1610 }
1602 SetNearestSelectComboBox(m_Level, level); 1611 SetNearestSelectComboBox(m_Level, level);
1603} 1612}
@@ -1931,11 +1940,11 @@ void CCompressDialog::SetDictionary2()
1931 case kLZMA2: 1940 case kLZMA2:
1932 { 1941 {
1933 { 1942 {
1934 _auto_Dict = 1943 _auto_Dict = level <= 4 ?
1935 ( level <= 3 ? ((UInt32)1 << (level * 2 + 16)) : 1944 (UInt32)1 << (level * 2 + 16) :
1936 ( level <= 6 ? ((UInt32)1 << (level + 19)) : 1945 level <= sizeof(size_t) / 2 + 4 ?
1937 ( level <= 7 ? ((UInt32)1 << 25) : ((UInt32)1 << 26) 1946 (UInt32)1 << (level + 20) :
1938 ))); 1947 (UInt32)1 << (sizeof(size_t) / 2 + 24);
1939 } 1948 }
1940 1949
1941 // we use threshold 3.75 GiB to switch to kLzmaMaxDictSize. 1950 // we use threshold 3.75 GiB to switch to kLzmaMaxDictSize.