mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 15:14:59 -06:00
4.60 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
173c07e166
commit
c10e6b16f6
@@ -32,7 +32,7 @@ public:
|
||||
if (newCapacity > 0)
|
||||
{
|
||||
newBuffer = new T[newCapacity];
|
||||
if(_capacity > 0)
|
||||
if (_capacity > 0)
|
||||
memmove(newBuffer, _items, MyMin(_capacity, newCapacity) * sizeof(T));
|
||||
}
|
||||
else
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
CBuffer& operator=(const CBuffer &buffer)
|
||||
{
|
||||
Free();
|
||||
if(buffer._capacity > 0)
|
||||
if (buffer._capacity > 0)
|
||||
{
|
||||
SetCapacity(buffer._capacity);
|
||||
memmove(_items, buffer._items, buffer._capacity * sizeof(T));
|
||||
|
||||
@@ -21,7 +21,7 @@ bool CFileBase::OpenBinary(const char *name, int flags)
|
||||
|
||||
bool CFileBase::Close()
|
||||
{
|
||||
if(_handle == -1)
|
||||
if (_handle == -1)
|
||||
return true;
|
||||
if (close(_handle) != 0)
|
||||
return false;
|
||||
|
||||
@@ -99,14 +99,14 @@ bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
|
||||
int pos = 0;
|
||||
if (!IsItSwitchChar(s[pos]))
|
||||
return false;
|
||||
while(pos < len)
|
||||
while (pos < len)
|
||||
{
|
||||
if (IsItSwitchChar(s[pos]))
|
||||
pos++;
|
||||
const int kNoLen = -1;
|
||||
int matchedSwitchIndex = 0; // GCC Warning
|
||||
int maxLen = kNoLen;
|
||||
for(int switchIndex = 0; switchIndex < _numSwitches; switchIndex++)
|
||||
for (int switchIndex = 0; switchIndex < _numSwitches; switchIndex++)
|
||||
{
|
||||
int switchLen = MyStringLen(switchForms[switchIndex].IDString);
|
||||
if (switchLen <= maxLen || pos + switchLen > len)
|
||||
@@ -114,8 +114,8 @@ bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
|
||||
|
||||
UString temp = s + pos;
|
||||
temp = temp.Left(switchLen);
|
||||
if(temp.CompareNoCase(switchForms[switchIndex].IDString) == 0)
|
||||
// if(_strnicmp(switchForms[switchIndex].IDString, LPCSTR(s) + pos, switchLen) == 0)
|
||||
if (temp.CompareNoCase(switchForms[switchIndex].IDString) == 0)
|
||||
// if (_strnicmp(switchForms[switchIndex].IDString, LPCSTR(s) + pos, switchLen) == 0)
|
||||
{
|
||||
matchedSwitchIndex = switchIndex;
|
||||
maxLen = switchLen;
|
||||
@@ -180,7 +180,7 @@ bool CParser::ParseString(const UString &s, const CSwitchForm *switchForms)
|
||||
int maxLen = switchForm.MaxLen;
|
||||
UString stringSwitch = s.Mid(pos, minLen);
|
||||
pos += minLen;
|
||||
for(int i = minLen; i < maxLen && pos < len; i++, pos++)
|
||||
for (int i = minLen; i < maxLen && pos < len; i++, pos++)
|
||||
{
|
||||
wchar_t c = s[pos];
|
||||
if (IsItSwitchChar(c))
|
||||
@@ -208,12 +208,12 @@ const CSwitchResult& CParser::operator[](size_t index) const
|
||||
int ParseCommand(int numCommandForms, const CCommandForm *commandForms,
|
||||
const UString &commandString, UString &postString)
|
||||
{
|
||||
for(int i = 0; i < numCommandForms; i++)
|
||||
for (int i = 0; i < numCommandForms; i++)
|
||||
{
|
||||
const UString id = commandForms[i].IDString;
|
||||
if (commandForms[i].PostStringMode)
|
||||
{
|
||||
if(commandString.Find(id) == 0)
|
||||
if (commandString.Find(id) == 0)
|
||||
{
|
||||
postString = commandString.Mid(id.Length());
|
||||
return i;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
CDynamicBuffer& operator=(const CDynamicBuffer &buffer)
|
||||
{
|
||||
this->Free();
|
||||
if(buffer._capacity > 0)
|
||||
if (buffer._capacity > 0)
|
||||
{
|
||||
SetCapacity(buffer._capacity);
|
||||
memmove(this->_items, buffer._items, buffer._capacity * sizeof(T));
|
||||
|
||||
@@ -22,7 +22,7 @@ void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base)
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while(pos > 0);
|
||||
while (pos > 0);
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void ConvertUInt64ToString(UInt64 value, wchar_t *s)
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while(pos > 0);
|
||||
while (pos > 0);
|
||||
*s = L'\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &resultStrings, UINT
|
||||
}
|
||||
|
||||
UString t;
|
||||
for(int i = 0; i < u.Length(); i++)
|
||||
for (int i = 0; i < u.Length(); i++)
|
||||
{
|
||||
wchar_t c = u[i];
|
||||
if (c == L'\n' || c == 0xD)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "MyWindows.h"
|
||||
|
||||
#ifndef RINOK
|
||||
#define RINOK(x) { HRESULT __result_ = (x); if(__result_ != S_OK) return __result_; }
|
||||
#define RINOK(x) { HRESULT __result_ = (x); if (__result_ != S_OK) return __result_; }
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
@@ -78,12 +78,18 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
inline HRESULT StringToBstr(LPCOLESTR src, BSTR *bstr)
|
||||
{
|
||||
*bstr = ::SysAllocString(src);
|
||||
return (*bstr != 0) ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
class CMyComBSTR
|
||||
{
|
||||
public:
|
||||
BSTR m_str;
|
||||
CMyComBSTR() { m_str = NULL; }
|
||||
CMyComBSTR(LPCOLESTR pSrc) { m_str = ::SysAllocString(pSrc); }
|
||||
CMyComBSTR(): m_str(NULL) {}
|
||||
CMyComBSTR(LPCOLESTR src) { m_str = ::SysAllocString(src); }
|
||||
// CMyComBSTR(int nSize) { m_str = ::SysAllocStringLen(NULL, nSize); }
|
||||
// CMyComBSTR(int nSize, LPCOLESTR sz) { m_str = ::SysAllocStringLen(sz, nSize); }
|
||||
CMyComBSTR(const CMyComBSTR& src) { m_str = src.MyCopy(); }
|
||||
@@ -107,10 +113,10 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
CMyComBSTR& operator=(LPCOLESTR pSrc)
|
||||
CMyComBSTR& operator=(LPCOLESTR src)
|
||||
{
|
||||
::SysFreeString(m_str);
|
||||
m_str = ::SysAllocString(pSrc);
|
||||
m_str = ::SysAllocString(src);
|
||||
return *this;
|
||||
}
|
||||
unsigned int Length() const { return ::SysStringLen(m_str); }
|
||||
@@ -120,16 +126,18 @@ public:
|
||||
{
|
||||
int byteLen = ::SysStringByteLen(m_str);
|
||||
BSTR res = ::SysAllocStringByteLen(NULL, byteLen);
|
||||
memmove(res, m_str, byteLen);
|
||||
memcpy(res, m_str, byteLen);
|
||||
return res;
|
||||
}
|
||||
void Attach(BSTR src) { m_str = src; }
|
||||
/*
|
||||
void Attach(BSTR src) { m_str = src; }
|
||||
BSTR Detach()
|
||||
{
|
||||
BSTR s = m_str;
|
||||
m_str = NULL;
|
||||
return s;
|
||||
}
|
||||
*/
|
||||
void Empty()
|
||||
{
|
||||
::SysFreeString(m_str);
|
||||
@@ -138,7 +146,6 @@ public:
|
||||
bool operator!() const { return (m_str == NULL); }
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
class CMyUnknownImp
|
||||
|
||||
@@ -24,7 +24,7 @@ template <class T>
|
||||
inline T * MyStringCopy(T *dest, const T *src)
|
||||
{
|
||||
T *destStart = dest;
|
||||
while((*dest++ = *src++) != 0);
|
||||
while ((*dest++ = *src++) != 0);
|
||||
return destStart;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class CStringBase
|
||||
pLast = NULL;
|
||||
p = GetNextCharPointer(p);
|
||||
}
|
||||
if(pLast != NULL)
|
||||
if (pLast != NULL)
|
||||
{
|
||||
int i = (int)(pLast - _chars);
|
||||
Delete(i, _length - i);
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
/*
|
||||
const int kMaxStringSize = 0x20000000;
|
||||
#ifndef _WIN32_WCE
|
||||
if(newCapacity > kMaxStringSize || newCapacity < _length)
|
||||
if (newCapacity > kMaxStringSize || newCapacity < _length)
|
||||
throw 1052337;
|
||||
#endif
|
||||
*/
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
{
|
||||
/*
|
||||
#ifndef _WIN32_WCE
|
||||
if(newLength >= _capacity)
|
||||
if (newLength >= _capacity)
|
||||
throw 282217;
|
||||
#endif
|
||||
*/
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
}
|
||||
CStringBase& operator=(const CStringBase& s)
|
||||
{
|
||||
if(&s == this)
|
||||
if (&s == this)
|
||||
return *this;
|
||||
Empty();
|
||||
SetCapacity(s._length);
|
||||
@@ -414,7 +414,7 @@ public:
|
||||
}
|
||||
int FindOneOf(const CStringBase &s) const
|
||||
{
|
||||
for(int i = 0; i < _length; i++)
|
||||
for (int i = 0; i < _length; i++)
|
||||
if (s.Find(_chars[i]) >= 0)
|
||||
return i;
|
||||
return -1;
|
||||
@@ -461,7 +461,7 @@ public:
|
||||
pLast = NULL;
|
||||
p = GetNextCharPointer(p);
|
||||
}
|
||||
if(pLast != NULL)
|
||||
if (pLast != NULL)
|
||||
{
|
||||
int i = pLast - _chars;
|
||||
Delete(i, _length - i);
|
||||
@@ -487,7 +487,7 @@ public:
|
||||
return _length;
|
||||
int numInsertChars = s.Length();
|
||||
InsertSpace(index, numInsertChars);
|
||||
for(int i = 0; i < numInsertChars; i++)
|
||||
for (int i = 0; i < numInsertChars; i++)
|
||||
_chars[index + i] = s[i];
|
||||
_length += numInsertChars;
|
||||
return _length;
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
{
|
||||
int size = v.Size();
|
||||
Reserve(Size() + size);
|
||||
for(int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
Add(v[i]);
|
||||
return *this;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
int i = size / 2;
|
||||
do
|
||||
SortRefDown(p, i, size, compare, param);
|
||||
while(--i != 0);
|
||||
while (--i != 0);
|
||||
}
|
||||
do
|
||||
{
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
{
|
||||
int size = v.Size();
|
||||
Reserve(Size() + size);
|
||||
for(int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
Add(v[i]);
|
||||
return *this;
|
||||
}
|
||||
@@ -191,13 +191,13 @@ public:
|
||||
virtual void Delete(int index, int num = 1)
|
||||
{
|
||||
TestIndexAndCorrectNum(index, num);
|
||||
for(int i = 0; i < num; i++)
|
||||
for (int i = 0; i < num; i++)
|
||||
delete (T *)(((void **)_items)[index + i]);
|
||||
CPointerVector::Delete(index, num);
|
||||
}
|
||||
int Find(const T& item) const
|
||||
{
|
||||
for(int i = 0; i < Size(); i++)
|
||||
for (int i = 0; i < Size(); i++)
|
||||
if (item == (*this)[i])
|
||||
return i;
|
||||
return -1;
|
||||
|
||||
@@ -94,14 +94,10 @@ HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src)
|
||||
|
||||
LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2)
|
||||
{
|
||||
if(ft1->dwHighDateTime < ft2->dwHighDateTime)
|
||||
return -1;
|
||||
if(ft1->dwHighDateTime > ft2->dwHighDateTime)
|
||||
return 1;
|
||||
if(ft1->dwLowDateTime < ft2->dwLowDateTime)
|
||||
return -1;
|
||||
if(ft1->dwLowDateTime > ft2->dwLowDateTime)
|
||||
return 1;
|
||||
if (ft1->dwHighDateTime < ft2->dwHighDateTime) return -1;
|
||||
if (ft1->dwHighDateTime > ft2->dwHighDateTime) return 1;
|
||||
if (ft1->dwLowDateTime < ft2->dwLowDateTime) return -1;
|
||||
if (ft1->dwLowDateTime > ft2->dwLowDateTime) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ bool CStdInStream::Open(LPCTSTR fileName)
|
||||
|
||||
bool CStdInStream::Close()
|
||||
{
|
||||
if(!_streamIsOpen)
|
||||
if (!_streamIsOpen)
|
||||
return true;
|
||||
_streamIsOpen = (fclose(_stream) != 0);
|
||||
return !_streamIsOpen;
|
||||
@@ -48,12 +48,12 @@ AString CStdInStream::ScanStringUntilNewLine()
|
||||
for (;;)
|
||||
{
|
||||
int intChar = GetChar();
|
||||
if(intChar == EOF)
|
||||
if (intChar == EOF)
|
||||
throw kEOFMessage;
|
||||
char c = char(intChar);
|
||||
if (c == kIllegalChar)
|
||||
throw kIllegalCharMessage;
|
||||
if(c == kNewLineChar)
|
||||
if (c == kNewLineChar)
|
||||
break;
|
||||
s += c;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void CStdInStream::ReadToString(AString &resultString)
|
||||
{
|
||||
resultString.Empty();
|
||||
int c;
|
||||
while((c = GetChar()) != EOF)
|
||||
while ((c = GetChar()) != EOF)
|
||||
resultString += char(c);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool CStdInStream::Eof()
|
||||
int CStdInStream::GetChar()
|
||||
{
|
||||
int c = fgetc(_stream); // getc() doesn't work in BeOS?
|
||||
if(c == EOF && !Eof())
|
||||
if (c == EOF && !Eof())
|
||||
throw kReadErrorMessage;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool CStdOutStream::Open(const char *fileName)
|
||||
|
||||
bool CStdOutStream::Close()
|
||||
{
|
||||
if(!_streamIsOpen)
|
||||
if (!_streamIsOpen)
|
||||
return true;
|
||||
if (fclose(_stream) != 0)
|
||||
return false;
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
|
||||
{
|
||||
UString resultString;
|
||||
if(!srcString.IsEmpty())
|
||||
if (!srcString.IsEmpty())
|
||||
{
|
||||
int numChars = MultiByteToWideChar(codePage, 0, srcString,
|
||||
srcString.Length(), resultString.GetBuffer(srcString.Length()),
|
||||
srcString.Length() + 1);
|
||||
#ifndef _WIN32_WCE
|
||||
if(numChars == 0)
|
||||
if (numChars == 0)
|
||||
throw 282228;
|
||||
#endif
|
||||
resultString.ReleaseBuffer(numChars);
|
||||
@@ -39,7 +39,7 @@ AString UnicodeStringToMultiByte(const UString &s, UINT codePage, char defaultCh
|
||||
&defaultChar, &defUsed);
|
||||
defaultCharWasUsed = (defUsed != FALSE);
|
||||
#ifndef _WIN32_WCE
|
||||
if(numChars == 0)
|
||||
if (numChars == 0)
|
||||
throw 282229;
|
||||
#endif
|
||||
dest.ReleaseBuffer(numChars);
|
||||
@@ -71,7 +71,7 @@ UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
|
||||
for (int i = 0; i < srcString.Length(); i++)
|
||||
resultString += wchar_t(srcString[i]);
|
||||
/*
|
||||
if(!srcString.IsEmpty())
|
||||
if (!srcString.IsEmpty())
|
||||
{
|
||||
int numChars = mbstowcs(resultString.GetBuffer(srcString.Length()), srcString, srcString.Length() + 1);
|
||||
if (numChars < 0) throw "Your environment does not support UNICODE";
|
||||
@@ -87,7 +87,7 @@ AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
|
||||
for (int i = 0; i < srcString.Length(); i++)
|
||||
resultString += char(srcString[i]);
|
||||
/*
|
||||
if(!srcString.IsEmpty())
|
||||
if (!srcString.IsEmpty())
|
||||
{
|
||||
int numRequiredBytes = srcString.Length() * 6 + 1;
|
||||
int numChars = wcstombs(resultString.GetBuffer(numRequiredBytes), srcString, numRequiredBytes);
|
||||
|
||||
@@ -106,8 +106,8 @@ void SplitPathToParts(const UString &path, UStringVector &pathParts)
|
||||
void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name)
|
||||
{
|
||||
int i;
|
||||
for(i = path.Length() - 1; i >= 0; i--)
|
||||
if(IsCharDirLimiter(path[i]))
|
||||
for (i = path.Length() - 1; i >= 0; i--)
|
||||
if (IsCharDirLimiter(path[i]))
|
||||
break;
|
||||
dirPrefix = path.Left(i + 1);
|
||||
name = path.Mid(i + 1);
|
||||
@@ -116,8 +116,8 @@ void SplitPathToParts(const UString &path, UString &dirPrefix, UString &name)
|
||||
UString ExtractDirPrefixFromPath(const UString &path)
|
||||
{
|
||||
int i;
|
||||
for(i = path.Length() - 1; i >= 0; i--)
|
||||
if(IsCharDirLimiter(path[i]))
|
||||
for (i = path.Length() - 1; i >= 0; i--)
|
||||
if (IsCharDirLimiter(path[i]))
|
||||
break;
|
||||
return path.Left(i + 1);
|
||||
}
|
||||
@@ -125,8 +125,8 @@ UString ExtractDirPrefixFromPath(const UString &path)
|
||||
UString ExtractFileNameFromPath(const UString &path)
|
||||
{
|
||||
int i;
|
||||
for(i = path.Length() - 1; i >= 0; i--)
|
||||
if(IsCharDirLimiter(path[i]))
|
||||
for (i = path.Length() - 1; i >= 0; i--)
|
||||
if (IsCharDirLimiter(path[i]))
|
||||
break;
|
||||
return path.Mid(i + 1);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ bool CCensorNode::CheckPath(const UString &path, bool isFile, bool &include) con
|
||||
bool CCensorNode::CheckPath(const UString &path, bool isFile) const
|
||||
{
|
||||
bool include;
|
||||
if(CheckPath(path, isFile, include))
|
||||
if (CheckPath(path, isFile, include))
|
||||
return include;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user