diff --git a/7zip/Archive/7z/7zMethods.cpp b/7zip/Archive/7z/7zMethods.cpp index f899d0e9..56ed5b99 100755 --- a/7zip/Archive/7z/7zMethods.cpp +++ b/7zip/Archive/7z/7zMethods.cpp @@ -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; diff --git a/7zip/Archive/7z/7zUpdate.cpp b/7zip/Archive/7z/7zUpdate.cpp index e5d82764..8017c75d 100755 --- a/7zip/Archive/7z/7zUpdate.cpp +++ b/7zip/Archive/7z/7zUpdate.cpp @@ -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; } } diff --git a/7zip/Archive/Common/CoderLoader.h b/7zip/Archive/Common/CoderLoader.h index 1679a96f..02322d8c 100755 --- a/7zip/Archive/Common/CoderLoader.h +++ b/7zip/Archive/Common/CoderLoader.h @@ -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; } diff --git a/7zip/Archive/Common/FilterCoder.cpp b/7zip/Archive/Common/FilterCoder.cpp index 1ad0f5de..5d24aed7 100755 --- a/7zip/Archive/Common/FilterCoder.cpp +++ b/7zip/Archive/Common/FilterCoder.cpp @@ -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() diff --git a/7zip/Archive/Common/FilterCoder.h b/7zip/Archive/Common/FilterCoder.h index 4db7f28a..45618172 100755 --- a/7zip/Archive/Common/FilterCoder.h +++ b/7zip/Archive/Common/FilterCoder.h @@ -43,11 +43,11 @@ protected: UInt64 _outSize; UInt64 _nowPos64; - void Init() + HRESULT Init() { - Filter->Init(); _nowPos64 = 0; _outSizeIsDefined = false; + return Filter->Init(); } CMyComPtr _setPassword; diff --git a/7zip/Common/InBuffer.cpp b/7zip/Common/InBuffer.cpp index f1d58756..cbc4608b 100755 --- a/7zip/Common/InBuffer.cpp +++ b/7zip/Common/InBuffer.cpp @@ -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) diff --git a/7zip/Common/OutBuffer.cpp b/7zip/Common/OutBuffer.cpp index 38827de1..2d4871f5 100755 --- a/7zip/Common/OutBuffer.cpp +++ b/7zip/Common/OutBuffer.cpp @@ -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 diff --git a/7zip/Common/OutBuffer.h b/7zip/Common/OutBuffer.h index 51ccb659..0ce54e21 100755 --- a/7zip/Common/OutBuffer.h +++ b/7zip/Common/OutBuffer.h @@ -25,6 +25,7 @@ protected: CMyComPtr _stream; UInt64 _processedSize; Byte *_buffer2; + bool _overDict; HRESULT FlushPart(); void FlushWithCheck(); diff --git a/7zip/Compress/LZ/LZOutWindow.cpp b/7zip/Compress/LZ/LZOutWindow.cpp index 093c9ce8..e2d6aba1 100755 --- a/7zip/Compress/LZ/LZOutWindow.cpp +++ b/7zip/Compress/LZ/LZOutWindow.cpp @@ -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 -} - diff --git a/7zip/Compress/LZ/LZOutWindow.h b/7zip/Compress/LZ/LZOutWindow.h index f2a182c0..5387fdb8 100755 --- a/7zip/Compress/LZ/LZOutWindow.h +++ b/7zip/Compress/LZ/LZOutWindow.h @@ -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); diff --git a/7zip/Compress/LZMA/LZMADecoder.cpp b/7zip/Compress/LZMA/LZMADecoder.cpp index 57ab5a8d..9640d7bc 100755 --- a/7zip/Compress/LZMA/LZMADecoder.cpp +++ b/7zip/Compress/LZMA/LZMADecoder.cpp @@ -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(); diff --git a/7zip/Compress/LZMA_Alone/makefile.gcc b/7zip/Compress/LZMA_Alone/makefile.gcc index afc64388..1e180742 100755 --- a/7zip/Compress/LZMA_Alone/makefile.gcc +++ b/7zip/Compress/LZMA_Alone/makefile.gcc @@ -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 diff --git a/7zip/FileManager/AppState.h b/7zip/FileManager/AppState.h index 35239266..318c0258 100755 --- a/7zip/FileManager/AppState.h +++ b/7zip/FileManager/AppState.h @@ -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++; diff --git a/7zip/FileManager/FSFolderCopy.cpp b/7zip/FileManager/FSFolderCopy.cpp index 8d7c8dd7..5eadd0d6 100755 --- a/7zip/FileManager/FSFolderCopy.cpp +++ b/7zip/FileManager/FSFolderCopy.cpp @@ -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'\\') { diff --git a/7zip/FileManager/PanelDrag.cpp b/7zip/FileManager/PanelDrag.cpp index db342f73..028be67b 100755 --- a/7zip/FileManager/PanelDrag.cpp +++ b/7zip/FileManager/PanelDrag.cpp @@ -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; diff --git a/7zip/FileManager/RegistryAssociations.cpp b/7zip/FileManager/RegistryAssociations.cpp index 5186ea79..40490d55 100755 --- a/7zip/FileManager/RegistryAssociations.cpp +++ b/7zip/FileManager/RegistryAssociations.cpp @@ -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() diff --git a/7zip/FileManager/Resource/LangPage/LangPage.cpp b/7zip/FileManager/Resource/LangPage/LangPage.cpp index 25491913..929bc9bf 100755 --- a/7zip/FileManager/Resource/LangPage/LangPage.cpp +++ b/7zip/FileManager/Resource/LangPage/LangPage.cpp @@ -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(); diff --git a/7zip/FileManager/TextPairs.cpp b/7zip/FileManager/TextPairs.cpp index b32d02cf..ce5a4c3f 100755 --- a/7zip/FileManager/TextPairs.cpp +++ b/7zip/FileManager/TextPairs.cpp @@ -116,7 +116,7 @@ UString GetTextConfigValue(const CObjectVector &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); } diff --git a/7zip/FileManager/ViewSettings.cpp b/7zip/FileManager/ViewSettings.cpp index d9fd98d6..9b8d0765 100755 --- a/7zip/FileManager/ViewSettings.cpp +++ b/7zip/FileManager/ViewSettings.cpp @@ -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++; diff --git a/7zip/MyVersion.h b/7zip/MyVersion.h index 61f68ccf..47142ea1 100755 --- a/7zip/MyVersion.h +++ b/7zip/MyVersion.h @@ -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 diff --git a/7zip/UI/Agent/AgentOut.cpp b/7zip/UI/Agent/AgentOut.cpp index d31d40da..b898d461 100755 --- a/7zip/UI/Agent/AgentOut.cpp +++ b/7zip/UI/Agent/AgentOut.cpp @@ -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()); diff --git a/7zip/UI/Agent/AgentProxy.cpp b/7zip/UI/Agent/AgentProxy.cpp index 23b3e9d1..ce5737ee 100755 --- a/7zip/UI/Agent/AgentProxy.cpp +++ b/7zip/UI/Agent/AgentProxy.cpp @@ -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) diff --git a/7zip/UI/Common/ArchiveCommandLine.cpp b/7zip/UI/Common/ArchiveCommandLine.cpp index 3a3a8c33..664f4972 100755 --- a/7zip/UI/Common/ArchiveCommandLine.cpp +++ b/7zip/UI/Common/ArchiveCommandLine.cpp @@ -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; diff --git a/7zip/UI/Common/ArchiveExtractCallback.cpp b/7zip/UI/Common/ArchiveExtractCallback.cpp index 6e4be552..1495446a 100755 --- a/7zip/UI/Common/ArchiveExtractCallback.cpp +++ b/7zip/UI/Common/ArchiveExtractCallback.cpp @@ -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); diff --git a/7zip/UI/Common/ArchiverInfo.h b/7zip/UI/Common/ArchiverInfo.h index b05d0614..3b829518 100755 --- a/7zip/UI/Common/ArchiverInfo.h +++ b/7zip/UI/Common/ArchiverInfo.h @@ -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; } diff --git a/7zip/UI/Common/DefaultName.cpp b/7zip/UI/Common/DefaultName.cpp index dcc2152d..ab75fa2c 100755 --- a/7zip/UI/Common/DefaultName.cpp +++ b/7zip/UI/Common/DefaultName.cpp @@ -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; diff --git a/7zip/UI/Common/UpdatePair.cpp b/7zip/UI/Common/UpdatePair.cpp index 64515865..ce8f2dd7 100755 --- a/7zip/UI/Common/UpdatePair.cpp +++ b/7zip/UI/Common/UpdatePair.cpp @@ -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 diff --git a/7zip/UI/Explorer/RegistryContextMenu.cpp b/7zip/UI/Explorer/RegistryContextMenu.cpp index 409f8204..73a8420e 100755 --- a/7zip/UI/Explorer/RegistryContextMenu.cpp +++ b/7zip/UI/Explorer/RegistryContextMenu.cpp @@ -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() diff --git a/7zip/UI/Far/PluginWrite.cpp b/7zip/UI/Far/PluginWrite.cpp index 0342be2e..58d77ec9 100755 --- a/7zip/UI/Far/PluginWrite.cpp +++ b/7zip/UI/Far/PluginWrite.cpp @@ -362,7 +362,7 @@ HRESULT CompressFiles(const CObjectVector &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 &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); diff --git a/7zip/UI/GUI/CompressDialog.cpp b/7zip/UI/GUI/CompressDialog.cpp index 2a0147c3..12e1cd37 100755 --- a/7zip/UI/GUI/CompressDialog.cpp +++ b/7zip/UI/GUI/CompressDialog.cpp @@ -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(); diff --git a/7zip/UI/GUI/ExtractDialog.cpp b/7zip/UI/GUI/ExtractDialog.cpp index 43c04ae3..3d71f04d 100755 --- a/7zip/UI/GUI/ExtractDialog.cpp +++ b/7zip/UI/GUI/ExtractDialog.cpp @@ -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); } diff --git a/Common/String.cpp b/Common/String.cpp index 34ec37e0..a3d5bed1 100755 --- a/Common/String.cpp +++ b/Common/String.cpp @@ -71,6 +71,7 @@ wchar_t * MyStringLower(wchar_t *s) #endif +/* inline int ConvertCompareResult(int r) { return r - 2; } 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)); #endif } +*/ #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) { return toupper(c); } +/* int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2) { while (true) @@ -147,6 +139,7 @@ int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2) if (u1 == 0) return 0; } } +*/ #endif @@ -173,3 +166,27 @@ int MyStringCompare(const wchar_t *s1, const wchar_t *s2) 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 diff --git a/Common/String.h b/Common/String.h index a34e8347..c4277c1c 100755 --- a/Common/String.h +++ b/Common/String.h @@ -90,19 +90,23 @@ wchar_t MyCharUpper(wchar_t c); ////////////////////////////////////// // Compare +/* #ifndef _WIN32_WCE int MyStringCollate(const char *s1, const char *s2); int MyStringCollateNoCase(const char *s1, const char *s2); #endif int MyStringCollate(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 wchar_t *s1, const wchar_t *s2); -template -inline int MyStringCompareNoCase(const T *s1, const T *s2) - { return MyStringCollateNoCase(s1, s2); } +#ifdef _WIN32 +int MyStringCompareNoCase(const char *s1, const char *s2); +#endif + +int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2); template class CStringBase @@ -358,10 +362,12 @@ public: int CompareNoCase(const CStringBase& s) const { return MyStringCompareNoCase(_chars, s._chars); } + /* int Collate(const CStringBase& s) const { return MyStringCollate(_chars, s._chars); } int CollateNoCase(const CStringBase& s) const { return MyStringCollateNoCase(_chars, s._chars); } + */ int Find(T c) const { return Find(c, 0); } int Find(T c, int startIndex) const diff --git a/Common/Wildcard.cpp b/Common/Wildcard.cpp index 74ad97a6..80cd82d8 100755 --- a/Common/Wildcard.cpp +++ b/Common/Wildcard.cpp @@ -202,7 +202,7 @@ bool CItem::CheckPath(const UStringVector &pathParts, bool isFile) const int CCensorNode::FindSubNode(const UString &name) const { 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 -1; } @@ -349,7 +349,7 @@ void CCensorNode::AddItem2(bool include, const UString &path, bool recursive) int CCensor::FindPrefix(const UString &prefix) const { 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 -1; } diff --git a/DOC/7zip.nsi b/DOC/7zip.nsi index ec91560a..35264690 100755 --- a/DOC/7zip.nsi +++ b/DOC/7zip.nsi @@ -2,7 +2,7 @@ ;Defines !define VERSION_MAJOR 4 -!define VERSION_MINOR 27 +!define VERSION_MINOR 28 !define VERSION_POSTFIX_FULL " beta" !ifdef WIN64 !ifdef IA64