diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2021-07-23 01:00:14 +0300 |
---|---|---|
committer | Kornel <kornel@geekhood.net> | 2021-07-23 01:00:14 +0300 |
commit | 585698650f7257d2cefa6a3a2a49d5bbe84fd9b2 (patch) | |
tree | 8900be42e892a440bbd1063804b0557288c2f97f /CPP/7zip/UI/Far | |
parent | 4a960640a340a848a2d2c27f19b339c2c3d3f734 (diff) |
21.0221.02
Diffstat (limited to 'CPP/7zip/UI/Far')
-rw-r--r-- | CPP/7zip/UI/Far/ExtractEngine.cpp | 1 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/Far.cpp | 6 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/Far.dsp | 4 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/OverwriteDialogFar.cpp | 2 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/Plugin.cpp | 8 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/PluginDelete.cpp | 34 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/PluginWrite.cpp | 35 | ||||
-rw-r--r-- | CPP/7zip/UI/Far/makefile | 2 |
8 files changed, 68 insertions, 24 deletions
diff --git a/CPP/7zip/UI/Far/ExtractEngine.cpp b/CPP/7zip/UI/Far/ExtractEngine.cpp index 3567c048..e6fe2d01 100644 --- a/CPP/7zip/UI/Far/ExtractEngine.cpp +++ b/CPP/7zip/UI/Far/ExtractEngine.cpp @@ -167,6 +167,7 @@ STDMETHODIMP CExtractCallbackImp::MessageError(const wchar_t *message) return CheckBreak2(); } +void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, AString &s); void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, AString &s) { s.Empty(); diff --git a/CPP/7zip/UI/Far/Far.cpp b/CPP/7zip/UI/Far/Far.cpp index 5d92bc40..a9e47916 100644 --- a/CPP/7zip/UI/Far/Far.cpp +++ b/CPP/7zip/UI/Far/Far.cpp @@ -3,6 +3,10 @@ #include "StdAfx.h" +#ifdef __clang__ + #pragma clang diagnostic ignored "-Wmissing-prototypes" +#endif + #include "../../../Common/MyWindows.h" #include "../../../Common/MyInitGuid.h" @@ -39,7 +43,9 @@ const char *g_PluginName_for_Error = "7-Zip"; } +#if defined(_UNICODE) && !defined(_WIN64) && !defined(UNDER_CE) #define NT_CHECK_FAIL_ACTION return FALSE; +#endif BOOL WINAPI DllMain( #ifdef UNDER_CE diff --git a/CPP/7zip/UI/Far/Far.dsp b/CPP/7zip/UI/Far/Far.dsp index 2433b252..b32ae6fa 100644 --- a/CPP/7zip/UI/Far/Far.dsp +++ b/CPP/7zip/UI/Far/Far.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\Far\Plugins\7-Zip\7-ZipFar.dll" /opt:NOWIN98 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Progs\Far\Plugins\7-Zip\7-ZipFar.dll" /opt:NOWIN98 # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "Far - Win32 Debug" @@ -80,7 +80,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\Far\Plugins\7-Zip\7-ZipFar.dll" /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Progs\Far\Plugins\7-Zip\7-ZipFar.dll" /pdbtype:sept !ENDIF diff --git a/CPP/7zip/UI/Far/OverwriteDialogFar.cpp b/CPP/7zip/UI/Far/OverwriteDialogFar.cpp index 1171453e..b8fc565f 100644 --- a/CPP/7zip/UI/Far/OverwriteDialogFar.cpp +++ b/CPP/7zip/UI/Far/OverwriteDialogFar.cpp @@ -26,7 +26,7 @@ struct CFileInfoStrings AString Time; }; -void SetFileInfoStrings(const CFileInfo &fileInfo, +static void SetFileInfoStrings(const CFileInfo &fileInfo, CFileInfoStrings &fileInfoStrings) { char buffer[256]; diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp index 72f81ac9..92b62369 100644 --- a/CPP/7zip/UI/Far/Plugin.cpp +++ b/CPP/7zip/UI/Far/Plugin.cpp @@ -197,10 +197,12 @@ void CPlugin::EnterToDirectory(const UString &dirName) s = ".."; _folder->BindToFolder(s, &newFolder); if (!newFolder) + { if (dirName.IsEmpty()) return; else throw 40325; + } _folder = newFolder; } @@ -457,7 +459,7 @@ static AString PropToString2(const NCOM::CPropVariant &prop, PROPID propID) return s; } -static void AddPropertyString(InfoPanelLine *lines, int &numItems, PROPID propID, const wchar_t *name, +static void AddPropertyString(InfoPanelLine *lines, unsigned &numItems, PROPID propID, const wchar_t *name, const NCOM::CPropVariant &prop) { if (prop.vt != VT_EMPTY) @@ -472,7 +474,7 @@ static void AddPropertyString(InfoPanelLine *lines, int &numItems, PROPID propID } } -static void InsertSeparator(InfoPanelLine *lines, int &numItems) +static void InsertSeparator(InfoPanelLine *lines, unsigned &numItems) { if (numItems < kNumInfoLinesMax) { @@ -528,7 +530,7 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info) MyStringCopy(m_InfoLines[1].Text, g_StartupInfo.GetMsgString(NMessageID::kArchiveType)); MyStringCopy(m_InfoLines[1].Data, (const char *)UnicodeStringToMultiByte(_archiveTypeName, CP_OEMCP)); - int numItems = 2; + unsigned numItems = 2; { CMyComPtr<IFolderProperties> folderProperties; diff --git a/CPP/7zip/UI/Far/PluginDelete.cpp b/CPP/7zip/UI/Far/PluginDelete.cpp index 95584341..0d19c6e7 100644 --- a/CPP/7zip/UI/Far/PluginDelete.cpp +++ b/CPP/7zip/UI/Far/PluginDelete.cpp @@ -4,6 +4,9 @@ #include <stdio.h> +#include "../../../Common/StringConvert.h" +#include "FarUtils.h" + #include "Messages.h" #include "Plugin.h" #include "UpdateCallbackFar.h" @@ -28,16 +31,37 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) g_StartupInfo.GetMsgString(NMessageID::kDeleteDelete), g_StartupInfo.GetMsgString(NMessageID::kDeleteCancel) }; - char msg[1024]; + + // char msg[1024]; + AString str1; + if (numItems == 1) { - sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteFile), panelItems[0].FindData.cFileName); - msgItems[1] = msg; + str1 = g_StartupInfo.GetMsgString(NMessageID::kDeleteFile); + AString name (panelItems[0].FindData.cFileName); + const unsigned kSizeLimit = 48; + if (name.Len() > kSizeLimit) + { + UString s = MultiByteToUnicodeString(name, CP_OEMCP); + ReduceString(s, kSizeLimit); + name = UnicodeStringToMultiByte(s, CP_OEMCP); + } + str1.Replace(AString ("%.40s"), name); + msgItems[1] = str1; + // sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteFile), panelItems[0].FindData.cFileName); + // msgItems[2] = msg; } else if (numItems > 1) { - sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles), numItems); - msgItems[1] = msg; + str1 = g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles); + { + AString n; + n.Add_UInt32(numItems); + str1.Replace(AString ("%d"), n); + } + msgItems[1] = str1; + // sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles), numItems); + // msgItems[1] = msg; } if (g_StartupInfo.ShowMessage(FMSG_WARNING, NULL, msgItems, ARRAY_SIZE(msgItems), 2) != 0) return (FALSE); diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp index ec0f119b..bf1d13df 100644 --- a/CPP/7zip/UI/Far/PluginWrite.cpp +++ b/CPP/7zip/UI/Far/PluginWrite.cpp @@ -89,7 +89,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( } */ - if (numItems == 0) + if (numItems <= 0) return NFileOperationReturnCode::kError; if (_agent->IsThereReadOnlyArc()) @@ -104,14 +104,18 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( NCompression::CInfo compressionInfo; compressionInfo.Load(); - int methodIndex = 0; - int i; - for (i = ARRAY_SIZE(g_MethodMap) - 1; i >= 0; i--) + unsigned methodIndex = 0; + + unsigned i; + for (i = ARRAY_SIZE(g_MethodMap); i != 0;) + { + i--; if (compressionInfo.Level >= g_MethodMap[i]) { methodIndex = i; break; } + } const int kMethodRadioIndex = 2; const int kModeRadioIndex = kMethodRadioIndex + 7; @@ -200,10 +204,10 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( UStringVector fileNames; fileNames.ClearAndReserve(numItems); - for (i = 0; i < numItems; i++) + for (i = 0; i < (unsigned)numItems; i++) fileNames.AddInReserved(MultiByteToUnicodeString(panelItems[i].FindData.cFileName, CP_OEMCP)); CObjArray<const wchar_t *> fileNamePointers(numItems); - for (i = 0; i < numItems; i++) + for (i = 0; i < (unsigned)numItems; i++) fileNamePointers[i] = fileNames[i]; CMyComPtr<IOutFolderArchive> outArchive; @@ -459,29 +463,36 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) const int kMethodRadioIndex = kArchiveNameIndex + 2; const int kModeRadioIndex = kMethodRadioIndex + 7; - - char updateAddToArchiveString[512]; + // char updateAddToArchiveString[512]; + AString str1; { const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex]; const AString s (UnicodeStringToMultiByte(arcInfo.Name, CP_OEMCP)); + str1 = g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive); + str1.Replace(AString ("%s"), s); + /* sprintf(updateAddToArchiveString, g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), (const char *)s); + */ } - int methodIndex = 0; - int i; - for (i = ARRAY_SIZE(g_MethodMap) - 1; i >= 0; i--) + unsigned methodIndex = 0; + unsigned i; + for (i = ARRAY_SIZE(g_MethodMap); i != 0;) + { + i--; if (compressionInfo.Level >= g_MethodMap[i]) { methodIndex = i; break; } + } const struct CInitDialogItem initItems[]= { { DI_DOUBLEBOX, 3, 1, 72, kYSize - 2, false, false, 0, false, NMessageID::kUpdateTitle, NULL, NULL }, - { DI_TEXT, 5, 2, 0, 0, false, false, 0, false, -1, updateAddToArchiveString, NULL }, + { DI_TEXT, 5, 2, 0, 0, false, false, 0, false, -1, str1, NULL }, { DI_EDIT, 5, 3, 70, 3, true, false, DIF_HISTORY, false, -1, archiveNameA, kArchiveHistoryKeyName}, // { DI_EDIT, 5, 3, 70, 3, true, false, 0, false, -1, arcName, NULL}, diff --git a/CPP/7zip/UI/Far/makefile b/CPP/7zip/UI/Far/makefile index 621c8d9e..14be13d6 100644 --- a/CPP/7zip/UI/Far/makefile +++ b/CPP/7zip/UI/Far/makefile @@ -20,7 +20,6 @@ CURRENT_OBJS = \ $O\PluginWrite.obj \ $O\ProgressBox.obj \ $O\UpdateCallbackFar.obj \ - $O\UTFConvert.obj \ COMMON_OBJS = \ $O\IntToString.obj \ @@ -29,6 +28,7 @@ COMMON_OBJS = \ $O\StringConvert.obj \ $O\StringToInt.obj \ $O\MyVector.obj \ + $O\UTFConvert.obj \ $O\Wildcard.obj \ WIN_OBJS = \ |