diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2014-11-23 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:51 +0300 |
commit | f08f4dcc3c02464c17753b3feafcfe5243b9e236 (patch) | |
tree | b0e1b15bc5368d92dff422e8ec0818564a2b00b8 /CPP/7zip/UI/Far | |
parent | 83f8ddcc5b2161e1e3c49666265257fca8aeb12c (diff) |
9.349.34
Diffstat (limited to 'CPP/7zip/UI/Far')
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/ExtractEngine.cpp | 59 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/ExtractEngine.h | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Far.cpp (renamed from CPP/7zip/UI/Far/Main.cpp) | 37 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Far.def | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Far.dsp | 112 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Far.dsw | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/FarPlugin.h | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/FarUtils.cpp | 40 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/FarUtils.h | 13 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Messages.h | 94 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/OverwriteDialogFar.cpp (renamed from CPP/7zip/UI/Far/OverwriteDialog.cpp) | 27 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/OverwriteDialogFar.h (renamed from CPP/7zip/UI/Far/OverwriteDialog.h) | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Plugin.cpp | 236 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/Plugin.h | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/PluginCommon.cpp | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/PluginDelete.cpp | 19 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/PluginRead.cpp | 75 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/PluginWrite.cpp | 237 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/ProgressBox.cpp | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/ProgressBox.h | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/StdAfx.cpp | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/StdAfx.h | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/UpdateCallbackFar.cpp (renamed from CPP/7zip/UI/Far/UpdateCallback100.cpp) | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/UpdateCallbackFar.h (renamed from CPP/7zip/UI/Far/UpdateCallback100.h) | 12 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/makefile | 61 | ||||
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/Far/resource.rc | 0 |
26 files changed, 524 insertions, 558 deletions
diff --git a/CPP/7zip/UI/Far/ExtractEngine.cpp b/CPP/7zip/UI/Far/ExtractEngine.cpp index b18eed59..4384c6ec 100755..100644 --- a/CPP/7zip/UI/Far/ExtractEngine.cpp +++ b/CPP/7zip/UI/Far/ExtractEngine.cpp @@ -2,12 +2,13 @@ #include "StdAfx.h" -#include "Common/StringConvert.h" +#include "../../../Common/IntToString.h" +#include "../../../Common/StringConvert.h" #include "ExtractEngine.h" #include "FarUtils.h" #include "Messages.h" -#include "OverwriteDialog.h" +#include "OverwriteDialogFar.h" using namespace NWindows; using namespace NFar; @@ -119,44 +120,68 @@ STDMETHODIMP CExtractCallBackImp::MessageError(const wchar_t *message) return S_OK; } -static void ReduceString(UString &s, int size) +static void ReduceString(UString &s, unsigned size) { - if (s.Length() > size) - s = s.Left(size / 2) + UString(L" ... ") + s.Right(size / 2); + if (s.Len() > size) + { + s.Delete(size / 2, s.Len() - size); + s.Insert(size / 2, L" ... "); + } } STDMETHODIMP CExtractCallBackImp::SetOperationResult(Int32 operationResult, bool encrypted) { - switch(operationResult) + switch (operationResult) { case NArchive::NExtract::NOperationResult::kOK: break; default: { - UINT idMessage; - switch(operationResult) + UINT messageID = 0; + switch (operationResult) { - case NArchive::NExtract::NOperationResult::kUnSupportedMethod: - idMessage = NMessageID::kExtractUnsupportedMethod; + case NArchive::NExtract::NOperationResult::kUnsupportedMethod: + messageID = NMessageID::kExtractUnsupportedMethod; break; case NArchive::NExtract::NOperationResult::kCRCError: - idMessage = encrypted ? + messageID = encrypted ? NMessageID::kExtractCRCFailedEncrypted : NMessageID::kExtractCRCFailed; break; case NArchive::NExtract::NOperationResult::kDataError: - idMessage = encrypted ? + messageID = encrypted ? NMessageID::kExtractDataErrorEncrypted : NMessageID::kExtractDataError; break; - default: - return E_FAIL; } UString name = m_CurrentFilePath; ReduceString(name, 70); - AString s = g_StartupInfo.GetMsgString(idMessage); - s.Replace(" '%s'", ""); - if (g_StartupInfo.ShowMessageLines(s + (AString)("\n") + UnicodeStringToMultiByte(name, m_CodePage)) == -1) + AString s; + if (messageID != 0) + { + s = g_StartupInfo.GetMsgString(messageID); + s.Replace(" '%s'", ""); + } + else if (operationResult == NArchive::NExtract::NOperationResult::kUnavailable) + s = "Unavailable data"; + else if (operationResult == NArchive::NExtract::NOperationResult::kUnexpectedEnd) + s = "Unexpected end of data"; + else if (operationResult == NArchive::NExtract::NOperationResult::kDataAfterEnd) + s = "There are some data after the end of the payload data"; + else if (operationResult == NArchive::NExtract::NOperationResult::kIsNotArc) + s = "Is not archive"; + else if (operationResult == NArchive::NExtract::NOperationResult::kHeadersError) + s = "kHeaders Error"; + else + { + char temp[16]; + ConvertUInt32ToString(operationResult, temp); + s = "Error #"; + s += temp; + } + s += "\n"; + s += UnicodeStringToMultiByte(name, m_CodePage); + if (g_StartupInfo.ShowMessageLines(s) == -1) return E_ABORT; } } diff --git a/CPP/7zip/UI/Far/ExtractEngine.h b/CPP/7zip/UI/Far/ExtractEngine.h index 5676103a..f57602a9 100755..100644 --- a/CPP/7zip/UI/Far/ExtractEngine.h +++ b/CPP/7zip/UI/Far/ExtractEngine.h @@ -1,10 +1,10 @@ // ExtractEngine.h -#ifndef __EXTRACTENGINE_H -#define __EXTRACTENGINE_H +#ifndef __EXTRACT_ENGINE_H +#define __EXTRACT_ENGINE_H -#include "Common/MyCom.h" -#include "Common/MyString.h" +#include "../../../Common/MyCom.h" +#include "../../../Common/MyString.h" #include "../../IPassword.h" #include "../Agent/IFolderArchive.h" diff --git a/CPP/7zip/UI/Far/Main.cpp b/CPP/7zip/UI/Far/Far.cpp index 7b58d0ca..38fed101 100755..100644 --- a/CPP/7zip/UI/Far/Main.cpp +++ b/CPP/7zip/UI/Far/Far.cpp @@ -2,12 +2,12 @@ #include "StdAfx.h" -#include "Common/MyInitGuid.h" +#include "../../../Common/MyInitGuid.h" -#include "Common/StringConvert.h" +#include "../../../Common/StringConvert.h" -#include "Windows/FileDir.h" -#include "Windows/NtCheck.h" +#include "../../../Windows/FileDir.h" +#include "../../../Windows/NtCheck.h" #include "../../Common/FileStreams.h" @@ -18,6 +18,8 @@ #include "ProgressBox.h" using namespace NWindows; +using namespace NFile; +using namespace NDir; using namespace NFar; static const char *kCommandPrefix = "7-zip"; @@ -87,7 +89,7 @@ class COpenArchiveCallback: DWORD m_PrevTickCount; - NWindows::NFile::NFind::CFileInfo _fileInfo; + NFind::CFileInfo _fileInfo; public: bool PasswordIsDefined; UString Password; @@ -161,7 +163,8 @@ void COpenArchiveCallback::ShowMessage() UInt64 total = 0, cur = 0; bool curIsDefined = false, totalIsDefined = false; - char message[256] = { 0 }; + char message[256]; + message[0] = 0; if (_numFilesCurDefined) ConvertUInt64ToStringAligned(_numFilesCur, message, 5); @@ -267,7 +270,7 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, IInStream **in STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value) { - NWindows::NCOM::CPropVariant prop; + NCOM::CPropVariant prop; switch(propID) { case kpidName: prop = GetUnicodeString(_fileInfo.Name, CP_OEMCP); break; @@ -294,7 +297,7 @@ HRESULT GetPassword(UString &password) { DI_PSWEDIT, 5, 3, 70, 3, true, false, 0, true, -1, "", NULL } }; - const int kNumItems = sizeof(initItems)/sizeof(initItems[0]); + const int kNumItems = ARRAY_SIZE(initItems); FarDialogItem dialogItems[kNumItems]; g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumItems); @@ -336,8 +339,8 @@ static HANDLE MyOpenFilePluginW(const wchar_t *name) FString normalizedName = us2fs(name); normalizedName.Trim(); FString fullName; - NFile::NDirectory::MyGetFullPathName(normalizedName, fullName); - NFile::NFind::CFileInfo fileInfo; + MyGetFullPathName(normalizedName, fullName); + NFind::CFileInfo fileInfo; if (!fileInfo.Find(fullName)) return INVALID_HANDLE_VALUE; if (fileInfo.IsDir()) @@ -361,7 +364,7 @@ static HANDLE MyOpenFilePluginW(const wchar_t *name) openArchiveCallbackSpec->Init(); { FString dirPrefix, fileName; - NFile::NDirectory::GetFullPathAndSplit(fullName, dirPrefix, fileName); + GetFullPathAndSplit(fullName, dirPrefix, fileName); openArchiveCallbackSpec->LoadFileInfo(dirPrefix, fileName); } @@ -449,10 +452,12 @@ EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, INT_PTR item) AString fileName = (const char *)item; if(fileName.IsEmpty()) return INVALID_HANDLE_VALUE; - if (fileName.Length() >= 2 && + if (fileName.Len() >= 2 && fileName[0] == '\"' && fileName.Back() == '\"') - fileName = fileName.Mid(1, fileName.Length() - 2); - + { + fileName.DeleteBack(); + fileName.DeleteFrontal(1); + } return MyOpenFilePlugin(fileName); } if(openFrom == OPEN_PLUGINSMENU) @@ -542,7 +547,7 @@ EXTERN_C void WINAPI GetPluginInfo(struct PluginInfo *info) static const char *pluginCfgStrings[1]; pluginCfgStrings[0] = g_StartupInfo.GetMsgString(NMessageID::kOpenArchiveMenuString); info->PluginConfigStrings = (char **)pluginCfgStrings; - info->PluginConfigStringsNumber = sizeof(pluginCfgStrings) / sizeof(pluginCfgStrings[0]); + info->PluginConfigStringsNumber = ARRAY_SIZE(pluginCfgStrings); info->CommandPrefix = (char *)kCommandPrefix; MY_TRY_END1("GetPluginInfo"); } @@ -564,7 +569,7 @@ EXTERN_C int WINAPI Configure(int /* itemNumber */) { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kCancel, NULL, NULL }, }; - const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); + const int kNumDialogItems = ARRAY_SIZE(initItems); const int kOkButtonIndex = kNumDialogItems - 2; FarDialogItem dialogItems[kNumDialogItems]; diff --git a/CPP/7zip/UI/Far/Far.def b/CPP/7zip/UI/Far/Far.def index 39f3a5e2..39f3a5e2 100755..100644 --- a/CPP/7zip/UI/Far/Far.def +++ b/CPP/7zip/UI/Far/Far.def diff --git a/CPP/7zip/UI/Far/Far.dsp b/CPP/7zip/UI/Far/Far.dsp index 394977bb..bd50fd93 100755..100644 --- a/CPP/7zip/UI/Far/Far.dsp +++ b/CPP/7zip/UI/Far/Far.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MTd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -158,6 +158,14 @@ SOURCE=..\..\..\Common\StringConvert.h # End Source File # Begin Source File +SOURCE=..\..\..\Common\StringToInt.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\Common\StringToInt.h +# End Source File +# Begin Source File + SOURCE=..\..\..\Common\Wildcard.cpp # End Source File # Begin Source File @@ -178,7 +186,7 @@ SOURCE=.\ExtractEngine.h # End Source File # Begin Source File -SOURCE=.\Main.cpp +SOURCE=.\Far.cpp # End Source File # Begin Source File @@ -186,11 +194,11 @@ SOURCE=.\Messages.h # End Source File # Begin Source File -SOURCE=.\OverwriteDialog.cpp +SOURCE=.\OverwriteDialogFar.cpp # End Source File # Begin Source File -SOURCE=.\OverwriteDialog.h +SOURCE=.\OverwriteDialogFar.h # End Source File # Begin Source File @@ -218,11 +226,11 @@ SOURCE=.\resource.h # End Source File # Begin Source File -SOURCE=.\UpdateCallback100.cpp +SOURCE=.\UpdateCallbackFar.cpp # End Source File # Begin Source File -SOURCE=.\UpdateCallback100.h +SOURCE=.\UpdateCallbackFar.h # End Source File # End Group # Begin Group "Far" @@ -266,11 +274,11 @@ SOURCE=..\..\..\Windows\DLL.h # End Source File # Begin Source File -SOURCE=..\..\..\Windows\Error.cpp +SOURCE=..\..\..\Windows\ErrorMsg.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Windows\Error.h +SOURCE=..\..\..\Windows\ErrorMsg.h # End Source File # Begin Source File @@ -298,6 +306,10 @@ SOURCE=..\..\..\Windows\FileIO.h # End Source File # Begin Source File +SOURCE=..\..\..\Windows\FileLink.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\Windows\FileName.cpp # End Source File # Begin Source File @@ -314,11 +326,11 @@ SOURCE=..\..\..\Windows\PropVariant.h # End Source File # Begin Source File -SOURCE=..\..\..\Windows\PropVariantConversions.cpp +SOURCE=..\..\..\Windows\PropVariantConv.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Windows\PropVariantConversions.h +SOURCE=..\..\..\Windows\PropVariantConv.h # End Source File # Begin Source File @@ -338,7 +350,11 @@ SOURCE=..\..\..\Windows\Synchronization.h # End Source File # Begin Source File -SOURCE=..\..\..\Windows\Time.cpp +SOURCE=..\..\..\Windows\TimeUtils.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\Windows\TimeUtils.h # End Source File # End Group # Begin Group "UI Common" @@ -422,6 +438,14 @@ SOURCE=..\Common\PropIDUtils.h # End Source File # Begin Source File +SOURCE=..\Common\SetProperties.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\SetProperties.h +# End Source File +# Begin Source File + SOURCE=..\Common\SortUtils.cpp # End Source File # Begin Source File @@ -546,6 +570,14 @@ SOURCE=..\..\Common\FileStreams.h # End Source File # Begin Source File +SOURCE=..\..\Common\LimitedStreams.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\LimitedStreams.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\ProgressUtils.cpp # End Source File # Begin Source File @@ -554,12 +586,32 @@ SOURCE=..\..\Common\ProgressUtils.h # End Source File # Begin Source File +SOURCE=..\..\Common\PropId.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\StreamObjects.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\StreamObjects.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\StreamUtils.cpp # End Source File # Begin Source File SOURCE=..\..\Common\StreamUtils.h # End Source File +# Begin Source File + +SOURCE=..\..\Common\UniqBlocks.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\UniqBlocks.h +# End Source File # End Group # Begin Group "C" @@ -623,5 +675,41 @@ SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp SOURCE=..\..\Archive\Common\OutStreamWithCRC.h # End Source File # End Group +# Begin Group "Interface" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\Archive\IArchive.h +# End Source File +# Begin Source File + +SOURCE=..\..\ICoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\IDecl.h +# End Source File +# Begin Source File + +SOURCE=..\Common\IFileExtractCallback.h +# End Source File +# Begin Source File + +SOURCE=..\FileManager\IFolder.h +# End Source File +# Begin Source File + +SOURCE=..\..\IPassword.h +# End Source File +# Begin Source File + +SOURCE=..\..\IProgress.h +# End Source File +# Begin Source File + +SOURCE=..\..\PropID.h +# End Source File +# End Group # End Target # End Project diff --git a/CPP/7zip/UI/Far/Far.dsw b/CPP/7zip/UI/Far/Far.dsw index f4ef0801..f4ef0801 100755..100644 --- a/CPP/7zip/UI/Far/Far.dsw +++ b/CPP/7zip/UI/Far/Far.dsw diff --git a/CPP/7zip/UI/Far/FarPlugin.h b/CPP/7zip/UI/Far/FarPlugin.h index d9ea6dca..a6185a1d 100755..100644 --- a/CPP/7zip/UI/Far/FarPlugin.h +++ b/CPP/7zip/UI/Far/FarPlugin.h @@ -165,7 +165,7 @@ struct FarDialogItem const char *History; const char *Mask; struct FarList *ListItems; - int ListPos; + int ListPos; CHAR_INFO *VBuf; }; unsigned int Flags; diff --git a/CPP/7zip/UI/Far/FarUtils.cpp b/CPP/7zip/UI/Far/FarUtils.cpp index 9f55e8e5..14343522 100755..100644 --- a/CPP/7zip/UI/Far/FarUtils.cpp +++ b/CPP/7zip/UI/Far/FarUtils.cpp @@ -2,13 +2,13 @@ #include "StdAfx.h" -#include "Common/StringConvert.h" +#include "../../../Common/StringConvert.h" #ifndef UNDER_CE -#include "Windows/Console.h" +#include "../../../Windows/Console.h" #endif -#include "Windows/Defs.h" -#include "Windows/Error.h" +#include "../../../Windows/Defs.h" +#include "../../../Windows/ErrorMsg.h" #include "FarUtils.h" @@ -53,17 +53,17 @@ namespace NMessageID int CStartupInfo::ShowMessage(const char *message) { const char *items[]= { GetMsgString(NMessageID::kError), message, GetMsgString(NMessageID::kOk) }; - return ShowMessage(FMSG_WARNING, NULL, items, sizeof(items) / sizeof(items[0]), 1); + return ShowMessage(FMSG_WARNING, NULL, items, ARRAY_SIZE(items), 1); } static void SplitString(const AString &srcString, AStringVector &destStrings) { destStrings.Clear(); AString string; - int len = srcString.Length(); + unsigned len = srcString.Len(); if (len == 0) return; - for (int i = 0; i < len; i++) + for (unsigned i = 0; i < len; i++) { char c = srcString[i]; if (c == '\n') @@ -85,10 +85,10 @@ int CStartupInfo::ShowMessageLines(const char *message) { AStringVector strings; SplitString(message, strings); - const int kNumStringsMax = 20; + const unsigned kNumStringsMax = 20; const char *items[kNumStringsMax + 1] = { GetMsgString(NMessageID::kError) }; - int pos = 1; - for (int i = 0; i < strings.Size() && pos < kNumStringsMax; i++) + unsigned pos = 1; + for (unsigned i = 0; i < strings.Size() && pos < kNumStringsMax; i++) items[pos++] = strings[i]; items[pos++] = GetMsgString(NMessageID::kOk); @@ -197,7 +197,7 @@ void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName, } void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName, - LPCTSTR valueName, UINT32 value) const + LPCTSTR valueName, UInt32 value) const { NRegistry::CKey regKey; CreateRegKey(parentKey, keyName, regKey); @@ -226,14 +226,14 @@ CSysString CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyN return value; } -UINT32 CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyName, - LPCTSTR valueName, UINT32 valueDefault) const +UInt32 CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyName, + LPCTSTR valueName, UInt32 valueDefault) const { NRegistry::CKey regKey; if (OpenRegKey(parentKey, keyName, regKey) != ERROR_SUCCESS) return valueDefault; - UINT32 value; + UInt32 value; if(regKey.QueryValue(valueName, value) != ERROR_SUCCESS) return valueDefault; @@ -352,13 +352,13 @@ int CStartupInfo::Menu( int selectedItem) { CRecordVector<FarMenuItem> farMenuItems; - for(int i = 0; i < items.Size(); i++) + FOR_VECTOR (i, items) { FarMenuItem item; item.Checked = 0; item.Separator = 0; - item.Selected = (i == selectedItem); - CSysString reducedString = items[i].Left(sizeof(item.Text) / sizeof(item.Text[0]) - 1); + item.Selected = ((int)i == selectedItem); + CSysString reducedString = items[i].Left(ARRAY_SIZE(item.Text) - 1); MyStringCopy(item.Text, (const char *)GetOemString(reducedString)); farMenuItems.Add(item); } @@ -449,9 +449,9 @@ bool WasEscPressed() void ShowErrorMessage(DWORD errorCode) { - UString message = NError::MyFormatMessageW(errorCode); - message.Replace(L"\x0D", L""); - message.Replace(L"\x0A", L" "); + UString message = NError::MyFormatMessage(errorCode); + message.RemoveChar(L'\x0D'); + message.Replace(L'\x0A', L' '); g_StartupInfo.ShowMessage(UnicodeStringToMultiByte(message, CP_OEMCP)); } diff --git a/CPP/7zip/UI/Far/FarUtils.h b/CPP/7zip/UI/Far/FarUtils.h index a4887c9a..1a5a49c7 100755..100644 --- a/CPP/7zip/UI/Far/FarUtils.h +++ b/CPP/7zip/UI/Far/FarUtils.h @@ -1,10 +1,11 @@ // FarUtils.h -#ifndef __FARUTILS_H -#define __FARUTILS_H +#ifndef __FAR_UTILS_H +#define __FAR_UTILS_H #include "FarPlugin.h" -#include "Windows/Registry.h" + +#include "../../../Windows/Registry.h" namespace NFar { @@ -79,15 +80,15 @@ public: void SetRegKeyValue(HKEY parentKey, const CSysString &keyName, const LPCTSTR valueName, LPCTSTR value) const; void SetRegKeyValue(HKEY hRoot, const CSysString &keyName, - const LPCTSTR valueName, UINT32 value) const; + const LPCTSTR valueName, UInt32 value) const; void SetRegKeyValue(HKEY hRoot, const CSysString &keyName, const LPCTSTR valueName, bool value) const; CSysString QueryRegKeyValue(HKEY parentKey, const CSysString &keyName, LPCTSTR valueName, const CSysString &valueDefault) const; - UINT32 QueryRegKeyValue(HKEY parentKey, const CSysString &keyName, - LPCTSTR valueName, UINT32 valueDefault) const; + UInt32 QueryRegKeyValue(HKEY parentKey, const CSysString &keyName, + LPCTSTR valueName, UInt32 valueDefault) const; bool QueryRegKeyValue(HKEY parentKey, const CSysString &keyName, LPCTSTR valueName, bool valueDefault) const; diff --git a/CPP/7zip/UI/Far/Messages.h b/CPP/7zip/UI/Far/Messages.h index fc3723af..e6972392 100755..100644 --- a/CPP/7zip/UI/Far/Messages.h +++ b/CPP/7zip/UI/Far/Messages.h @@ -1,10 +1,14 @@ -// SevenZip/ Messages.h +// Far/Messages.h -#ifndef __SEVENZIP_MESSAGES_H -#define __SEVENZIP_MESSAGES_H +#ifndef __7ZIP_FAR_MESSAGES_H +#define __7ZIP_FAR_MESSAGES_H + +#include "../../PropID.h" namespace NMessageID { +const UINT k_Last_PropId_supported_by_plugin = kpidStreamId; + enum EEnum { kOk, @@ -20,63 +24,6 @@ enum EEnum kYes, kNo, - kPath, - kName, - kExtension, - kIsFolder, - kSize, - kPackSize, - kAttributes, - kCTime, - kATime, - kMTime, - kSolid, - kCommented, - kEncrypted, - kSplitBefore, - kSplitAfter, - kDictionarySize, - kCRC, - kType, - kAnti, - kMethod, - kHostOS, - kFileSystem, - kUser, - kGroup, - kBlock, - kComment, - kPosition, - kNumSubFolders, - kNumSubFiles, - kUnpackVer, - kVolume, - kIsVolume, - kOffset, - kLinks, - kNumBlocks, - kNumVolumes, - - kBit64, - kBigEndian, - kCpu, - kPhySize, - kHeadersSize, - kChecksum, - kCharacts, - kVa, - kId, - kShortName, - kCreatorApp, - kSectorSize, - kPosixAttrib, - kLink, - - kTotalSize, - kFreeSpace, - kClusterSize, - kLabel, - kGetPasswordTitle, kEnterPasswordForFile, @@ -140,18 +87,18 @@ enum EEnum kUpdateAddToArchive, kUpdateMethod, - kUpdateMethodStore, - kUpdateMethodFastest, - kUpdateMethodFast, - kUpdateMethodNormal, - kUpdateMethodMaximum, - kUpdateMethodUltra, + kUpdateMethod_Store, + kUpdateMethod_Fastest, + kUpdateMethod_Fast, + kUpdateMethod_Normal, + kUpdateMethod_Maximum, + kUpdateMethod_Ultra, kUpdateMode, - kUpdateModeAdd, - kUpdateModeUpdate, - kUpdateModeFreshen, - kUpdateModeSynchronize, + kUpdateMode_Add, + kUpdateMode_Update, + kUpdateMode_Fresh, + kUpdateMode_Sync, kUpdateAdd, kUpdateSelectArchiver, @@ -176,7 +123,12 @@ enum EEnum kConfigTitle, - kConfigPluginEnabled + kConfigPluginEnabled, + + // ---------- IDs for Properies (kpid*) ---------- + kNoProperty, + k_Last_MessageID_for_Property = kNoProperty + k_Last_PropId_supported_by_plugin + // ---------- }; } diff --git a/CPP/7zip/UI/Far/OverwriteDialog.cpp b/CPP/7zip/UI/Far/OverwriteDialogFar.cpp index 5be6a5f9..a7fb495e 100755..100644 --- a/CPP/7zip/UI/Far/OverwriteDialog.cpp +++ b/CPP/7zip/UI/Far/OverwriteDialogFar.cpp @@ -1,20 +1,20 @@ -// OverwriteDialog.cpp +// OverwriteDialogFar.cpp #include "StdAfx.h" #include <stdio.h> -#include "OverwriteDialog.h" +#include "../../../Common/StringConvert.h" +#include "../../../Common/IntToString.h" -#include "Common/StringConvert.h" - -#include "Windows/FileName.h" -#include "Windows/Defs.h" -#include "Windows/PropVariantConversions.h" +#include "../../../Windows/FileName.h" +#include "../../../Windows/PropVariantConv.h" #include "FarUtils.h" #include "Messages.h" +#include "OverwriteDialogFar.h" + using namespace NWindows; using namespace NFar; @@ -33,8 +33,9 @@ void SetFileInfoStrings(const CFileInfo &fileInfo, if (fileInfo.SizeIsDefined) { - sprintf(buffer, "%I64u ", fileInfo.Size); + ConvertUInt64ToString(fileInfo.Size, buffer); fileInfoStrings.Size = buffer; + fileInfoStrings.Size += ' '; fileInfoStrings.Size += g_StartupInfo.GetMsgString(NMessageID::kOverwriteBytes); } else @@ -48,10 +49,11 @@ void SetFileInfoStrings(const CFileInfo &fileInfo, { if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime)) throw 4190402; - UString timeString = ConvertFileTimeToString(localFileTime); + char timeString[32]; + ConvertFileTimeToString(localFileTime, timeString); fileInfoStrings.Time = g_StartupInfo.GetMsgString(NMessageID::kOverwriteModifiedOn); - fileInfoStrings.Time += " "; - fileInfoStrings.Time += UnicodeStringToMultiByte(timeString, CP_OEMCP); + fileInfoStrings.Time += ' '; + fileInfoStrings.Time += timeString; } } @@ -97,7 +99,7 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kOverwriteCancel, NULL, NULL } }; - const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); + const int kNumDialogItems = ARRAY_SIZE(initItems); FarDialogItem aDialogItems[kNumDialogItems]; g_StartupInfo.InitDialogItems(initItems, aDialogItems, kNumDialogItems); int anAskCode = g_StartupInfo.ShowDialog(kXSize, kYSize, @@ -109,4 +111,3 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf } } - diff --git a/CPP/7zip/UI/Far/OverwriteDialog.h b/CPP/7zip/UI/Far/OverwriteDialogFar.h index a0842e78..34947436 100755..100644 --- a/CPP/7zip/UI/Far/OverwriteDialog.h +++ b/CPP/7zip/UI/Far/OverwriteDialogFar.h @@ -1,10 +1,10 @@ -// OverwriteDialog.h +// OverwriteDialogFar.h -#ifndef OVERWRITEDIALOG_H -#define OVERWRITEDIALOG_H +#ifndef __OVERWRITE_DIALOG_FAR_H +#define __OVERWRITE_DIALOG_FAR_H -#include "Common/MyString.h" -#include "Common/Types.h" +#include "../../../Common/MyString.h" +#include "../../../Common/MyTypes.h" namespace NOverwriteDialog { diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp index 8bdfb10d..bebd47de 100755..100644 --- a/CPP/7zip/UI/Far/Plugin.cpp +++ b/CPP/7zip/UI/Far/Plugin.cpp @@ -2,12 +2,12 @@ #include "StdAfx.h" -#include "Common/IntToString.h" -#include "Common/StringConvert.h" -#include "Common/Wildcard.h" +#include "../../../Common/IntToString.h" +#include "../../../Common/StringConvert.h" +#include "../../../Common/Wildcard.h" -#include "Windows/FileDir.h" -#include "Windows/PropVariantConversions.h" +#include "../../../Windows/FileDir.h" +#include "../../../Windows/PropVariantConv.h" #include "../Common/PropIDUtils.h" @@ -16,8 +16,17 @@ #include "Plugin.h" using namespace NWindows; +using namespace NFile; +using namespace NDir; using namespace NFar; +// This function is unused +int CompareFileNames_ForFolderList(const wchar_t *s1, const wchar_t *s2) +{ + return MyStringCompareNoCase(s1, s2); +} + + CPlugin::CPlugin(const FString &fileName, IInFolderArchive *archiveHandler, UString archiveTypeName): m_ArchiveHandler(archiveHandler), m_FileName(fileName), @@ -52,16 +61,16 @@ static void MyGetFileTime(IFolderFolder *anArchiveFolder, UInt32 itemIndex, #define kDotsReplaceString "[[..]]" #define kDotsReplaceStringU L"[[..]]" -static void CopyStrLimited(char *dest, const AString &src, int len) +static void CopyStrLimited(char *dest, const AString &src, unsigned len) { len--; - if (src.Length() < len) - len = src.Length(); + if (src.Len() < len) + len = src.Len(); memcpy(dest, src, sizeof(dest[0]) * len); dest[len] = 0; } -#define COPY_STR_LIMITED(dest, src) CopyStrLimited(dest, src, sizeof(dest) / sizeof(dest[0])) +#define COPY_STR_LIMITED(dest, src) CopyStrLimited(dest, src, ARRAY_SIZE(dest)) void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex) { @@ -100,11 +109,8 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex) if (_folder->GetProperty(itemIndex, kpidSize, &prop) != S_OK) throw 271932; - UInt64 length; - if (prop.vt == VT_EMPTY) - length = 0; - else - length = ::ConvertPropVariantToUInt64(prop); + UInt64 length = 0; + ConvertPropVariantToUInt64(prop, length); panelItem.FindData.nFileSizeLow = (UInt32)length; panelItem.FindData.nFileSizeHigh = (UInt32)(length >> 32); @@ -118,10 +124,8 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex) if (_folder->GetProperty(itemIndex, kpidPackSize, &prop) != S_OK) throw 271932; - if (prop.vt == VT_EMPTY) - length = 0; - else - length = ::ConvertPropVariantToUInt64(prop); + length = 0; + ConvertPropVariantToUInt64(prop, length); panelItem.PackSize = UInt32(length); panelItem.PackSizeHigh = UInt32(length >> 32); @@ -150,8 +154,7 @@ int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int opM g_StartupInfo.GetMsgString(NMessageID::kWaitTitle), g_StartupInfo.GetMsgString(NMessageID::kReadingList) }; - g_StartupInfo.ShowMessage(0, NULL, msgItems, - sizeof(msgItems) / sizeof(msgItems[0]), 0); + g_StartupInfo.ShowMessage(0, NULL, msgItems, ARRAY_SIZE(msgItems), 0); */ } @@ -223,14 +226,14 @@ int CPlugin::SetDirectory(const char *aszDir, int /* opMode */) { _folder.Release(); m_ArchiveHandler->BindToRootFolder(&_folder); - path = path.Mid(1); + path.DeleteFrontal(1); } UStringVector pathParts; SplitPathToParts(path, pathParts); - for (int i = 0; i < pathParts.Size(); i++) + FOR_VECTOR (i, pathParts) EnterToDirectory(pathParts[i]); } - GetCurrentDir(); + SetCurrentDirVar(); return TRUE; } @@ -252,12 +255,12 @@ void CPlugin::GetPathParts(UStringVector &pathParts) } } -void CPlugin::GetCurrentDir() +void CPlugin::SetCurrentDirVar() { m_CurrentDir.Empty(); UStringVector pathParts; GetPathParts(pathParts); - for (int i = 0; i < pathParts.Size(); i++) + FOR_VECTOR (i, pathParts) { m_CurrentDir += WCHAR_PATH_SEPARATOR; m_CurrentDir += pathParts[i]; @@ -267,81 +270,11 @@ void CPlugin::GetCurrentDir() static char *kPluginFormatName = "7-ZIP"; -struct CPROPIDToName -{ - PROPID PropID; - int PluginID; -}; - -static CPROPIDToName kPROPIDToName[] = -{ - { kpidPath, NMessageID::kPath }, - { kpidName, NMessageID::kName }, - { kpidExtension, NMessageID::kExtension }, - { kpidIsDir, NMessageID::kIsFolder }, - { kpidSize, NMessageID::kSize }, - { kpidPackSize, NMessageID::kPackSize }, - { kpidAttrib, NMessageID::kAttributes }, - { kpidCTime, NMessageID::kCTime }, - { kpidATime, NMessageID::kATime }, - { kpidMTime, NMessageID::kMTime }, - { kpidSolid, NMessageID::kSolid }, - { kpidCommented, NMessageID::kCommented }, - { kpidEncrypted, NMessageID::kEncrypted }, - { kpidSplitBefore, NMessageID::kSplitBefore }, - { kpidSplitAfter, NMessageID::kSplitAfter }, - { kpidDictionarySize, NMessageID::kDictionarySize }, - { kpidCRC, NMessageID::kCRC }, - { kpidType, NMessageID::kType }, - { kpidIsAnti, NMessageID::kAnti }, - { kpidMethod, NMessageID::kMethod }, - { kpidHostOS, NMessageID::kHostOS }, - { kpidFileSystem, NMessageID::kFileSystem }, - { kpidUser, NMessageID::kUser }, - { kpidGroup, NMessageID::kGroup }, - { kpidBlock, NMessageID::kBlock }, - { kpidComment, NMessageID::kComment }, - { kpidPosition, NMessageID::kPosition }, - { kpidNumSubDirs, NMessageID::kNumSubFolders }, - { kpidNumSubFiles, NMessageID::kNumSubFiles }, - { kpidUnpackVer, NMessageID::kUnpackVer }, - { kpidVolume, NMessageID::kVolume }, - { kpidIsVolume, NMessageID::kIsVolume }, - { kpidOffset, NMessageID::kOffset }, - { kpidLinks, NMessageID::kLinks }, - { kpidNumBlocks, NMessageID::kNumBlocks }, - { kpidNumVolumes, NMessageID::kNumVolumes }, - - { kpidBit64, NMessageID::kBit64 }, - { kpidBigEndian, NMessageID::kBigEndian }, - { kpidCpu, NMessageID::kCpu }, - { kpidPhySize, NMessageID::kPhySize }, - { kpidHeadersSize, NMessageID::kHeadersSize }, - { kpidChecksum, NMessageID::kChecksum }, - { kpidCharacts, NMessageID::kCharacts }, - { kpidVa, NMessageID::kVa }, - { kpidId, NMessageID::kId }, - { kpidShortName, NMessageID::kShortName}, - { kpidCreatorApp, NMessageID::kCreatorApp }, - { kpidSectorSize, NMessageID::kSectorSize }, - { kpidPosixAttrib, NMessageID::kPosixAttrib }, - { kpidLink, NMessageID::kLink }, - { kpidError, NMessageID::kError }, - - { kpidTotalSize, NMessageID::kTotalSize }, - { kpidFreeSpace, NMessageID::kFreeSpace }, - { kpidClusterSize, NMessageID::kClusterSize }, - { kpidVolumeName, NMessageID::kLabel } -}; - -static const int kNumPROPIDToName = sizeof(kPROPIDToName) / sizeof(kPROPIDToName[0]); - -static int FindPropertyToName(PROPID propID) +static int FindPropNameID(PROPID propID) { - for (int i = 0; i < kNumPROPIDToName; i++) - if (kPROPIDToName[i].PropID == propID) - return i; - return -1; + if (propID > NMessageID::k_Last_PropId_supported_by_plugin) + return -1; + return NMessageID::kNoProperty + propID; } /* @@ -374,8 +307,7 @@ static CPropertyIDInfo kPropertyIDInfos[] = // { kpidType, L"Type" } }; -static const int kNumPropertyIDInfos = sizeof(kPropertyIDInfos) / - sizeof(kPropertyIDInfos[0]); +static const int kNumPropertyIDInfos = ARRAY_SIZE(kPropertyIDInfos); static int FindPropertyInfo(PROPID propID) { @@ -423,23 +355,21 @@ void CPlugin::AddColumn(PROPID propID) static AString GetNameOfProp(PROPID propID, const wchar_t *name) { - int index = FindPropertyToName(propID); - if (index < 0) - { - if (name) - return UnicodeStringToMultiByte((const wchar_t *)name, CP_OEMCP); - char s[32]; - ConvertUInt64ToString(propID, s); - return s; - } - return g_StartupInfo.GetMsgString(kPROPIDToName[index].PluginID); + int farID = FindPropNameID(propID); + if (farID >= 0) + return g_StartupInfo.GetMsgString(farID); + if (name) + return UnicodeStringToMultiByte((const wchar_t *)name, CP_OEMCP); + char s[16]; + ConvertUInt32ToString(propID, s); + return s; } static AString GetNameOfProp2(PROPID propID, const wchar_t *name) { AString s = GetNameOfProp(propID, name); - if (s.Length() > (kInfoPanelLineSize - 1)) - s = s.Left(kInfoPanelLineSize - 1); + if (s.Len() > (kInfoPanelLineSize - 1)) + s.DeleteFrom(kInfoPanelLineSize - 1); return s; } @@ -447,9 +377,9 @@ static AString ConvertSizeToString(UInt64 value) { char s[32]; ConvertUInt64ToString(value, s); - int i = MyStringLen(s); - int pos = sizeof(s) / sizeof(s[0]); - s[--pos] = L'\0'; + unsigned i = MyStringLen(s); + unsigned pos = ARRAY_SIZE(s); + s[--pos] = 0; while (i > 3) { s[--pos] = s[--i]; @@ -476,7 +406,7 @@ static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID) } else if (prop.vt != VT_EMPTY) { - if (( + if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && ( propID == kpidSize || propID == kpidPackSize || propID == kpidNumSubDirs || @@ -484,11 +414,20 @@ static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID) propID == kpidNumBlocks || propID == kpidPhySize || propID == kpidHeadersSize || - propID == kpidClusterSize - ) && (prop.vt == VT_UI8 || prop.vt == VT_UI4)) - s = ConvertSizeToString(ConvertPropVariantToUInt64(prop)); + propID == kpidClusterSize || + propID == kpidUnpackSize + )) + { + UInt64 v = 0; + ConvertPropVariantToUInt64(prop, v); + s = ConvertSizeToString(v); + } else - s = UnicodeStringToMultiByte(ConvertPropertyToString(prop, propID), CP_OEMCP); + { + UString temp; + ConvertPropertyToString(temp, prop, propID); + s = UnicodeStringToMultiByte(temp, CP_OEMCP); + } } s.Replace((char)0xA, ' '); s.Replace((char)0xD, ' '); @@ -498,8 +437,8 @@ static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID) static AString PropToString2(const NCOM::CPropVariant &prop, PROPID propID) { AString s = PropToString(prop, propID); - if (s.Length() > (kInfoPanelLineSize - 1)) - s = s.Left(kInfoPanelLineSize - 1); + if (s.Len() > (kInfoPanelLineSize - 1)) + s.DeleteFrom(kInfoPanelLineSize - 1); return s; } @@ -523,8 +462,8 @@ static void InsertSeparator(InfoPanelLine *lines, int &numItems) if (numItems < kNumInfoLinesMax) { InfoPanelLine &item = lines[numItems++]; - MyStringCopy(item.Text, ""); - MyStringCopy(item.Data, ""); + *item.Text = 0; + *item.Data = 0; item.Separator = TRUE; } } @@ -546,7 +485,7 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info) UString name; { FString dirPrefix, fileName; - NFile::NDirectory::GetFullPathAndSplit(m_FileName, dirPrefix, fileName); + GetFullPathAndSplit(m_FileName, dirPrefix, fileName); name = fs2us(fileName); } @@ -566,7 +505,7 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info) info->PanelTitle = m_PannelTitleBuffer; memset(m_InfoLines, 0, sizeof(m_InfoLines)); - MyStringCopy(m_InfoLines[0].Text, ""); + m_InfoLines[0].Text[0] = 0; m_InfoLines[0].Separator = TRUE; MyStringCopy(m_InfoLines[1].Text, g_StartupInfo.GetMsgString(NMessageID::kArchiveType)); @@ -734,15 +673,15 @@ HRESULT CPlugin::ShowAttributesWindow() if (!g_StartupInfo.ControlGetActivePanelCurrentItemInfo(pluginPanelItem)) return S_FALSE; if (strcmp(pluginPanelItem.FindData.cFileName, "..") == 0 && - NFile::NFind::NAttributes::IsDir(pluginPanelItem.FindData.dwFileAttributes)) + NFind::NAttributes::IsDir(pluginPanelItem.FindData.dwFileAttributes)) return S_FALSE; int itemIndex = (int)pluginPanelItem.UserData; CObjectVector<CArchiveItemProperty> properties; UInt32 numProps; RINOK(_folder->GetNumberOfProperties(&numProps)); - int i; - for (i = 0; i < (int)numProps; i++) + unsigned i; + for (i = 0; i < numProps; i++) { CMyComBSTR name; PROPID propID; @@ -772,14 +711,9 @@ HRESULT CPlugin::ShowAttributesWindow() CInitDialogItem idi = { DI_TEXT, 5, 3 + i, 0, 0, false, false, 0, false, 0, NULL, NULL }; - int index = FindPropertyToName(property.ID); - if (index < 0) - { - idi.DataMessageId = -1; + idi.DataMessageId = FindPropNameID(property.ID); + if (idi.DataMessageId < 0) idi.DataString = property.Name; - } - else - idi.DataMessageId = kPROPIDToName[index].PluginID; initDialogItems.Add(idi); NCOM::CPropVariant prop; @@ -794,47 +728,43 @@ HRESULT CPlugin::ShowAttributesWindow() } } - int numLines = values.Size(); + unsigned numLines = values.Size(); for (i = 0; i < numLines; i++) { CInitDialogItem &idi = initDialogItems[1 + i * 2 + 1]; idi.DataString = values[i]; } - int numDialogItems = initDialogItems.Size(); + unsigned numDialogItems = initDialogItems.Size(); - CRecordVector<FarDialogItem> dialogItems; - dialogItems.Reserve(numDialogItems); - for (i = 0; i < numDialogItems; i++) - dialogItems.Add(FarDialogItem()); - g_StartupInfo.InitDialogItems(&initDialogItems.Front(), - &dialogItems.Front(), numDialogItems); + CObjArray<FarDialogItem> dialogItems(numDialogItems); + g_StartupInfo.InitDialogItems(&initDialogItems.Front(), dialogItems, numDialogItems); - int maxLen = 0; + unsigned maxLen = 0; for (i = 0; i < numLines; i++) { FarDialogItem &dialogItem = dialogItems[1 + i * 2]; - int len = (int)strlen(dialogItem.Data); + unsigned len = (unsigned)strlen(dialogItem.Data); if (len > maxLen) maxLen = len; } - int maxLen2 = 0; - const int kSpace = 10; + unsigned maxLen2 = 0; + const unsigned kSpace = 10; for (i = 0; i < numLines; i++) { FarDialogItem &dialogItem = dialogItems[1 + i * 2 + 1]; - int len = (int)strlen(dialogItem.Data); + unsigned len = (int)strlen(dialogItem.Data); if (len > maxLen2) maxLen2 = len; dialogItem.X1 = maxLen + kSpace; } size = numLines + 6; xSize = maxLen + kSpace + maxLen2 + 5; - FarDialogItem &firstDialogItem = dialogItems.Front(); + FarDialogItem &firstDialogItem = dialogItems[0]; firstDialogItem.Y2 = size - 2; firstDialogItem.X2 = xSize - 4; - /* int askCode = */ g_StartupInfo.ShowDialog(xSize, size, NULL, &dialogItems.Front(), numDialogItems); + /* int askCode = */ g_StartupInfo.ShowDialog(xSize, size, NULL, dialogItems, numDialogItems); return S_OK; } @@ -852,7 +782,7 @@ int CPlugin::ProcessKey(int key, unsigned int controlState) if ((controlState & PKF_ALT) != 0 && key == VK_F6) { FString folderPath; - if (!NFile::NDirectory::GetOnlyDirPrefix(m_FileName, folderPath)) + if (!GetOnlyDirPrefix(m_FileName, folderPath)) return FALSE; PanelInfo panelInfo; g_StartupInfo.ControlGetActivePanelInfo(panelInfo); diff --git a/CPP/7zip/UI/Far/Plugin.h b/CPP/7zip/UI/Far/Plugin.h index c4122c45..f01dc435 100755..100644 --- a/CPP/7zip/UI/Far/Plugin.h +++ b/CPP/7zip/UI/Far/Plugin.h @@ -3,11 +3,11 @@ #ifndef __7ZIP_FAR_PLUGIN_H #define __7ZIP_FAR_PLUGIN_H -#include "Common/MyCom.h" +#include "../../../Common/MyCom.h" -#include "Windows/COM.h" -#include "Windows/FileFind.h" -#include "Windows/PropVariant.h" +#include "../../../Windows/COM.h" +#include "../../../Windows/FileFind.h" +#include "../../../Windows/PropVariant.h" #include "../Common/WorkDir.h" @@ -37,7 +37,7 @@ class CPlugin void EnterToDirectory(const UString &dirName); void GetPathParts(UStringVector &pathParts); - void GetCurrentDir(); + void SetCurrentDirVar(); HRESULT AfterUpdate(CWorkDirTempFile &tempFile, const UStringVector &pathVector); public: FString m_FileName; diff --git a/CPP/7zip/UI/Far/PluginCommon.cpp b/CPP/7zip/UI/Far/PluginCommon.cpp index ce1a18bb..ce1a18bb 100755..100644 --- a/CPP/7zip/UI/Far/PluginCommon.cpp +++ b/CPP/7zip/UI/Far/PluginCommon.cpp diff --git a/CPP/7zip/UI/Far/PluginDelete.cpp b/CPP/7zip/UI/Far/PluginDelete.cpp index 3a3df300..1adf91a7 100755..100644 --- a/CPP/7zip/UI/Far/PluginDelete.cpp +++ b/CPP/7zip/UI/Far/PluginDelete.cpp @@ -2,9 +2,11 @@ #include "StdAfx.h" +#include <stdio.h> + #include "Messages.h" #include "Plugin.h" -#include "UpdateCallback100.h" +#include "UpdateCallbackFar.h" using namespace NFar; @@ -36,12 +38,10 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) } else if (numItems > 1) { - sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles), - numItems); + sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles), numItems); msgItems[1] = msg; } - if (g_StartupInfo.ShowMessage(FMSG_WARNING, NULL, msgItems, - sizeof(msgItems) / sizeof(msgItems[0]), 2) != 0) + if (g_StartupInfo.ShowMessage(FMSG_WARNING, NULL, msgItems, ARRAY_SIZE(msgItems), 2) != 0) return (FALSE); } @@ -62,11 +62,10 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) if (tempFile.CreateTempFile(m_FileName) != S_OK) return FALSE; - CRecordVector<UINT32> indices; - indices.Reserve(numItems); + CObjArray<UInt32> indices(numItems); int i; for (i = 0; i < numItems; i++) - indices.Add((UINT32)panelItems[i].UserData); + indices[i] = (UInt32)panelItems[i].UserData; //////////////////////////// // Save _folder; @@ -88,7 +87,7 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer); - result = outArchive->DeleteItems(tempFile.OutStream, &indices.Front(), indices.Size(), updateCallback); + result = outArchive->DeleteItems(tempFile.OutStream, indices, numItems, updateCallback); updateCallback.Release(); outArchive.Release(); @@ -101,6 +100,6 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) ShowErrorMessage(result); return FALSE; } - GetCurrentDir(); + SetCurrentDirVar(); return TRUE; } diff --git a/CPP/7zip/UI/Far/PluginRead.cpp b/CPP/7zip/UI/Far/PluginRead.cpp index a4450064..6e77a9d5 100755..100644 --- a/CPP/7zip/UI/Far/PluginRead.cpp +++ b/CPP/7zip/UI/Far/PluginRead.cpp @@ -6,19 +6,20 @@ #include "Messages.h" -#include "Common/StringConvert.h" +#include "../../../Common/StringConvert.h" -#include "Windows/FileName.h" -#include "Windows/FileFind.h" -#include "Windows/FileDir.h" -#include "Windows/Defs.h" +#include "../../../Windows/FileName.h" +#include "../../../Windows/FileFind.h" +#include "../../../Windows/FileDir.h" #include "../Common/ZipRegistry.h" #include "ExtractEngine.h" -using namespace NFar; using namespace NWindows; +using namespace NFile; +using namespace NDir; +using namespace NFar; static const char *kHelpTopicExtrFromSevenZip = "Extract"; @@ -28,8 +29,8 @@ static const char *kExractPathHistoryName = "7-ZipExtractPath"; HRESULT CPlugin::ExtractFiles( bool decompressAllItems, - const UINT32 *indices, - UINT32 numIndices, + const UInt32 *indices, + UInt32 numIndices, bool silent, NExtract::NPathMode::EEnum pathMode, NExtract::NOverwriteMode::EEnum overwriteMode, @@ -70,7 +71,10 @@ HRESULT CPlugin::ExtractFiles( CMyComPtr<IArchiveFolder> archiveFolder; _folder.QueryInterface(IID_IArchiveFolder, &archiveFolder); - return archiveFolder->Extract(indices, numIndices, pathMode, overwriteMode, + return archiveFolder->Extract(indices, numIndices, + BoolToInt(true), // includeAltStreams + BoolToInt(false), // replaceAltStreamChars + pathMode, overwriteMode, destPath, BoolToInt(false), extractCallback); } } @@ -93,14 +97,14 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa AString destPath = destPathLoc; UString destPathU = GetUnicodeString(destPath, CP_OEMCP); - NFile::NName::NormalizeDirPathPrefix(destPathU); + NName::NormalizeDirPathPrefix(destPathU); destPath = UnicodeStringToMultiByte(destPathU, CP_OEMCP); bool extractSelectedFiles = true; NExtract::CInfo extractionInfo; - extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames; - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt; + extractionInfo.PathMode = NExtract::NPathMode::kCurPaths; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kOverwrite; bool silent = (opMode & OPM_SILENT) != 0; bool decompressAllItems = false; @@ -134,30 +138,30 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa { DI_SINGLEBOX, 4, 5, kXMid - 2, 5 + 4, false, false, 0, false, NMessageID::kExtractPathMode, NULL, NULL }, { DI_RADIOBUTTON, 6, 6, 0, 0, false, - extractionInfo.PathMode == NExtract::NPathMode::kFullPathnames, + extractionInfo.PathMode == NExtract::NPathMode::kFullPaths, DIF_GROUP, false, NMessageID::kExtractPathFull, NULL, NULL }, { DI_RADIOBUTTON, 6, 7, 0, 0, false, - extractionInfo.PathMode == NExtract::NPathMode::kCurrentPathnames, + extractionInfo.PathMode == NExtract::NPathMode::kCurPaths, 0, false, NMessageID::kExtractPathCurrent, NULL, NULL }, { DI_RADIOBUTTON, 6, 8, 0, 0, false, - extractionInfo.PathMode == NExtract::NPathMode::kNoPathnames, + extractionInfo.PathMode == NExtract::NPathMode::kNoPaths, false, 0, NMessageID::kExtractPathNo, NULL, NULL }, { DI_SINGLEBOX, kXMid, 5, kXSize - 6, 5 + kNumOverwriteOptions, false, false, 0, false, NMessageID::kExtractOwerwriteMode, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAskBefore, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAsk, DIF_GROUP, false, NMessageID::kExtractOwerwriteAsk, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kWithoutPrompt, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kOverwrite, 0, false, NMessageID::kExtractOwerwritePrompt, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkipExisting, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkip, 0, false, NMessageID::kExtractOwerwriteSkip, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 9, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRename, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kRename, 0, false, NMessageID::kExtractOwerwriteAutoRename, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false, - extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting, + extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kRenameExisting, 0, false, NMessageID::kExtractOwerwriteAutoRenameExisting, NULL, NULL }, { DI_SINGLEBOX, 4, 10, kXMid- 2, 10 + 3, false, false, 0, false, NMessageID::kExtractFilesMode, NULL, NULL }, @@ -174,7 +178,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kExtractCancel, NULL, NULL } }; - const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); + const int kNumDialogItems = ARRAY_SIZE(initItems); const int kOkButtonIndex = kNumDialogItems - 2; const int kPasswordIndex = kNumDialogItems - 4; @@ -195,9 +199,9 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa destPathU = L"\\"; #else FString destPathF = us2fs(destPathU); - if (!NFile::NDirectory::MyGetCurrentDirectory(destPathF)) + if (!GetCurrentDir(destPathF)) throw 318016; - NFile::NName::NormalizeDirPathPrefix(destPathF); + NName::NormalizeDirPathPrefix(destPathF); destPathU = fs2us(destPathF); #endif break; @@ -211,24 +215,24 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa } if (dialogItems[kPathModeRadioIndex].Selected) - extractionInfo.PathMode = NExtract::NPathMode::kFullPathnames; + extractionInfo.PathMode = NExtract::NPathMode::kFullPaths; else if (dialogItems[kPathModeRadioIndex + 1].Selected) - extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames; + extractionInfo.PathMode = NExtract::NPathMode::kCurPaths; else if (dialogItems[kPathModeRadioIndex + 2].Selected) - extractionInfo.PathMode = NExtract::NPathMode::kNoPathnames; + extractionInfo.PathMode = NExtract::NPathMode::kNoPaths; else throw 31806; if (dialogItems[kOverwriteModeRadioIndex].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAskBefore; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAsk; else if (dialogItems[kOverwriteModeRadioIndex + 1].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kOverwrite; else if (dialogItems[kOverwriteModeRadioIndex + 2].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkipExisting; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkip; else if (dialogItems[kOverwriteModeRadioIndex + 3].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRename; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kRename; else if (dialogItems[kOverwriteModeRadioIndex + 4].Selected) - extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRenameExisting; + extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kRenameExisting; else throw 31806; @@ -253,19 +257,18 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa passwordIsDefined = !password.IsEmpty(); } - NFile::NDirectory::CreateComplexDirectory(us2fs(destPathU)); + CreateComplexDir(us2fs(destPathU)); /* vector<int> realIndices; if (!decompressAllItems) GetRealIndexes(panelItems, itemsNumber, realIndices); */ - CRecordVector<UINT32> indices; - indices.Reserve(itemsNumber); + CObjArray<UInt32> indices(itemsNumber); for (int i = 0; i < itemsNumber; i++) - indices.Add((UINT32)panelItems[i].UserData); + indices[i] = (UInt32)panelItems[i].UserData; - HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber, + HRESULT result = ExtractFiles(decompressAllItems, indices, itemsNumber, !showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode, destPathU, passwordIsDefined, password); diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp index e02f4d80..e36f3911 100755..100644 --- a/CPP/7zip/UI/Far/PluginWrite.cpp +++ b/CPP/7zip/UI/Far/PluginWrite.cpp @@ -2,13 +2,15 @@ #include "StdAfx.h" +#include <stdio.h> + #include "Plugin.h" -#include "Common/Wildcard.h" -#include "Common/StringConvert.h" +#include "../../../Common/StringConvert.h" +#include "../../../Common/Wildcard.h" -#include "Windows/FileName.h" -#include "Windows/FileFind.h" +#include "../../../Windows/FileName.h" +#include "../../../Windows/FileFind.h" #include "../Common/ZipRegistry.h" @@ -16,11 +18,11 @@ #include "ProgressBox.h" #include "Messages.h" -#include "UpdateCallback100.h" +#include "UpdateCallbackFar.h" using namespace NWindows; using namespace NFile; -using namespace NDirectory; +using namespace NDir; using namespace NFar; using namespace NUpdateArchive; @@ -29,9 +31,9 @@ static const char *kHelpTopic = "Update"; static const char *kArchiveHistoryKeyName = "7-ZipArcName"; -static const UINT32 g_MethodMap[] = { 0, 1, 3, 5, 7, 9 }; +static const UInt32 g_MethodMap[] = { 0, 1, 3, 5, 7, 9 }; -static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method) +static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UInt32 method) { CMyComPtr<ISetProperties> setProperties; if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK) @@ -40,7 +42,7 @@ static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method) realNames.Add(UString(L"x")); NCOM::CPropVariant value = (UInt32)method; CRecordVector<const wchar_t *> names; - for (int i = 0; i < realNames.Size(); i++) + FOR_VECTOR (i, realNames) names.Add(realNames[i]); RINOK(setProperties->SetProperties(&names.Front(), &value, names.Size())); } @@ -57,7 +59,7 @@ HRESULT CPlugin::AfterUpdate(CWorkDirTempFile &tempFile, const UStringVector &pa RINOK(m_ArchiveHandler->ReOpen(NULL)); // check it m_ArchiveHandler->BindToRootFolder(&_folder); - for (int i = 0; i < pathVector.Size(); i++) + FOR_VECTOR (i, pathVector) { CMyComPtr<IFolderFolder> newFolder; _folder->BindToFolder(pathVector[i], &newFolder); @@ -96,7 +98,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( int methodIndex = 0; int i; - for (i = sizeof(g_MethodMap) / sizeof(g_MethodMap[0]) - 1; i >= 0; i--) + for (i = ARRAY_SIZE(g_MethodMap) - 1; i >= 0; i--) if (compressionInfo.Level >= g_MethodMap[i]) { methodIndex = i; @@ -108,29 +110,22 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( struct CInitDialogItem initItems[]={ { DI_DOUBLEBOX, 3, 1, 72, kYSize - 2, false, false, 0, false, NMessageID::kUpdateTitle, NULL, NULL }, + { DI_SINGLEBOX, 4, 2, kXMid - 2, 2 + 7, false, false, 0, false, NMessageID::kUpdateMethod, NULL, NULL }, - { DI_RADIOBUTTON, 6, 3, 0, 0, methodIndex == 0, methodIndex == 0, - DIF_GROUP, false, NMessageID::kUpdateMethodStore, NULL, NULL }, - { DI_RADIOBUTTON, 6, 4, 0, 0, methodIndex == 1, methodIndex == 1, - 0, false, NMessageID::kUpdateMethodFastest, NULL, NULL }, - { DI_RADIOBUTTON, 6, 5, 0, 0, methodIndex == 2, methodIndex == 2, - 0, false, NMessageID::kUpdateMethodFast, NULL, NULL }, - { DI_RADIOBUTTON, 6, 6, 0, 0, methodIndex == 3, methodIndex == 3, - 0, false, NMessageID::kUpdateMethodNormal, NULL, NULL }, - { DI_RADIOBUTTON, 6, 7, 0, 0, methodIndex == 4, methodIndex == 4, - 0, false, NMessageID::kUpdateMethodMaximum, NULL, NULL }, - { DI_RADIOBUTTON, 6, 8, 0, 0, methodIndex == 5, methodIndex == 5, - 0, false, NMessageID::kUpdateMethodUltra, NULL, NULL }, + + { DI_RADIOBUTTON, 6, 3, 0, 0, methodIndex == 0, methodIndex == 0, DIF_GROUP, false, NMessageID::kUpdateMethod_Store, NULL, NULL }, + { DI_RADIOBUTTON, 6, 4, 0, 0, methodIndex == 1, methodIndex == 1, 0, false, NMessageID::kUpdateMethod_Fastest, NULL, NULL }, + { DI_RADIOBUTTON, 6, 5, 0, 0, methodIndex == 2, methodIndex == 2, 0, false, NMessageID::kUpdateMethod_Fast, NULL, NULL }, + { DI_RADIOBUTTON, 6, 6, 0, 0, methodIndex == 3, methodIndex == 3, 0, false, NMessageID::kUpdateMethod_Normal, NULL, NULL }, + { DI_RADIOBUTTON, 6, 7, 0, 0, methodIndex == 4, methodIndex == 4, 0, false, NMessageID::kUpdateMethod_Maximum, NULL, NULL }, + { DI_RADIOBUTTON, 6, 8, 0, 0, methodIndex == 5, methodIndex == 5, 0, false, NMessageID::kUpdateMethod_Ultra, NULL, NULL }, { DI_SINGLEBOX, kXMid, 2, 70, 2 + 5, false, false, 0, false, NMessageID::kUpdateMode, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 3, 0, 0, false, true, - DIF_GROUP, false, NMessageID::kUpdateModeAdd, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 4, 0, 0, false, false, - 0, false, NMessageID::kUpdateModeUpdate, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false, false, - 0, false, NMessageID::kUpdateModeFreshen, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, false, - 0, false, NMessageID::kUpdateModeSynchronize, NULL, NULL }, + + { DI_RADIOBUTTON, kXMid + 2, 3, 0, 0, false, true, DIF_GROUP, false, NMessageID::kUpdateMode_Add, NULL, NULL }, + { DI_RADIOBUTTON, kXMid + 2, 4, 0, 0, false, false, 0, false, NMessageID::kUpdateMode_Update, NULL, NULL }, + { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false, false, 0, false, NMessageID::kUpdateMode_Fresh, NULL, NULL }, + { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, false, 0, false, NMessageID::kUpdateMode_Sync, NULL, NULL }, { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL }, @@ -138,7 +133,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kCancel, NULL, NULL } }; - const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); + const int kNumDialogItems = ARRAY_SIZE(initItems); const int kOkButtonIndex = kNumDialogItems - 2; FarDialogItem dialogItems[kNumDialogItems]; g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems); @@ -148,22 +143,17 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( return NFileOperationReturnCode::kInterruptedByUser; compressionInfo.Level = g_MethodMap[0]; - for (i = 0; i < sizeof(g_MethodMap)/ sizeof(g_MethodMap[0]); i++) + for (i = 0; i < ARRAY_SIZE(g_MethodMap); i++) if (dialogItems[kMethodRadioIndex + i].Selected) compressionInfo.Level = g_MethodMap[i]; const CActionSet *actionSet; - if (dialogItems[kModeRadioIndex].Selected) - actionSet = &kAddActionSet; - else if (dialogItems[kModeRadioIndex + 1].Selected) - actionSet = &kUpdateActionSet; - else if (dialogItems[kModeRadioIndex + 2].Selected) - actionSet = &kFreshActionSet; - else if (dialogItems[kModeRadioIndex + 3].Selected) - actionSet = &kSynchronizeActionSet; - else - throw 51751; + if (dialogItems[kModeRadioIndex ].Selected) actionSet = &k_ActionSet_Add; + else if (dialogItems[kModeRadioIndex + 1].Selected) actionSet = &k_ActionSet_Update; + else if (dialogItems[kModeRadioIndex + 2].Selected) actionSet = &k_ActionSet_Fresh; + else if (dialogItems[kModeRadioIndex + 3].Selected) actionSet = &k_ActionSet_Sync; + else throw 51751; compressionInfo.Save(); @@ -201,13 +191,12 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( GetPathParts(pathVector); UStringVector fileNames; - fileNames.Reserve(numItems); + fileNames.ClearAndReserve(numItems); for (i = 0; i < numItems; i++) - fileNames.Add(MultiByteToUnicodeString(panelItems[i].FindData.cFileName, CP_OEMCP)); - CRecordVector<const wchar_t *> fileNamePointers; - fileNamePointers.Reserve(numItems); + fileNames.AddInReserved(MultiByteToUnicodeString(panelItems[i].FindData.cFileName, CP_OEMCP)); + CObjArray<const wchar_t *> fileNamePointers(numItems); for (i = 0; i < numItems; i++) - fileNamePointers.Add(fileNames[i]); + fileNamePointers[i] = fileNames[i]; CMyComPtr<IOutFolderArchive> outArchive; HRESULT result = m_ArchiveHandler.QueryInterface(IID_IOutFolderArchive, &outArchive); @@ -218,7 +207,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( } outArchive->SetFolder(_folder); - outArchive->SetFiles(L"", &fileNamePointers.Front(), fileNamePointers.Size()); + outArchive->SetFiles(L"", fileNamePointers, numItems); BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues]; for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++) actionSetByte[i] = (BYTE)actionSet->StateActions[i]; @@ -231,7 +220,12 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK) return NFileOperationReturnCode::kError; - result = outArchive->DoOperation2(tempFile.OutStream, actionSetByte, NULL, updateCallback); + // FStringVector requestedPaths; + // FStringVector processedPaths; + result = outArchive->DoOperation2( + // &requestedPaths, &processedPaths, + NULL, NULL, + tempFile.OutStream, actionSetByte, NULL, updateCallback); updateCallback.Release(); outArchive.Release(); @@ -289,7 +283,7 @@ namespace NPathType { EEnum GetPathType(const UString &path) { - if (path.Length() <= 2) + if (path.Len() <= 2) return kLocal; if (path[0] == kDirDelimiter && path[1] == kDirDelimiter) return kUNC; @@ -308,7 +302,7 @@ void CParsedPath::ParsePath(const UString &path) if (posDiskDelimiter >= 0) { curPos = posDiskDelimiter + 1; - if (path.Length() > curPos) + if ((int)path.Len() > curPos) if (path[curPos] == kDirDelimiter) curPos++; } @@ -316,21 +310,22 @@ void CParsedPath::ParsePath(const UString &path) } case NPathType::kUNC: { - int curPos = path.Find(kDirDelimiter, 2); + // the bug was fixed: + curPos = path.Find(kDirDelimiter, 2); if (curPos < 0) - curPos = path.Length(); + curPos = path.Len(); else curPos++; } } Prefix = path.Left(curPos); - SplitPathToParts(path.Mid(curPos), PathParts); + SplitPathToParts(path.Ptr(curPos), PathParts); } UString CParsedPath::MergePath() const { UString result = Prefix; - for (int i = 0; i < PathParts.Size(); i++) + FOR_VECTOR (i, PathParts) { if (i != 0) result += kDirDelimiter; @@ -352,21 +347,22 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) return E_FAIL; UStringVector fileNames; - int i; - for (i = 0; i < pluginPanelItems.Size(); i++) { - const PluginPanelItem &panelItem = pluginPanelItems[i]; - if (strcmp(panelItem.FindData.cFileName, "..") == 0 && - NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes)) - return E_FAIL; - if (strcmp(panelItem.FindData.cFileName, ".") == 0 && - NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes)) - return E_FAIL; - FString fullPath; - FString fileNameUnicode = us2fs(MultiByteToUnicodeString(panelItem.FindData.cFileName, CP_OEMCP)); - if (!MyGetFullPathName(fileNameUnicode, fullPath)) - return E_FAIL; - fileNames.Add(fs2us(fullPath)); + FOR_VECTOR (i, pluginPanelItems) + { + const PluginPanelItem &panelItem = pluginPanelItems[i]; + if (strcmp(panelItem.FindData.cFileName, "..") == 0 && + NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes)) + return E_FAIL; + if (strcmp(panelItem.FindData.cFileName, ".") == 0 && + NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes)) + return E_FAIL; + FString fullPath; + FString fileNameUnicode = us2fs(MultiByteToUnicodeString(panelItem.FindData.cFileName, CP_OEMCP)); + if (!MyGetFullPathName(fileNameUnicode, fullPath)) + return E_FAIL; + fileNames.Add(fs2us(fullPath)); + } } NCompression::CInfo compressionInfo; @@ -379,14 +375,14 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) if (codecs->Load() != S_OK) throw "Can't load 7-Zip codecs"; { - for (int i = 0; i < codecs->Formats.Size(); i++) + FOR_VECTOR (i, codecs->Formats) { const CArcInfoEx &arcInfo = codecs->Formats[i]; if (arcInfo.UpdateEnabled) { if (archiverIndex == -1) archiverIndex = i; - if (arcInfo.Name.CompareNoCase(compressionInfo.ArcType) == 0) + if (MyStringCompareNoCase(arcInfo.Name, compressionInfo.ArcType) == 0) archiverIndex = i; } } @@ -416,7 +412,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex]; int prevFormat = archiverIndex; - if (!arcInfo.KeepName) + if (!arcInfo.Flags_KeepName()) { int dotPos = archiveName.ReverseFind('.'); int slashPos = MyMax(archiveName.ReverseFind('\\'), archiveName.ReverseFind('/')); @@ -426,7 +422,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) archiveName += L'.'; archiveName += arcInfo.GetMainExt(); - const CActionSet *actionSet = &kAddActionSet; + const CActionSet *actionSet = &k_ActionSet_Add; for (;;) { @@ -448,7 +444,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) int methodIndex = 0; int i; - for (i = sizeof(g_MethodMap) / sizeof(g_MethodMap[0]) - 1; i >= 0; i--) + for (i = ARRAY_SIZE(g_MethodMap) - 1; i >= 0; i--) if (compressionInfo.Level >= g_MethodMap[i]) { methodIndex = i; @@ -465,32 +461,20 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) // { DI_EDIT, 5, 3, 70, 3, true, false, 0, false, -1, archiveName, NULL}, { DI_SINGLEBOX, 4, 4, kXMid - 2, 4 + 7, false, false, 0, false, NMessageID::kUpdateMethod, NULL, NULL }, - { DI_RADIOBUTTON, 6, 5, 0, 0, false, methodIndex == 0, - DIF_GROUP, false, NMessageID::kUpdateMethodStore, NULL, NULL }, - { DI_RADIOBUTTON, 6, 6, 0, 0, false, methodIndex == 1, - 0, false, NMessageID::kUpdateMethodFastest, NULL, NULL }, - { DI_RADIOBUTTON, 6, 7, 0, 0, false, methodIndex == 2, - 0, false, NMessageID::kUpdateMethodFast, NULL, NULL }, - { DI_RADIOBUTTON, 6, 8, 0, 0, false, methodIndex == 3, - 0, false, NMessageID::kUpdateMethodNormal, NULL, NULL }, - { DI_RADIOBUTTON, 6, 9, 0, 0, false, methodIndex == 4, - false, 0, NMessageID::kUpdateMethodMaximum, NULL, NULL }, - { DI_RADIOBUTTON, 6, 10, 0, 0, false, methodIndex == 5, - false, 0, NMessageID::kUpdateMethodUltra, NULL, NULL }, + + { DI_RADIOBUTTON, 6, 5, 0, 0, false, methodIndex == 0, DIF_GROUP, false, NMessageID::kUpdateMethod_Store, NULL, NULL }, + { DI_RADIOBUTTON, 6, 6, 0, 0, false, methodIndex == 1, 0, false, NMessageID::kUpdateMethod_Fastest, NULL, NULL }, + { DI_RADIOBUTTON, 6, 7, 0, 0, false, methodIndex == 2, 0, false, NMessageID::kUpdateMethod_Fast, NULL, NULL }, + { DI_RADIOBUTTON, 6, 8, 0, 0, false, methodIndex == 3, 0, false, NMessageID::kUpdateMethod_Normal, NULL, NULL }, + { DI_RADIOBUTTON, 6, 9, 0, 0, false, methodIndex == 4, 0, false, NMessageID::kUpdateMethod_Maximum, NULL, NULL }, + { DI_RADIOBUTTON, 6,10, 0, 0, false, methodIndex == 5, 0, false, NMessageID::kUpdateMethod_Ultra, NULL, NULL }, { DI_SINGLEBOX, kXMid, 4, 70, 4 + 5, false, false, 0, false, NMessageID::kUpdateMode, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false, - actionSet == &kAddActionSet, - DIF_GROUP, false, NMessageID::kUpdateModeAdd, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, - actionSet == &kUpdateActionSet, - 0, false, NMessageID::kUpdateModeUpdate, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false, - actionSet == &kFreshActionSet, - 0, false, NMessageID::kUpdateModeFreshen, NULL, NULL }, - { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false, - actionSet == &kSynchronizeActionSet, - 0, false, NMessageID::kUpdateModeSynchronize, NULL, NULL }, + + { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false, actionSet == &k_ActionSet_Add, DIF_GROUP, false, NMessageID::kUpdateMode_Add, NULL, NULL }, + { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, actionSet == &k_ActionSet_Update, 0, false, NMessageID::kUpdateMode_Update, NULL, NULL }, + { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false, actionSet == &k_ActionSet_Fresh, 0, false, NMessageID::kUpdateMode_Fresh, NULL, NULL }, + { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false, actionSet == &k_ActionSet_Sync, 0, false, NMessageID::kUpdateMode_Sync, NULL, NULL }, { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL }, @@ -499,7 +483,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kCancel, NULL, NULL } }; - const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); + const int kNumDialogItems = ARRAY_SIZE(initItems); const int kOkButtonIndex = kNumDialogItems - 3; const int kSelectarchiverButtonIndex = kNumDialogItems - 2; @@ -514,26 +498,21 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) archiveName = MultiByteToUnicodeString(archiveNameA, CP_OEMCP); compressionInfo.Level = g_MethodMap[0]; - for (i = 0; i < sizeof(g_MethodMap)/ sizeof(g_MethodMap[0]); i++) + for (i = 0; i < ARRAY_SIZE(g_MethodMap); i++) if (dialogItems[kMethodRadioIndex + i].Selected) compressionInfo.Level = g_MethodMap[i]; - if (dialogItems[kModeRadioIndex].Selected) - actionSet = &kAddActionSet; - else if (dialogItems[kModeRadioIndex + 1].Selected) - actionSet = &kUpdateActionSet; - else if (dialogItems[kModeRadioIndex + 2].Selected) - actionSet = &kFreshActionSet; - else if (dialogItems[kModeRadioIndex + 3].Selected) - actionSet = &kSynchronizeActionSet; - else - throw 51751; + if (dialogItems[kModeRadioIndex ].Selected) actionSet = &k_ActionSet_Add; + else if (dialogItems[kModeRadioIndex + 1].Selected) actionSet = &k_ActionSet_Update; + else if (dialogItems[kModeRadioIndex + 2].Selected) actionSet = &k_ActionSet_Fresh; + else if (dialogItems[kModeRadioIndex + 3].Selected) actionSet = &k_ActionSet_Sync; + else throw 51751; if (askCode == kSelectarchiverButtonIndex) { CIntVector indices; CSysStringVector archiverNames; - for (int i = 0; i < codecs->Formats.Size(); i++) + FOR_VECTOR (i, codecs->Formats) { const CArcInfoEx &arc = codecs->Formats[i]; if (arc.UpdateEnabled) @@ -549,13 +528,14 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) if (index >= 0) { const CArcInfoEx &prevArchiverInfo = codecs->Formats[prevFormat]; - if (prevArchiverInfo.KeepName) + if (prevArchiverInfo.Flags_KeepName()) { const UString &prevExtension = prevArchiverInfo.GetMainExt(); - const int prevExtensionLen = prevExtension.Length(); - if (archiveName.Right(prevExtensionLen).CompareNoCase(prevExtension) == 0) + const unsigned prevExtensionLen = prevExtension.Len(); + if (archiveName.Len() >= prevExtensionLen && + MyStringCompareNoCase(archiveName.RightPtr(prevExtensionLen), prevExtension) == 0) { - int pos = archiveName.Length() - prevExtensionLen; + int pos = archiveName.Len() - prevExtensionLen; if (pos > 1) { int dotPos = archiveName.ReverseFind('.'); @@ -569,7 +549,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex]; prevFormat = archiverIndex; - if (arcInfo.KeepName) + if (arcInfo.Flags_KeepName()) archiveName = archiveNameSrc; else { @@ -636,7 +616,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) &archiveType, NULL)); - if (archiverInfoFinal.Name.CompareNoCase((const wchar_t *)archiveType) != 0) + if (MyStringCompareNoCase(archiverInfoFinal.Name, (const wchar_t *)archiveType) != 0) throw "Type of existing archive differs from specified type"; HRESULT result = archiveHandler.QueryInterface( IID_IOutFolderArchive, &outArchive); @@ -662,13 +642,14 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) */ } - CRecordVector<const wchar_t *> fileNamePointers; - fileNamePointers.Reserve(fileNames.Size()); + CObjArray<const wchar_t *> fileNamePointers(fileNames.Size()); + + unsigned i; for (i = 0; i < fileNames.Size(); i++) - fileNamePointers.Add(fileNames[i]); + fileNamePointers[i] = fileNames[i]; outArchive->SetFolder(NULL); - outArchive->SetFiles(L"", &fileNamePointers.Front(), fileNamePointers.Size()); + outArchive->SetFiles(L"", fileNamePointers, fileNames.Size()); BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues]; for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++) actionSetByte[i] = (BYTE)actionSet->StateActions[i]; @@ -681,7 +662,11 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) RINOK(SetOutProperties(outArchive, compressionInfo.Level)); + // FStringVector requestedPaths; + // FStringVector processedPaths; HRESULT result = outArchive->DoOperation( + // &requestedPaths, &processedPaths, + NULL, NULL, codecs, archiverIndex, tempFile.OutStream, actionSetByte, NULL, updateCallback); @@ -698,10 +683,12 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) { archiveHandler->Close(); } - if (!tempFile.MoveToOriginal(archiveHandler != NULL)) + + result = tempFile.MoveToOriginal(archiveHandler != NULL); + if (result != S_OK) { - ShowLastErrorMessage(); - return E_FAIL; + ShowErrorMessage(result); + return result; } return S_OK; } diff --git a/CPP/7zip/UI/Far/ProgressBox.cpp b/CPP/7zip/UI/Far/ProgressBox.cpp index b13b0b51..3ad0560a 100755..100644 --- a/CPP/7zip/UI/Far/ProgressBox.cpp +++ b/CPP/7zip/UI/Far/ProgressBox.cpp @@ -4,9 +4,10 @@ #include <stdio.h> -#include "ProgressBox.h" -#include "Common/IntToString.h" +#include "../../../Common/IntToString.h" + #include "FarUtils.h" +#include "ProgressBox.h" static void CopySpaces(char *dest, int numSpaces) { @@ -106,7 +107,7 @@ void CProgressBox::Progress(const UInt64 *total, const UInt64 *completed, const _prevMessage = message; _prevPercentMessage = percentMessage; const char *strings[] = { message, percentMessage }; - ShowMessages(strings, sizeof(strings) / sizeof(strings[0])); + ShowMessages(strings, ARRAY_SIZE(strings)); _wasShown = true; } } diff --git a/CPP/7zip/UI/Far/ProgressBox.h b/CPP/7zip/UI/Far/ProgressBox.h index 2bada8e9..9c26763d 100755..100644 --- a/CPP/7zip/UI/Far/ProgressBox.h +++ b/CPP/7zip/UI/Far/ProgressBox.h @@ -1,10 +1,10 @@ // ProgressBox.h -#ifndef __PROGRESSBOX_H -#define __PROGRESSBOX_H +#ifndef __PROGRESS_BOX_H +#define __PROGRESS_BOX_H -#include "Common/MyString.h" -#include "Common/Types.h" +#include "../../../Common/MyString.h" +#include "../../../Common/MyTypes.h" void ConvertUInt64ToStringAligned(UInt64 value, char *s, int alignSize); diff --git a/CPP/7zip/UI/Far/StdAfx.cpp b/CPP/7zip/UI/Far/StdAfx.cpp index d0feea85..d0feea85 100755..100644 --- a/CPP/7zip/UI/Far/StdAfx.cpp +++ b/CPP/7zip/UI/Far/StdAfx.cpp diff --git a/CPP/7zip/UI/Far/StdAfx.h b/CPP/7zip/UI/Far/StdAfx.h index ae0e328a..3bff655e 100755..100644 --- a/CPP/7zip/UI/Far/StdAfx.h +++ b/CPP/7zip/UI/Far/StdAfx.h @@ -3,11 +3,11 @@ #ifndef __STDAFX_H #define __STDAFX_H -#define _CRT_SECURE_NO_DEPRECATE -#include <windows.h> -#include <stdio.h> +// #define _CRT_SECURE_NO_DEPRECATE +// #include <windows.h> +// #include <stdio.h> -#include "Common/NewHandler.h" +#include "../../../Common/Common.h" #endif diff --git a/CPP/7zip/UI/Far/UpdateCallback100.cpp b/CPP/7zip/UI/Far/UpdateCallbackFar.cpp index 0785f55b..f2877888 100755..100644 --- a/CPP/7zip/UI/Far/UpdateCallback100.cpp +++ b/CPP/7zip/UI/Far/UpdateCallbackFar.cpp @@ -1,12 +1,11 @@ -// UpdateCallback.h +// UpdateCallbackFar.cpp #include "StdAfx.h" -#include "UpdateCallback100.h" +#include "../../../Common/StringConvert.h" -#include "Common/Defs.h" -#include "Common/StringConvert.h" #include "FarUtils.h" +#include "UpdateCallbackFar.h" using namespace NFar; diff --git a/CPP/7zip/UI/Far/UpdateCallback100.h b/CPP/7zip/UI/Far/UpdateCallbackFar.h index bfe8419a..b2980f21 100755..100644 --- a/CPP/7zip/UI/Far/UpdateCallback100.h +++ b/CPP/7zip/UI/Far/UpdateCallbackFar.h @@ -1,14 +1,14 @@ -// UpdateCallback.h +// UpdateCallbackFar.h -#ifndef __UPDATE_CALLBACK_H -#define __UPDATE_CALLBACK_H +#ifndef __UPDATE_CALLBACK_FAR_H +#define __UPDATE_CALLBACK_FAR_H -#include "Common/MyCom.h" - -#include "../Agent/IFolderArchive.h" +#include "../../../Common/MyCom.h" #include "../../IPassword.h" +#include "../Agent/IFolderArchive.h" + #include "ProgressBox.h" class CUpdateCallback100Imp: diff --git a/CPP/7zip/UI/Far/makefile b/CPP/7zip/UI/Far/makefile index 0d6f8d68..2c32d533 100755..100644 --- a/CPP/7zip/UI/Far/makefile +++ b/CPP/7zip/UI/Far/makefile @@ -1,24 +1,24 @@ PROG = 7-ZipFar.dll DEF_FILE = Far.def -CFLAGS = $(CFLAGS) -I ../../../ \ +CFLAGS = $(CFLAGS) \ -DEXTERNAL_CODECS !IFNDEF UNDER_CE CFLAGS = $(CFLAGS) -DWIN_LONG_PATH !ENDIF -FAR_OBJS = \ +CURRENT_OBJS = \ $O\ExtractEngine.obj \ $O\FarUtils.obj \ - $O\Main.obj \ - $O\OverwriteDialog.obj \ + $O\Far.obj \ + $O\OverwriteDialogFar.obj \ $O\Plugin.obj \ $O\PluginCommon.obj \ $O\PluginDelete.obj \ $O\PluginRead.obj \ $O\PluginWrite.obj \ $O\ProgressBox.obj \ - $O\UpdateCallback100.obj \ + $O\UpdateCallbackFar.obj \ COMMON_OBJS = \ $O\IntToString.obj \ @@ -31,22 +31,27 @@ COMMON_OBJS = \ WIN_OBJS = \ $O\DLL.obj \ - $O\Error.obj \ + $O\ErrorMsg.obj \ $O\FileDir.obj \ $O\FileFind.obj \ $O\FileIO.obj \ + $O\FileLink.obj \ $O\FileName.obj \ $O\PropVariant.obj \ - $O\PropVariantConversions.obj \ + $O\PropVariantConv.obj \ $O\Registry.obj \ $O\Synchronization.obj \ - $O\Time.obj \ + $O\TimeUtils.obj \ 7ZIP_COMMON_OBJS = \ $O\FilePathAutoRename.obj \ $O\FileStreams.obj \ + $O\LimitedStreams.obj \ $O\ProgressUtils.obj \ + $O\PropId.obj \ + $O\StreamObjects.obj \ $O\StreamUtils.obj \ + $O\UniqBlocks.obj \ UI_COMMON_OBJS = \ $O\ArchiveExtractCallback.obj \ @@ -57,6 +62,7 @@ UI_COMMON_OBJS = \ $O\LoadCodecs.obj \ $O\OpenArchive.obj \ $O\PropIDUtils.obj \ + $O\SetProperties.obj \ $O\SortUtils.obj \ $O\UpdateAction.obj \ $O\UpdateCallback.obj \ @@ -74,6 +80,9 @@ AGENT_OBJS = \ $O\AgentProxy.obj \ $O\UpdateCallbackAgent.obj \ +COMPRESS_OBJS = \ + $O\CopyCoder.obj \ + C_OBJS = \ $O\Alloc.obj \ $O\CpuArch.obj \ @@ -82,38 +91,4 @@ C_OBJS = \ !include "../../Crc.mak" -OBJS = \ - $O\StdAfx.obj \ - $(FAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(UI_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(AGENT_OBJS) \ - $O\CopyCoder.obj \ - $(C_OBJS) \ - $(ASM_OBJS) \ - $O\resource.res - -!include "../../../Build.mak" - -$(FAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(UI_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp - $(COMPL) -$(AGENT_OBJS): ../Agent/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/$(*B).cpp - $(COMPL) -$(C_OBJS): ../../../../C/$(*B).c - $(COMPL_O2) -!include "../../Asm.mak" +!include "../../7zip.mak" diff --git a/CPP/7zip/UI/Far/resource.rc b/CPP/7zip/UI/Far/resource.rc index a5c2e2f3..a5c2e2f3 100755..100644 --- a/CPP/7zip/UI/Far/resource.rc +++ b/CPP/7zip/UI/Far/resource.rc |