Skip to content

Commit 03bfa26

Browse files
committed
Cosmetic changes
1 parent 65a5b4f commit 03bfa26

41 files changed

Lines changed: 101 additions & 130 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dist/DocGen/oauth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
22
@file
3-
@section OAuth Auth 2.0 authorization example
3+
@section OAuth OAuth 2.0 authorization example
44
@include oauth.nut
55
*/

Source/3rdpart/MemberFunctionCallback.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,29 @@ CBTHookCallbackBase* AvailableCallbackSlots[kMaxCallbacks] = {
2323
std::mutex AvailableCallbackSlotsMutex;
2424

2525
struct Dummy {
26-
27-
~Dummy()
28-
{
29-
for (auto it : AvailableCallbackSlots)
30-
{
26+
~Dummy() {
27+
for (auto it : AvailableCallbackSlots) {
3128
delete it;
3229
}
3330
}
3431
};
32+
3533
Dummy dummyObject;
3634

37-
CBTHookMemberFunctionCallback::CBTHookMemberFunctionCallback(const HookCallback& method)
38-
{
35+
CBTHookMemberFunctionCallback::CBTHookMemberFunctionCallback(const HookCallback& method) {
3936
std::lock_guard<std::mutex> lock(AvailableCallbackSlotsMutex);
4037
constexpr int imax = std::size(AvailableCallbackSlots);
41-
for( m_nAllocIndex = 0; m_nAllocIndex < imax; ++m_nAllocIndex )
42-
{
43-
m_cbCallback = AvailableCallbackSlots[m_nAllocIndex]->Reserve( method);
44-
if (m_cbCallback != NULL)
45-
{
38+
for (m_nAllocIndex = 0; m_nAllocIndex < imax; ++m_nAllocIndex) {
39+
m_cbCallback = AvailableCallbackSlots[m_nAllocIndex]->Reserve(method);
40+
if (m_cbCallback != nullptr) {
4641
return;
4742
}
4843
}
4944
LOG(ERROR) << "Cannot create member function callback";
5045
}
5146

52-
CBTHookMemberFunctionCallback::~CBTHookMemberFunctionCallback()
53-
{
54-
if( IsValid() )
55-
{
47+
CBTHookMemberFunctionCallback::~CBTHookMemberFunctionCallback() {
48+
if (IsValid()) {
5649
std::lock_guard<std::mutex> lock(AvailableCallbackSlotsMutex);
5750
AvailableCallbackSlots[m_nAllocIndex]->Free();
5851
}

Source/CLI/ConsoleScriptDialogProvider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ std::string ConsoleScriptDialogProvider::messageBox(const std::string& message,
6262
std::cerr << ": ";
6363
char res;
6464
std::cin >> res;
65-
res = toupper(res);
65+
res = static_cast<char>(toupper(res));
6666
return buttonsMap[res];
6767
}
6868
}

Source/Core/AbstractServerIconCache.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ class AbstractServerIconCache {
2929

3030
}
3131
virtual ~AbstractServerIconCache() = default;
32-
virtual NativeIcon getIconForServer(const std::string& name, int dpi, bool smallIcon) = 0;
32+
virtual NativeIcon getIconForServer(const std::string& name, unsigned int dpi, bool smallIcon) = 0;
3333

34-
[[nodiscard]] virtual NativeIcon getBigIconForServer(const std::string& name, int dpi) = 0;
34+
[[nodiscard]] virtual NativeIcon getBigIconForServer(const std::string& name, unsigned int dpi) = 0;
3535

36-
virtual NativeBitmap getIconBitmapForServer(const std::string& name, int dpi, bool smallIcon) = 0;
36+
virtual NativeBitmap getIconBitmapForServer(const std::string& name, unsigned int dpi, bool smallIcon) = 0;
3737

3838
virtual std::string getIconNameForServer(const std::string& name, bool returnFullPath);
3939

4040
/**
4141
* @throws std::logic_error
4242
*/
43-
virtual void preLoadIcons(int dpi) = 0;
43+
virtual void preLoadIcons(unsigned int dpi) = 0;
4444
protected:
4545
CUploadEngineListBase* engineList_;
4646
std::string iconsDir_;

Source/Core/QtServerIconCache.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ QtServerIconCache::QtServerIconCache(CUploadEngineListBase *engineList, std::str
1111
defaultServerIcon_ = QIcon(":/res/server.png");
1212
}
1313

14-
NativeIcon QtServerIconCache::getIconForServer(const std::string &name, int dpi, bool smallIcon) {
14+
NativeIcon QtServerIconCache::getIconForServer(const std::string &name, unsigned int dpi, bool smallIcon) {
1515
return tryIconLoad(name).icon;
1616
}
1717

18-
NativeIcon QtServerIconCache::getBigIconForServer(const std::string &name, int dpi) {
18+
NativeIcon QtServerIconCache::getBigIconForServer(const std::string &name, unsigned int dpi) {
1919
return tryIconLoad(name).icon;
2020
}
2121

22-
NativeBitmap QtServerIconCache::getIconBitmapForServer(const std::string &name, int dpi, bool smallIcon) {
22+
NativeBitmap QtServerIconCache::getIconBitmapForServer(const std::string &name, unsigned int dpi, bool smallIcon) {
2323
return tryIconLoad(name).bm;
2424
}
2525

26-
void QtServerIconCache::preLoadIcons(int dpi) {
26+
void QtServerIconCache::preLoadIcons(unsigned int dpi) {
2727
if (iconsPreload_) {
2828
throw std::logic_error("preLoadIcons() should not be called twice");
2929
}

Source/Core/QtServerIconCache.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class QtServerIconCache: public AbstractServerIconCache {
2020
};
2121
QtServerIconCache(CUploadEngineListBase* engineList, std::string iconsDir);
2222

23-
NativeIcon getIconForServer(const std::string& name, int dpi, bool smallIcon = true) override;
23+
NativeIcon getIconForServer(const std::string& name, unsigned int dpi, bool smallIcon = true) override;
2424

25-
[[nodiscard]] NativeIcon getBigIconForServer(const std::string& name, int dpi) override;
26-
NativeBitmap getIconBitmapForServer(const std::string& name, int dpi, bool smallIcon = true) override;
25+
[[nodiscard]] NativeIcon getBigIconForServer(const std::string& name, unsigned int dpi) override;
26+
NativeBitmap getIconBitmapForServer(const std::string& name, unsigned int dpi, bool smallIcon = true) override;
2727

2828
/**
2929
* @throws std::logic_error
3030
*/
31-
void preLoadIcons(int dpi) override;
31+
void preLoadIcons(unsigned int dpi) override;
3232
private:
3333
std::unordered_map<std::string, CacheItem> serverIcons_;
3434
std::mutex cacheMutex_;

Source/Core/WinServerIconCache.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ WinServerIconCache::~WinServerIconCache(){
2929
}
3030
}
3131

32-
WinServerIconCache::WinIcon WinServerIconCache::tryIconLoad(const std::string& name, int dpi, bool smallIcon) {
32+
WinServerIconCache::WinIcon WinServerIconCache::tryIconLoad(const std::string& name, unsigned int dpi, bool smallIcon) {
3333
std::lock_guard lk(cacheMutex_);
3434
const int w = DPIHelper::GetSystemMetricsForDpi(smallIcon ? SM_CXSMICON : SM_CXICON, dpi);
3535
const int h = DPIHelper::GetSystemMetricsForDpi(smallIcon ? SM_CYSMICON : SM_CYICON, dpi);
@@ -73,15 +73,15 @@ WinServerIconCache::WinIcon WinServerIconCache::tryIconLoad(const std::string& n
7373
return item;
7474
}
7575

76-
NativeBitmap WinServerIconCache::getIconBitmapForServer(const std::string& name, int dpi, bool smallIcon) {
76+
NativeBitmap WinServerIconCache::getIconBitmapForServer(const std::string& name, unsigned int dpi, bool smallIcon) {
7777
return tryIconLoad(name, dpi, smallIcon).bm;
7878
}
7979

80-
NativeIcon WinServerIconCache::getIconForServer(const std::string& name, int dpi, bool smallIcon) {
80+
NativeIcon WinServerIconCache::getIconForServer(const std::string& name, unsigned int dpi, bool smallIcon) {
8181
return tryIconLoad(name, dpi, smallIcon).icon;
8282
}
8383

84-
NativeIcon WinServerIconCache::getBigIconForServer(const std::string& name, int dpi) {
84+
NativeIcon WinServerIconCache::getBigIconForServer(const std::string& name, unsigned int dpi) {
8585
CString iconFileName = IuCoreUtils::Utf8ToWstring(getIconNameForServer(name, true)).c_str();
8686

8787
if (iconFileName.IsEmpty()) {
@@ -109,7 +109,7 @@ NativeIcon WinServerIconCache::getBigIconForServer(const std::string& name, int
109109
return icon;
110110
}
111111

112-
void WinServerIconCache::loadIcons(int dpi, bool smallIcons) {
112+
void WinServerIconCache::loadIcons(unsigned int dpi, bool smallIcons) {
113113
std::unique_ptr<CImageList, ImageListDeleter> imageList(new CImageList, ImageListDeleter {});
114114
const int iconWidth = DPIHelper::GetSystemMetricsForDpi(smallIcons ? SM_CXSMICON: SM_CXICON, dpi);
115115
const int iconHeight = DPIHelper::GetSystemMetricsForDpi(smallIcons ? SM_CYSMICON : SM_CYICON, dpi);
@@ -137,7 +137,7 @@ void WinServerIconCache::onServerAdded(const std::string& name) {
137137
}
138138
}
139139

140-
std::optional<WinServerIconCache::ImageListWithIndexes> WinServerIconCache::getCachedImageList(int dpi, bool smallIcons /*= true*/) {
140+
std::optional<WinServerIconCache::ImageListWithIndexes> WinServerIconCache::getCachedImageList(unsigned int dpi, bool smallIcons /*= true*/) {
141141
std::lock_guard lk(cacheMutex_);
142142
auto it = imageLists_.find({ dpi, smallIcons });
143143
if (it != imageLists_.end()) {
@@ -152,7 +152,7 @@ std::optional<WinServerIconCache::ImageListWithIndexes> WinServerIconCache::getC
152152
return {};
153153
}
154154

155-
void WinServerIconCache::preLoadIcons(int dpi) {
155+
void WinServerIconCache::preLoadIcons(unsigned int dpi) {
156156
if (iconsPreload_) {
157157
throw std::logic_error("preLoadIcons() should not be called twice");
158158
}
@@ -165,7 +165,7 @@ void WinServerIconCache::preLoadIcons(int dpi) {
165165
});
166166
}
167167

168-
WinServerIconCache::ImageListWithIndexes WinServerIconCache::getImageList(int dpi, bool smallIcons) {
168+
WinServerIconCache::ImageListWithIndexes WinServerIconCache::getImageList(unsigned int dpi, bool smallIcons) {
169169
auto imageList = getCachedImageList(dpi, smallIcons);
170170
if (imageList) {
171171
return *imageList;

Source/Core/WinServerIconCache.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ class WinServerIconCache : public AbstractServerIconCache {
4747
WinServerIconCache(CUploadEngineListBase* engineList, std::string iconsDir);
4848
~WinServerIconCache() override;
4949

50-
NativeIcon getIconForServer(const std::string& name, int dpi, bool smallIcon = true) override;
50+
NativeIcon getIconForServer(const std::string& name, unsigned int dpi, bool smallIcon) override;
5151

5252
/**
5353
* The caller of this function is responsible for destroying
5454
* the icon when it is no longer needed.
5555
*/
56-
[[nodiscard]] NativeIcon getBigIconForServer(const std::string& name, int dpi) override;
56+
[[nodiscard]] NativeIcon getBigIconForServer(const std::string& name, unsigned int dpi) override;
5757

58-
NativeBitmap getIconBitmapForServer(const std::string& name, int dpi, bool smallIcon = true) override;
58+
NativeBitmap getIconBitmapForServer(const std::string& name, unsigned int dpi, bool smallIcon) override;
5959

6060
/**
6161
* @throws std::logic_error
6262
*/
63-
void preLoadIcons(int dpi) override;
63+
void preLoadIcons(unsigned int dpi) override;
6464

6565
using ImageListWithIndexes = std::pair<HIMAGELIST, std::unordered_map<std::string,int>>;
66-
ImageListWithIndexes getImageList(int dpi, bool smallIcons = true);
66+
ImageListWithIndexes getImageList(unsigned int dpi, bool smallIcons = true);
6767

6868
private :
6969
std::unordered_map<std::pair<int, std::string>, WinIcon> serverIcons_;
@@ -72,9 +72,9 @@ private :
7272
std::future<int> future_;
7373
bool iconsPreload_ = false;
7474
std::mutex imageListsMutex_;
75-
std::unordered_map<std::pair<int,bool>, std::pair<std::unique_ptr<CImageList, ImageListDeleter>, std::unordered_map<std::string, int>>> imageLists_;
76-
WinIcon tryIconLoad(const std::string& name, int dpi, bool smallIcon = true);
77-
void loadIcons(int dpi, bool smallIcons);
75+
std::unordered_map<std::pair<unsigned int,bool>, std::pair<std::unique_ptr<CImageList, ImageListDeleter>, std::unordered_map<std::string, int>>> imageLists_;
76+
WinIcon tryIconLoad(const std::string& name, unsigned int dpi, bool smallIcon = true);
77+
void loadIcons(unsigned int dpi, bool smallIcons);
7878
void onServerAdded(const std::string& name);
79-
std::optional<ImageListWithIndexes> getCachedImageList(int dpi, bool smallIcons = true);
79+
std::optional<ImageListWithIndexes> getCachedImageList(unsigned int dpi, bool smallIcons = true);
8080
};

Source/Gui/Application.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ class Application {
354354
settings_.Language = U2W(it->first);
355355
}
356356

357-
358357
/*CString foundName = lang_.getLanguageFileNameForLocale(shortLanguageName);
359358
if (!foundName.IsEmpty()) {
360359
settings_.Language = foundName;

Source/Gui/Controls/HistoryTreeControl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ void CHistoryTreeControl::CreateDownloader() {
6969
}
7070
}
7171

72-
7372
LRESULT CHistoryTreeControl::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
7473
Init();
7574
return 0;

0 commit comments

Comments
 (0)