Browse Source

fixed warnings and fixed saving new clips from notepad (#761)

sabrogden 1 year ago
parent
commit
a03dd82c83
26 changed files with 106 additions and 507 deletions
  1. 3 5
      About.cpp
  2. 5 5
      Accels.cpp
  3. 1 1
      Accels.h
  4. 0 3
      ActionEnums.cpp
  5. 1 0
      ActionEnums.h
  6. 1 1
      BitmapHelper.cpp
  7. 6 9
      CP_Main.cpp
  8. 0 38
      CP_Main.vcxproj
  9. 0 6
      CP_Main.vcxproj.filters
  10. 8 6
      Clip.cpp
  11. 1 1
      Clip.h
  12. 1 2
      DatabaseUtilities.cpp
  13. 2 4
      DittoAddins.cpp
  14. 2 2
      EventThread.cpp
  15. 2 2
      ICU_String.cpp
  16. 1 1
      ImageFormatAggregator.cpp
  17. 2 2
      ImageViewer.cpp
  18. 0 363
      InternetUpdate.cpp
  19. 0 45
      InternetUpdate.h
  20. 2 3
      MainFrm.cpp
  21. 49 0
      Misc.cpp
  22. 12 0
      Misc.h
  23. 3 3
      Options.cpp
  24. 1 1
      Options.h
  25. 0 1
      OptionsGeneral.cpp
  26. 3 3
      ScrollHelper.cpp

+ 3 - 5
About.cpp

@@ -6,7 +6,7 @@
 #include "stdafx.h"
 #include "cp_main.h"
 #include "About.h"
-#include "InternetUpdate.h"
+#include "misc.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -59,10 +59,8 @@ BOOL CAbout::OnInitDialog()
 
 	m_List.AddString(_T("Ditto"));
 
-	CInternetUpdate update;
-
-	auto runningVersion = update.GetRunningVersion();
-	CString cs = update.GetVersionString(runningVersion);
+	auto runningVersion = GetRunningVersion();
+	CString cs = GetVersionString(runningVersion);
 
 	CString csText;
 	csText = "    Version " + cs;

+ 5 - 5
Accels.cpp

@@ -83,20 +83,20 @@ bool CAccels::OnMsg(MSG *pMsg, CAccel &a)
         return NULL;
     }
 
-    BYTE vkey = LOBYTE(pMsg->wParam);
+    const BYTE vkey = LOBYTE(pMsg->wParam);
 	BYTE mod = 0;
 	if (m_checkModifierKeys)
 	{
 		mod = GetKeyStateModifiers();
 	}
-    DWORD key = ACCEL_MAKEKEY(vkey, mod);
+    const DWORD key = ACCEL_MAKEKEY(vkey, mod);
 
     //CString cs;
     //cs.Format(_T("Key: %d, Mod: %d, vkey: %d, diff: %d\r\n"), key, mod, vkey, (GetTickCount() - m_firstMapTick));
     //OutputDebugString(cs);
 		
 	if (m_firstMapTick != 0 &&
-		(GetTickCount() - m_firstMapTick) < CGetSetOptions::m_doubleKeyStrokeTimeout)
+		(GetTickCount64() - m_firstMapTick) < CGetSetOptions::m_doubleKeyStrokeTimeout)
 	{
 		pair<multimap<DWORD, CAccel>::iterator, multimap<DWORD, CAccel>::iterator> ppp;
 		ppp = m_multiMap.equal_range(m_activeFirstKey);
@@ -131,7 +131,7 @@ bool CAccels::OnMsg(MSG *pMsg, CAccel &a)
 			else
 			{
 				m_activeFirstKey = key;
-				m_firstMapTick = GetTickCount();
+				m_firstMapTick = GetTickCount64();
 				break;
 			}
 		}
@@ -148,7 +148,7 @@ bool CAccels::OnMsg(MSG *pMsg, CAccel &a)
 bool CAccels::ContainsKey(int vKey)
 {
 	CString cmdShortcutText;
-	for (multimap<DWORD, CAccel>::iterator it = m_multiMap.begin(); it != m_multiMap.end(); ++it)
+	for (auto it = m_multiMap.begin(); it != m_multiMap.end(); ++it)
 	{
 		if (LOBYTE(it->second.Key) == vKey || LOBYTE(it->second.Key2) == vKey)
 		{

+ 1 - 1
Accels.h

@@ -61,5 +61,5 @@ protected:
 	multimap<DWORD, CAccel> m_multiMap;
 	DWORD m_activeFirstKey;
 
-	DWORD m_firstMapTick;
+	ULONGLONG m_firstMapTick;
 };

+ 0 - 3
ActionEnums.cpp

@@ -512,9 +512,6 @@ int ActionEnums::GetDefaultShortCutKeyB(ActionEnumValues value, int pos)
 	switch (pos)
 	{
 	case 0:
-		switch (value)
-		{
-		}
 		break;
 	}
 

+ 1 - 0
ActionEnums.h

@@ -1,4 +1,5 @@
 #pragma once
+
 class ActionEnums
 {
 public:

+ 1 - 1
BitmapHelper.cpp

@@ -104,7 +104,7 @@ BOOL CBitmapHelper::GetCBitmap(CClipFormats &clips, CDC* pDC, CBitmap* pBitMap,
 	if (!pBitMap)
 		return bRet;
 
-	int count = clips.GetCount();
+	int count = (int)clips.GetCount();
 	int width = 0;
 	int height = 0;
 

+ 6 - 9
CP_Main.cpp

@@ -5,7 +5,6 @@
 #include ".\cp_main.h"
 #include "server.h"
 #include "Client.h"
-#include "InternetUpdate.h"
 #include <io.h>
 #include "Path.h"
 #include "Clip_ImportExport.h"
@@ -80,7 +79,7 @@ public:
 			{
 				m_plainTextPaste = TRUE;
 			}
-			else if (wcsnicmp(pszParam, _T("paste"), 5) == 0)
+			else if (_wcsnicmp(pszParam, _T("paste"), 5) == 0)
 			{
 				CString pidCommand(pszParam);
 				long sep = pidCommand.ReverseFind(':');
@@ -91,7 +90,7 @@ public:
 					m_pasteClip = TRUE;
 				}
 			}
-			else if (wcsnicmp(pszParam, _T("edit"), 4) == 0)
+			else if (_wcsnicmp(pszParam, _T("edit"), 4) == 0)
 			{
 				CString pidCommand(pszParam);
 				long sep = pidCommand.ReverseFind(':');
@@ -102,7 +101,7 @@ public:
 					m_editClip = TRUE;
 				}
 			}
-			else if (wcsnicmp(pszParam, _T("RestartByRestartManager"), 23) == 0)
+			else if (_wcsnicmp(pszParam, _T("RestartByRestartManager"), 23) == 0)
 			{
 				m_restartFromRestartManager = true;
 			}
@@ -358,12 +357,10 @@ BOOL CCP_MainApp::InitInstance()
 		}
 
 		return FALSE;
-	}	
-
-	CInternetUpdate update;
+	}		
 
-	auto runningVersion = update.GetRunningVersion();
-	CString cs = update.GetVersionString(runningVersion);
+	auto runningVersion = GetRunningVersion();
+	CString cs = GetVersionString(runningVersion);
 	cs.Insert(0, _T("InitInstance  -  Running Version - "));
 	Log(cs);
 

+ 0 - 38
CP_Main.vcxproj

@@ -1271,43 +1271,6 @@
     </ClCompile>
     <ClCompile Include="HListBox.cpp" />
     <ClCompile Include="HTMLFormatAggregator.cpp" />
-    <ClCompile Include="InternetUpdate.cpp">
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Disabled</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">MaxSpeed</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Disabled</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
-      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">EnableFastChecks</BasicRuntimeChecks>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
-      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">MaxSpeed</Optimization>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
     <ClCompile Include="MainFrm.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Disabled</Optimization>
@@ -2896,7 +2859,6 @@
     <ClInclude Include="Shared\IAddinExports.h" />
     <ClInclude Include="Shared\IClip.h" />
     <ClInclude Include="IClipAggregator.h" />
-    <ClInclude Include="InternetUpdate.h" />
     <ClInclude Include="MainFrm.h" />
     <ClInclude Include="MainTableFunctions.h" />
     <ClInclude Include="Misc.h" />

+ 0 - 6
CP_Main.vcxproj.filters

@@ -118,9 +118,6 @@
     <ClCompile Include="HyperLink.cpp">
       <Filter>source</Filter>
     </ClCompile>
-    <ClCompile Include="InternetUpdate.cpp">
-      <Filter>source</Filter>
-    </ClCompile>
     <ClCompile Include="MainFrm.cpp">
       <Filter>source</Filter>
     </ClCompile>
@@ -556,9 +553,6 @@
     <ClInclude Include="RulerRichEditCtrl\ids.h">
       <Filter>header</Filter>
     </ClInclude>
-    <ClInclude Include="InternetUpdate.h">
-      <Filter>header</Filter>
-    </ClInclude>
     <ClInclude Include="MainFrm.h">
       <Filter>header</Filter>
     </ClInclude>

+ 8 - 6
Clip.cpp

@@ -649,7 +649,7 @@ bool CClip::SetDescFromText(HGLOBAL hgData, bool unicode)
 		TCHAR* text = (TCHAR *) GlobalLock(hgData);
 		bufLen = GlobalSize(hgData);
 
-		m_Desc = CString(text, bufLen/(sizeof(wchar_t)));
+		m_Desc = CString(text, (int)(bufLen/(sizeof(wchar_t))));
 		bRet = true;
 	}
 	else
@@ -657,7 +657,7 @@ bool CClip::SetDescFromText(HGLOBAL hgData, bool unicode)
 		char* text = (char *) GlobalLock(hgData);
 		bufLen = GlobalSize(hgData);
 	
-		m_Desc = CString(text, bufLen);
+		m_Desc = CString(text, (int)bufLen);
 		bRet = true;
 	}
 		
@@ -1317,7 +1317,7 @@ bool CClip::RemoveStickySetting(int clipId, int parentId)
 	return reset;
 }
 
-double CClip::GetExistingTopStickyClipId(int parentId)
+int CClip::GetExistingTopStickyClipId(int parentId)
 {
 	int existingTopClipId = -1;
 
@@ -1419,7 +1419,7 @@ double CClip::GetNewLastSticky(int parentId, int clipId)
 	}
 	CATCH_SQLITE_EXCEPTION
 
-		return newOrder;
+	return newOrder;
 }
 
 void CClip::MakeLatestOrder()
@@ -1845,8 +1845,6 @@ BOOL CClip::SaveFormats(CString *unicode, CStringA *asci, CStringA *rtf, BOOL up
 			int count = theApp.m_db.execDMLEx(_T("DELETE FROM Data WHERE lID = %d;"), deletedData[i]);
 		}
 
-		AddToDataTable();
-
 		if (m_id >= 0)
 		{
 			if (updateDescription)
@@ -1861,6 +1859,8 @@ BOOL CClip::SaveFormats(CString *unicode, CStringA *asci, CStringA *rtf, BOOL up
 			AddToMainTable();
 		}
 
+		AddToDataTable();
+
 		theApp.m_db.execDML(_T("commit transaction;"));
 	}
 	CATCH_SQLITE_EXCEPTION_AND_RETURN(false)
@@ -2022,6 +2022,8 @@ Gdiplus::Bitmap *CClip::CreateGdiplusBitmap()
 	CClipFormat *dib = this->m_Formats.FindFormat(CF_DIB);
 	if (dib != NULL)
 		return dib->CreateGdiplusBitmap();
+
+	return nullptr;
 }
 
 /*----------------------------------------------------------------------------*\

+ 1 - 1
Clip.h

@@ -210,7 +210,7 @@ public:
 	double GetNewLastOrder(int parentId, int clipId);
 	static double GetNewTopSticky(int parentId, int clipId);
 	static double GetNewLastSticky(int parentId, int clipId);
-	static double GetExistingTopStickyClipId(int parentId);
+	static int GetExistingTopStickyClipId(int parentId);
 	static bool RemoveStickySetting(int clipId, int parentId);
 
 	bool AddFileDataToData(CString &errorMessage);

+ 1 - 2
DatabaseUtilities.cpp

@@ -8,7 +8,6 @@
 #include "ProcessPaste.h"
 #include <io.h>
 #include "Path.h"
-#include "InternetUpdate.h"
 #include "zlib/zlib.h"
 #include "Shared/TextConvert.h"
 using namespace nsPath;
@@ -976,7 +975,7 @@ BOOL DeleteNonUsedClips(bool fromAppWindow)
 		q.nextRow();
 	}
 
-	int clipsDeleted = IDs.GetCount();
+	int clipsDeleted = (int)IDs.GetCount();
 	int deletedTableCount = 0;
 
 	if (IDs.GetCount() > 0)

+ 2 - 4
DittoAddins.cpp

@@ -1,6 +1,6 @@
 #include "stdafx.h"
 #include ".\dittoaddins.h"
-#include "InternetUpdate.h"
+#include "misc.h"
 #include "CP_Main.h"
 
 CDittoAddins::CDittoAddins(void)
@@ -144,9 +144,7 @@ bool CDittoAddins::CallPrePasteFunction(int Id, IClip *pClip)
 void CDittoAddins::LoadDittoInfo(CDittoInfo &DittoInfo)
 {
 	DittoInfo.m_csDatabasePath = CGetSetOptions::GetDBPath();
-	DittoInfo.m_csLanguageCode = theApp.m_Language.GetLangCode();
-	CInternetUpdate update;
-	//DittoInfo.m_nVersion = update.GetRunningVersion();
+	DittoInfo.m_csLanguageCode = theApp.m_Language.GetLangCode();	
 	DittoInfo.m_csSqliteVersion = sqlite3_libversion();
 	DittoInfo.m_hWndDitto = theApp.QPastehWnd();
 }

+ 2 - 2
EventThread.cpp

@@ -242,7 +242,7 @@ void CEventThread::RunThread()
 	{
 		CheckForRebuildHandleVector(handles);
 
-		DWORD event = WaitForMultipleObjects(handles.size(), handles.data(), FALSE, m_waitTimeout);
+		DWORD event = WaitForMultipleObjects((DWORD)handles.size(), handles.data(), FALSE, m_waitTimeout);
 
 		if(event == WAIT_FAILED)
 		{
@@ -250,7 +250,7 @@ void CEventThread::RunThread()
 			LPSTR messageBuffer = nullptr;
 			size_t size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, errorMessageId, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, nullptr);
 
-			CString message(messageBuffer, size);
+			CString message(messageBuffer, (int)size);
 
 			LocalFree(messageBuffer);
 

+ 2 - 2
ICU_String.cpp

@@ -87,7 +87,7 @@ CString CICU_String::ToLowerStringEx(CString source)
 
 	int length = source.GetLength();
 	int errorCode = 0;
-	u_strToLower(dest.GetBufferSetLength(length * 1.2), length*1.2, source.GetBuffer(), length, NULL, &errorCode);
+	u_strToLower(dest.GetBufferSetLength((int)(length * 1.2)), (int)(length * 1.2), source.GetBuffer(), length, NULL, &errorCode);
 
 	source.ReleaseBuffer();
 	dest.ReleaseBuffer();
@@ -106,7 +106,7 @@ CString CICU_String::ToUpperStringEx(CString source)
 
 	int length = source.GetLength();
 	int errorCode = 0;
-	u_strToUpper(dest.GetBufferSetLength(length*1.2), length*1.2, source.GetBuffer(), length, NULL, &errorCode);
+	u_strToUpper(dest.GetBufferSetLength((int)(length * 1.2)), (int)(length * 1.2), source.GetBuffer(), length, NULL, &errorCode);
 
 	source.ReleaseBuffer();
 	dest.ReleaseBuffer();

+ 1 - 1
ImageFormatAggregator.cpp

@@ -35,7 +35,7 @@ HGLOBAL CImageFormatAggregator::GetHGlobal()
 		return NULL;
 	}
 
-	int count = m_images.GetCount();
+	int count = (int)m_images.GetCount();
 	for (int i = 0; i < count; i++)
 	{
 		CClipFormat clip = m_images[i];

+ 2 - 2
ImageViewer.cpp

@@ -145,8 +145,8 @@ void CImageViewer::OnPaint()
 
 		Gdiplus::Rect dest((int)0, (int)0, (int)rect.Width(), (int)rect.Height());
 
-		double nW = rect.Width() * (1 / m_scale);
-		double nH = rect.Height() * (1 / m_scale);
+		int nW = (int)(rect.Width() * (1 / m_scale));
+		int nH = (int)(rect.Height() * (1 / m_scale));
 
 		graphics.DrawImage(m_pGdiplusBitmap, dest, s.cx, s.cy, nW, nH, Gdiplus::UnitPixel, &attrs);
 

+ 0 - 363
InternetUpdate.cpp

@@ -1,363 +0,0 @@
-// InternetUpdate.cpp: implementation of the CInternetUpdate class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-#include "cp_main.h"
-#include "InternetUpdate.h"
-#include <afxinet.h>
-#include "ProgressWnd.h"
-#include "io.h"
-
-#ifdef _DEBUG
-#undef THIS_FILE
-static char THIS_FILE[]=__FILE__;
-#define new DEBUG_NEW
-#endif
-
-#define HTTPBUFLEN    512 // Size of HTTP Buffer...
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-CInternetUpdate::CInternetUpdate()
-{
-
-}
-
-CInternetUpdate::~CInternetUpdate()
-{
-
-}
-
-//BOOL CInternetUpdate::CheckForUpdate(HWND hParent, BOOL bCheckForPrevUpdate, BOOL bShowNoUpdatesDlg)
-//{
-//	m_bShowMessages = bShowNoUpdatesDlg;
-//	m_hParent = hParent;
-//	
-//	CTime Now = CTime::GetCurrentTime();
-//	struct tm ptmTemp;
-//	tm tmNow = *(Now.GetLocalTm(&ptmTemp));
-//	long lCurrentDayOfYear = tmNow.tm_yday;
-//
-//	RemoveOldUpdateFile();
-//	
-//	if(bCheckForPrevUpdate)
-//	{
-//		if(!CGetSetOptions::GetCheckForUpdates())
-//			return FALSE;
-//
-//		long lLastUpdateDay = CGetSetOptions::GetLastUpdate();
-//
-//		if(lCurrentDayOfYear - lLastUpdateDay < 10)
-//			return FALSE;
-//
-//		//if the last time we check was today return
-//		if(lLastUpdateDay == lCurrentDayOfYear)
-//			return FALSE;
-//	}
-//
-//	CGetSetOptions::SetLastUpdate(lCurrentDayOfYear);
-//	
-//	BOOL bRet = FALSE;
-//	
-//	m_lRunningVersion = GetRunningVersion();
-//	m_lUpdateVersion = GetUpdateVersion();
-//
-//	if(m_lUpdateVersion > m_lRunningVersion)
-//	{
-//		CString csMessage;
-//		csMessage.Format(	_T("%s, %s\n")
-//							_T("%s, %s\n\n")
-//							_T("%s"),
-//							theApp.m_Language.GetString("Updates_Available", "Updates available for Ditto.\nVisit ditto-cp.sourceforge.net for details\n\nRunning Version"),
-//							GetVersionString(m_lRunningVersion), 
-//							theApp.m_Language.GetString("Update_Version", "Update Version"),
-//							GetVersionString(m_lUpdateVersion),
-//							theApp.m_Language.GetString("Download_Update", "Download updated version?"));
-//
-//		if(MessageBox(hParent, csMessage, _T("Ditto"), MB_YESNO) == IDYES)
-//		{
-//			CString csFile = DownloadUpdate();
-//
-//			if(!csFile.IsEmpty())
-//			{
-//				CloseHandle(theApp.m_hMutex);
-//				Sleep(100);
-//				ShellExecute(NULL, NULL, csFile, NULL, NULL, SW_SHOWNORMAL);
-//			}
-//
-//			bRet = TRUE;
-//		}
-//	}
-//	else if(m_bShowMessages)
-//	{
-//		MessageBox(hParent, theApp.m_Language.GetString("No_Updates", "No updates available"), _T("Ditto"), MB_OK);
-//	}
-//
-//	return bRet;
-//}
-
-//BOOL CInternetUpdate::RemoveOldUpdateFile()
-//{
-//	CString csFile = CGetSetOptions::GetPath(PATH_UPDATE_FILE);
-//	csFile += "DittoSetup.exe";
-//	
-//	BOOL bRet = TRUE;
-//	if(FileExists(csFile))
-//	{
-//		bRet = ::DeleteFile(csFile);
-//	}
-//
-//	return bRet;
-//}
-
-CString CInternetUpdate::GetVersionString(VersionInfo version)
-{
-	CString csLine;
-	csLine.Format(_T("%02i.%02i.%02i.%02i"), 
-		version.Major,
-		version.Minor,
-		version.Revision,
-		version.Build);
-
-	return csLine;
-}
-
-VersionInfo CInternetUpdate::GetRunningVersion()
-{
-	VersionInfo verInfo;
-	CString csFileName = CGetSetOptions::GetExeFileName();
-
-	DWORD dwSize, dwHandle;
-	LPBYTE lpData;
-	UINT iBuffSize;
-	VS_FIXEDFILEINFO *lpFFI;
-	long ver;
-
-	dwSize = GetFileVersionInfoSize(csFileName.GetBuffer(csFileName.GetLength()), &dwHandle);
-
-	if(dwSize != 0)
-	{
-		csFileName.ReleaseBuffer();
-		if((lpData=(unsigned char *)malloc(dwSize)) != NULL)
-		{
-			if(GetFileVersionInfo(csFileName.GetBuffer(csFileName.GetLength()), dwHandle, dwSize, lpData) != 0)
-			{
-				if(VerQueryValue(lpData, _T("\\"), (LPVOID*)&lpFFI, &iBuffSize) != 0)
-				{
-					if(iBuffSize > 0)
-					{
-						verInfo.Major = (lpFFI->dwProductVersionMS >> 16) & 0xffff;
-						verInfo.Minor = (lpFFI->dwProductVersionMS >> 0) & 0xffff;
-						verInfo.Revision = (lpFFI->dwProductVersionLS >> 16) & 0xffff;
-						verInfo.Build = (lpFFI->dwProductVersionLS >> 0) & 0xffff;
-					}
-				}
-			}
-			free(lpData);
-		}
-	}
-
-    return(verInfo);
-}
-
-//long CInternetUpdate::GetUpdateVersion()
-//{
-//	char httpbuff[HTTPBUFLEN];
-//	
-//	//Try to get a path from the regestry
-//	CString csPath = CGetSetOptions::GetUpdateFilePath();
-//
-//	//if nothing there get the default
-//	if(csPath.IsEmpty())
-//	{
-//		csPath = "ditto-cp.sourceforge.net/Update3/DittoVersion.txt";
-//	}
-//	
-//	CString csUrl = "http://" + csPath;
-//	
-//	CString csFile = CGetSetOptions::GetPath(PATH_UPDATE_FILE);
-//	csFile += "DittoVersion.txt";
-//
-//	bool bError = false;
-//	CStdioFile *remotefile = NULL;
-//
-//	long lReturn = -1;
-//	try
-//	{
-//		CInternetSession mysession;
-//		remotefile = mysession.OpenURL(csUrl,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
-//		if(!remotefile)
-//			return 0;
-//		
-//		CFile myfile(csFile, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
-//		
-//		UINT unBytesRead = 0;
-//		UINT unTotalBytes = 0;
-//		
-//		while (unBytesRead = remotefile->Read(httpbuff, HTTPBUFLEN))
-//		{
-//			unTotalBytes += unBytesRead;
-//			myfile.Write(httpbuff, unBytesRead);
-//
-//			if(!remotefile)
-//			{
-//				unTotalBytes = 0;
-//				break;
-//			}
-//		}
-//		
-//		myfile.Close();
-//		
-//		if(unTotalBytes)
-//		{
-//			CStdioFile file;
-//			if(file.Open(csFile, CFile::modeRead|CFile::typeText))
-//			{
-//				CString csVersion;
-//				if(file.ReadString(csVersion))
-//				{
-//					file.Close();		
-//					lReturn = ATOL(csVersion);
-//				}
-//			}
-//		}
-//	}
-//	catch(CInternetException *pEX)
-//	{
-//		bError = true;	
-//		pEX->Delete();
-//	}
-//	catch(CFileException *e)
-//	{
-//		bError = true;
-//		e->Delete();
-//	}
-//	catch(...)
-//	{
-//		bError = true;
-//		csFile.Empty();
-//	}
-//
-//	if(bError)
-//	{
-//		if(m_bShowMessages)
-//		{
-//			MessageBox(m_hParent, _T("Error Connecting."), _T("Ditto"), MB_OK);
-//			m_bShowMessages = FALSE;
-//		}
-//	}
-//	
-//	if(remotefile)
-//	{
-//		remotefile->Close();
-//
-//		delete remotefile;
-//		remotefile = NULL;
-//	}
-//
-//	if(FileExists(csFile))
-//		CFile::Remove(csFile);
-//
-//	return lReturn;
-//}
-
-//CString CInternetUpdate::DownloadUpdate()
-//{
-//	char httpbuff[HTTPBUFLEN];
-//	
-//	//Try to get a path from the regestry
-//	CString csPath = CGetSetOptions::GetUpdateInstallPath();
-//
-//	//if nothing there get the default
-//	if(csPath.IsEmpty())
-//	{
-//		csPath = "ditto-cp.sourceforge.net/U3/DittoSetup.exe";
-//	}
-//		
-//
-//	CString csUrl = "http://" + csPath;
-//	
-//	CString csFile = CGetSetOptions::GetPath(PATH_UPDATE_FILE);
-//	csFile += "DittoSetup.exe";
-//
-//	long lReturn = -1;
-//	CHttpFile	*RemoteFile = NULL;
-//
-//	try
-//	{
-//		CInternetSession mysession;
-//
-//		RemoteFile = (CHttpFile*)mysession.OpenURL(csUrl,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
-//		if(!RemoteFile)
-//			return "";
-//
-//		//Get the file size
-//		DWORD		dFileSize;
-//		RemoteFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH, dFileSize);
-//
-//		//Set up the progress wnd
-//		CProgressWnd progress;
-//		progress.Create(CWnd::FromHandlePermanent(m_hParent), _T("Ditto Update"));
-//		progress.SetRange(0, dFileSize, HTTPBUFLEN);
-//		progress.SetText(_T("Downloading Ditto Update ..."));
-//		
-//		//Create the file to put the info in
-//		CFile myfile(csFile, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
-//		
-//		UINT unBytesRead = 0;
-//		UINT unTotalBytes = 0;
-//		
-//		//Read in the file
-//		while (unBytesRead = RemoteFile->Read(httpbuff, HTTPBUFLEN))
-//		{
-//			progress.StepIt();
-//			progress.PeekAndPump();
-//			if(progress.Cancelled())
-//			{
-//				csFile.Empty();
-//				break;
-//			}
-//			
-//			unTotalBytes += unBytesRead;
-//			myfile.Write(httpbuff, unBytesRead);
-//
-//			if(!RemoteFile)
-//			{
-//				MessageBox(m_hParent, _T("Error Downloading update."), _T("Ditto"), MB_OK);
-//				csFile = "";
-//				break;
-//			}
-//		}
-//				
-//		myfile.Close();
-//	}
-//	catch(CInternetException *pEX)
-//	{
-//		MessageBox(m_hParent, _T("Error Downloading update."), _T("Ditto"), MB_OK);
-//		csFile.Empty();
-//		pEX->Delete();
-//	}
-//	catch(CFileException *e)
-//	{
-//		MessageBox(m_hParent, _T("Error Downloading update."), _T("Ditto"), MB_OK);
-//		csFile.Empty();
-//		e->Delete();
-//	}
-//	catch(...)
-//	{
-//		MessageBox(m_hParent, _T("Error Downloading update."), _T("Ditto"), MB_OK);
-//		csFile.Empty();
-//	}
-//
-//	if(RemoteFile)
-//	{
-//		RemoteFile->Close();
-//		delete RemoteFile;
-//		RemoteFile = NULL;
-//	}
-//
-//	return csFile;
-//}

+ 0 - 45
InternetUpdate.h

@@ -1,45 +0,0 @@
-// InternetUpdate.h: interface for the CInternetUpdate class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_INTERNETUPDATE_H__0ED6CFE4_1E10_4D32_93A1_1C5CC1FDA3D2__INCLUDED_)
-#define AFX_INTERNETUPDATE_H__0ED6CFE4_1E10_4D32_93A1_1C5CC1FDA3D2__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-class VersionInfo
-{
-public:
-	int Major;
-	int Minor;
-	int Revision;
-	int Build;
-};
-
-class CInternetUpdate  
-{
-public:
-	CInternetUpdate();
-	virtual ~CInternetUpdate();
-
-	//BOOL CheckForUpdate(HWND hParent, BOOL bCheckForPrevUpdate, BOOL bShowNoUpdatesDlg);
-
-	VersionInfo GetRunningVersion();
-	//long GetUpdateVersion();
-
-	CString GetVersionString(VersionInfo lVersion);
-	//CString DownloadUpdate();
-	
-protected:
-	//long m_lRunningVersion;
-	//long m_lUpdateVersion;
-	//HWND m_hParent;
-	//BOOL m_bShowMessages;
-
-	//BOOL RemoveOldUpdateFile();
-
-};
-
-#endif // !defined(AFX_INTERNETUPDATE_H__0ED6CFE4_1E10_4D32_93A1_1C5CC1FDA3D2__INCLUDED_)

+ 2 - 3
MainFrm.cpp

@@ -7,7 +7,6 @@
 #include "afxole.h"
 #include "Misc.h"
 #include "CopyProperties.h"
-#include "InternetUpdate.h"
 #include ".\mainfrm.h"
 #include "HyperLink.h"
 #include "tinyxml\tinyxml.h"
@@ -1513,14 +1512,14 @@ void CMainFrame::OnFirstDeleteallnonusedclips()
 
 LRESULT CMainFrame::OnPasteClip(WPARAM wParam, LPARAM lParam)
 {
-	PasteOrShowGroup(wParam, TRUE, FALSE, TRUE, false);
+	PasteOrShowGroup((int)wParam, TRUE, FALSE, TRUE, false);
 	return TRUE;
 }
 
 LRESULT CMainFrame::OnEditClip(WPARAM wParam, LPARAM lParam)
 {
 	CClipIDs IDs;
-	IDs.Add(wParam);
+	IDs.Add((int)wParam);
 
 	bool textOnly = false;
 	if (GetKeyState(VK_SHIFT) & 0x8000)

+ 49 - 0
Misc.cpp

@@ -1725,4 +1725,53 @@ int WordCount(const CString &text)
 	}
 
 	return wc;
+}
+
+CString GetVersionString(VersionInfo version)
+{
+	CString csLine;
+	csLine.Format(_T("%02i.%02i.%02i.%02i"),
+		version.Major,
+		version.Minor,
+		version.Revision,
+		version.Build);
+
+	return csLine;
+}
+
+VersionInfo GetRunningVersion()
+{
+	VersionInfo verInfo;
+	CString csFileName = CGetSetOptions::GetExeFileName();
+
+	DWORD dwSize, dwHandle;
+	LPBYTE lpData;
+	UINT iBuffSize;
+	VS_FIXEDFILEINFO* lpFFI;
+
+	dwSize = GetFileVersionInfoSize(csFileName.GetBuffer(csFileName.GetLength()), &dwHandle);
+
+	if (dwSize != 0)
+	{
+		csFileName.ReleaseBuffer();
+		if ((lpData = (unsigned char*)malloc(dwSize)) != NULL)
+		{
+			if (GetFileVersionInfo(csFileName.GetBuffer(csFileName.GetLength()), dwHandle, dwSize, lpData) != 0)
+			{
+				if (VerQueryValue(lpData, _T("\\"), (LPVOID*)&lpFFI, &iBuffSize) != 0)
+				{
+					if (iBuffSize > 0)
+					{
+						verInfo.Major = (lpFFI->dwProductVersionMS >> 16) & 0xffff;
+						verInfo.Minor = (lpFFI->dwProductVersionMS >> 0) & 0xffff;
+						verInfo.Revision = (lpFFI->dwProductVersionLS >> 16) & 0xffff;
+						verInfo.Build = (lpFFI->dwProductVersionLS >> 0) & 0xffff;
+					}
+				}
+			}
+			free(lpData);
+		}
+	}
+
+	return(verInfo);
 }

+ 12 - 0
Misc.h

@@ -216,4 +216,16 @@ BOOL RestoreDbPrompt(HWND hwnd);
 
 int WordCount(const CString& text);
 
+class VersionInfo
+{
+public:
+	int Major;
+	int Minor;
+	int Revision;
+	int Build;
+};
+
+VersionInfo GetRunningVersion();
+CString GetVersionString(VersionInfo version);
+
 #endif // !defined(AFX_CP_GUI_GLOBALS__FBCDED09_A6F2_47EB_873F_50A746EBC86B__INCLUDED_)

+ 3 - 3
Options.cpp

@@ -1597,7 +1597,7 @@ void CGetSetOptions::SetNetworkPassword(CString csPassword)
 CStringA CGetSetOptions::GetNetworkPassword()
 {
 	CString cs = GetProfileString("NetworkStringPassword", "LetMeIn");
-	CString csReturn = CTextConvert::UnicodeToUTF8(cs);
+	CStringA csReturn = CTextConvert::UnicodeToUTF8(cs);
 	return csReturn;
 }
 
@@ -3033,10 +3033,10 @@ void CGetSetOptions::SetIgnoreAnnoyingCFDIB(CString val)
 	SetProfileString("IgnoreAnnoyingCFDIB", val);
 }
 
-std::set<CString> CGetSetOptions::GetIgnoreAnnoyingCFDIBSet(BOOL useCache)
+set<CString> CGetSetOptions::GetIgnoreAnnoyingCFDIBSet(BOOL useCache)
 {
 	CString rawString = CGetSetOptions::GetIgnoreAnnoyingCFDIB(useCache);
-	std:set<CString> processSet;
+	set<CString> processSet;
 	CTokenizer token(rawString, _T(";"));
 	CString process;
 	while (token.Next(process))

+ 1 - 1
Options.h

@@ -676,7 +676,7 @@ public:
 	static CString GetIgnoreAnnoyingCFDIB(BOOL useCache = FALSE);
 	static CString m_ignoreAnnoyingCFDIB;
 	static void SetIgnoreAnnoyingCFDIB(CString val);
-	static std::set<CString> GetIgnoreAnnoyingCFDIBSet(BOOL useCache = FALSE);
+	static set<CString> GetIgnoreAnnoyingCFDIBSet(BOOL useCache = FALSE);
 
 	static BOOL GetRegexCaseInsensitive();
 	static void SetRegexCaseInsensitive(BOOL val);

+ 0 - 1
OptionsGeneral.cpp

@@ -4,7 +4,6 @@
 #include "stdafx.h"
 #include "CP_Main.h"
 #include "OptionsGeneral.h"
-#include "InternetUpdate.h"
 #include <io.h>
 #include <Mmsystem.h> //play sound
 #include "Path.h"

+ 3 - 3
ScrollHelper.cpp

@@ -66,8 +66,8 @@ void CScrollHelper::SetDisplaySize(int displayWidth, int displayHeight, double z
 
 	CRect rect;
 	GetClientRectSB(m_attachWnd, rect);
-	double width = (rect.Width() * (1 / m_zoomScale)) + .5;
-	double height = (rect.Height() * (1 / m_zoomScale)) + .5;
+	int width = (int)((rect.Width() * (1 / m_zoomScale)) + .5);
+	int height = (int)((rect.Height() * (1 / m_zoomScale)) + .5);
 	CSize windowSize(width, height);
 
 	if (windowSize.cx >= displayWidth)
@@ -458,7 +458,7 @@ void CScrollHelper::UpdateScrollInfo()
     GetClientRectSB(m_attachWnd, rect);
 	double width = (rect.Width() * (1 / m_zoomScale)) + .5;
 	double height = (rect.Height() * (1 / m_zoomScale)) + .5;
-    CSize windowSize(width, height * (1/m_zoomScale));
+    CSize windowSize((int)width, (int)(height * (1/m_zoomScale)));
 
     // Update horizontal scrollbar.
     CSize deltaPos(0,0);