mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 05:15:01 -06:00
18.06
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user