aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/UI/FileManager
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-07-16 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2023-12-17 14:35:38 +0500
commit93be7d4abfd4233228f58ee1fbbcd76d91be66a4 (patch)
tree9b11631a70ca7150321838d9d6bd473e52d6684d /CPP/7zip/UI/FileManager
parenta3e1d227377188734b82f023f96f8e25dc40f3e6 (diff)
download7zip-93be7d4abfd4233228f58ee1fbbcd76d91be66a4.tar.gz
7zip-93be7d4abfd4233228f58ee1fbbcd76d91be66a4.tar.bz2
7zip-93be7d4abfd4233228f58ee1fbbcd76d91be66a4.zip
22.0122.01
Diffstat (limited to '')
-rw-r--r--CPP/7zip/UI/FileManager/FSFolder.cpp9
-rw-r--r--CPP/7zip/UI/FileManager/FSFolderCopy.cpp7
-rw-r--r--CPP/7zip/UI/FileManager/MyCom2.h5
-rw-r--r--CPP/7zip/UI/FileManager/PanelOperations.cpp10
-rw-r--r--CPP/7zip/UI/FileManager/SysIconUtils.cpp12
-rw-r--r--CPP/7zip/UI/FileManager/TextPairs.cpp17
6 files changed, 41 insertions, 19 deletions
diff --git a/CPP/7zip/UI/FileManager/FSFolder.cpp b/CPP/7zip/UI/FileManager/FSFolder.cpp
index 72cb0ce..f603061 100644
--- a/CPP/7zip/UI/FileManager/FSFolder.cpp
+++ b/CPP/7zip/UI/FileManager/FSFolder.cpp
@@ -5,8 +5,13 @@
5#if defined(_MSC_VER) 5#if defined(_MSC_VER)
6#include <winternl.h> 6#include <winternl.h>
7#else 7#else
8// mingw 8#if defined(__GNUC__) && (__GNUC__ >= 10)
9#include <ddk/winddk.h> 9 // new mingw:
10 #include <winternl.h>
11#else
12 // old mingw:
13 #include <ddk/winddk.h>
14#endif
10#endif 15#endif
11 16
12#include "../../../Common/ComTry.h" 17#include "../../../Common/ComTry.h"
diff --git a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
index ff444b3..4ca931b 100644
--- a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
+++ b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
@@ -29,6 +29,9 @@ using namespace NFind;
29extern bool g_IsNT; 29extern bool g_IsNT;
30#endif 30#endif
31 31
32#define MY_CAST_FUNC (void(*)())
33// #define MY_CAST_FUNC
34
32namespace NFsFolder { 35namespace NFsFolder {
33 36
34HRESULT CCopyStateIO::MyCopyFile(CFSTR inPath, CFSTR outPath, DWORD attrib) 37HRESULT CCopyStateIO::MyCopyFile(CFSTR inPath, CFSTR outPath, DWORD attrib)
@@ -245,7 +248,9 @@ void CCopyState::Prepare()
245 my_CopyFileExA = NULL; 248 my_CopyFileExA = NULL;
246 if (!g_IsNT) 249 if (!g_IsNT)
247 { 250 {
248 my_CopyFileExA = (Func_CopyFileExA)::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "CopyFileExA"); 251 my_CopyFileExA = (Func_CopyFileExA)
252 MY_CAST_FUNC
253 ::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "CopyFileExA");
249 } 254 }
250 else 255 else
251 #endif 256 #endif
diff --git a/CPP/7zip/UI/FileManager/MyCom2.h b/CPP/7zip/UI/FileManager/MyCom2.h
index c45c215..5fe1ef7 100644
--- a/CPP/7zip/UI/FileManager/MyCom2.h
+++ b/CPP/7zip/UI/FileManager/MyCom2.h
@@ -7,8 +7,9 @@
7 7
8#define MY_ADDREF_RELEASE_MT \ 8#define MY_ADDREF_RELEASE_MT \
9STDMETHOD_(ULONG, AddRef)() { InterlockedIncrement((LONG *)&__m_RefCount); return __m_RefCount; } \ 9STDMETHOD_(ULONG, AddRef)() { InterlockedIncrement((LONG *)&__m_RefCount); return __m_RefCount; } \
10STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); if (__m_RefCount != 0) \ 10STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); \
11 return __m_RefCount; delete this; return 0; } 11 if (__m_RefCount != 0) return __m_RefCount; \
12 delete this; return 0; }
12 13
13#define MY_UNKNOWN_IMP_SPEC_MT2(i1, i) \ 14#define MY_UNKNOWN_IMP_SPEC_MT2(i1, i) \
14 MY_QUERYINTERFACE_BEGIN \ 15 MY_QUERYINTERFACE_BEGIN \
diff --git a/CPP/7zip/UI/FileManager/PanelOperations.cpp b/CPP/7zip/UI/FileManager/PanelOperations.cpp
index e34e74f..a683b5e 100644
--- a/CPP/7zip/UI/FileManager/PanelOperations.cpp
+++ b/CPP/7zip/UI/FileManager/PanelOperations.cpp
@@ -24,6 +24,9 @@ using namespace NWindows;
24using namespace NFile; 24using namespace NFile;
25using namespace NName; 25using namespace NName;
26 26
27#define MY_CAST_FUNC (void(*)())
28// #define MY_CAST_FUNC
29
27#ifndef _UNICODE 30#ifndef _UNICODE
28extern bool g_IsNT; 31extern bool g_IsNT;
29#endif 32#endif
@@ -96,7 +99,7 @@ HRESULT CThreadFolderOperations::DoOperation(CPanel &panel, const UString &progr
96} 99}
97 100
98#ifndef _UNICODE 101#ifndef _UNICODE
99typedef int (WINAPI * SHFileOperationWP)(LPSHFILEOPSTRUCTW lpFileOp); 102typedef int (WINAPI * Func_SHFileOperationW)(LPSHFILEOPSTRUCTW lpFileOp);
100#endif 103#endif
101 104
102/* 105/*
@@ -192,9 +195,10 @@ void CPanel::DeleteItems(bool NON_CE_VAR(toRecycleBin))
192 #ifdef _UNICODE 195 #ifdef _UNICODE
193 /* res = */ ::SHFileOperationW(&fo); 196 /* res = */ ::SHFileOperationW(&fo);
194 #else 197 #else
195 SHFileOperationWP shFileOperationW = (SHFileOperationWP) 198 Func_SHFileOperationW shFileOperationW = (Func_SHFileOperationW)
199 MY_CAST_FUNC
196 ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW"); 200 ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
197 if (shFileOperationW == 0) 201 if (!shFileOperationW)
198 return; 202 return;
199 /* res = */ shFileOperationW(&fo); 203 /* res = */ shFileOperationW(&fo);
200 #endif 204 #endif
diff --git a/CPP/7zip/UI/FileManager/SysIconUtils.cpp b/CPP/7zip/UI/FileManager/SysIconUtils.cpp
index b756dfc..d8e0f8b 100644
--- a/CPP/7zip/UI/FileManager/SysIconUtils.cpp
+++ b/CPP/7zip/UI/FileManager/SysIconUtils.cpp
@@ -12,6 +12,9 @@
12 12
13#include <ShlObj.h> 13#include <ShlObj.h>
14 14
15#define MY_CAST_FUNC (void(*)())
16// #define MY_CAST_FUNC
17
15#ifndef _UNICODE 18#ifndef _UNICODE
16extern bool g_IsNT; 19extern bool g_IsNT;
17#endif 20#endif
@@ -39,15 +42,16 @@ int GetIconIndexForCSIDL(int csidl)
39} 42}
40 43
41#ifndef _UNICODE 44#ifndef _UNICODE
42typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags); 45typedef int (WINAPI * Func_SHGetFileInfoW)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
43 46
44static struct CSHGetFileInfoInit 47static struct CSHGetFileInfoInit
45{ 48{
46 SHGetFileInfoWP shGetFileInfoW; 49 Func_SHGetFileInfoW shGetFileInfoW;
47 CSHGetFileInfoInit() 50 CSHGetFileInfoInit()
48 { 51 {
49 shGetFileInfoW = (SHGetFileInfoWP) 52 shGetFileInfoW = (Func_SHGetFileInfoW)
50 ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW"); 53 MY_CAST_FUNC
54 ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
51 } 55 }
52} g_SHGetFileInfoInit; 56} g_SHGetFileInfoInit;
53#endif 57#endif
diff --git a/CPP/7zip/UI/FileManager/TextPairs.cpp b/CPP/7zip/UI/FileManager/TextPairs.cpp
index 6a989fc..4edf025 100644
--- a/CPP/7zip/UI/FileManager/TextPairs.cpp
+++ b/CPP/7zip/UI/FileManager/TextPairs.cpp
@@ -104,13 +104,16 @@ void CPairsStorage::Sort() { Pairs.Sort(ComparePairItems, 0); }
104 104
105int CPairsStorage::FindID(const UString &id, int &insertPos) const 105int CPairsStorage::FindID(const UString &id, int &insertPos) const
106{ 106{
107 int left = 0, right = Pairs.Size(); 107 unsigned left = 0, right = Pairs.Size();
108 while (left != right) 108 while (left != right)
109 { 109 {
110 int mid = (left + right) / 2; 110 const unsigned mid = (left + right) / 2;
111 int compResult = ComparePairIDs(id, Pairs[mid].ID); 111 const int compResult = ComparePairIDs(id, Pairs[mid].ID);
112 if (compResult == 0) 112 if (compResult == 0)
113 {
114 insertPos = mid; // to disable GCC warning
113 return mid; 115 return mid;
116 }
114 if (compResult < 0) 117 if (compResult < 0)
115 right = mid; 118 right = mid;
116 else 119 else
@@ -129,7 +132,7 @@ int CPairsStorage::FindID(const UString &id) const
129void CPairsStorage::AddPair(const CTextPair &pair) 132void CPairsStorage::AddPair(const CTextPair &pair)
130{ 133{
131 int insertPos; 134 int insertPos;
132 int pos = FindID(pair.ID, insertPos); 135 const int pos = FindID(pair.ID, insertPos);
133 if (pos >= 0) 136 if (pos >= 0)
134 Pairs[pos] = pair; 137 Pairs[pos] = pair;
135 else 138 else
@@ -138,7 +141,7 @@ void CPairsStorage::AddPair(const CTextPair &pair)
138 141
139void CPairsStorage::DeletePair(const UString &id) 142void CPairsStorage::DeletePair(const UString &id)
140{ 143{
141 int pos = FindID(id); 144 const int pos = FindID(id);
142 if (pos >= 0) 145 if (pos >= 0)
143 Pairs.Delete(pos); 146 Pairs.Delete(pos);
144} 147}
@@ -146,7 +149,7 @@ void CPairsStorage::DeletePair(const UString &id)
146bool CPairsStorage::GetValue(const UString &id, UString &value) const 149bool CPairsStorage::GetValue(const UString &id, UString &value) const
147{ 150{
148 value.Empty(); 151 value.Empty();
149 int pos = FindID(id); 152 const int pos = FindID(id);
150 if (pos < 0) 153 if (pos < 0)
151 return false; 154 return false;
152 value = Pairs[pos].Value; 155 value = Pairs[pos].Value;
@@ -155,7 +158,7 @@ bool CPairsStorage::GetValue(const UString &id, UString &value) const
155 158
156UString CPairsStorage::GetValue(const UString &id) const 159UString CPairsStorage::GetValue(const UString &id) const
157{ 160{
158 int pos = FindID(id); 161 const int pos = FindID(id);
159 if (pos < 0) 162 if (pos < 0)
160 return UString(); 163 return UString();
161 return Pairs[pos].Value; 164 return Pairs[pos].Value;