diff --git a/CMake/win32.cmake b/CMake/win32.cmake
deleted file mode 100644
index 403e7ce8e..000000000
--- a/CMake/win32.cmake
+++ /dev/null
@@ -1,54 +0,0 @@
-################################################################################
-# set some windows specific variables
-################################################################################
-
-if( MSVC_VERSION LESS 1800 ) # VC10-/VS2010-
- message(FATAL_ERROR "The project requires C++11 features. "
- "You need at least Visual Studio 12 (Microsoft Visual Studio 2013)")
-endif()
-
-if(DEBUG)
- add_definitions(-DDEBUG -D_DEBUG)
-else()
- add_definitions(-DNDEBUG -D_NDEBUG)
-endif()
-
-# ignore some warnings
-add_linker_flags(/ignore:4006
- /ignore:4099
- /ignore:4221)
-add_compiler_flags(/wd4996 /MP)
-
-
-set(CMAKE_GENERATOR_TOOLSET "v120_xp")
-set(WIN_TARGET 0x0502) # Windows XP SP2
-set(WIN_SDK_MIN 0x0600) # Windows Vista
-set(WIN_IE_VERSION 0x0603) # IE 6 SP2
-add_definitions(-DWINVER=${WIN_TARGET}
- -D_WIN32_WINNT=${WIN_SDK_MIN}
- -D_WIN32_IE=${WIN_IE_VERSION}
- -D_USING_V120_SDK71_)
-
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(64BIT TRUE)
- message("-- detected 64bit")
-else()
- set(64BIT FALSE)
- message("-- detected 32bit")
-endif()
-
-macro(SetSharedRuntime target)
- if(DEBUG)
- set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MDd")
- else()
- set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MD")
- endif()
-endmacro()
-
-macro(SetStaticRuntime target)
- if(DEBUG)
- set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MTd")
- else()
- set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/MT")
- endif()
-endmacro()
\ No newline at end of file
diff --git a/Data/Scripts/imgbb.nut b/Data/Scripts/imgbb.nut
index 13fc477db..877e25a1d 100644
--- a/Data/Scripts/imgbb.nut
+++ b/Data/Scripts/imgbb.nut
@@ -16,7 +16,11 @@ function _ObtainToken() {
function _UploadToAccount(FileName, options) {
nm.enableResponseCodeChecking(true);
- local apiKey = ServerParams.getParam("Login");
+ local apiKey = ServerParams.getParam("Password");
+ if (apiKey == "") {
+ WriteLog("error", "[imgbb.com] Cannot upload to account without API key");
+ return 0;
+ }
nm.addQueryParam("key", apiKey);
nm.addQueryParamFile("image", FileName, ExtractFileName(FileName), "");
nm.setUrl("https://api.imgbb.com/1/upload");
@@ -40,9 +44,9 @@ function _UploadToAccount(FileName, options) {
function UploadFile(FileName, options) {
nm.enableResponseCodeChecking(false);
- local apiKey = ServerParams.getParam("Login");
+ local login = ServerParams.getParam("Login");
- if (apiKey != "") {
+ if (login != "") {
return _UploadToAccount(FileName, options);
}
diff --git a/Data/servers.xml b/Data/servers.xml
index 67a97ecbc..8d2c6286a 100644
--- a/Data/servers.xml
+++ b/Data/servers.xml
@@ -38,8 +38,8 @@
-
-
+
+
@@ -222,7 +222,7 @@
-->
-
+
diff --git a/Source/Core/BackgroundTask.cpp b/Source/Core/BackgroundTask.cpp
index 8fe02117d..aef942b97 100644
--- a/Source/Core/BackgroundTask.cpp
+++ b/Source/Core/BackgroundTask.cpp
@@ -18,7 +18,7 @@ void BackgroundTask::run() {
BackgroundTaskResult result = BackgroundTaskResult::Failed;
defer d([&] { // Run at function exit
isRunning_ = false;
- onTaskFinished(this, result);
+ onTaskFinished(this, result);
});
if (isCanceled_) {
result = BackgroundTaskResult::Canceled;
@@ -26,4 +26,4 @@ void BackgroundTask::run() {
}
isRunning_ = true;
result = doJob();
-}
\ No newline at end of file
+}
diff --git a/Source/Core/BackgroundTask.h b/Source/Core/BackgroundTask.h
index 291e02a9a..47e5b96be 100644
--- a/Source/Core/BackgroundTask.h
+++ b/Source/Core/BackgroundTask.h
@@ -1,8 +1,9 @@
#ifndef IU_CORE_BACKGROUNDTASK
#define IU_CORE_BACKGROUNDTASK
-#include
+#include
#include
+#include
#include "TaskDispatcher.h"
#include "Utils/CoreTypes.h"
@@ -21,8 +22,8 @@ class BackgroundTask: public CancellableTask {
bool isInProgress() override;
DISALLOW_COPY_AND_ASSIGN(BackgroundTask);
protected:
- bool isRunning_ = false;
- bool isCanceled_ = false;
+ std::atomic isRunning_ = false;
+ std::atomic isCanceled_ = false;
};
#endif
diff --git a/Source/Core/ScreenCapture.cpp b/Source/Core/ScreenCapture.cpp
index b534f1c3d..ce2dcf7a9 100644
--- a/Source/Core/ScreenCapture.cpp
+++ b/Source/Core/ScreenCapture.cpp
@@ -205,7 +205,6 @@ std::shared_ptr CRectRegion::GetImage(HDC src)
RECT regionBoundingRect;
CRgn screenRegion = CloneRegion(m_ScreenRegion);
RECT screenBounds;
-
GuiTools::GetScreenBounds(screenBounds);
CRgn FullScreenRgn;
FullScreenRgn.CreateRectRgnIndirect(&screenBounds);
@@ -217,7 +216,12 @@ std::shared_ptr CRectRegion::GetImage(HDC src)
screenRegion.GetRgnBox(®ionBoundingRect);
int bmWidth = regionBoundingRect.right - regionBoundingRect.left;
int bmHeight = regionBoundingRect.bottom - regionBoundingRect.top;
-
+
+ if (bmWidth <= 0 || bmHeight <=0) {
+ LOG(WARNING) << "Cannot make screenshot of empty region";
+ return {};
+ }
+
CBitmap tempBm; // Temporary bitmap and device context
CDC tempDC; // which were added to avoid artifacts with BitBlt
HDC dc = GetDC( 0 );
diff --git a/Source/Core/SearchGoogleImages.cpp b/Source/Core/SearchGoogleImages.cpp
index db54214f4..fd729e17c 100644
--- a/Source/Core/SearchGoogleImages.cpp
+++ b/Source/Core/SearchGoogleImages.cpp
@@ -4,7 +4,7 @@
#include "Utils/CryptoUtils.h"
#include "Core/Utils/DesktopUtils.h"
-SearchGoogleImages::SearchGoogleImages(std::shared_ptr networkClientFactory, const std::string& fileName): SearchByImageTask(fileName),
+SearchGoogleImages::SearchGoogleImages(std::shared_ptr networkClientFactory, std::string fileName): SearchByImageTask(std::move(fileName)),
networkClientFactory_(std::move(networkClientFactory))
{
}
@@ -74,4 +74,4 @@ bool SearchGoogleImages::base64EncodeCompat(const std::string& file, std::string
}
}
return true;
-}
\ No newline at end of file
+}
diff --git a/Source/Core/SearchGoogleImages.h b/Source/Core/SearchGoogleImages.h
index 21b20d5bc..256c7b55a 100644
--- a/Source/Core/SearchGoogleImages.h
+++ b/Source/Core/SearchGoogleImages.h
@@ -6,15 +6,13 @@
#include "SearchByImage.h"
#include "Network/INetworkClient.h"
-class NetworkClient;
-
class SearchGoogleImages: public SearchByImageTask {
public:
- explicit SearchGoogleImages(std::shared_ptr networkClientFactory, const std::string& fileName);
+ explicit SearchGoogleImages(std::shared_ptr networkClientFactory, std::string fileName);
protected:
BackgroundTaskResult doJob() override;
static bool base64EncodeCompat(const std::string& file, std::string& output);
std::shared_ptr networkClientFactory_;
};
-#endif
\ No newline at end of file
+#endif
diff --git a/Source/Core/TempFileDeleter.cpp b/Source/Core/TempFileDeleter.cpp
index 789f216a4..a182f0aff 100644
--- a/Source/Core/TempFileDeleter.cpp
+++ b/Source/Core/TempFileDeleter.cpp
@@ -1,10 +1,14 @@
-#include "TempFileDeleter.h"
+#include "TempFileDeleter.h"
#include "Core/Utils/CoreUtils.h"
TempFileDeleter::~TempFileDeleter()
{
- cleanup();
+ try {
+ cleanup();
+ } catch (const std::exception& ex) {
+ LOG(ERROR) << ex.what();
+ }
}
void TempFileDeleter::addFile(const std::string& fileName)
@@ -21,4 +25,4 @@ bool TempFileDeleter::cleanup()
}
m_files.clear();
return result;
-}
\ No newline at end of file
+}
diff --git a/Source/Core/Utils/CoreUtils.h b/Source/Core/Utils/CoreUtils.h
index 90a48f880..6b3dcf0c6 100644
--- a/Source/Core/Utils/CoreUtils.h
+++ b/Source/Core/Utils/CoreUtils.h
@@ -46,7 +46,13 @@ class defer {
defer(const defer&) = delete;
defer(std::function functor) : mFunctor(functor) {}
- ~defer() { mFunctor(); }
+ ~defer() {
+ try {
+ mFunctor();
+ } catch (const std::exception& ex) {
+ LOG(ERROR) << ex.what();
+ }
+ }
};
namespace IuCoreUtils
diff --git a/Source/Gui/Dialogs/WizardDlg.cpp b/Source/Gui/Dialogs/WizardDlg.cpp
index 47c6a76c9..a2ca7b65a 100644
--- a/Source/Gui/Dialogs/WizardDlg.cpp
+++ b/Source/Gui/Dialogs/WizardDlg.cpp
@@ -343,7 +343,7 @@ LRESULT CWizardDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
LoadUploadEngines(userServersFolder + list[i], ErrorStr);
}
}
- } catch ( std::exception& ex) {
+ } catch (const std::exception& ex) {
LOG(ERROR) << ex.what();
}
@@ -1038,10 +1038,10 @@ STDMETHODIMP CWizardDlg::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POI
ReleaseStgMedium(&ddd);
}
}
- }
- if (!enableDragndropOverlay_) {
- queryDropFiledescriptors(pDataObj, &enableDragndropOverlay_);
+ if (!enableDragndropOverlay_) {
+ queryDropFiledescriptors(pDataObj, &enableDragndropOverlay_);
+ }
}
if (enableDragndropOverlay_) {
diff --git a/Source/Image Uploader.rc b/Source/Image Uploader.rc
index bd3b44382..8e775574e 100644
--- a/Source/Image Uploader.rc
+++ b/Source/Image Uploader.rc
@@ -73,7 +73,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0xCC
BEGIN
LISTBOX IDC_COMMANDBOX,-2,-1,198,165,LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP
LTEXT "#Çàäåðæêà:",IDC_DELAYLABEL,12,175,47,8
- EDITTEXT IDC_DELAYEDIT,79,173,27,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_DELAYEDIT,79,173,27,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_DELAYSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,97,172,11,14
LTEXT "#ñ",IDC_SECLABEL,114,176,26,8
CONTROL "#Open screenshot in editor",IDC_OPENSCREENSHOTINEDITORCHECKBOX,