summaryrefslogtreecommitdiff
path: root/updater/popups.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'updater/popups.cpp')
-rw-r--r--updater/popups.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/updater/popups.cpp b/updater/popups.cpp
index 7e29a80..7d7e20a 100644
--- a/updater/popups.cpp
+++ b/updater/popups.cpp
@@ -62,7 +62,7 @@ LRESULT CALLBACK NullWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM
return DefWindowProc(hWnd, message, wParam, lParam);
}
-void __stdcall sttPopupProcA( ULONG_PTR dwParam )
+void __stdcall sttPopupProcA( void *dwParam )
{
POPUPDATAEX* ppd = ( POPUPDATAEX* )dwParam;
@@ -75,7 +75,7 @@ void __stdcall sttPopupProcA( ULONG_PTR dwParam )
free( ppd );
}
-void __stdcall sttPopupProcW( ULONG_PTR dwParam )
+void __stdcall sttPopupProcW( void* dwParam )
{
POPUPDATAW* ppd = ( POPUPDATAW* )dwParam;
@@ -97,7 +97,7 @@ void ShowPopupA( HANDLE hContact, const char* line1, const char* line2, int flag
char *message = new char[strlen(line1) + strlen(line2) + 2]; // newline and null terminator
sprintf(message, "%s\n%s", line1, line2);
MessageBoxA( NULL, message, title, MB_OK | MB_ICONINFORMATION );
- delete message;
+ delete[] message;
} else if(line1) {
MessageBoxA( NULL, line1, title, MB_OK | MB_ICONINFORMATION );
} else if(line2) {
@@ -154,7 +154,7 @@ void ShowPopupA( HANDLE hContact, const char* line1, const char* line2, int flag
((PopupDataType*)ppd->PluginData)->flags = flags;
((PopupDataType*)ppd->PluginData)->hIcon = ppd->lchIcon;
- QueueUserAPC( sttPopupProcA , mainThread, ( ULONG_PTR )ppd );
+ CallFunctionAsync( sttPopupProcA , ppd );
}
}
@@ -164,13 +164,13 @@ void ShowPopupW( HANDLE hContact, const wchar_t* line1, const wchar_t* line2, in
if ( !ServiceExists( MS_POPUP_ADDPOPUPW )) {
wchar_t title[256];
- swprintf(title, L"%s Message", _T(MODULE));
+ _snwprintf(title, SIZEOF(title), L"%s Message", _T(MODULE));
if(line1 && line2) {
- wchar_t *message = new wchar_t[wcslen(line1) + wcslen(line2) + 2]; // newline and null terminator
- swprintf(message, L"%s\n%s", line1, line2);
+ size_t len = wcslen(line1) + wcslen(line2) + 1;
+ wchar_t *message = (wchar_t*)alloca(len * sizeof(wchar_t)); // newline and null terminator
+ _snwprintf(message, len, L"%s\n%s", line1, line2);
MessageBoxW( NULL, message, title, MB_OK | MB_ICONINFORMATION );
- delete message;
} else if(line1) {
MessageBoxW( NULL, line1, title, MB_OK | MB_ICONINFORMATION );
} else if(line2) {
@@ -226,21 +226,21 @@ void ShowPopupW( HANDLE hContact, const wchar_t* line1, const wchar_t* line2, in
((PopupDataType*)ppd->PluginData)->flags = flags;
((PopupDataType*)ppd->PluginData)->hIcon = ppd->lchIcon;
- QueueUserAPC( sttPopupProcW , mainThread, ( ULONG_PTR )ppd );
+ CallFunctionAsync( sttPopupProcW , ppd );
}
}
void ShowWarning(TCHAR *msg) {
if(ServiceExists(MS_POPUP_SHOWMESSAGE)) {
TCHAR title[512];
- _stprintf(title, _T("%s Warning"), _T(MODULE));
+ mir_sntprintf(title, SIZEOF(title), _T("%s Warning"), _T(MODULE));
TCHAR message[1024];
- _stprintf(message, _T("%s: %s"), _T(MODULE), msg);
+ mir_sntprintf(message, SIZEOF(message), _T("%s: %s"), _T(MODULE), msg);
ShowPopup(0, title, message, 0, 10);
//PUShowMessage(message, SM_WARNING);
} else {
TCHAR title[512];
- _stprintf(title, _T("%s Warning"), MODULE);
+ mir_sntprintf(title, SIZEOF(title), _T("%s Warning"), MODULE);
MessageBox(0, msg, title, MB_OK | MB_ICONWARNING);
}
}
@@ -250,17 +250,17 @@ void ShowPopup(HANDLE hContact, const TCHAR *line1, const TCHAR *line2, int flag
if(ServiceExists(MS_POPUP_ADDPOPUPW))
ShowPopupW(hContact, line1, line2, flags, timeout);
else {
- char *al1 = w2a(line1), *al2 = w2a(line2);
+ char *al1 = mir_u2a(line1), *al2 = mir_u2a(line2);
ShowPopupA(hContact, al1, al2, flags, timeout);
- free(al1); free(al2);
+ mir_free(al1); mir_free(al2);
}
#else
if(ServiceExists(MS_POPUP_ADDPOPUP))
ShowPopupA(hContact, line1, line2, flags, timeout);
else {
- wchar_t *wl1 = a2w(line1), *wl2 = a2w(line2);
+ wchar_t *wl1 = mir_a2u(line1), *wl2 = mir_a2u(line2);
ShowPopupW(hContact, wl1, wl2, flags, timeout);
- free(wl1); free(wl2);
+ mir_free(wl1); mir_free(wl2);
}
#endif
@@ -269,14 +269,14 @@ void ShowPopup(HANDLE hContact, const TCHAR *line1, const TCHAR *line2, int flag
void ShowError(TCHAR *msg) {
if(ServiceExists(MS_POPUP_SHOWMESSAGE)) {
TCHAR title[512];
- _stprintf(title, _T("%s Error"), _T(MODULE));
+ mir_sntprintf(title, SIZEOF(title), _T("%s Error"), _T(MODULE));
TCHAR message[1024];
- _stprintf(message, _T("%s: %s"), _T(MODULE), msg);
+ mir_sntprintf(message, SIZEOF(message), _T("%s: %s"), _T(MODULE), msg);
//PUShowMessage(message, SM_WARNING);
ShowPopup(0, title, message, 0, 10);
} else {
TCHAR title[512];
- _stprintf(title, _T("%s Error"), _T(MODULE));
+ mir_sntprintf(title, SIZEOF(title), _T("%s Error"), _T(MODULE));
MessageBox(0, msg, title, MB_OK | MB_ICONERROR);
}
}
@@ -286,17 +286,17 @@ void ChangePopupText(HWND hwnd, TCHAR *text) {
if(ServiceExists(MS_POPUP_CHANGETEXTW))
CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hwnd, (LPARAM)text);
else {
- char *atext = w2a(text);
+ char *atext = mir_u2a(text);
CallService(MS_POPUP_CHANGETEXT, (WPARAM)hwnd, (LPARAM)atext);
- free(atext);
+ mir_free(atext);
}
#else
if(ServiceExists(MS_POPUP_CHANGETEXT))
CallService(MS_POPUP_CHANGETEXT, (WPARAM)hwnd, (LPARAM)text);
else {
- wchar_t *wtext = a2w(text);
+ wchar_t *wtext = mir_a2u(text);
CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hwnd, (LPARAM)wtext);
- free(wtext);
+ mir_free(wtext);
}
#endif
}