summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CryptoPP/src/main.cpp23
-rw-r--r--plugins/Popup/src/bitmap_funcs.cpp6
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp7
-rw-r--r--plugins/SpellChecker/src/dictionary.cpp17
-rw-r--r--plugins/YAMN/src/debug.cpp17
5 files changed, 32 insertions, 38 deletions
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp
index af7aa6306f..7869c8d416 100644
--- a/plugins/CryptoPP/src/main.cpp
+++ b/plugins/CryptoPP/src/main.cpp
@@ -31,14 +31,21 @@ PLUGININFOEX pluginInfoEx = {
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID)
{
- g_hInst = hInst;
- InitializeCriticalSection(&localQueueMutex);
- InitializeCriticalSection(&localContextMutex);
-#ifdef _DEBUG
- isVista = 1;
-#else
- isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
-#endif
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ g_hInst = hInst;
+ #ifdef _DEBUG
+ isVista = 1;
+ #else
+ isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
+ #endif
+ InitializeCriticalSection(&localQueueMutex);
+ InitializeCriticalSection(&localContextMutex);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DeleteCriticalSection(&localQueueMutex);
+ DeleteCriticalSection(&localContextMutex);
+ }
+
return TRUE;
}
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp
index 8e37e796ad..add146491f 100644
--- a/plugins/Popup/src/bitmap_funcs.cpp
+++ b/plugins/Popup/src/bitmap_funcs.cpp
@@ -420,9 +420,6 @@ void MyBitmap::DrawColorized(MyBitmap *bmp, int x, int y, int w, int h, COLOR32
PU_DIV255(koef2b * cl * alpha),
alpha);
#pragma warning(pop)
-// bits[(i+y)*width + (j+x)] = (cl > 128) ?
-// rgba(koef1r * cl + br, koef1g * cl + bg, koef1b * cl + bb, geta(bmp->bits[int(i*ky)*bmp->width + int(j*kx)])):
-// rgba(koef2r * cl, koef2g * cl, koef2b * cl, geta(bmp->bits[int(i*ky)*bmp->width + int(j*kx)]));
}
}
}
@@ -461,7 +458,6 @@ void MyBitmap::BlendPart(MyBitmap *bmp, int xin, int yin, int win, int hin, int
getb(src)+PU_DIV255((255-alpha)*getb(dst)),
geta(src)+PU_DIV255((255-alpha)*geta(dst))
);
-// bits[(i+y)*width + (j+x)] = bmp->bits[int(yin+i*ky)*bmp->width + int(xin+j*kx)];
}
}
}
@@ -743,7 +739,7 @@ HRGN MyBitmap::buildOpaqueRgn(int level, bool opaque)
rectsCount += addRectsCount;
LPRGNDATA pRgnDataNew = (LPRGNDATA)(new BYTE[sizeof(RGNDATAHEADER) + (rectsCount)*sizeof(RECT)]);
memcpy(pRgnDataNew, pRgnData, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount * sizeof(RECT));
- delete pRgnData;
+ delete[] pRgnData;
pRgnData = pRgnDataNew;
pRects = (LPRECT)(&pRgnData->Buffer);
}
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index 7ab564817b..02a48befd3 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -332,18 +332,17 @@ void PopupWnd2::animate()
SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getShadowRegionOpacity()), FALSE);
- if (MyDwmEnableBlurBehindWindow && PopUpOptions.EnableAeroGlass)
- {
+ if (MyDwmEnableBlurBehindWindow && PopUpOptions.EnableAeroGlass) {
DWM_BLURBEHIND bb = {0};
bb.dwFlags = DWM_BB_ENABLE|DWM_BB_BLURREGION;
bb.fEnable = TRUE;
bb.hRgnBlur = m_bmp->buildOpaqueRgn(254, false);
MyDwmEnableBlurBehindWindow(m_hwnd, &bb);
+ DeleteObject(bb.hRgnBlur);
}
// update tooltips
- for (int i=0; i < m_actionCount; ++i)
- {
+ for (int i=0; i < m_actionCount; ++i) {
char *title = strchr(m_actions[i].actionA.lpzTitle, '/');
if (title) title++;
else title = m_actions[i].actionA.lpzTitle;
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp
index 883f5852f9..5ef89dae92 100644
--- a/plugins/SpellChecker/src/dictionary.cpp
+++ b/plugins/SpellChecker/src/dictionary.cpp
@@ -19,8 +19,6 @@ Boston, MA 02111-1307, USA.
#include "commons.h"
-DWORD WINAPI LoadThread(LPVOID hd);
-
// Additional languages that i could not find in Windows
TCHAR *aditionalLanguages[] = {
LPGENT("tl_PH"), LPGENT("Tagalog (Philippines)"),
@@ -337,6 +335,8 @@ struct {
#define LANGUAGE_LOADING -1
#define LANGUAGE_LOADED 0
+void LoadThread(LPVOID hd);
+
class HunspellDictionary : public Dictionary {
protected:
TCHAR fileWithoutExtension[1024];
@@ -412,7 +412,7 @@ protected:
WideCharToMultiByte(codePage, 0, word, -1, hunspellWord, (int)hunspellWordLen, NULL, NULL);
}
- TCHAR * fromHunspell(const char *hunspellWord)
+ TCHAR* fromHunspell(const char *hunspellWord)
{
int len = MultiByteToWideChar(codePage, 0, hunspellWord, -1, NULL, 0);
WCHAR *ret = (WCHAR *) malloc((len + 1) * sizeof(WCHAR));
@@ -420,7 +420,7 @@ protected:
return ret;
}
- TCHAR * fromHunspellAndFree(char *hunspellWord)
+ TCHAR* fromHunspellAndFree(char *hunspellWord)
{
if (hunspellWord == NULL)
return NULL;
@@ -695,10 +695,7 @@ public:
if (loaded == LANGUAGE_NOT_LOADED)
{
loaded = LANGUAGE_LOADING;
-
- DWORD thread_id;
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) LoadThread,
- (LPVOID) this, 0, &thread_id);
+ mir_forkthread(LoadThread, this);
}
}
@@ -722,12 +719,10 @@ public:
}
};
-
-DWORD WINAPI LoadThread(LPVOID hd)
+void LoadThread(LPVOID hd)
{
HunspellDictionary *dict = (HunspellDictionary *) hd;
dict->loadThread();
- return 0;
}
diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp
index 1f19975586..c459d0cbb7 100644
--- a/plugins/YAMN/src/debug.cpp
+++ b/plugins/YAMN/src/debug.cpp
@@ -15,7 +15,7 @@
//--------------------------------------------------------------------------------------------------
TCHAR DebugUserDirectory[MAX_PATH] = _T(".");
-LPCRITICAL_SECTION FileAccessCS;
+CRITICAL_SECTION FileAccessCS;
#ifdef DEBUG_SYNCHRO
TCHAR DebugSynchroFileName2[]=_T("%s\\yamn-debug.synchro.log");
@@ -40,11 +40,7 @@ void InitDebug()
#if defined (DEBUG_SYNCHRO) || defined (DEBUG_COMM) || defined (DEBUG_DECODE)
TCHAR DebugFileName[MAX_PATH];
#endif
- if (FileAccessCS==NULL)
- {
- FileAccessCS=new CRITICAL_SECTION;
- InitializeCriticalSection(FileAccessCS);
- }
+ InitializeCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
_stprintf(DebugFileName,DebugSynchroFileName2,DebugUserDirectory);
@@ -70,6 +66,7 @@ void InitDebug()
void UnInitDebug()
{
+ DeleteCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"File is being closed normally.");
CloseHandle(SynchroFile);
@@ -99,10 +96,10 @@ void DebugLog(HANDLE File,const char *fmt,...)
while(_vsnprintf(str,strsize,fmt,vararg)==-1)
str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
- EnterCriticalSection(FileAccessCS);
+ EnterCriticalSection(&FileAccessCS);
WriteFile(File,tids,(DWORD)strlen(tids),&Written,NULL);
WriteFile(File,str,(DWORD)strlen(str),&Written,NULL);
- LeaveCriticalSection(FileAccessCS);
+ LeaveCriticalSection(&FileAccessCS);
free(str);
}
@@ -120,10 +117,10 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...)
while(_vsnwprintf(str,strsize,fmt,vararg)==-1)
str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
- EnterCriticalSection(FileAccessCS);
+ EnterCriticalSection(&FileAccessCS);
WriteFile(File,tids,(DWORD)strlen(tids),&Written,NULL);
WriteFile(File,str,(DWORD)wcslen(str)*sizeof(WCHAR),&Written,NULL);
- LeaveCriticalSection(FileAccessCS);
+ LeaveCriticalSection(&FileAccessCS);
free(str);
}