Update to 7-Zip 17.00 Beta

This commit is contained in:
Tino Reichardt
2017-04-30 14:14:14 +02:00
parent 54389d6e2f
commit aa5ba75da0
451 changed files with 15746 additions and 8574 deletions

View File

@@ -8,6 +8,15 @@
#include "ExtractingFilePath.h"
bool g_PathTrailReplaceMode =
#ifdef _WIN32
true
#else
false
#endif
;
static void ReplaceIncorrectChars(UString &s)
{
{
@@ -26,17 +35,42 @@ static void ReplaceIncorrectChars(UString &s)
}
}
#ifdef _WIN32
if (g_PathTrailReplaceMode)
{
for (unsigned i = s.Len(); i != 0;)
/*
// if (g_PathTrailReplaceMode == 1)
{
wchar_t c = s[--i];
if (c != '.' && c != ' ')
break;
s.ReplaceOneCharAtPos(i, '_');
if (!s.IsEmpty())
{
wchar_t c = s.Back();
if (c == '.' || c == ' ')
{
// s += (wchar_t)(0x9c); // STRING TERMINATOR
s += (wchar_t)'_';
}
}
}
else
*/
{
unsigned i;
for (i = s.Len(); i != 0;)
{
wchar_t c = s[i - 1];
if (c != '.' && c != ' ')
break;
i--;
s.ReplaceOneCharAtPos(i, '_');
// s.ReplaceOneCharAtPos(i, (c == ' ' ? (wchar_t)(0x2423) : (wchar_t)0x00B7));
}
/*
if (g_PathTrailReplaceMode > 1 && i != s.Len())
{
s.DeleteFrom(i);
}
*/
}
}
#endif
}
#ifdef _WIN32
@@ -61,7 +95,7 @@ void Correct_AltStream_Name(UString &s)
s.ReplaceOneCharAtPos(i, '_');
}
if (s.IsEmpty())
s = L'_';
s = '_';
}
static const unsigned g_ReservedWithNum_Index = 4;
@@ -120,8 +154,8 @@ static void Correct_PathPart(UString &s)
#endif
}
// static const wchar_t *k_EmptyReplaceName = L"[]";
static const wchar_t k_EmptyReplaceName = L'_';
// static const char * const k_EmptyReplaceName = "[]";
static const char k_EmptyReplaceName = '_';
UString Get_Correct_FsFile_Name(const UString &name)
{
@@ -176,11 +210,11 @@ void Correct_FsPath(bool absIsAllowed, UStringVector &parts, bool isDir)
if (isDrive)
{
// we convert "c:name" to "c:\name", if absIsAllowed path.
const UString &ds = parts[i - 1];
if (ds.Len() != 2)
UString &ds = parts[i - 1];
if (ds.Len() > 2)
{
UString s = ds.Ptr(2);
parts.Insert(i, s);
parts.Insert(i, ds.Ptr(2));
ds.DeleteFrom(2);
}
}
#endif
@@ -214,7 +248,7 @@ void Correct_FsPath(bool absIsAllowed, UStringVector &parts, bool isDir)
if (!isDir)
{
if (parts.IsEmpty())
parts.Add(k_EmptyReplaceName);
parts.Add((UString)k_EmptyReplaceName);
else
{
UString &s = parts.Back();