summaryrefslogtreecommitdiff
path: root/plugins/AVS
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/AVS
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/AVS')
-rw-r--r--plugins/AVS/src/acc.cpp58
-rw-r--r--plugins/AVS/src/cache.cpp32
-rw-r--r--plugins/AVS/src/image_utils.cpp44
-rw-r--r--plugins/AVS/src/main.cpp40
-rw-r--r--plugins/AVS/src/options.cpp54
-rw-r--r--plugins/AVS/src/poll.cpp12
-rw-r--r--plugins/AVS/src/services.cpp84
-rw-r--r--plugins/AVS/src/utils.cpp30
8 files changed, 177 insertions, 177 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp
index 416c50279b..94142a7895 100644
--- a/plugins/AVS/src/acc.cpp
+++ b/plugins/AVS/src/acc.cpp
@@ -78,11 +78,11 @@ typedef struct
BOOL AnimatedGifGetData(ACCData *data)
{
FIBITMAP *page = fei->FI_LockPage(data->ag.multi, 0);
- if (page == NULL)
+ if (page == nullptr)
return FALSE;
// Get info
- FITAG *tag = NULL;
+ FITAG *tag = nullptr;
if (!fei->FI_GetMetadata(FIMD_ANIMATION, page, "LogicalWidth", &tag))
goto ERR;
data->ag.logicalWidth = *(WORD *)fei->FI_GetTagValue(tag);
@@ -124,16 +124,16 @@ void AnimatedGifMountFrame(ACCData* data, int page)
{
data->ag.frame.num = page;
- if (data->ag.hbms[page] != NULL) {
+ if (data->ag.hbms[page] != nullptr) {
data->ag.frame.disposal_method = GIF_DISPOSAL_LEAVE;
return;
}
FIBITMAP *dib = fei->FI_LockPage(data->ag.multi, data->ag.frame.num);
- if (dib == NULL)
+ if (dib == nullptr)
return;
- FITAG *tag = NULL;
+ FITAG *tag = nullptr;
if (fei->FI_GetMetadata(FIMD_ANIMATION, dib, "FrameLeft", &tag))
data->ag.frame.left = *(WORD *)fei->FI_GetTagValue(tag);
else
@@ -194,14 +194,14 @@ void AnimatedGifMountFrame(ACCData* data, int page)
void AnimatedGifDeleteTmpValues(ACCData* data)
{
- if (data->ag.multi != NULL) {
+ if (data->ag.multi != nullptr) {
fei->FI_CloseMultiBitmap(data->ag.multi, 0);
- data->ag.multi = NULL;
+ data->ag.multi = nullptr;
}
- if (data->ag.dib != NULL) {
+ if (data->ag.dib != nullptr) {
fei->FI_Unload(data->ag.dib);
- data->ag.dib = NULL;
+ data->ag.dib = nullptr;
}
}
@@ -212,18 +212,18 @@ void DestroyAnimatedGif(ACCData* data)
AnimatedGifDeleteTmpValues(data);
- if (data->ag.hbms != NULL) {
+ if (data->ag.hbms != nullptr) {
for (int i = 0; i < data->ag.frameCount; i++)
- if (data->ag.hbms[i] != NULL)
+ if (data->ag.hbms[i] != nullptr)
DeleteObject(data->ag.hbms[i]);
free(data->ag.hbms);
- data->ag.hbms = NULL;
+ data->ag.hbms = nullptr;
}
- if (data->ag.times != NULL) {
+ if (data->ag.times != nullptr) {
free(data->ag.times);
- data->ag.times = NULL;
+ data->ag.times = nullptr;
}
data->showingAnimatedGif = FALSE;
@@ -232,16 +232,16 @@ void DestroyAnimatedGif(ACCData* data)
void StartAnimatedGif(ACCData* data)
{
- if (fei == NULL)
+ if (fei == nullptr)
return;
- AVATARCACHEENTRY *ace = NULL;
+ AVATARCACHEENTRY *ace = nullptr;
if (data->hContact != NULL)
ace = (AVATARCACHEENTRY*)GetAvatarBitmap(data->hContact, 0);
else
ace = (AVATARCACHEENTRY*)GetMyAvatar(0, (LPARAM)data->proto);
- if (ace == NULL)
+ if (ace == nullptr)
return;
int format = ProtoGetAvatarFormat(ace->szFilename);
@@ -253,7 +253,7 @@ void StartAnimatedGif(ACCData* data)
fif = fei->FI_GetFIFFromFilenameU(ace->szFilename);
data->ag.multi = fei->FI_OpenMultiBitmapU(fif, ace->szFilename, FALSE, TRUE, FALSE, GIF_LOAD256);
- if (data->ag.multi == NULL)
+ if (data->ag.multi == nullptr)
return;
data->ag.frameCount = fei->FI_GetPageCount(data->ag.multi);
@@ -265,7 +265,7 @@ void StartAnimatedGif(ACCData* data)
// allocate entire logical area
data->ag.dib = fei->FI_Allocate(data->ag.logicalWidth, data->ag.logicalHeight, 32, 0, 0, 0);
- if (data->ag.dib == NULL)
+ if (data->ag.dib == nullptr)
goto ERR;
// fill with background color to start
@@ -288,7 +288,7 @@ void StartAnimatedGif(ACCData* data)
return;
ERR:
fei->FI_CloseMultiBitmap(data->ag.multi, 0);
- data->ag.multi = NULL;
+ data->ag.multi = nullptr;
}
void DestroyAnimation(ACCData* data)
@@ -334,12 +334,12 @@ static void Invalidate(HWND hwnd)
ScreenToClient(parent, &rc);
InvalidateRect(parent, &rc, TRUE);
}
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
static void NotifyAvatarChange(HWND hwnd)
{
- PSHNOTIFY pshn = { 0 };
+ PSHNOTIFY pshn = {};
pshn.hdr.idFrom = GetDlgCtrlID(hwnd);
pshn.hdr.hwndFrom = hwnd;
pshn.hdr.code = NM_AVATAR_CHANGED;
@@ -382,7 +382,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_TRANSPARENT);
data = (ACCData*)mir_calloc(sizeof(ACCData));
- if (data == NULL)
+ if (data == nullptr)
return FALSE;
SetWindowLongPtr(hwnd, 0, (LONG_PTR)data);
@@ -502,7 +502,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
else
ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)data->hContact, 0);
- if (ace == NULL || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
+ if (ace == nullptr || ace->bmHeight == 0 || ace->bmWidth == 0 || (data->respectHidden && (ace->dwFlags & AVS_HIDEONCLIST))) {
*width = 0;
*height = 0;
return TRUE;
@@ -553,7 +553,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
PAINTSTRUCT ps;
{
HDC hdc = BeginPaint(hwnd, &ps);
- if (hdc == NULL)
+ if (hdc == nullptr)
break;
int oldBkMode = SetBkMode(hdc, TRANSPARENT);
@@ -597,7 +597,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
ret = 1;
if (!data->ag.started) {
- SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], NULL);
+ SetTimer(hwnd, 0, data->ag.times[data->ag.frame.num], nullptr);
data->ag.started = TRUE;
}
}
@@ -642,7 +642,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case WM_SIZE:
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
break;
case WM_TIMER:
@@ -664,7 +664,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
AnimatedGifMountFrame(data, frame);
data->ag.started = FALSE;
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
break;
}
@@ -677,7 +677,7 @@ int LoadACC()
wc.cbSize = sizeof(wc);
wc.lpszClassName = AVATAR_CONTROL_CLASS;
wc.lpfnWndProc = ACCWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(ACCData*);
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index 18250bddd7..160f1a3d1b 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -25,7 +25,7 @@ CacheNode::CacheNode()
CacheNode::~CacheNode()
{
- if (hbmPic != 0)
+ if (hbmPic != nullptr)
DeleteObject(hbmPic);
}
@@ -69,11 +69,11 @@ void PushAvatarRequest(CacheNode *cc)
CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny)
{
if (g_shutDown)
- return NULL;
+ return nullptr;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || !db_get_b(NULL, AVS_MODULE, szProto, 1))
- return NULL;
+ if (szProto == nullptr || !db_get_b(NULL, AVS_MODULE, szProto, 1))
+ return nullptr;
AVATARCACHEENTRY tmp;
tmp.hContact = hContact;
@@ -82,13 +82,13 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny)
CacheNode *cc = arCache.find((CacheNode*)&tmp);
if (cc) {
- cc->t_lastAccess = time(NULL);
- return (cc->loaded || findAny) ? cc : NULL;
+ cc->t_lastAccess = time(nullptr);
+ return (cc->loaded || findAny) ? cc : nullptr;
}
// not found
if (!add)
- return NULL;
+ return nullptr;
cc = new CacheNode();
cc->hContact = hContact;
@@ -97,7 +97,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny)
PushAvatarRequest(cc);
SetEvent(hLoaderEvent); // wake him up
- return NULL;
+ return nullptr;
}
// output a notification message.
@@ -133,7 +133,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace)
// Get hash
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
DBVARIANT dbv = { 0 };
if (!db_get_s(hContact, szProto, "AvatarHash", &dbv)) {
if (dbv.type == DBVT_WCHAR)
@@ -198,7 +198,7 @@ int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode)
mir_cslock lck(cachecs);
CacheNode *cc = arCache.find((CacheNode*)&tmp);
- if (cc != NULL) {
+ if (cc != nullptr) {
DWORD dwFlags = cc->dwFlags;
cc->dwFlags = mode ? (cc->dwFlags | attrib) : (cc->dwFlags & ~attrib);
if (cc->dwFlags != dwFlags)
@@ -231,7 +231,7 @@ void PicLoader(LPVOID)
if (node)
arQueue.remove(0);
}
- if (node == NULL)
+ if (node == nullptr)
break;
if (db_get_b(node->hContact, "ContactPhoto", "NeedUpdate", 0))
@@ -239,18 +239,18 @@ void PicLoader(LPVOID)
AVATARCACHEENTRY ace_temp;
memcpy(&ace_temp, node, sizeof(AVATARCACHEENTRY));
- ace_temp.hbmPic = 0;
+ ace_temp.hbmPic = nullptr;
- int result = CreateAvatarInCache(node->hContact, &ace_temp, NULL);
+ int result = CreateAvatarInCache(node->hContact, &ace_temp, nullptr);
if (result == -2) {
char *szProto = GetContactProto(node->hContact);
- if (szProto == NULL || Proto_NeedDelaysForAvatars(szProto))
+ if (szProto == nullptr || Proto_NeedDelaysForAvatars(szProto))
QueueAdd(node->hContact);
else if (FetchAvatarFor(node->hContact, szProto) == GAIR_SUCCESS) // Try to create again
- result = CreateAvatarInCache(node->hContact, &ace_temp, NULL);
+ result = CreateAvatarInCache(node->hContact, &ace_temp, nullptr);
}
- if (result == 1 && ace_temp.hbmPic != 0) { // Loaded
+ if (result == 1 && ace_temp.hbmPic != nullptr) { // Loaded
HBITMAP oldPic = node->hbmPic;
{
mir_cslock l(cachecs);
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp
index 6219f7d8f5..020b618285 100644
--- a/plugins/AVS/src/image_utils.cpp
+++ b/plugins/AVS/src/image_utils.cpp
@@ -13,7 +13,7 @@ void MakeBmpTransparent(HBITMAP hBitmap)
DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -31,8 +31,8 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap)
DWORD dwLen = bmp.bmWidth * bmp.bmHeight * 4;
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
// Create bitmap
BITMAPINFO RGB32BitsBITMAPINFO;
@@ -44,14 +44,14 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap)
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
BYTE *ptPixels;
- HBITMAP hDirectBitmap = CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0);
+ HBITMAP hDirectBitmap = CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0);
// Copy data
if (bmp.bmBitsPixel != 32) {
- HDC hdcOrig = CreateCompatibleDC(NULL);
+ HDC hdcOrig = CreateCompatibleDC(nullptr);
HBITMAP oldOrig = (HBITMAP)SelectObject(hdcOrig, hBitmap);
- HDC hdcDest = CreateCompatibleDC(NULL);
+ HDC hdcDest = CreateCompatibleDC(nullptr);
HBITMAP oldDest = (HBITMAP)SelectObject(hdcDest, hDirectBitmap);
BitBlt(hdcDest, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOrig, 0, 0, SRCCOPY);
@@ -85,7 +85,7 @@ HBITMAP CreateBitmap32(int cx, int cy)
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
UINT *ptPixels;
- return CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0);
+ return CreateDIBSection(nullptr, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0);
}
// Set the color of points that are transparent
@@ -99,7 +99,7 @@ void SetTranspBkgColor(HBITMAP hBitmap, COLORREF color)
DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -161,22 +161,22 @@ void SetHIMETRICtoDP(HDC hdc, SIZE* sz)
HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename)
{
- if (fei == NULL)
- return 0;
+ if (fei == nullptr)
+ return nullptr;
FIBITMAP *dib = (FIBITMAP*)CallService(MS_IMG_LOAD, (WPARAM)ptszFilename, IMGL_RETURNDIB | IMGL_WCHAR);
- if (dib == NULL)
- return 0;
+ if (dib == nullptr)
+ return nullptr;
- FIBITMAP *dib32 = NULL;
+ FIBITMAP *dib32 = nullptr;
if (fei->FI_GetBPP(dib) != 32) {
dib32 = fei->FI_ConvertTo32Bits(dib);
fei->FI_Unload(dib);
}
else dib32 = dib;
- if (dib32 == NULL)
- return NULL;
+ if (dib32 == nullptr)
+ return nullptr;
if (fei->FI_IsTransparent(dib32))
if (bIsTransparent)
@@ -185,8 +185,8 @@ HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename)
if (fei->FI_GetWidth(dib32) > 128 || fei->FI_GetHeight(dib32) > 128) {
FIBITMAP *dib_new = fei->FI_MakeThumbnail(dib32, 128, FALSE);
fei->FI_Unload(dib32);
- if (dib_new == NULL)
- return 0;
+ if (dib_new == nullptr)
+ return nullptr;
dib32 = dib_new;
}
@@ -196,7 +196,7 @@ HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename)
return bitmap;
}
-static HWND hwndClui = 0;
+static HWND hwndClui = nullptr;
//
// Save ///////////////////////////////////////////////////////////////////////////////////////////
@@ -205,7 +205,7 @@ static HWND hwndClui = 0;
int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags)
{
- if (fei == NULL)
+ if (fei == nullptr)
return -1;
wchar_t tszFilename[MAX_PATH];
@@ -278,7 +278,7 @@ DWORD GetImgHash(HBITMAP hBitmap)
DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
WORD *p = (WORD *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return 0;
memset(p, 0, dwLen);
@@ -334,7 +334,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
DWORD dwLen = width * height * 4;
BYTE *p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return FALSE;
HBITMAP hBmpTmp;
@@ -490,7 +490,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap)
bool transpProportional = (db_get_b(NULL, AVS_MODULE, "MakeTransparencyProportionalToColorDiff", 0) != 0);
int *stack = (int *)malloc(width * height * 2 * sizeof(int));
- if (stack == NULL) {
+ if (stack == nullptr) {
free(p);
return FALSE;
}
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp
index ab86b8d03d..f691a0945d 100644
--- a/plugins/AVS/src/main.cpp
+++ b/plugins/AVS/src/main.cpp
@@ -26,15 +26,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst = 0;
-HICON g_hIcon = 0;
+HINSTANCE g_hInst = nullptr;
+HICON g_hIcon = nullptr;
bool g_shutDown = false;
int hLangpack;
wchar_t g_szDataPath[MAX_PATH]; // user datae path (read at startup only)
BOOL g_AvatarHistoryAvail = FALSE;
-HWND hwndSetMyAvatar = 0;
+HWND hwndSetMyAvatar = nullptr;
HANDLE hMyAvatarsFolder;
HANDLE hGlobalAvatarFolder;
@@ -56,14 +56,14 @@ OBJLIST<protoPicCacheEntry>
g_ProtoPictures(10, ComparePicture),
g_MyAvatars(10, ComparePicture);
-char *g_szMetaName = NULL;
+char *g_szMetaName = nullptr;
// Stores the id of the dialog
int OnDetailsInit(WPARAM wParam, LPARAM lParam);
int OptInit(WPARAM wParam, LPARAM lParam);
-FI_INTERFACE *fei = 0;
+FI_INTERFACE *fei = nullptr;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -82,10 +82,10 @@ PLUGININFOEX pluginInfoEx = {
static int ProtocolAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack != NULL && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) {
+ if (ack != nullptr && ack->type == ACKTYPE_AVATAR && !db_mc_isMeta(ack->hContact)) {
if (ack->result == ACKRESULT_SUCCESS) {
- if (ack->hProcess == NULL)
- ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, NULL, ack->szModule);
+ if (ack->hProcess == nullptr)
+ ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, nullptr, ack->szModule);
else
ProcessAvatarInfo(ack->hContact, GAIR_SUCCESS, (PROTO_AVATAR_INFORMATION*)ack->hProcess, ack->szModule);
}
@@ -94,7 +94,7 @@ static int ProtocolAck(WPARAM, LPARAM lParam)
}
else if (ack->result == ACKRESULT_STATUS) {
char *szProto = GetContactProto(ack->hContact);
- if (szProto == NULL || Proto_NeedDelaysForAvatars(szProto)) {
+ if (szProto == nullptr || Proto_NeedDelaysForAvatars(szProto)) {
// Queue
db_set_b(ack->hContact, "ContactPhoto", "NeedUpdate", 1);
QueueAdd(ack->hContact);
@@ -115,7 +115,7 @@ static int MetaChanged(WPARAM hMeta, LPARAM hSubContact)
// Get the node
CacheNode *node = FindAvatarInCache(hSubContact, true);
- if (node == NULL || !node->loaded) {
+ if (node == nullptr || !node->loaded) {
ace = (AVATARCACHEENTRY*)GetProtoDefaultAvatar(hSubContact);
QueueAdd(hSubContact);
}
@@ -198,7 +198,7 @@ static int OnAccChanged(WPARAM wParam, LPARAM lParam)
static int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- if (cws == NULL || g_shutDown)
+ if (cws == nullptr || g_shutDown)
return 0;
if (hContact == 0)
@@ -219,7 +219,7 @@ static int ShutdownProc(WPARAM, LPARAM)
g_shutDown = true;
SetEvent(hLoaderEvent);
SetEvent(hShutdownEvent);
- CloseHandle(hShutdownEvent); hShutdownEvent = NULL;
+ CloseHandle(hShutdownEvent); hShutdownEvent = nullptr;
return 0;
}
@@ -257,7 +257,7 @@ void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bm
if (GetClipRgn(r->hTargetDC, oldRgn) != 1) {
DeleteObject(oldRgn);
- oldRgn = NULL;
+ oldRgn = nullptr;
}
HRGN rgn;
@@ -324,9 +324,9 @@ static int ModulesLoaded(WPARAM, LPARAM)
{
wchar_t szEventName[100];
mir_snwprintf(szEventName, L"avs_loaderthread_%d", GetCurrentThreadId());
- hLoaderEvent = CreateEvent(NULL, TRUE, FALSE, szEventName);
+ hLoaderEvent = CreateEvent(nullptr, TRUE, FALSE, szEventName);
- SetThreadPriority(mir_forkthread(PicLoader, 0), THREAD_PRIORITY_IDLE);
+ SetThreadPriority(mir_forkthread(PicLoader, nullptr), THREAD_PRIORITY_IDLE);
// Folders plugin support
hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT L"\\Avatars");
@@ -335,10 +335,10 @@ static int ModulesLoaded(WPARAM, LPARAM)
g_AvatarHistoryAvail = ServiceExists(MS_AVATARHISTORY_ENABLED);
int accCount;
- PROTOACCOUNT **accs = NULL;
+ PROTOACCOUNT **accs = nullptr;
Proto_EnumAccounts(&accCount, &accs);
- if (fei != NULL) {
+ if (fei != nullptr) {
LoadDefaultInfo();
int protoCount;
@@ -364,7 +364,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
static int LoadAvatarModule()
{
- hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hShutdownEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
@@ -406,8 +406,8 @@ extern "C" int __declspec(dllexport) Load(void)
if (ServiceExists(MS_IMG_GETINTERFACE))
result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
- if (fei == NULL || result != S_OK) {
- MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar service"), MB_OK);
+ if (fei == nullptr || result != S_OK) {
+ MessageBox(nullptr, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar service"), MB_OK);
return 1;
}
LoadACC();
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp
index 97e6190c51..0ef9d71dd5 100644
--- a/plugins/AVS/src/options.cpp
+++ b/plugins/AVS/src/options.cpp
@@ -47,7 +47,7 @@ struct WindowData
static void RemoveProtoPic(const char *szProto)
{
- if (szProto == NULL)
+ if (szProto == nullptr)
return;
db_unset(NULL, PPICT_MODULE, szProto);
@@ -55,7 +55,7 @@ static void RemoveProtoPic(const char *szProto)
if (!mir_strcmp(AVS_DEFAULT, szProto)) {
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry &p = g_ProtoPictures[i];
- if (p.szProtoname == NULL)
+ if (p.szProtoname == nullptr)
continue;
p.clear();
@@ -72,10 +72,10 @@ static void RemoveProtoPic(const char *szProto)
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry &p = g_ProtoPictures[i];
- if (p.szProtoname == NULL)
+ if (p.szProtoname == nullptr)
continue;
PROTOACCOUNT *pdescr = Proto_GetAccount(p.szProtoname);
- if (pdescr == NULL && mir_strcmp(p.szProtoname, szProto))
+ if (pdescr == nullptr && mir_strcmp(p.szProtoname, szProto))
continue;
if (!mir_strcmp(p.szProtoname, szProto) || !mir_strcmp(pdescr->szProtoName, szProtoname)) {
@@ -104,7 +104,7 @@ static void SetProtoPic(char *szProto)
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lpstrFilter = filter;
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.nMaxFile = MAX_PATH;
ofn.nMaxFileTitle = MAX_PATH;
@@ -128,7 +128,7 @@ static void SetProtoPic(char *szProto)
if (mir_strlen(p.szProtoname) == 0)
continue;
- if (p.hbmPic == 0 || !mir_strcmp(p.szProtoname, AVS_DEFAULT)) {
+ if (p.hbmPic == nullptr || !mir_strcmp(p.szProtoname, AVS_DEFAULT)) {
CreateAvatarInCache(0, &p, szProto);
NotifyEventHooks(hEventChanged, 0, (LPARAM)&p);
}
@@ -140,13 +140,13 @@ static void SetProtoPic(char *szProto)
mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1);
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
PROTOACCOUNT* pdescr = Proto_GetAccount(g_ProtoPictures[i].szProtoname);
- if (pdescr == NULL && mir_strcmp(g_ProtoPictures[i].szProtoname, szProto))
+ if (pdescr == nullptr && mir_strcmp(g_ProtoPictures[i].szProtoname, szProto))
continue;
if (!mir_strcmp(g_ProtoPictures[i].szProtoname, szProto) || !mir_strcmp(pdescr->szProtoName, szProtoname)) {
protoPicCacheEntry& p = g_ProtoPictures[i];
if (mir_strlen(p.szProtoname) != 0) {
- if (p.hbmPic == 0) {
+ if (p.hbmPic == nullptr) {
CreateAvatarInCache(0, &p, szProto);
NotifyEventHooks(hEventChanged, 0, (LPARAM)&p);
}
@@ -161,7 +161,7 @@ static void SetProtoPic(char *szProto)
break;
if (!mir_strcmp(p.szProtoname, szProto) && mir_strlen(p.szProtoname) == mir_strlen(szProto)) {
- if (p.hbmPic != 0)
+ if (p.hbmPic != nullptr)
DeleteObject(p.hbmPic);
memset(&p, 0, sizeof(AVATARCACHEENTRY));
CreateAvatarInCache(0, &p, szProto);
@@ -277,10 +277,10 @@ static char* GetProtoFromList(HWND hwndDlg, int iItem)
item.mask = LVIF_PARAM;
item.iItem = iItem;
if (!ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROTOCOLS), &item))
- return NULL;
+ return nullptr;
protoPicCacheEntry *pce = (protoPicCacheEntry *)item.lParam;
- return (pce == NULL) ? NULL : pce->szProtoname;
+ return (pce == nullptr) ? nullptr : pce->szProtoname;
}
static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -392,12 +392,12 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar
}
else SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, dbv.ptszVal);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE);
db_free(&dbv);
}
else {
SetDlgItemText(hwndDlg, IDC_PROTOAVATARNAME, L"");
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE);
}
}
}
@@ -493,7 +493,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0);
ShowWindow(hwndDlg, SW_SHOWNORMAL);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, FALSE);
CheckDlgButton(hwndDlg, IDC_PROTECTAVATAR, db_get_b(hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, db_get_b(hContact, "ContactPhoto", "Hidden", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -573,7 +573,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
case IDC_RESET:
ProtectAvatar(hContact, 0);
- if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
DBVARIANT dbv = { 0 };
if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
@@ -597,7 +597,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_DELETE:
- if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
DBVARIANT dbv = { 0 };
ProtectAvatar(hContact, 0);
if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) {
@@ -612,7 +612,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
db_unset(hContact, "ContactPhoto", "Format");
DeleteAvatarFromCache(hContact, FALSE);
SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE);
break;
}
break;
@@ -685,11 +685,11 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
case DM_REALODAVATAR:
SaveTransparentData(hwndDlg, hContact, IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR));
ChangeAvatar(hContact, true);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE);
break;
case DM_AVATARCHANGED:
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, TRUE);
break;
case WM_NCDESTROY:
@@ -819,7 +819,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa
break;
case IDC_RESET:
ProtectAvatar(hContact, 0);
- if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
DBVARIANT dbv = { 0 };
if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
@@ -843,7 +843,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa
case IDC_DELETE:
ProtectAvatar(hContact, 0);
- if (MessageBox(0, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
+ if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
DBVARIANT dbv = { 0 };
if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) {
DeleteFile(dbv.ptszVal);
@@ -883,7 +883,7 @@ static char* GetSelectedProtocol(HWND hwndDlg)
// Get selection
int iItem = ListView_GetSelectionMark(hwndList);
if (iItem < 0)
- return NULL;
+ return nullptr;
// Get protocol name
LVITEM item = { 0 };
@@ -896,7 +896,7 @@ static char* GetSelectedProtocol(HWND hwndDlg)
static void EnableDisableControls(HWND hwndDlg, char *proto)
{
if (IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO)) {
- if (proto == NULL) {
+ if (proto == nullptr) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
}
@@ -954,7 +954,7 @@ static void EnableDisableProtocols(HWND hwndDlg, BOOL init)
}
char * proto = GetSelectedProtocol(hwndDlg);
- if (proto == NULL) {
+ if (proto == nullptr) {
ListView_SetItemState(hwndList, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x0F);
}
else {
@@ -1064,7 +1064,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP
SetMyAvatar(NULL, NULL);
else {
char *proto = GetSelectedProtocol(hwndDlg);
- if (proto != NULL)
+ if (proto != nullptr)
SetMyAvatar((WPARAM)proto, NULL);
}
break;
@@ -1076,7 +1076,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP
}
else {
char *proto = GetSelectedProtocol(hwndDlg);
- if (proto == NULL)
+ if (proto == nullptr)
break;
char description[256];
@@ -1113,7 +1113,7 @@ int OnDetailsInit(WPARAM wParam, LPARAM lParam)
}
else {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || db_get_b(NULL, AVS_MODULE, szProto, 1)) {
+ if (szProto == nullptr || db_get_b(NULL, AVS_MODULE, szProto, 1)) {
// Contact dialog
odp.pfnDlgProc = DlgProcAvatarUserInfo;
odp.position = -2000000000;
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp
index 1b02acda79..3a2a091e3b 100644
--- a/plugins/AVS/src/poll.cpp
+++ b/plugins/AVS/src/poll.cpp
@@ -63,7 +63,7 @@ static mir_cs cs;
void InitPolls()
{
// Init request queue
- mir_forkthread(RequestThread, NULL);
+ mir_forkthread(RequestThread, nullptr);
}
void UninitPolls()
@@ -97,7 +97,7 @@ static BOOL PollContactCanHaveAvatar(MCONTACT hContact, const char *szProto)
// Return true if this contact has to be checked
static BOOL PollCheckContact(MCONTACT hContact)
{
- return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, false, true) != NULL;
+ return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, false, true) != nullptr;
}
static void QueueRemove(MCONTACT hContact)
@@ -114,7 +114,7 @@ static void QueueRemove(MCONTACT hContact)
// Add an contact to a queue
void QueueAdd(MCONTACT hContact, int waitTime)
{
- if (fei == NULL || g_shutDown)
+ if (fei == nullptr || g_shutDown)
return;
mir_cslock lck(cs);
@@ -135,7 +135,7 @@ void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATION *pa
QueueRemove(hContact);
if (type == GAIR_SUCCESS) {
- if (pai == NULL)
+ if (pai == nullptr)
return;
// Fix settings in DB
@@ -186,10 +186,10 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto)
{
int result = GAIR_NOAVATAR;
- if (szProto == NULL)
+ if (szProto == nullptr)
szProto = GetContactProto(hContact);
- if (szProto != NULL && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) {
+ if (szProto != nullptr && PollProtocolCanHaveAvatar(szProto) && PollContactCanHaveAvatar(hContact, szProto)) {
// Can have avatar, but must request it?
if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, hContact, 0)) || (PollCheckProtocol(szProto) && PollCheckContact(hContact)))
{
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index c09163c78d..458ab27664 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -28,14 +28,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM)
{
- if (hContact == 0 || g_shutDown || fei == NULL)
+ if (hContact == 0 || g_shutDown || fei == nullptr)
return 0;
hContact = GetContactThatHaveTheAvatar(hContact);
// Get the node
CacheNode *node = FindAvatarInCache(hContact, true);
- if (node == NULL || !node->loaded)
+ if (node == nullptr || !node->loaded)
return (INT_PTR)GetProtoDefaultAvatar(hContact);
return (INT_PTR)node;
}
@@ -46,7 +46,7 @@ INT_PTR ProtectAvatar(WPARAM hContact, LPARAM lParam)
{
BYTE was_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
- if (fei == NULL || was_locked == (BYTE)lParam) // no need for redundant lockings...
+ if (fei == nullptr || was_locked == (BYTE)lParam) // no need for redundant lockings...
return 0;
if (hContact) {
@@ -98,8 +98,8 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case WM_NOTIFY:
if (data->setView) {
HWND hwndParent = GetParent(hwnd);
- HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL);
- if (hwndLv != NULL) {
+ HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr);
+ if (hwndLv != nullptr) {
SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0);
data->setView = FALSE;
}
@@ -121,19 +121,19 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam)
wchar_t *szFinalName;
BYTE locking_request;
- if (hContact == NULL || fei == NULL)
+ if (hContact == NULL || fei == nullptr)
return 0;
int is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0);
wchar_t *tszPath = (wchar_t*)lParam;
- if (tszPath == NULL) {
+ if (tszPath == nullptr) {
wchar_t filter[256];
Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
- ofn.hwndOwner = 0;
+ ofn.hwndOwner = nullptr;
ofn.lpstrFile = FileName;
ofn.lpstrFilter = filter;
ofn.nMaxFile = MAX_PATH;
@@ -179,7 +179,7 @@ INT_PTR SetAvatar(WPARAM hContact, LPARAM lParam)
static INT_PTR CanSetMyAvatar(WPARAM wParam, LPARAM)
{
char *protocol = (char *)wParam;
- if (protocol == NULL || fei == NULL)
+ if (protocol == nullptr || fei == nullptr)
return 0;
return ProtoServiceExists(protocol, PS_SETMYAVATAR);
@@ -196,9 +196,9 @@ static int InternalRemoveMyAvatar(char *protocol)
// Remove avatar
int ret = 0;
- if (protocol != NULL) {
+ if (protocol != nullptr) {
if (ProtoServiceExists(protocol, PS_SETMYAVATAR))
- ret = SaveAvatar(protocol, NULL);
+ ret = SaveAvatar(protocol, nullptr);
else
ret = -3;
@@ -225,7 +225,7 @@ static int InternalRemoveMyAvatar(char *protocol)
continue;
// Found a protocol
- int retTmp = SaveAvatar(accs[i]->szModuleName, NULL);
+ int retTmp = SaveAvatar(accs[i]->szModuleName, nullptr);
if (retTmp != 0)
ret = retTmp;
}
@@ -240,7 +240,7 @@ static int InternalRemoveMyAvatar(char *protocol)
SetIgnoreNotify(protocol, FALSE);
- ReportMyAvatarChanged(WPARAM((protocol == NULL) ? "" : protocol), 0);
+ ReportMyAvatarChanged(WPARAM((protocol == nullptr) ? "" : protocol), 0);
return ret;
}
@@ -293,7 +293,7 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM
CheckDlgButton(hwnd, IDC_MAKE_SQUARE, data->square ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_GROW, data->grow ? BST_CHECKED : BST_UNCHECKED);
- if (data->protocol != NULL && (Proto_AvatarImageProportion(data->protocol) & PIP_SQUARE))
+ if (data->protocol != nullptr && (Proto_AvatarImageProportion(data->protocol) & PIP_SQUARE))
EnableWindow(GetDlgItem(hwnd, IDC_MAKE_SQUARE), FALSE);
break;
@@ -301,8 +301,8 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM
data = (SetMyAvatarHookData *)ofn->lCustData;
if (data->thumbnail) {
HWND hwndParent = GetParent(hwnd);
- HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL);
- if (hwndLv != NULL) {
+ HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr);
+ if (hwndLv != nullptr) {
SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0);
data->thumbnail = FALSE;
}
@@ -314,7 +314,7 @@ static UINT_PTR CALLBACK SetMyAvatarHookProc(HWND hwnd, UINT msg, WPARAM, LPARAM
data->square = IsDlgButtonChecked(hwnd, IDC_MAKE_SQUARE);
data->grow = IsDlgButtonChecked(hwnd, IDC_GROW);
- hwndSetMyAvatar = NULL;
+ hwndSetMyAvatar = nullptr;
break;
}
@@ -407,7 +407,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen
d.hBmpProto = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0);
- if (d.hBmpProto == NULL) {
+ if (d.hBmpProto == nullptr) {
if (d.temp_file[0] != '\0')
DeleteFile(d.temp_file);
return -1;
@@ -489,7 +489,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
return -3;
// file exists...
- HBITMAP hBmp = NULL;
+ HBITMAP hBmp = nullptr;
if (format == PA_FORMAT_SWF) {
if (!allAcceptSWF)
@@ -502,14 +502,14 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
else {
// Try to open if is not a flash or XML
hBmp = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)szFinalName, IMGL_WCHAR);
- if (hBmp == NULL)
+ if (hBmp == nullptr)
return -4;
}
SetIgnoreNotify(protocol, TRUE);
int ret = 0;
- if (protocol != NULL) {
+ if (protocol != nullptr) {
ret = SetProtoMyAvatar(protocol, hBmp, szFinalName, format, data.square, data.grow);
if (ret == 0) {
DeleteGlobalUserAvatar();
@@ -542,7 +542,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
BOOL saved = TRUE;
if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) {
mir_snwprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar");
- CreateDirectory(globalFile, NULL);
+ CreateDirectory(globalFile, nullptr);
}
wchar_t *ext = wcsrchr(szFinalName, '.'); // Can't be NULL here
@@ -563,7 +563,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
HBITMAP hBmpTmp = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0);
// Check if need to resize
- if (hBmpTmp == hBmp || hBmpTmp == NULL) {
+ if (hBmpTmp == hBmp || hBmpTmp == nullptr) {
// Use original image
mir_snwprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
CopyFile(szFinalName, globalFile, FALSE);
@@ -595,34 +595,34 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
SetIgnoreNotify(protocol, FALSE);
- ReportMyAvatarChanged(WPARAM((protocol == NULL) ? "" : protocol), 0);
+ ReportMyAvatarChanged(WPARAM((protocol == nullptr) ? "" : protocol), 0);
return ret;
}
INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
wchar_t FileName[MAX_PATH];
- wchar_t *szFinalName = NULL;
+ wchar_t *szFinalName = nullptr;
BOOL allAcceptXML;
BOOL allAcceptSWF;
// Protocol allow seting of avatar?
char* protocol = (char*)wParam;
- if (protocol != NULL && !CanSetMyAvatar((WPARAM)protocol, 0))
+ if (protocol != nullptr && !CanSetMyAvatar((WPARAM)protocol, 0))
return -1;
wchar_t* tszPath = (wchar_t*)lParam;
- if (tszPath == NULL && hwndSetMyAvatar != 0) {
+ if (tszPath == nullptr && hwndSetMyAvatar != nullptr) {
SetForegroundWindow(hwndSetMyAvatar);
SetFocus(hwndSetMyAvatar);
ShowWindow(hwndSetMyAvatar, SW_SHOW);
return -2;
}
- SetMyAvatarHookData data = { 0 };
+ SetMyAvatarHookData data = {};
// Check for XML and SWF
- if (protocol == NULL) {
+ if (protocol == nullptr) {
allAcceptXML = TRUE;
allAcceptSWF = TRUE;
@@ -651,7 +651,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam)
|| db_get_b(0, AVS_MODULE, "SetAllwaysMakeSquare", 0);
}
- if (tszPath == NULL) {
+ if (tszPath == nullptr) {
data.protocol = protocol;
CMStringW filter;
@@ -677,7 +677,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam)
ofn.hInstance = g_hInst;
wchar_t title[256];
- if (protocol == NULL)
+ if (protocol == nullptr)
mir_snwprintf(title, TranslateT("Set my avatar"));
else {
wchar_t* prototmp = mir_a2u(protocol);
@@ -707,7 +707,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
static INT_PTR ContactOptions(WPARAM wParam, LPARAM)
{
if (wParam)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), 0, DlgProcAvatarOptions, (LPARAM)wParam);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AVATAROPTIONS), nullptr, DlgProcAvatarOptions, (LPARAM)wParam);
return 0;
}
@@ -715,29 +715,29 @@ static INT_PTR ContactOptions(WPARAM wParam, LPARAM)
INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
{
- AVATARCACHEENTRY *ace = NULL;
+ AVATARCACHEENTRY *ace = nullptr;
AVATARDRAWREQUEST *r = (AVATARDRAWREQUEST*)lParam;
- if (fei == NULL || r == NULL || IsBadReadPtr((void *)r, sizeof(AVATARDRAWREQUEST)))
+ if (fei == nullptr || r == nullptr || IsBadReadPtr((void *)r, sizeof(AVATARDRAWREQUEST)))
return 0;
if (r->cbSize != sizeof(AVATARDRAWREQUEST))
return 0;
if (r->dwFlags & AVDRQ_PROTOPICT) {
- if (r->szProto == NULL)
+ if (r->szProto == nullptr)
return 0;
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry& p = g_ProtoPictures[i];
- if (!mir_strcmp(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != 0) {
+ if (!mir_strcmp(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != nullptr) {
ace = (AVATARCACHEENTRY *)&g_ProtoPictures[i];
break;
}
}
}
else if (r->dwFlags & AVDRQ_OWNPIC) {
- if (r->szProto == NULL)
+ if (r->szProto == nullptr)
return 0;
if (r->szProto[0] == '\0' && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1))
@@ -748,9 +748,9 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
else ace = (AVATARCACHEENTRY *)GetAvatarBitmap((WPARAM)r->hContact, 0);
if (ace && (!(r->dwFlags & AVDRQ_RESPECTHIDDEN) || !(ace->dwFlags & AVS_HIDEONCLIST))) {
- ace->t_lastAccess = time(NULL);
+ ace->t_lastAccess = time(nullptr);
- if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == 0)
+ if (ace->bmHeight == 0 || ace->bmWidth == 0 || ace->hbmPic == nullptr)
return 0;
InternalDrawAvatar(r, ace->hbmPic, ace->bmWidth, ace->bmHeight, ace->dwFlags);
@@ -764,7 +764,7 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam)
INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- if (wParam || g_shutDown || fei == NULL)
+ if (wParam || g_shutDown || fei == nullptr)
return 0;
char *szProto = (char *)lParam;
@@ -772,7 +772,7 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam)
return 0;
for (int i = 0; i < g_MyAvatars.getCount(); i++)
- if (!mir_strcmp(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != 0)
+ if (!mir_strcmp(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != nullptr)
return (INT_PTR)&g_MyAvatars[i];
return 0;
@@ -818,7 +818,7 @@ static void ReloadMyAvatar(LPVOID lpParam)
INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM)
{
const char *proto = (const char*)wParam;
- if (proto == NULL)
+ if (proto == nullptr)
return -1;
for (int i = 0; i < g_MyAvatars.getCount(); i++) {
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp
index a20372b9dc..1aa82f4515 100644
--- a/plugins/AVS/src/utils.cpp
+++ b/plugins/AVS/src/utils.cpp
@@ -70,16 +70,16 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto)
ptrW tszValue;
wchar_t tszFilename[MAX_PATH]; tszFilename[0] = 0;
- ace->hbmPic = 0;
+ ace->hbmPic = nullptr;
ace->dwFlags = 0;
ace->bmHeight = 0;
ace->bmWidth = 0;
- ace->lpDIBSection = NULL;
+ ace->lpDIBSection = nullptr;
ace->szFilename[0] = 0;
- if (szProto == NULL) {
+ if (szProto == nullptr) {
char *proto = GetContactProto(hContact);
- if (proto == NULL || !db_get_b(NULL, AVS_MODULE, proto, 1))
+ if (proto == nullptr || !db_get_b(NULL, AVS_MODULE, proto, 1))
return -1;
if (db_get_b(hContact, "ContactPhoto", "Locked", 0) && (tszValue = db_get_wsa(hContact, "ContactPhoto", "Backup")))
@@ -100,7 +100,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto)
if (!strstr(szProto, "Global avatar for")) {
PROTOACCOUNT* pdescr = Proto_GetAccount(szProto);
- if (pdescr == NULL)
+ if (pdescr == nullptr)
return -1;
char key[MAX_PATH];
mir_snprintf(key, "Global avatar for %s accounts", pdescr->szProtoName);
@@ -148,10 +148,10 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto)
ace->dwFlags = 0;
ace->bmHeight = 0;
ace->bmWidth = 0;
- ace->lpDIBSection = NULL;
+ ace->lpDIBSection = nullptr;
wcsncpy(ace->szFilename, tszFilename, MAX_PATH);
ace->szFilename[MAX_PATH - 1] = 0;
- if (ace->hbmPic == 0)
+ if (ace->hbmPic == nullptr)
return -1;
BITMAP bminfo;
@@ -232,7 +232,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, char *szProto)
int GetFileHash(wchar_t* filename)
{
- HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return 0;
@@ -242,7 +242,7 @@ int GetFileHash(wchar_t* filename)
do {
// Read file chunk
dwRead = 0;
- ReadFile(hFile, data, 1024, &dwRead, NULL);
+ ReadFile(hFile, data, 1024, &dwRead, nullptr);
/* loop through each byte of data */
for (int byte = 0; byte < (int)dwRead; ++byte) {
@@ -269,7 +269,7 @@ int GetFileHash(wchar_t* filename)
protoPicCacheEntry::~protoPicCacheEntry()
{
- if (hbmPic != 0)
+ if (hbmPic != nullptr)
DeleteObject(hbmPic);
mir_free(szProtoname);
mir_free(tszAccName);
@@ -277,7 +277,7 @@ protoPicCacheEntry::~protoPicCacheEntry()
void protoPicCacheEntry::clear()
{
- if (hbmPic != 0)
+ if (hbmPic != nullptr)
DeleteObject(hbmPic);
memset(this, 0, sizeof(AVATARCACHEENTRY));
@@ -384,11 +384,11 @@ protoPicCacheEntry* GetProtoDefaultAvatar(MCONTACT hContact)
if (szProto) {
for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry& p = g_ProtoPictures[i];
- if (!mir_strcmp(p.szProtoname, szProto) && p.hbmPic != NULL)
+ if (!mir_strcmp(p.szProtoname, szProto) && p.hbmPic != nullptr)
return &g_ProtoPictures[i];
}
}
- return NULL;
+ return nullptr;
}
MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked)
@@ -412,7 +412,7 @@ int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist, int pa_format)
// Get the node
CacheNode *node = FindAvatarInCache(hContact, g_AvatarHistoryAvail && fNotifyHist, true);
- if (node == NULL)
+ if (node == nullptr)
return 0;
if (fNotifyHist)
@@ -446,7 +446,7 @@ void DeleteGlobalUserAvatar()
void SetIgnoreNotify(char *protocol, BOOL ignore)
{
for (int i = 0; i < g_MyAvatars.getCount(); i++) {
- if (protocol == NULL || !mir_strcmp(g_MyAvatars[i].szProtoname, protocol)) {
+ if (protocol == nullptr || !mir_strcmp(g_MyAvatars[i].szProtoname, protocol)) {
if (ignore)
g_MyAvatars[i].dwFlags |= AVS_IGNORENOTIFY;
else