4.28 beta

This commit is contained in:
Igor Pavlov
2005-09-26 00:00:00 +00:00
committed by Kornel Lesiński
parent d66cf2fcf3
commit 32c73adef4
35 changed files with 108 additions and 101 deletions

View File

@@ -160,7 +160,7 @@ bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo)
for(int i = 0; i < g_Methods.Size(); i++)
{
const CMethodInfo2 &method = g_Methods[i];
if (method.Name.CollateNoCase(name) == 0)
if (method.Name.CompareNoCase(name) == 0)
{
methodInfo = method;
return true;

View File

@@ -158,7 +158,7 @@ static int CompareFolders(const CFolder &f1, const CFolder &f2)
static int CompareFiles(const CFileItem &f1, const CFileItem &f2)
{
return MyStringCollateNoCase(f1.Name, f2.Name);
return MyStringCompareNoCase(f1.Name, f2.Name);
}
static int CompareFolderRefs(const int *p1, const int *p2, void *param)
@@ -196,12 +196,12 @@ static int CompareEmptyItems(const int *p1, const int *p2, void *param)
{
if (u1.IsAnti != u2.IsAnti)
return (u1.IsAnti ? 1 : -1);
int n = MyStringCollateNoCase(u1.Name, u2.Name);
int n = MyStringCompareNoCase(u1.Name, u2.Name);
return (u1.IsAnti ? (-n) : n);
}
if (u1.IsAnti != u2.IsAnti)
return (u1.IsAnti ? 1 : -1);
return MyStringCollateNoCase(u1.Name, u2.Name);
return MyStringCompareNoCase(u1.Name, u2.Name);
}
struct CRefItem
@@ -253,18 +253,18 @@ static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *para
{
if (u1.IsAnti != u2.IsAnti)
return (u1.IsAnti ? 1 : -1);
n = MyStringCollateNoCase(u1.Name, u2.Name);
n = MyStringCompareNoCase(u1.Name, u2.Name);
return (u1.IsAnti ? (-n) : n);
}
if (a1.SortByType)
{
RINOZ(MyStringCollateNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos));
RINOZ(MyStringCollateNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos));
RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos));
RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos));
if (u1.LastWriteTimeIsDefined && u2.LastWriteTimeIsDefined)
RINOZ(CompareFileTime(&u1.LastWriteTime, &u2.LastWriteTime));
RINOZ(MyCompare(u1.Size, u2.Size))
}
return MyStringCollateNoCase(u1.Name, u2.Name);
return MyStringCompareNoCase(u1.Name, u2.Name);
}
struct CSolidGroup
@@ -689,7 +689,7 @@ static HRESULT Update2(
if (numSubFiles == 0)
prevExtension = ext;
else
if (ext.CollateNoCase(prevExtension) != 0)
if (ext.CompareNoCase(prevExtension) != 0)
break;
}
}

View File

@@ -91,7 +91,7 @@ public:
int FindPath(LPCTSTR filePath)
{
for (int i = 0; i < Pairs.Size(); i++)
if (Pairs[i].Path.CollateNoCase(filePath) == 0)
if (Pairs[i].Path.CompareNoCase(filePath) == 0)
return i;
return -1;
}

View File

@@ -40,7 +40,7 @@ STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
Init();
RINOK(Init());
UInt32 bufferPos = 0;
if (_outSizeIsDefined = (outSize != 0))
_outSize = *outSize;
@@ -86,8 +86,7 @@ STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream)
{
_bufferPos = 0;
_outStream = outStream;
Init();
return S_OK;
return Init();
}
STDMETHODIMP CFilterCoder::ReleaseOutStream()
@@ -164,8 +163,7 @@ STDMETHODIMP CFilterCoder::SetInStream(ISequentialInStream *inStream)
{
_convertedPosBegin = _convertedPosEnd = _bufferPos = 0;
_inStream = inStream;
Init();
return S_OK;
return Init();
}
STDMETHODIMP CFilterCoder::ReleaseInStream()

View File

@@ -43,11 +43,11 @@ protected:
UInt64 _outSize;
UInt64 _nowPos64;
void Init()
HRESULT Init()
{
Filter->Init();
_nowPos64 = 0;
_outSizeIsDefined = false;
return Filter->Init();
}
CMyComPtr<ICryptoSetPassword> _setPassword;

View File

@@ -7,11 +7,11 @@
#include "../../Common/Alloc.h"
CInBuffer::CInBuffer():
_bufferBase(0),
_bufferSize(0),
_buffer(0),
_bufferLimit(0),
_stream(0)
_bufferBase(0),
_stream(0),
_bufferSize(0)
{}
bool CInBuffer::Create(UInt32 bufferSize)

View File

@@ -36,6 +36,7 @@ void COutBuffer::Init()
_limitPos = _bufferSize;
_pos = 0;
_processedSize = 0;
_overDict = false;
#ifdef _NO_EXCEPTIONS
ErrorCode = S_OK;
#endif
@@ -49,16 +50,16 @@ UInt64 COutBuffer::GetProcessedSize() const
return res;
}
HRESULT COutBuffer::FlushPart()
{
// _streamPos < _bufferSize
UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos);
HRESULT result = S_OK;
#ifdef _NO_EXCEPTIONS
if (ErrorCode != S_OK)
result = ErrorCode;
#endif
if (size == 0)
return result;
if (_buffer2 != 0)
{
memmove(_buffer2, _buffer + _streamPos, size);
@@ -76,9 +77,14 @@ HRESULT COutBuffer::FlushPart()
size = processedSize;
}
_streamPos += size;
_limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
if (_streamPos == _bufferSize)
_streamPos = 0;
if (_pos == _bufferSize)
{
_overDict = true;
_pos = 0;
}
_limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
_processedSize += size;
return result;
}
@@ -102,8 +108,6 @@ HRESULT COutBuffer::Flush()
void COutBuffer::FlushWithCheck()
{
HRESULT result = FlushPart();
if (_pos == _bufferSize)
_pos = 0;
#ifdef _NO_EXCEPTIONS
ErrorCode = result;
#else

View File

@@ -25,6 +25,7 @@ protected:
CMyComPtr<ISequentialOutStream> _stream;
UInt64 _processedSize;
Byte *_buffer2;
bool _overDict;
HRESULT FlushPart();
void FlushWithCheck();

View File

@@ -8,32 +8,10 @@
void CLZOutWindow::Init(bool solid)
{
if(!solid)
{
_streamPos = 0;
_limitPos = _bufferSize;
_pos = 0;
_processedSize = 0;
_overDict = false;
}
COutBuffer::Init();
#ifdef _NO_EXCEPTIONS
ErrorCode = S_OK;
#endif
}
void CLZOutWindow::FlushWithCheck()
{
HRESULT result = FlushPart();
if (_pos == _bufferSize)
{
_pos = 0;
_overDict = true;
}
#ifdef _NO_EXCEPTIONS
ErrorCode = result;
#else
if (result != S_OK)
throw CLZOutWindowException(result);
#endif
}

View File

@@ -6,6 +6,7 @@
#include "../../IStream.h"
#include "../../Common/OutBuffer.h"
/*
#ifndef _NO_EXCEPTIONS
class CLZOutWindowException
{
@@ -14,11 +15,11 @@ public:
CLZOutWindowException(HRESULT errorCode): ErrorCode(errorCode) {}
};
#endif
*/
typedef COutBufferException CLZOutWindowException;
class CLZOutWindow: public COutBuffer
{
bool _overDict;
void FlushWithCheck();
public:
void Init(bool solid = false);

View File

@@ -112,13 +112,12 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
UInt32 len;
if(_isRep[state.Index].Decode(&_rangeDecoder) == 1)
{
bool readLen = true;
len = 0;
if(_isRepG0[state.Index].Decode(&_rangeDecoder) == 0)
{
if(_isRep0Long[state.Index][posState].Decode(&_rangeDecoder) == 0)
{
state.UpdateShortRep();
readLen = false;
len = 1;
}
}
@@ -141,7 +140,7 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
rep1 = rep0;
rep0 = distance;
}
if (readLen)
if (len == 0)
{
len = _repMatchLenDecoder.Decode(&_rangeDecoder, posState) + kMatchMinLen;
state.UpdateRep();

View File

@@ -20,6 +20,7 @@ OBJS = \
InBuffer.o \
OutBuffer.o \
FileStreams.o \
StreamUtils.o \
Alloc.o \
C_FileIO.o \
CommandLineParser.o \
@@ -77,6 +78,9 @@ OutBuffer.o: ../../Common/OutBuffer.cpp
FileStreams.o: ../../Common/FileStreams.cpp
$(CXX) $(CFLAGS) ../../Common/FileStreams.cpp
StreamUtils.o: ../../Common/StreamUtils.cpp
$(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp
Alloc.o: ../../../Common/Alloc.cpp
$(CXX) $(CFLAGS) ../../../Common/Alloc.cpp

View File

@@ -9,7 +9,7 @@ void inline AddUniqueStringToHead(UStringVector &list,
const UString &string)
{
for(int i = 0; i < list.Size();)
if (string.CollateNoCase(list[i]) == 0)
if (string.CompareNoCase(list[i]) == 0)
list.Delete(i);
else
i++;

View File

@@ -171,7 +171,7 @@ static HRESULT MyCopyFile(
UINT64 &completedSize)
{
UString destPath = destPathSpec;
if (destPath.CollateNoCase(srcPath) == 0)
if (destPath.CompareNoCase(srcPath) == 0)
{
UString message = UString(L"can not move file \'") +
GetUnicodeString(destPath, fileCodePage) + UString(L"\' onto itself");
@@ -217,7 +217,7 @@ static HRESULT CopyFolder(
UString destPath = destPathSpec;
int len = srcPath.Length();
if (destPath.Length() >= len && srcPath.CollateNoCase(destPath.Left(len)) == 0)
if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
{
if (destPath.Length() == len || destPath[len] == L'\\')
{
@@ -330,7 +330,7 @@ HRESULT MyMoveFile(
UINT64 &completedSize)
{
UString destPath = destPathSpec;
if (destPath.CollateNoCase(srcPath) == 0)
if (destPath.CompareNoCase(srcPath) == 0)
{
UString message = UString(L"can not move file \'")
+ GetUnicodeString(destPath, fileCodePage) +
@@ -373,7 +373,7 @@ HRESULT MyMoveFolder(
{
UString destPath = destPathSpec;
int len = srcPath.Length();
if (destPath.Length() >= len && srcPath.CollateNoCase(destPath.Left(len)) == 0)
if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
{
if (destPath.Length() == len || destPath[len] == L'\\')
{

View File

@@ -532,7 +532,7 @@ bool CDropTarget::IsItSameDrive() const
for (int i = 0; i < m_SourcePaths.Size(); i++)
{
const UString &path = m_SourcePaths[i];
if (drive.CollateNoCase(path.Left(drive.Length())) != 0)
if (drive.CompareNoCase(path.Left(drive.Length())) != 0)
return false;
}
return true;

View File

@@ -122,7 +122,7 @@ static bool CheckShellExtensionInfo2(const CSysString &extension)
if (extKey.QueryValue(NULL, programNameValue) != ERROR_SUCCESS)
return false;
CSysString extProgramKeyName = GetExtProgramKeyName(extension);
return (programNameValue.CollateNoCase(extProgramKeyName) == 0);
return (programNameValue.CompareNoCase(extProgramKeyName) == 0);
}
bool CheckShellExtensionInfo(const CSysString &extension)
@@ -237,7 +237,7 @@ static bool CheckContextMenuHandlerCommon(const CSysString &aKeyName)
CSysString aValue;
if (aKey.QueryValue(NULL, aValue) != ERROR_SUCCESS)
return false;
return (aValue.CollateNoCase(kContextMenuHandlerCLASSIDValue) == 0);
return (aValue.CompareNoCase(kContextMenuHandlerCLASSIDValue) == 0);
}
bool CheckContextMenuHandler()

View File

@@ -58,7 +58,7 @@ bool CLangPage::OnInit()
index = _langCombo.AddString(GetSystemString(name));
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(GetSystemString(lang.ShortName));
if (g_LangID.CollateNoCase(GetSystemString(lang.ShortName)) == 0)
if (g_LangID.CompareNoCase(GetSystemString(lang.ShortName)) == 0)
_langCombo.SetCurSel(index);
}
return CPropertyPage::OnInit();

View File

@@ -116,7 +116,7 @@ UString GetTextConfigValue(const CObjectVector<CTextPair> &pairs, const UString
}
static int ComparePairIDs(const UString &s1, const UString &s2)
{ return s1.CollateNoCase(s2); }
{ return s1.CompareNoCase(s2); }
static int ComparePairItems(const CTextPair &p1, const CTextPair &p2)
{ return ComparePairIDs(p1.ID, p2.ID); }

View File

@@ -419,7 +419,7 @@ void AddUniqueStringToHeadOfList(UStringVector &list,
const UString &string)
{
for(int i = 0; i < list.Size();)
if (string.CollateNoCase(list[i]) == 0)
if (string.CompareNoCase(list[i]) == 0)
list.Delete(i);
else
i++;

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 4
#define MY_VER_MINOR 27
#define MY_VERSION "4.27 beta"
#define MY_7ZIP_VERSION "7-Zip 4.27 beta"
#define MY_DATE "2005-09-21"
#define MY_VER_MINOR 28
#define MY_VERSION "4.28 beta"
#define MY_7ZIP_VERSION "7-Zip 4.28 beta"
#define MY_DATE "2005-09-27"
#define MY_COPYRIGHT "Copyright (c) 1999-2005 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -485,7 +485,7 @@ HRESULT CAgent::RenameItem(
UString oldFullPath;
RINOK(GetArchiveItemPath(GetArchive(), i, DefaultName, oldFullPath));
if (oldItemPath.CollateNoCase(oldFullPath.Left(oldItemPath.Length())) != 0)
if (oldItemPath.CompareNoCase(oldFullPath.Left(oldItemPath.Length())) != 0)
return E_INVALIDARG;
updatePair.NewName = newItemPath + oldFullPath.Mid(oldItemPath.Length());

View File

@@ -22,7 +22,7 @@ int CProxyFolder::FindDirSubItemIndex(const UString &name, int &insertPos) const
return -1;
}
int mid = (left + right) / 2;
int compare = name.CollateNoCase(Folders[mid].Name);
int compare = name.CompareNoCase(Folders[mid].Name);
if (compare == 0)
return mid;
if (compare < 0)

View File

@@ -412,7 +412,7 @@ static void ConvertToLongNames(const UString &prefix, NWildcard::CCensorNode &no
for (int j = i + 1; j < node.SubNodes.Size();)
{
const NWildcard::CCensorNode &nextNode2 = node.SubNodes[j];
if (nextNode1.Name.CollateNoCase(nextNode2.Name) == 0)
if (nextNode1.Name.CompareNoCase(nextNode2.Name) == 0)
{
nextNode1.IncludeItems += nextNode2.IncludeItems;
nextNode1.ExcludeItems += nextNode2.ExcludeItems;

View File

@@ -191,7 +191,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
if(pathParts.Size() <= numRemovePathParts)
return E_FAIL;
for(int i = 0; i < numRemovePathParts; i++)
if(_removePathParts[i].CollateNoCase(pathParts[i]) != 0)
if(_removePathParts[i].CompareNoCase(pathParts[i]) != 0)
return E_FAIL;
pathParts.Delete(0, numRemovePathParts);
processedPath = MakePathNameFromParts(pathParts);

View File

@@ -32,7 +32,7 @@ struct CArchiverInfo
int FindExtension(const UString &ext) const
{
for (int i = 0; i < Extensions.Size(); i++)
if (ext.CollateNoCase(Extensions[i].Ext) == 0)
if (ext.CompareNoCase(Extensions[i].Ext) == 0)
return i;
return -1;
}

View File

@@ -15,7 +15,7 @@ UString GetDefaultName2(const UString &fileName,
{
int dotPos = fileNameLength - (extLength + 1);
if (fileName[dotPos] == '.')
if (extension.CollateNoCase(fileName.Mid(dotPos + 1)) == 0)
if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0)
return fileName.Left(dotPos) + addSubExtension;
}
return kEmptyFileAlias;

View File

@@ -54,7 +54,7 @@ static inline int MyFileNameCompare(const UString &s1, const UString &s2)
{
return
#ifdef _WIN32
s1.CollateNoCase(s2);
s1.CompareNoCase(s2);
#else
s1.Compare(s2);
#endif

View File

@@ -45,7 +45,7 @@ static bool CheckContextMenuHandlerCommon(const CSysString &keyName)
CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false;
return (value.CollateNoCase(kExtensionCLSID) == 0);
return (value.CompareNoCase(kExtensionCLSID) == 0);
}
static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
@@ -57,7 +57,7 @@ static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false;
return (value.CollateNoCase(kExtensionCLSID) == 0);
return (value.CompareNoCase(kExtensionCLSID) == 0);
}
bool CheckContextMenuHandler()

View File

@@ -362,7 +362,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
const CArchiverInfo &archiverInfo = fullArchiverInfoList[i];
if (archiverInfo.UpdateEnabled)
{
if (archiverInfo.Name.CollateNoCase(compressionInfo.ArchiveType) == 0)
if (archiverInfo.Name.CompareNoCase(compressionInfo.ArchiveType) == 0)
archiverIndex = archiverInfoList.Size();
archiverInfoList.Add(archiverInfo);
}
@@ -612,7 +612,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
&archiveType,
NULL));
if (archiverInfoFinal.Name.CollateNoCase((const wchar_t *)archiveType) != 0)
if (archiverInfoFinal.Name.CompareNoCase((const wchar_t *)archiveType) != 0)
throw "Type of existing archive differs from specified type";
HRESULT result = archiveHandler.QueryInterface(
IID_IOutFolderArchive, &outArchive);

View File

@@ -265,8 +265,7 @@ bool CCompressDialog::OnInit()
{
const CArchiverInfo &ai = m_ArchiverInfoList[i];
m_Format.AddString(GetSystemString(ai.Name));
if (ai.Name.CollateNoCase(
m_RegistryInfo.ArchiveType) == 0)
if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0)
Info.ArchiverInfoIndex = i;
}
m_Format.SetCurSel(Info.ArchiverInfoIndex);
@@ -879,7 +878,7 @@ void CCompressDialog::SetDictionary()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
if (fo.Method.CollateNoCase(GetMethodSpec()) == 0)
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultDictionary = fo.Dictionary;
}
int methodID = GetMethodID();
@@ -1006,7 +1005,7 @@ void CCompressDialog::SetOrder()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
if (fo.Method.CollateNoCase(GetMethodSpec()) == 0)
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultOrder = fo.Order;
}
int methodID = GetMethodID();

View File

@@ -300,7 +300,7 @@ void CExtractDialog::OnButtonSetPath()
void AddUniqueString(CSysStringVector &list, const CSysString &s)
{
for(int i = 0; i < list.Size(); i++)
if (s.CollateNoCase(list[i]) == 0)
if (s.CompareNoCase(list[i]) == 0)
return;
list.Add(s);
}