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
+1 -1
View File
@@ -160,7 +160,7 @@ bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo)
for(int i = 0; i < g_Methods.Size(); i++) for(int i = 0; i < g_Methods.Size(); i++)
{ {
const CMethodInfo2 &method = g_Methods[i]; const CMethodInfo2 &method = g_Methods[i];
if (method.Name.CollateNoCase(name) == 0) if (method.Name.CompareNoCase(name) == 0)
{ {
methodInfo = method; methodInfo = method;
return true; return true;
+8 -8
View File
@@ -158,7 +158,7 @@ static int CompareFolders(const CFolder &f1, const CFolder &f2)
static int CompareFiles(const CFileItem &f1, const CFileItem &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) 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) if (u1.IsAnti != u2.IsAnti)
return (u1.IsAnti ? 1 : -1); return (u1.IsAnti ? 1 : -1);
int n = MyStringCollateNoCase(u1.Name, u2.Name); int n = MyStringCompareNoCase(u1.Name, u2.Name);
return (u1.IsAnti ? (-n) : n); return (u1.IsAnti ? (-n) : n);
} }
if (u1.IsAnti != u2.IsAnti) if (u1.IsAnti != u2.IsAnti)
return (u1.IsAnti ? 1 : -1); return (u1.IsAnti ? 1 : -1);
return MyStringCollateNoCase(u1.Name, u2.Name); return MyStringCompareNoCase(u1.Name, u2.Name);
} }
struct CRefItem struct CRefItem
@@ -253,18 +253,18 @@ static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *para
{ {
if (u1.IsAnti != u2.IsAnti) if (u1.IsAnti != u2.IsAnti)
return (u1.IsAnti ? 1 : -1); return (u1.IsAnti ? 1 : -1);
n = MyStringCollateNoCase(u1.Name, u2.Name); n = MyStringCompareNoCase(u1.Name, u2.Name);
return (u1.IsAnti ? (-n) : n); return (u1.IsAnti ? (-n) : n);
} }
if (a1.SortByType) if (a1.SortByType)
{ {
RINOZ(MyStringCollateNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos)); RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos));
RINOZ(MyStringCollateNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos)); RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos));
if (u1.LastWriteTimeIsDefined && u2.LastWriteTimeIsDefined) if (u1.LastWriteTimeIsDefined && u2.LastWriteTimeIsDefined)
RINOZ(CompareFileTime(&u1.LastWriteTime, &u2.LastWriteTime)); RINOZ(CompareFileTime(&u1.LastWriteTime, &u2.LastWriteTime));
RINOZ(MyCompare(u1.Size, u2.Size)) RINOZ(MyCompare(u1.Size, u2.Size))
} }
return MyStringCollateNoCase(u1.Name, u2.Name); return MyStringCompareNoCase(u1.Name, u2.Name);
} }
struct CSolidGroup struct CSolidGroup
@@ -689,7 +689,7 @@ static HRESULT Update2(
if (numSubFiles == 0) if (numSubFiles == 0)
prevExtension = ext; prevExtension = ext;
else else
if (ext.CollateNoCase(prevExtension) != 0) if (ext.CompareNoCase(prevExtension) != 0)
break; break;
} }
} }
+1 -1
View File
@@ -91,7 +91,7 @@ public:
int FindPath(LPCTSTR filePath) int FindPath(LPCTSTR filePath)
{ {
for (int i = 0; i < Pairs.Size(); i++) 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 i;
return -1; return -1;
} }
+3 -5
View File
@@ -40,7 +40,7 @@ STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress) ICompressProgressInfo *progress)
{ {
Init(); RINOK(Init());
UInt32 bufferPos = 0; UInt32 bufferPos = 0;
if (_outSizeIsDefined = (outSize != 0)) if (_outSizeIsDefined = (outSize != 0))
_outSize = *outSize; _outSize = *outSize;
@@ -86,8 +86,7 @@ STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream)
{ {
_bufferPos = 0; _bufferPos = 0;
_outStream = outStream; _outStream = outStream;
Init(); return Init();
return S_OK;
} }
STDMETHODIMP CFilterCoder::ReleaseOutStream() STDMETHODIMP CFilterCoder::ReleaseOutStream()
@@ -164,8 +163,7 @@ STDMETHODIMP CFilterCoder::SetInStream(ISequentialInStream *inStream)
{ {
_convertedPosBegin = _convertedPosEnd = _bufferPos = 0; _convertedPosBegin = _convertedPosEnd = _bufferPos = 0;
_inStream = inStream; _inStream = inStream;
Init(); return Init();
return S_OK;
} }
STDMETHODIMP CFilterCoder::ReleaseInStream() STDMETHODIMP CFilterCoder::ReleaseInStream()
+2 -2
View File
@@ -43,11 +43,11 @@ protected:
UInt64 _outSize; UInt64 _outSize;
UInt64 _nowPos64; UInt64 _nowPos64;
void Init() HRESULT Init()
{ {
Filter->Init();
_nowPos64 = 0; _nowPos64 = 0;
_outSizeIsDefined = false; _outSizeIsDefined = false;
return Filter->Init();
} }
CMyComPtr<ICryptoSetPassword> _setPassword; CMyComPtr<ICryptoSetPassword> _setPassword;
+3 -3
View File
@@ -7,11 +7,11 @@
#include "../../Common/Alloc.h" #include "../../Common/Alloc.h"
CInBuffer::CInBuffer(): CInBuffer::CInBuffer():
_bufferBase(0),
_bufferSize(0),
_buffer(0), _buffer(0),
_bufferLimit(0), _bufferLimit(0),
_stream(0) _bufferBase(0),
_stream(0),
_bufferSize(0)
{} {}
bool CInBuffer::Create(UInt32 bufferSize) bool CInBuffer::Create(UInt32 bufferSize)
+9 -5
View File
@@ -36,6 +36,7 @@ void COutBuffer::Init()
_limitPos = _bufferSize; _limitPos = _bufferSize;
_pos = 0; _pos = 0;
_processedSize = 0; _processedSize = 0;
_overDict = false;
#ifdef _NO_EXCEPTIONS #ifdef _NO_EXCEPTIONS
ErrorCode = S_OK; ErrorCode = S_OK;
#endif #endif
@@ -49,16 +50,16 @@ UInt64 COutBuffer::GetProcessedSize() const
return res; return res;
} }
HRESULT COutBuffer::FlushPart() HRESULT COutBuffer::FlushPart()
{ {
// _streamPos < _bufferSize
UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos); UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos);
HRESULT result = S_OK; HRESULT result = S_OK;
#ifdef _NO_EXCEPTIONS #ifdef _NO_EXCEPTIONS
if (ErrorCode != S_OK) if (ErrorCode != S_OK)
result = ErrorCode; result = ErrorCode;
#endif #endif
if (size == 0)
return result;
if (_buffer2 != 0) if (_buffer2 != 0)
{ {
memmove(_buffer2, _buffer + _streamPos, size); memmove(_buffer2, _buffer + _streamPos, size);
@@ -76,9 +77,14 @@ HRESULT COutBuffer::FlushPart()
size = processedSize; size = processedSize;
} }
_streamPos += size; _streamPos += size;
_limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
if (_streamPos == _bufferSize) if (_streamPos == _bufferSize)
_streamPos = 0; _streamPos = 0;
if (_pos == _bufferSize)
{
_overDict = true;
_pos = 0;
}
_limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
_processedSize += size; _processedSize += size;
return result; return result;
} }
@@ -102,8 +108,6 @@ HRESULT COutBuffer::Flush()
void COutBuffer::FlushWithCheck() void COutBuffer::FlushWithCheck()
{ {
HRESULT result = FlushPart(); HRESULT result = FlushPart();
if (_pos == _bufferSize)
_pos = 0;
#ifdef _NO_EXCEPTIONS #ifdef _NO_EXCEPTIONS
ErrorCode = result; ErrorCode = result;
#else #else
+1
View File
@@ -25,6 +25,7 @@ protected:
CMyComPtr<ISequentialOutStream> _stream; CMyComPtr<ISequentialOutStream> _stream;
UInt64 _processedSize; UInt64 _processedSize;
Byte *_buffer2; Byte *_buffer2;
bool _overDict;
HRESULT FlushPart(); HRESULT FlushPart();
void FlushWithCheck(); void FlushWithCheck();
+1 -23
View File
@@ -8,32 +8,10 @@
void CLZOutWindow::Init(bool solid) void CLZOutWindow::Init(bool solid)
{ {
if(!solid) if(!solid)
{ COutBuffer::Init();
_streamPos = 0;
_limitPos = _bufferSize;
_pos = 0;
_processedSize = 0;
_overDict = false;
}
#ifdef _NO_EXCEPTIONS #ifdef _NO_EXCEPTIONS
ErrorCode = S_OK; ErrorCode = S_OK;
#endif #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
}
+3 -2
View File
@@ -6,6 +6,7 @@
#include "../../IStream.h" #include "../../IStream.h"
#include "../../Common/OutBuffer.h" #include "../../Common/OutBuffer.h"
/*
#ifndef _NO_EXCEPTIONS #ifndef _NO_EXCEPTIONS
class CLZOutWindowException class CLZOutWindowException
{ {
@@ -14,11 +15,11 @@ public:
CLZOutWindowException(HRESULT errorCode): ErrorCode(errorCode) {} CLZOutWindowException(HRESULT errorCode): ErrorCode(errorCode) {}
}; };
#endif #endif
*/
typedef COutBufferException CLZOutWindowException;
class CLZOutWindow: public COutBuffer class CLZOutWindow: public COutBuffer
{ {
bool _overDict;
void FlushWithCheck();
public: public:
void Init(bool solid = false); void Init(bool solid = false);
+2 -3
View File
@@ -112,13 +112,12 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
UInt32 len; UInt32 len;
if(_isRep[state.Index].Decode(&_rangeDecoder) == 1) if(_isRep[state.Index].Decode(&_rangeDecoder) == 1)
{ {
bool readLen = true; len = 0;
if(_isRepG0[state.Index].Decode(&_rangeDecoder) == 0) if(_isRepG0[state.Index].Decode(&_rangeDecoder) == 0)
{ {
if(_isRep0Long[state.Index][posState].Decode(&_rangeDecoder) == 0) if(_isRep0Long[state.Index][posState].Decode(&_rangeDecoder) == 0)
{ {
state.UpdateShortRep(); state.UpdateShortRep();
readLen = false;
len = 1; len = 1;
} }
} }
@@ -141,7 +140,7 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
rep1 = rep0; rep1 = rep0;
rep0 = distance; rep0 = distance;
} }
if (readLen) if (len == 0)
{ {
len = _repMatchLenDecoder.Decode(&_rangeDecoder, posState) + kMatchMinLen; len = _repMatchLenDecoder.Decode(&_rangeDecoder, posState) + kMatchMinLen;
state.UpdateRep(); state.UpdateRep();
+4
View File
@@ -20,6 +20,7 @@ OBJS = \
InBuffer.o \ InBuffer.o \
OutBuffer.o \ OutBuffer.o \
FileStreams.o \ FileStreams.o \
StreamUtils.o \
Alloc.o \ Alloc.o \
C_FileIO.o \ C_FileIO.o \
CommandLineParser.o \ CommandLineParser.o \
@@ -77,6 +78,9 @@ OutBuffer.o: ../../Common/OutBuffer.cpp
FileStreams.o: ../../Common/FileStreams.cpp FileStreams.o: ../../Common/FileStreams.cpp
$(CXX) $(CFLAGS) ../../Common/FileStreams.cpp $(CXX) $(CFLAGS) ../../Common/FileStreams.cpp
StreamUtils.o: ../../Common/StreamUtils.cpp
$(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp
Alloc.o: ../../../Common/Alloc.cpp Alloc.o: ../../../Common/Alloc.cpp
$(CXX) $(CFLAGS) ../../../Common/Alloc.cpp $(CXX) $(CFLAGS) ../../../Common/Alloc.cpp
+1 -1
View File
@@ -9,7 +9,7 @@ void inline AddUniqueStringToHead(UStringVector &list,
const UString &string) const UString &string)
{ {
for(int i = 0; i < list.Size();) for(int i = 0; i < list.Size();)
if (string.CollateNoCase(list[i]) == 0) if (string.CompareNoCase(list[i]) == 0)
list.Delete(i); list.Delete(i);
else else
i++; i++;
+4 -4
View File
@@ -171,7 +171,7 @@ static HRESULT MyCopyFile(
UINT64 &completedSize) UINT64 &completedSize)
{ {
UString destPath = destPathSpec; UString destPath = destPathSpec;
if (destPath.CollateNoCase(srcPath) == 0) if (destPath.CompareNoCase(srcPath) == 0)
{ {
UString message = UString(L"can not move file \'") + UString message = UString(L"can not move file \'") +
GetUnicodeString(destPath, fileCodePage) + UString(L"\' onto itself"); GetUnicodeString(destPath, fileCodePage) + UString(L"\' onto itself");
@@ -217,7 +217,7 @@ static HRESULT CopyFolder(
UString destPath = destPathSpec; UString destPath = destPathSpec;
int len = srcPath.Length(); 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'\\') if (destPath.Length() == len || destPath[len] == L'\\')
{ {
@@ -330,7 +330,7 @@ HRESULT MyMoveFile(
UINT64 &completedSize) UINT64 &completedSize)
{ {
UString destPath = destPathSpec; UString destPath = destPathSpec;
if (destPath.CollateNoCase(srcPath) == 0) if (destPath.CompareNoCase(srcPath) == 0)
{ {
UString message = UString(L"can not move file \'") UString message = UString(L"can not move file \'")
+ GetUnicodeString(destPath, fileCodePage) + + GetUnicodeString(destPath, fileCodePage) +
@@ -373,7 +373,7 @@ HRESULT MyMoveFolder(
{ {
UString destPath = destPathSpec; UString destPath = destPathSpec;
int len = srcPath.Length(); 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'\\') if (destPath.Length() == len || destPath[len] == L'\\')
{ {
+1 -1
View File
@@ -532,7 +532,7 @@ bool CDropTarget::IsItSameDrive() const
for (int i = 0; i < m_SourcePaths.Size(); i++) for (int i = 0; i < m_SourcePaths.Size(); i++)
{ {
const UString &path = m_SourcePaths[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 false;
} }
return true; return true;
+2 -2
View File
@@ -122,7 +122,7 @@ static bool CheckShellExtensionInfo2(const CSysString &extension)
if (extKey.QueryValue(NULL, programNameValue) != ERROR_SUCCESS) if (extKey.QueryValue(NULL, programNameValue) != ERROR_SUCCESS)
return false; return false;
CSysString extProgramKeyName = GetExtProgramKeyName(extension); CSysString extProgramKeyName = GetExtProgramKeyName(extension);
return (programNameValue.CollateNoCase(extProgramKeyName) == 0); return (programNameValue.CompareNoCase(extProgramKeyName) == 0);
} }
bool CheckShellExtensionInfo(const CSysString &extension) bool CheckShellExtensionInfo(const CSysString &extension)
@@ -237,7 +237,7 @@ static bool CheckContextMenuHandlerCommon(const CSysString &aKeyName)
CSysString aValue; CSysString aValue;
if (aKey.QueryValue(NULL, aValue) != ERROR_SUCCESS) if (aKey.QueryValue(NULL, aValue) != ERROR_SUCCESS)
return false; return false;
return (aValue.CollateNoCase(kContextMenuHandlerCLASSIDValue) == 0); return (aValue.CompareNoCase(kContextMenuHandlerCLASSIDValue) == 0);
} }
bool CheckContextMenuHandler() bool CheckContextMenuHandler()
@@ -58,7 +58,7 @@ bool CLangPage::OnInit()
index = _langCombo.AddString(GetSystemString(name)); index = _langCombo.AddString(GetSystemString(name));
_langCombo.SetItemData(index, _paths.Size()); _langCombo.SetItemData(index, _paths.Size());
_paths.Add(GetSystemString(lang.ShortName)); _paths.Add(GetSystemString(lang.ShortName));
if (g_LangID.CollateNoCase(GetSystemString(lang.ShortName)) == 0) if (g_LangID.CompareNoCase(GetSystemString(lang.ShortName)) == 0)
_langCombo.SetCurSel(index); _langCombo.SetCurSel(index);
} }
return CPropertyPage::OnInit(); return CPropertyPage::OnInit();
+1 -1
View File
@@ -116,7 +116,7 @@ UString GetTextConfigValue(const CObjectVector<CTextPair> &pairs, const UString
} }
static int ComparePairIDs(const UString &s1, const UString &s2) 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) static int ComparePairItems(const CTextPair &p1, const CTextPair &p2)
{ return ComparePairIDs(p1.ID, p2.ID); } { return ComparePairIDs(p1.ID, p2.ID); }
+1 -1
View File
@@ -419,7 +419,7 @@ void AddUniqueStringToHeadOfList(UStringVector &list,
const UString &string) const UString &string)
{ {
for(int i = 0; i < list.Size();) for(int i = 0; i < list.Size();)
if (string.CollateNoCase(list[i]) == 0) if (string.CompareNoCase(list[i]) == 0)
list.Delete(i); list.Delete(i);
else else
i++; i++;
+4 -4
View File
@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 4 #define MY_VER_MAJOR 4
#define MY_VER_MINOR 27 #define MY_VER_MINOR 28
#define MY_VERSION "4.27 beta" #define MY_VERSION "4.28 beta"
#define MY_7ZIP_VERSION "7-Zip 4.27 beta" #define MY_7ZIP_VERSION "7-Zip 4.28 beta"
#define MY_DATE "2005-09-21" #define MY_DATE "2005-09-27"
#define MY_COPYRIGHT "Copyright (c) 1999-2005 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2005 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
+1 -1
View File
@@ -485,7 +485,7 @@ HRESULT CAgent::RenameItem(
UString oldFullPath; UString oldFullPath;
RINOK(GetArchiveItemPath(GetArchive(), i, DefaultName, 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; return E_INVALIDARG;
updatePair.NewName = newItemPath + oldFullPath.Mid(oldItemPath.Length()); updatePair.NewName = newItemPath + oldFullPath.Mid(oldItemPath.Length());
+1 -1
View File
@@ -22,7 +22,7 @@ int CProxyFolder::FindDirSubItemIndex(const UString &name, int &insertPos) const
return -1; return -1;
} }
int mid = (left + right) / 2; int mid = (left + right) / 2;
int compare = name.CollateNoCase(Folders[mid].Name); int compare = name.CompareNoCase(Folders[mid].Name);
if (compare == 0) if (compare == 0)
return mid; return mid;
if (compare < 0) if (compare < 0)
+1 -1
View File
@@ -412,7 +412,7 @@ static void ConvertToLongNames(const UString &prefix, NWildcard::CCensorNode &no
for (int j = i + 1; j < node.SubNodes.Size();) for (int j = i + 1; j < node.SubNodes.Size();)
{ {
const NWildcard::CCensorNode &nextNode2 = node.SubNodes[j]; 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.IncludeItems += nextNode2.IncludeItems;
nextNode1.ExcludeItems += nextNode2.ExcludeItems; nextNode1.ExcludeItems += nextNode2.ExcludeItems;
+1 -1
View File
@@ -191,7 +191,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
if(pathParts.Size() <= numRemovePathParts) if(pathParts.Size() <= numRemovePathParts)
return E_FAIL; return E_FAIL;
for(int i = 0; i < numRemovePathParts; i++) for(int i = 0; i < numRemovePathParts; i++)
if(_removePathParts[i].CollateNoCase(pathParts[i]) != 0) if(_removePathParts[i].CompareNoCase(pathParts[i]) != 0)
return E_FAIL; return E_FAIL;
pathParts.Delete(0, numRemovePathParts); pathParts.Delete(0, numRemovePathParts);
processedPath = MakePathNameFromParts(pathParts); processedPath = MakePathNameFromParts(pathParts);
+1 -1
View File
@@ -32,7 +32,7 @@ struct CArchiverInfo
int FindExtension(const UString &ext) const int FindExtension(const UString &ext) const
{ {
for (int i = 0; i < Extensions.Size(); i++) 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 i;
return -1; return -1;
} }
+1 -1
View File
@@ -15,7 +15,7 @@ UString GetDefaultName2(const UString &fileName,
{ {
int dotPos = fileNameLength - (extLength + 1); int dotPos = fileNameLength - (extLength + 1);
if (fileName[dotPos] == '.') 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 fileName.Left(dotPos) + addSubExtension;
} }
return kEmptyFileAlias; return kEmptyFileAlias;
+1 -1
View File
@@ -54,7 +54,7 @@ static inline int MyFileNameCompare(const UString &s1, const UString &s2)
{ {
return return
#ifdef _WIN32 #ifdef _WIN32
s1.CollateNoCase(s2); s1.CompareNoCase(s2);
#else #else
s1.Compare(s2); s1.Compare(s2);
#endif #endif
+2 -2
View File
@@ -45,7 +45,7 @@ static bool CheckContextMenuHandlerCommon(const CSysString &keyName)
CSysString value; CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS) if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false; return false;
return (value.CollateNoCase(kExtensionCLSID) == 0); return (value.CompareNoCase(kExtensionCLSID) == 0);
} }
static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName) static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
@@ -57,7 +57,7 @@ static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
CSysString value; CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS) if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false; return false;
return (value.CollateNoCase(kExtensionCLSID) == 0); return (value.CompareNoCase(kExtensionCLSID) == 0);
} }
bool CheckContextMenuHandler() bool CheckContextMenuHandler()
+2 -2
View File
@@ -362,7 +362,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
const CArchiverInfo &archiverInfo = fullArchiverInfoList[i]; const CArchiverInfo &archiverInfo = fullArchiverInfoList[i];
if (archiverInfo.UpdateEnabled) if (archiverInfo.UpdateEnabled)
{ {
if (archiverInfo.Name.CollateNoCase(compressionInfo.ArchiveType) == 0) if (archiverInfo.Name.CompareNoCase(compressionInfo.ArchiveType) == 0)
archiverIndex = archiverInfoList.Size(); archiverIndex = archiverInfoList.Size();
archiverInfoList.Add(archiverInfo); archiverInfoList.Add(archiverInfo);
} }
@@ -612,7 +612,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
&archiveType, &archiveType,
NULL)); 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"; throw "Type of existing archive differs from specified type";
HRESULT result = archiveHandler.QueryInterface( HRESULT result = archiveHandler.QueryInterface(
IID_IOutFolderArchive, &outArchive); IID_IOutFolderArchive, &outArchive);
+3 -4
View File
@@ -265,8 +265,7 @@ bool CCompressDialog::OnInit()
{ {
const CArchiverInfo &ai = m_ArchiverInfoList[i]; const CArchiverInfo &ai = m_ArchiverInfoList[i];
m_Format.AddString(GetSystemString(ai.Name)); m_Format.AddString(GetSystemString(ai.Name));
if (ai.Name.CollateNoCase( if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0)
m_RegistryInfo.ArchiveType) == 0)
Info.ArchiverInfoIndex = i; Info.ArchiverInfoIndex = i;
} }
m_Format.SetCurSel(Info.ArchiverInfoIndex); m_Format.SetCurSel(Info.ArchiverInfoIndex);
@@ -879,7 +878,7 @@ void CCompressDialog::SetDictionary()
if (index >= 0) if (index >= 0)
{ {
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index]; const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
if (fo.Method.CollateNoCase(GetMethodSpec()) == 0) if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultDictionary = fo.Dictionary; defaultDictionary = fo.Dictionary;
} }
int methodID = GetMethodID(); int methodID = GetMethodID();
@@ -1006,7 +1005,7 @@ void CCompressDialog::SetOrder()
if (index >= 0) if (index >= 0)
{ {
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index]; const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
if (fo.Method.CollateNoCase(GetMethodSpec()) == 0) if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultOrder = fo.Order; defaultOrder = fo.Order;
} }
int methodID = GetMethodID(); int methodID = GetMethodID();
+1 -1
View File
@@ -300,7 +300,7 @@ void CExtractDialog::OnButtonSetPath()
void AddUniqueString(CSysStringVector &list, const CSysString &s) void AddUniqueString(CSysStringVector &list, const CSysString &s)
{ {
for(int i = 0; i < list.Size(); i++) for(int i = 0; i < list.Size(); i++)
if (s.CollateNoCase(list[i]) == 0) if (s.CompareNoCase(list[i]) == 0)
return; return;
list.Add(s); list.Add(s);
} }
+28 -11
View File
@@ -71,6 +71,7 @@ wchar_t * MyStringLower(wchar_t *s)
#endif #endif
/*
inline int ConvertCompareResult(int r) { return r - 2; } inline int ConvertCompareResult(int r) { return r - 2; }
int MyStringCollate(const wchar_t *s1, const wchar_t *s2) int MyStringCollate(const wchar_t *s1, const wchar_t *s2)
@@ -114,25 +115,16 @@ int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
UnicodeStringToMultiByte(s2)); UnicodeStringToMultiByte(s2));
#endif #endif
} }
*/
#else #else
inline int NormalizeCompareResult(int res)
{
if (res < 0) return -1;
if (res > 0) return 1;
return 0;
}
/*
inline wchar_t MyCharUpper(wchar_t c)
{ return towupper(c); }
*/
wchar_t MyCharUpper(wchar_t c) wchar_t MyCharUpper(wchar_t c)
{ {
return toupper(c); return toupper(c);
} }
/*
int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2) int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
{ {
while (true) while (true)
@@ -147,6 +139,7 @@ int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2)
if (u1 == 0) return 0; if (u1 == 0) return 0;
} }
} }
*/
#endif #endif
@@ -173,3 +166,27 @@ int MyStringCompare(const wchar_t *s1, const wchar_t *s2)
if (c1 == 0) return 0; if (c1 == 0) return 0;
} }
} }
int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2)
{
while (true)
{
wchar_t c1 = *s1++;
wchar_t c2 = *s2++;
if (c1 != c2)
{
wchar_t u1 = MyCharUpper(c1);
wchar_t u2 = MyCharUpper(c2);
if (u1 < u2) return -1;
if (u1 > u2) return 1;
}
if (c1 == 0) return 0;
}
}
#ifdef _WIN32
int MyStringCompareNoCase(const char *s1, const char *s2)
{
return MyStringCompareNoCase(MultiByteToUnicodeString(s1), MultiByteToUnicodeString(s2));
}
#endif
+9 -3
View File
@@ -90,19 +90,23 @@ wchar_t MyCharUpper(wchar_t c);
////////////////////////////////////// //////////////////////////////////////
// Compare // Compare
/*
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
int MyStringCollate(const char *s1, const char *s2); int MyStringCollate(const char *s1, const char *s2);
int MyStringCollateNoCase(const char *s1, const char *s2); int MyStringCollateNoCase(const char *s1, const char *s2);
#endif #endif
int MyStringCollate(const wchar_t *s1, const wchar_t *s2); int MyStringCollate(const wchar_t *s1, const wchar_t *s2);
int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2); int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2);
*/
int MyStringCompare(const char *s1, const char *s2); int MyStringCompare(const char *s1, const char *s2);
int MyStringCompare(const wchar_t *s1, const wchar_t *s2); int MyStringCompare(const wchar_t *s1, const wchar_t *s2);
template <class T> #ifdef _WIN32
inline int MyStringCompareNoCase(const T *s1, const T *s2) int MyStringCompareNoCase(const char *s1, const char *s2);
{ return MyStringCollateNoCase(s1, s2); } #endif
int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2);
template <class T> template <class T>
class CStringBase class CStringBase
@@ -358,10 +362,12 @@ public:
int CompareNoCase(const CStringBase& s) const int CompareNoCase(const CStringBase& s) const
{ return MyStringCompareNoCase(_chars, s._chars); } { return MyStringCompareNoCase(_chars, s._chars); }
/*
int Collate(const CStringBase& s) const int Collate(const CStringBase& s) const
{ return MyStringCollate(_chars, s._chars); } { return MyStringCollate(_chars, s._chars); }
int CollateNoCase(const CStringBase& s) const int CollateNoCase(const CStringBase& s) const
{ return MyStringCollateNoCase(_chars, s._chars); } { return MyStringCollateNoCase(_chars, s._chars); }
*/
int Find(T c) const { return Find(c, 0); } int Find(T c) const { return Find(c, 0); }
int Find(T c, int startIndex) const int Find(T c, int startIndex) const
+2 -2
View File
@@ -202,7 +202,7 @@ bool CItem::CheckPath(const UStringVector &pathParts, bool isFile) const
int CCensorNode::FindSubNode(const UString &name) const int CCensorNode::FindSubNode(const UString &name) const
{ {
for (int i = 0; i < SubNodes.Size(); i++) for (int i = 0; i < SubNodes.Size(); i++)
if (SubNodes[i].Name.CollateNoCase(name) == 0) if (SubNodes[i].Name.CompareNoCase(name) == 0)
return i; return i;
return -1; return -1;
} }
@@ -349,7 +349,7 @@ void CCensorNode::AddItem2(bool include, const UString &path, bool recursive)
int CCensor::FindPrefix(const UString &prefix) const int CCensor::FindPrefix(const UString &prefix) const
{ {
for (int i = 0; i < Pairs.Size(); i++) for (int i = 0; i < Pairs.Size(); i++)
if (Pairs[i].Prefix.CollateNoCase(prefix) == 0) if (Pairs[i].Prefix.CompareNoCase(prefix) == 0)
return i; return i;
return -1; return -1;
} }
+1 -1
View File
@@ -2,7 +2,7 @@
;Defines ;Defines
!define VERSION_MAJOR 4 !define VERSION_MAJOR 4
!define VERSION_MINOR 27 !define VERSION_MINOR 28
!define VERSION_POSTFIX_FULL " beta" !define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64