Merge 18.06 in Easy7Zip

This commit is contained in:
glachancecmaisonneuve
2019-02-19 23:45:59 -05:00
118 changed files with 3058 additions and 2868 deletions

View File

@@ -25,14 +25,21 @@ static void AddName(UStringVector &strings, UString &s)
strings.Add(s);
}
bool ReadNamesFromListFile(CFSTR fileName, UStringVector &strings, UINT codePage)
bool ReadNamesFromListFile2(CFSTR fileName, UStringVector &strings, UINT codePage, DWORD &lastError)
{
lastError = 0;
NWindows::NFile::NIO::CInFile file;
if (!file.Open(fileName))
{
lastError = ::GetLastError();
return false;
}
UInt64 fileSize;
if (!file.GetLength(fileSize))
{
lastError = ::GetLastError();
return false;
}
if (fileSize >= ((UInt32)1 << 31) - 32)
return false;
UString u;
@@ -43,7 +50,10 @@ bool ReadNamesFromListFile(CFSTR fileName, UStringVector &strings, UINT codePage
CByteArr buf((size_t)fileSize);
UInt32 processed;
if (!file.Read(buf, (UInt32)fileSize, processed))
{
lastError = ::GetLastError();
return false;
}
if (processed != fileSize)
return false;
file.Close();
@@ -74,7 +84,10 @@ bool ReadNamesFromListFile(CFSTR fileName, UStringVector &strings, UINT codePage
char *p = s.GetBuf((unsigned)fileSize);
UInt32 processed;
if (!file.Read(p, (UInt32)fileSize, processed))
{
lastError = ::GetLastError();
return false;
}
if (processed != fileSize)
return false;
file.Close();

View File

@@ -9,6 +9,10 @@
#define MY__CP_UTF16 1200
#define MY__CP_UTF16BE 1201
bool ReadNamesFromListFile(CFSTR fileName, UStringVector &strings, UINT codePage = CP_OEMCP);
// bool ReadNamesFromListFile(CFSTR fileName, UStringVector &strings, UINT codePage = CP_OEMCP);
// = CP_OEMCP
bool ReadNamesFromListFile2(CFSTR fileName, UStringVector &strings, UINT codePage,
DWORD &lastError);
#endif

View File

@@ -307,6 +307,7 @@ public:
void ReplaceOneCharAtPos(unsigned pos, char c) { _chars[pos] = c; }
char *GetBuf() { return _chars; }
/* GetBuf(minLen): provides the buffer that can store
at least (minLen) characters and additional null terminator.
9.35: GetBuf doesn't preserve old characters and terminator */

View File

@@ -96,6 +96,7 @@ typedef LONG SCODE;
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define E_INVALIDARG ((HRESULT)0x80070057L)
#define HRESULT_FROM_WIN32(e) ((HRESULT)(e))
#ifdef _MSC_VER
#define STDMETHODCALLTYPE __stdcall