summaryrefslogtreecommitdiff
path: root/plugins/SecureIM
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/SecureIM
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r--plugins/SecureIM/src/commonheaders.cpp8
-rw-r--r--plugins/SecureIM/src/crypt_check.cpp8
-rw-r--r--plugins/SecureIM/src/crypt_dll.cpp4
-rw-r--r--plugins/SecureIM/src/crypt_icons.cpp6
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp20
-rw-r--r--plugins/SecureIM/src/crypt_misc.cpp8
-rw-r--r--plugins/SecureIM/src/dbevent.cpp2
-rw-r--r--plugins/SecureIM/src/images.cpp40
-rw-r--r--plugins/SecureIM/src/loadicons.cpp18
-rw-r--r--plugins/SecureIM/src/loadlib.cpp4
-rw-r--r--plugins/SecureIM/src/main.cpp8
-rw-r--r--plugins/SecureIM/src/mmi.cpp8
-rw-r--r--plugins/SecureIM/src/options.cpp44
-rw-r--r--plugins/SecureIM/src/splitmsg.cpp6
-rw-r--r--plugins/SecureIM/src/svcs_clist.cpp10
-rw-r--r--plugins/SecureIM/src/svcs_menu.cpp14
-rw-r--r--plugins/SecureIM/src/svcs_proto.cpp26
-rw-r--r--plugins/SecureIM/src/svcs_rsa.cpp10
18 files changed, 122 insertions, 122 deletions
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp
index 31fe1d8792..0c46b53bdd 100644
--- a/plugins/SecureIM/src/commonheaders.cpp
+++ b/plugins/SecureIM/src/commonheaders.cpp
@@ -5,13 +5,13 @@ HINSTANCE g_hInst, g_hIconInst;
char TEMP[MAX_PATH];
int TEMP_SIZE = 0;
-HANDLE g_hEvent[2], g_hCLIcon, g_hFolders = 0;
+HANDLE g_hEvent[2], g_hCLIcon, g_hFolders = nullptr;
HGENMENU g_hMenu[15];
int iService = 0;
int iHook = 0;
-HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1 + IEC_CNT*MODE_CNT] = { 0 };
+HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1 + IEC_CNT*MODE_CNT] = {};
HANDLE g_IEC[1 + IEC_CNT*MODE_CNT];
int iBmpDepth;
@@ -25,7 +25,7 @@ mir_cs localQueueMutex;
LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *szSetting)
{
char *val = db_get_sa(hContact, szModule, szSetting);
- if (!val) return NULL;
+ if (!val) return nullptr;
size_t len = mir_strlen(val) + 64;
char *buf = (LPSTR)mir_alloc(len);
strncpy(buf, val, len); mir_free(val);
@@ -86,7 +86,7 @@ void CopyToClipboard(HWND hwnd, LPSTR msg)
mir_strcpy(lpstrCopy, msg);
GlobalUnlock(hglbCopy);
- if(OpenClipboard(NULL)) {
+ if(OpenClipboard(nullptr)) {
EmptyClipboard();
SetClipboardData(CF_TEXT, hglbCopy);
CloseClipboard();
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp
index 67b80e507b..183f93f62f 100644
--- a/plugins/SecureIM/src/crypt_check.cpp
+++ b/plugins/SecureIM/src/crypt_check.cpp
@@ -56,7 +56,7 @@ BYTE isContactSecured(MCONTACT hContact)
break;
case MODE_RSA:
- if (p->cntx != 0) res |= SECURED;
+ if (p->cntx != nullptr) res |= SECURED;
break;
}
return res;
@@ -70,7 +70,7 @@ bool isClientMiranda(pUinKey ptr, BOOL emptyMirverAsMiranda)
bool isMiranda = true;
LPSTR mirver = db_get_sa(ptr->hContact, ptr->proto->name, "MirVer");
if (mirver) {
- isMiranda = (emptyMirverAsMiranda && !*mirver) || (strstr(mirver, "Miranda") != NULL);
+ isMiranda = (emptyMirverAsMiranda && !*mirver) || (strstr(mirver, "Miranda") != nullptr);
mir_free(mirver);
}
return isMiranda;
@@ -91,7 +91,7 @@ bool isProtoSmallPackets(MCONTACT hContact)
if (!p || !p->proto || !p->proto->inspecting)
return false;
- return strstr(p->proto->name, "IRC") != NULL || strstr(p->proto->name, "WinPopup") != NULL || strstr(p->proto->name, "VyChat") != NULL;
+ return strstr(p->proto->name, "IRC") != nullptr || strstr(p->proto->name, "WinPopup") != nullptr || strstr(p->proto->name, "VyChat") != nullptr;
}
bool isContactInvisible(MCONTACT hContact)
@@ -199,7 +199,7 @@ bool isSecureIM(pUinKey ptr, BOOL emptyMirverAsSecureIM)
bool isSecureIM = false;
LPSTR mirver = db_get_sa(ptr->hContact, ptr->proto->name, "MirVer");
if (mirver) {
- isSecureIM = (emptyMirverAsSecureIM && !*mirver) || (strstr(mirver, "SecureIM") != NULL) || (strstr(mirver, "secureim") != NULL);
+ isSecureIM = (emptyMirverAsSecureIM && !*mirver) || (strstr(mirver, "SecureIM") != nullptr) || (strstr(mirver, "secureim") != nullptr);
mir_free(mirver);
}
return isSecureIM;
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp
index 162b6090ab..afa18459e0 100644
--- a/plugins/SecureIM/src/crypt_dll.cpp
+++ b/plugins/SecureIM/src/crypt_dll.cpp
@@ -131,10 +131,10 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg)
CCSDATA *pccsd = (CCSDATA *)lParam;
PROTORECVEVENT *ppre = (PROTORECVEVENT *)pccsd->lParam;
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
LPSTR szOldMsg = cpp_decodeU(ptr->cntx, szEncMsg);
- if (szOldMsg == NULL) {
+ if (szOldMsg == nullptr) {
ptr->decoded = false;
switch (cpp_get_error(ptr->cntx)) {
case CPP_ERROR_BAD_LEN:
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp
index 3d7a74ac46..d0ad9953a5 100644
--- a/plugins/SecureIM/src/crypt_icons.cpp
+++ b/plugins/SecureIM/src/crypt_icons.cpp
@@ -38,7 +38,7 @@ static ICON_CACHE& getCacheItem(int mode, int type)
ICON_CACHE *p = new ICON_CACHE;
p->icon = icon;
p->mode = (type << 8) | mode;
- p->hCLIcon = NULL;
+ p->hCLIcon = nullptr;
arIcoList.insert(p);
return *p;
@@ -55,7 +55,7 @@ HANDLE mode2clicon(int mode, int type)
return INVALID_HANDLE_VALUE;
ICON_CACHE &p = getCacheItem(mode, type);
- if (p.hCLIcon == NULL)
+ if (p.hCLIcon == nullptr)
p.hCLIcon = ExtraIcon_AddIcon(p.icon);
return p.hCLIcon;
@@ -107,7 +107,7 @@ void ShowStatusIconNotify(MCONTACT hContact)
void RefreshContactListIcons(void)
{
for (int i = 0; i < arIcoList.getCount(); i++)
- arIcoList[i].hCLIcon = 0;
+ arIcoList[i].hCLIcon = nullptr;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
if (isSecureProtocol(hContact))
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp
index 3eeabe0721..bb97d160f0 100644
--- a/plugins/SecureIM/src/crypt_lists.cpp
+++ b/plugins/SecureIM/src/crypt_lists.cpp
@@ -6,7 +6,7 @@ LIST<UinKey> arClist(100, NumericKeySortT);
void loadSupportedProtocols()
{
LPSTR szNames = db_get_sa(0, MODULENAME, "protos");
- if (szNames && strchr(szNames, ':') == NULL) {
+ if (szNames && strchr(szNames, ':') == nullptr) {
LPSTR tmp = (LPSTR)mir_alloc(2048); int j = 0;
for (int i = 0; szNames[i]; i++) {
if (szNames[i] == ';')
@@ -70,16 +70,16 @@ pSupPro getSupPro(MCONTACT hContact)
if (Proto_IsProtoOnContact(hContact, arProto[j]->name))
return arProto[j];
- return NULL;
+ return nullptr;
}
// add contact in the list of secureIM users
pUinKey addContact(MCONTACT hContact)
{
- if (hContact == NULL) return NULL;
+ if (hContact == NULL) return nullptr;
pSupPro proto = getSupPro(hContact);
- if (proto == NULL) return NULL;
+ if (proto == nullptr) return nullptr;
pUinKey p = (pUinKey)mir_calloc(sizeof(UinKey));
p->header = HEADER;
@@ -107,7 +107,7 @@ void delContact(MCONTACT hContact)
if (p) {
arClist.remove(p);
- cpp_delete_context(p->cntx); p->cntx = 0;
+ cpp_delete_context(p->cntx); p->cntx = nullptr;
mir_free(p->tmp);
mir_free(p->msgSplitted);
mir_free(p);
@@ -129,7 +129,7 @@ void freeContactList()
{
for (int j = 0; j < arClist.getCount(); j++) {
pUinKey p = arClist[j];
- cpp_delete_context(p->cntx); p->cntx = 0;
+ cpp_delete_context(p->cntx); p->cntx = nullptr;
mir_free(p->tmp);
mir_free(p->msgSplitted);
mir_free(p);
@@ -157,7 +157,7 @@ pUinKey getUinCtx(HANDLE cntx)
if (arClist[j]->cntx == cntx)
return arClist[j];
- return NULL;
+ return nullptr;
}
// add message to user queue for send later
@@ -169,7 +169,7 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg)
mir_cslock lck(localQueueMutex);
- if (ptr->msgQueue == NULL) {
+ if (ptr->msgQueue == nullptr) {
// create new
ptr->msgQueue = (pWM)mir_alloc(sizeof(struct waitingMessage));
ptrMessage = ptr->msgQueue;
@@ -185,7 +185,7 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg)
}
ptrMessage->wParam = wParam;
- ptrMessage->nextMessage = NULL;
+ ptrMessage->nextMessage = nullptr;
ptrMessage->Message = mir_strdup(szMsg);
}
@@ -210,7 +210,7 @@ void getContactUinA(MCONTACT hContact, LPSTR szUIN)
DBVARIANT dbv_uniqueid;
LPSTR uID = (LPSTR)CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = 0; // Billy_Bons
+ if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = nullptr; // Billy_Bons
if (uID && db_get(hContact, ptr->name, uID, &dbv_uniqueid) == 0) {
if (dbv_uniqueid.type == DBVT_WORD)
sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name); //!!!!!!!!!!!
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp
index dfda8a284a..8f60119b0b 100644
--- a/plugins/SecureIM/src/crypt_misc.cpp
+++ b/plugins/SecureIM/src/crypt_misc.cpp
@@ -17,7 +17,7 @@ static void sttWaitForExchange(LPVOID param)
// if keyexchange failed or timeout
if (ptr->waitForExchange == 1 || ptr->waitForExchange == 3) { // протухло - отправляем незашифрованно, если надо
- if (ptr->msgQueue && msgbox1(0, sim104, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (ptr->msgQueue && msgbox1(nullptr, sim104, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES) {
mir_cslock lck(localQueueMutex);
ptr->sendQueue = true;
pWM ptrMessage = ptr->msgQueue;
@@ -31,7 +31,7 @@ static void sttWaitForExchange(LPVOID param)
ptrMessage = ptrMessage->nextMessage;
mir_free(tmp);
}
- ptr->msgQueue = NULL;
+ ptr->msgQueue = nullptr;
ptr->sendQueue = false;
}
ptr->waitForExchange = 0;
@@ -51,7 +51,7 @@ static void sttWaitForExchange(LPVOID param)
ptrMessage = ptrMessage->nextMessage;
mir_free(tmp);
}
- ptr->msgQueue = NULL;
+ ptr->msgQueue = nullptr;
ptr->waitForExchange = 0;
}
else if (ptr->waitForExchange == 0) { // очистить очередь
@@ -64,7 +64,7 @@ static void sttWaitForExchange(LPVOID param)
ptrMessage = ptrMessage->nextMessage;
mir_free(tmp);
}
- ptr->msgQueue = NULL;
+ ptr->msgQueue = nullptr;
}
}
diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp
index 9ed7a92671..495bc324e2 100644
--- a/plugins/SecureIM/src/dbevent.cpp
+++ b/plugins/SecureIM/src/dbevent.cpp
@@ -5,7 +5,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText)
DBEVENTINFO dbei = {};
dbei.szModule = GetContactProto(hContact);
dbei.flags = DBEF_SENT | DBEF_READ;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)mir_strlen(szText) + 1;
dbei.pBlob = (PBYTE)szText;
diff --git a/plugins/SecureIM/src/images.cpp b/plugins/SecureIM/src/images.cpp
index ea171fd482..60a1af63d1 100644
--- a/plugins/SecureIM/src/images.cpp
+++ b/plugins/SecureIM/src/images.cpp
@@ -9,7 +9,7 @@ void HalfBitmap32Alpha(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);
@@ -39,7 +39,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);
@@ -64,7 +64,7 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force)
dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
+ if (p == nullptr)
return;
memset(p, 0, dwLen);
@@ -106,8 +106,8 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap)
dwLen = bmp.bmWidth * bmp.bmHeight * 4;
p = (BYTE *)malloc(dwLen);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
// Create bitmap
BITMAPINFO RGB32BitsBITMAPINFO;
@@ -118,21 +118,21 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap)
RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- HBITMAP hDirectBitmap = CreateDIBSection(NULL,
+ HBITMAP hDirectBitmap = CreateDIBSection(nullptr,
(BITMAPINFO *)&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
(void **)&ptPixels,
- NULL, 0);
+ nullptr, 0);
// Copy data
if (bmp.bmBitsPixel != 32) {
HDC hdcOrig, hdcDest;
HBITMAP oldOrig, oldDest;
- hdcOrig = CreateCompatibleDC(NULL);
+ hdcOrig = CreateCompatibleDC(nullptr);
oldOrig = (HBITMAP)SelectObject(hdcOrig, hBitmap);
- hdcDest = CreateCompatibleDC(NULL);
+ hdcDest = CreateCompatibleDC(nullptr);
oldDest = (HBITMAP)SelectObject(hdcDest, hDirectBitmap);
BitBlt(hdcDest, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOrig, 0, 0, SRCCOPY);
@@ -168,11 +168,11 @@ HBITMAP CreateBitmap32(int cx, int cy)
RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
- HBITMAP DirectBitmap = CreateDIBSection(NULL,
+ HBITMAP DirectBitmap = CreateDIBSection(nullptr,
(BITMAPINFO *)&RGB32BitsBITMAPINFO,
DIB_RGB_COLORS,
(void **)&ptPixels,
- NULL, 0);
+ nullptr, 0);
return DirectBitmap;
}
@@ -197,7 +197,7 @@ BOOL MakeBitmap32(HBITMAP *hBitmap)
BOOL MakeGrayscale(HBITMAP *hBitmap)
{
- BYTE *p = NULL;
+ BYTE *p = nullptr;
BYTE *p1;
DWORD dwLen;
int width, height, x, y;
@@ -209,7 +209,7 @@ BOOL MakeGrayscale(HBITMAP *hBitmap)
dwLen = width * height * 4;
p = (BYTE *)malloc(dwLen);
- if (p == NULL) {
+ if (p == nullptr) {
return FALSE;
}
@@ -241,11 +241,11 @@ HICON MakeHalfAlphaIcon(HICON SourceIcon)
ICONINFO TargetIconInfo;
if (!GetIconInfo(TempIcon, &TargetIconInfo))
- return NULL;
+ return nullptr;
BITMAP TargetBitmapInfo;
if (!GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo))
- return NULL;
+ return nullptr;
MakeBitmap32(&TargetIconInfo.hbmColor);
HalfBitmap32Alpha(TargetIconInfo.hbmColor);
@@ -264,7 +264,7 @@ HICON MakeGrayscaleIcon(HICON SourceIcon)
ICONINFO TargetIconInfo;
BITMAP TargetBitmapInfo;
if (!GetIconInfo(TempIcon, &TargetIconInfo) || GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo) == 0)
- return NULL;
+ return nullptr;
MakeGrayscale(&TargetIconInfo.hbmColor);
@@ -286,19 +286,19 @@ HICON BindOverlayIcon(HICON SourceIcon, HICON OverlayIcon)
TempIcon = CopyIcon(SourceIcon);
if (!GetIconInfo(TempIcon, &TargetIconInfo))
- return NULL;
+ return nullptr;
MakeBitmap32(&TargetIconInfo.hbmColor);
CorrectBitmap32Alpha(TargetIconInfo.hbmColor, FALSE);
GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo);
if (!GetIconInfo(OverlayIcon, &OverlayIconInfo) || !GetObject(OverlayIconInfo.hbmColor, sizeof(BITMAP), &OverlayBitmapInfo))
- return NULL;
+ return nullptr;
- TargetDC = CreateCompatibleDC(NULL);
+ TargetDC = CreateCompatibleDC(nullptr);
OldTargetBitmap = (HBITMAP)SelectObject(TargetDC, TargetIconInfo.hbmColor);
- OverlayDC = CreateCompatibleDC(NULL);
+ OverlayDC = CreateCompatibleDC(nullptr);
OldOverlayBitmap = (HBITMAP)SelectObject(OverlayDC, OverlayIconInfo.hbmColor);
AlphaBlend(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight,
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp
index ceb5a545cd..756a235b4c 100644
--- a/plugins/SecureIM/src/loadicons.cpp
+++ b/plugins/SecureIM/src/loadicons.cpp
@@ -45,11 +45,11 @@ static icons[] =
HINSTANCE LoadIconsPack(const char* szIconsPack)
{
HINSTANCE hNewIconInst = LoadLibrary(szIconsPack);
- if (hNewIconInst != NULL) {
+ if (hNewIconInst != nullptr) {
for (int i = ID_FIRSTICON; i <= ID_LASTICON; i++)
- if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == NULL) {
+ if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == nullptr) {
FreeLibrary(hNewIconInst);
- hNewIconInst = NULL;
+ hNewIconInst = nullptr;
break;
}
}
@@ -73,22 +73,22 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam)
void InitIcons(void)
{
- HINSTANCE hNewIconInst = NULL;
+ HINSTANCE hNewIconInst = nullptr;
if (g_hFolders) {
char pathname[MAX_PATH];
FoldersGetCustomPath(g_hFolders, pathname, MAX_PATH, "icons\\");
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
hNewIconInst = LoadIconsPack(pathname);
}
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
hNewIconInst = LoadIconsPack("icons\\secureim_icons.dll");
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
hNewIconInst = LoadIconsPack("plugins\\secureim_icons.dll");
- if (hNewIconInst == NULL)
+ if (hNewIconInst == nullptr)
g_hIconInst = g_hInst;
else
g_hIconInst = hNewIconInst;
@@ -96,7 +96,7 @@ void InitIcons(void)
char tszPath[MAX_PATH];
GetModuleFileName(g_hIconInst, tszPath, _countof(tszPath));
- SKINICONDESC sid = { 0 };
+ SKINICONDESC sid = {};
sid.section.a = "SecureIM";
sid.defaultFile.a = tszPath;
diff --git a/plugins/SecureIM/src/loadlib.cpp b/plugins/SecureIM/src/loadlib.cpp
index 640f464ce4..c1c5cc483e 100644
--- a/plugins/SecureIM/src/loadlib.cpp
+++ b/plugins/SecureIM/src/loadlib.cpp
@@ -6,9 +6,9 @@ HMODULE h;
BOOL loadlib(void)
{
h = LoadLibrary("plugins/cryptopp.dll");
- if (h == NULL) {
+ if (h == nullptr) {
h = LoadLibrary("cryptopp.dll");
- if (h == NULL) return 0;
+ if (h == nullptr) return 0;
}
cpp.cc = (_cpp_create_context)GetProcAddress(h, "cpp_create_context");
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index 22a5ef4749..a56200fff4 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -107,7 +107,7 @@ static int onModulesLoaded(WPARAM, LPARAM)
}
if (!rsa_4096)
- mir_forkthread(sttGenerateRSA, NULL);
+ mir_forkthread(sttGenerateRSA, nullptr);
mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10));
@@ -236,7 +236,7 @@ static int onModulesLoaded(WPARAM, LPARAM)
g_hMenu[0] = MyAddMenuItem(sim301, 110000, "5A8C2F35-4699-43A4-A820-516DEB83FCA1", g_hICO[ICO_CM_EST], MODULENAME"/SIM_EST", CMIF_NOTOFFLINE);
g_hMenu[1] = MyAddMenuItem(sim302, 110001, "0B092254-DA91-42D6-A89D-365981BB3D91", g_hICO[ICO_CM_DIS], MODULENAME"/SIM_DIS", CMIF_NOTOFFLINE);
- g_hMenu[2] = MyAddMenuItem(sim312[0], 110002, "635576BB-A927-4F64-B205-DD464F57CC99", NULL, NULL);
+ g_hMenu[2] = MyAddMenuItem(sim312[0], 110002, "635576BB-A927-4F64-B205-DD464F57CC99", nullptr, nullptr);
g_hMenu[3] = MyAddSubItem(g_hMenu[2], sim232[0], 110003, 110002, MODULENAME"/SIM_ST_DIS");
g_hMenu[4] = MyAddSubItem(g_hMenu[2], sim232[1], 110004, 110002, MODULENAME"/SIM_ST_ENA");
g_hMenu[5] = MyAddSubItem(g_hMenu[2], sim232[2], 110005, 110002, MODULENAME"/SIM_ST_TRY");
@@ -251,7 +251,7 @@ static int onModulesLoaded(WPARAM, LPARAM)
g_hMenu[9] = MyAddMenuItem(sim309, 110009, "5C60AD6F-6B1B-4758-BB68-C008168BF32B", mode2icon(MODE_GPG, 2), MODULENAME"/GPG_DEL", 0);
}
- g_hMenu[10] = MyAddMenuItem(sim311[0], 110010, "D56DD118-863B-4069-9A6A-C0057BA99CC6", NULL, NULL);
+ g_hMenu[10] = MyAddMenuItem(sim311[0], 110010, "D56DD118-863B-4069-9A6A-C0057BA99CC6", nullptr, nullptr);
g_hMenu[11] = MyAddSubItem(g_hMenu[10], sim231[0], 110011, 110010, MODULENAME"/MODE_NAT");
g_hMenu[12] = MyAddSubItem(g_hMenu[10], sim231[1], 110012, 110010, MODULENAME"/MODE_PGP");
g_hMenu[13] = MyAddSubItem(g_hMenu[10], sim231[2], 110013, 110010, MODULENAME"/MODE_GPG");
@@ -324,7 +324,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
// load crypo++ dll
if (!loadlib()) {
- msgbox1(0, sim107, MODULENAME, MB_OK | MB_ICONSTOP);
+ msgbox1(nullptr, sim107, MODULENAME, MB_OK | MB_ICONSTOP);
return 1;
}
diff --git a/plugins/SecureIM/src/mmi.cpp b/plugins/SecureIM/src/mmi.cpp
index 5f2c5a8896..30b1030e32 100644
--- a/plugins/SecureIM/src/mmi.cpp
+++ b/plugins/SecureIM/src/mmi.cpp
@@ -57,7 +57,7 @@ char* m_aastrcat(LPCSTR strA, LPCSTR strB)
return str;
}
-LPSTR m_string = NULL;
+LPSTR m_string = nullptr;
// ANSIz + ANSIz = ANSIz
char* m_ustrcat(LPCSTR strA, LPCSTR strB)
@@ -68,7 +68,7 @@ char* m_ustrcat(LPCSTR strA, LPCSTR strB)
return m_string;
}
-LPSTR m_hex = NULL;
+LPSTR m_hex = nullptr;
LPSTR to_hex(PBYTE bin, int len)
{
@@ -90,7 +90,7 @@ void __fastcall safe_free(void** p)
{
if (*p) {
mir_free(*p);
- *p = NULL;
+ *p = nullptr;
}
}
@@ -98,7 +98,7 @@ void __fastcall safe_delete(void** p)
{
if (*p) {
delete(*p);
- *p = NULL;
+ *p = nullptr;
}
}
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp
index 7ca3e45258..79095679a5 100644
--- a/plugins/SecureIM/src/options.cpp
+++ b/plugins/SecureIM/src/options.cpp
@@ -10,7 +10,7 @@ BOOL hasKey(pUinKey ptr)
BOOL ret = 0;
if (ptr->mode == MODE_NATIVE) {
LPSTR str = db_get_sa(ptr->hContact, MODULENAME, "PSK");
- ret = (str != NULL); SAFE_FREE(str);
+ ret = (str != nullptr); SAFE_FREE(str);
}
else if (ptr->mode == MODE_RSAAES) {
DBVARIANT dbv;
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
ListView_SetImageList(hLV, hSmall, LVSIL_SMALL);
ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL);
{
- static const char *szColHdr[] = { sim203, sim204, sim230, sim205, "", sim234, 0 };
+ static const char *szColHdr[] = { sim203, sim204, sim230, sim205, "", sim234, nullptr };
static int iColWidth[] = { 150, 110, 60, 55, 35, 330 };
LVCOLUMN lvc;
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -280,7 +280,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
if (ptr) {
LPSTR buffer = (LPSTR)alloca(PSKSIZE + 1);
getContactName(ptr->hContact, buffer);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PSK), NULL, DlgProcSetPSK, (LPARAM)buffer);
+ int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PSK), nullptr, DlgProcSetPSK, (LPARAM)buffer);
if (res == IDOK) {
setListViewPSK(hLV, idx, 1);
db_set_s(ptr->hContact, MODULENAME, "tPSK", buffer);
@@ -429,7 +429,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
ptr = (pUinKey)getListViewParam(hLV, lpLV->iItem);
if (ptr) {
POINT p; GetCursorPos(&p);
- HMENU hMenu = NULL;
+ HMENU hMenu = nullptr;
if (ptr->tmode == MODE_NATIVE || ptr->tmode == MODE_RSAAES) {
switch (lpLV->iSubItem) {
case 2: // mode
@@ -463,7 +463,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
CheckMenuItem(hMenu, ID_SIM_NATIVE + ptr->tmode, MF_CHECKED);
if (!bPGP) EnableMenuItem(hMenu, ID_SIM_PGP, MF_GRAYED);
if (!bGPG) EnableMenuItem(hMenu, ID_SIM_GPG, MF_GRAYED);
- TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_LEFTALIGN | TPM_TOPALIGN, p.x, p.y, 0, hDlg, 0);
+ TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_LEFTALIGN | TPM_TOPALIGN, p.x, p.y, 0, hDlg, nullptr);
DestroyMenu(hMenu);
}
}
@@ -511,7 +511,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -525,7 +525,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
case IDC_RSA_EXP:
{
LPSTR pub = (LPSTR)alloca(RSASIZE);
- mir_exp->rsa_export_keypair(CPP_MODE_RSA, NULL, pub, NULL);
+ mir_exp->rsa_export_keypair(CPP_MODE_RSA, nullptr, pub, nullptr);
if (!SaveExportRSAKeyDlg(hDlg, pub, 0))
msgbox(hDlg, sim114, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
}
@@ -534,10 +534,10 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
case IDC_RSA_EXPPRIV:
{
LPSTR passphrase = (LPSTR)alloca(RSASIZE);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, DlgProcSetPassphrase, (LPARAM)passphrase);
+ int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
if (res == IDOK) {
LPSTR priv = (LPSTR)alloca(RSASIZE);
- mir_exp->rsa_export_keypair(CPP_MODE_RSA, priv, NULL, passphrase);
+ mir_exp->rsa_export_keypair(CPP_MODE_RSA, priv, nullptr, passphrase);
if (!SaveExportRSAKeyDlg(hDlg, priv, 1))
msgbox(hDlg, sim112, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
}
@@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
return TRUE;
LPSTR passphrase = (LPSTR)alloca(RSASIZE);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, DlgProcSetPassphrase, (LPARAM)passphrase);
+ int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
if (res == IDOK) {
if (!mir_exp->rsa_import_keypair(CPP_MODE_RSA, priv, passphrase))
msgbox(hDlg, sim113, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
@@ -644,7 +644,7 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
ListView_SetImageList(hLV, hSmall, LVSIL_SMALL);
ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL);
{
- static const char *szColHdr[] = { sim203, sim204, sim215, 0 };
+ static const char *szColHdr[] = { sim203, sim204, sim215, nullptr };
static int iColWidth[] = { 160, 150, 80 };
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
@@ -667,7 +667,7 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -770,7 +770,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
ListView_SetImageList(hLV, hSmall, LVSIL_SMALL);
ListView_SetImageList(hLV, hLarge, LVSIL_NORMAL);
{
- static const char *szColHdr[] = { sim203, sim204, sim215, sim227, 0 };
+ static const char *szColHdr[] = { sim203, sim204, sim215, sim227, nullptr };
static int iColWidth[] = { 140, 120, 120, 40 };
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
@@ -794,7 +794,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l
case WM_PAINT:
if (!iInit)
- InvalidateRect(hDlg, NULL, FALSE);
+ InvalidateRect(hDlg, nullptr, FALSE);
break;
case WM_COMMAND:
@@ -1025,7 +1025,7 @@ void RefreshProtoDlg(HWND hDlg)
EnableWindow(GetDlgItem(hDlg, IDC_SPLITON), false);
EnableWindow(GetDlgItem(hDlg, IDC_SPLITOFF), false);
- BYTE sha[64]; int len; mir_exp->rsa_get_keyhash(CPP_MODE_RSA, NULL, NULL, (PBYTE)&sha, &len);
+ BYTE sha[64]; int len; mir_exp->rsa_get_keyhash(CPP_MODE_RSA, nullptr, nullptr, (PBYTE)&sha, &len);
LPSTR txt = mir_strdup(to_hex(sha, len));
SetDlgItemText(hDlg, IDC_RSA_SHA, txt);
mir_free(txt);
@@ -1067,7 +1067,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit)
LPSTR szKeyID = db_get_sa(hContact, MODULENAME, "pgp_abbr");
lvi.iItem++;
- lvi.iImage = (szKeyID != 0);
+ lvi.iImage = (szKeyID != nullptr);
lvi.lParam = (LPARAM)ptr;
getContactName(hContact, tmp);
@@ -1130,7 +1130,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit)
LPSTR szKeyID = db_get_sa(hContact, MODULENAME, "gpg");
lvi.iItem++;
- lvi.iImage = (szKeyID != 0);
+ lvi.iImage = (szKeyID != nullptr);
lvi.lParam = (LPARAM)ptr;
getContactName(hContact, tmp);
@@ -1340,14 +1340,14 @@ void ApplyGPGSettings(HWND hDlg)
GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgLog", tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
- else gpg_set_log(0);
+ else gpg_set_log(nullptr);
BOOL bgpgTmpFlag = (IsDlgButtonChecked(hDlg, IDC_TMPPATHON_CBOX) == BST_CHECKED);
db_set_b(0, MODULENAME, "gpgTmpFlag", bgpgTmpFlag);
GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, _countof(tmp));
db_set_s(0, MODULENAME, "gpgTmp", tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
- else gpg_set_tmp(0);
+ else gpg_set_tmp(nullptr);
HWND hLV = GetDlgItem(hDlg, IDC_GPG_USERLIST);
int i = ListView_GetNextItem(hLV, (UINT)-1, LVNI_ALL);
@@ -1438,7 +1438,7 @@ void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus)
strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1);
LV_SetItemTextA(hLV, iItem, 4, str);
- LPSTR sha = NULL;
+ LPSTR sha = nullptr;
if (iStatus) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
@@ -1587,7 +1587,7 @@ LPCSTR publ_end = "-----END PGP PUBLIC KEY BLOCK-----";
LPSTR LoadKeys(LPCSTR file, BOOL priv)
{
FILE *f = fopen(file, "r");
- if (!f) return NULL;
+ if (!f) return nullptr;
fseek(f, 0, SEEK_END);
int flen = ftell(f);
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp
index db0cf190a2..a4f1d8a946 100644
--- a/plugins/SecureIM/src/splitmsg.cpp
+++ b/plugins/SecureIM/src/splitmsg.cpp
@@ -38,7 +38,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg)
int msg_id, part_num, part_all;
sscanf(szMsg, "%4X%2X%2X", &msg_id, &part_num, &part_all);
//
- pPM ppm = NULL, pm = ptr->msgPart;
+ pPM ppm = nullptr, pm = ptr->msgPart;
if (!ptr->msgPart) {
pm = ptr->msgPart = new partitionMessage;
memset(pm, 0, sizeof(partitionMessage));
@@ -65,7 +65,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg)
int len = 0, i;
for (i = 0; i < part_all; i++) {
- if (pm->message[i] == NULL) break;
+ if (pm->message[i] == nullptr) break;
len += (int)mir_strlen(pm->message[i]);
}
if (i == part_all) { // combine message
@@ -87,7 +87,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg)
Sent_NetLog("combine: not all parts");
// not combined yet
- return NULL;
+ return nullptr;
}
// отправляет сообщение, если надо то разбивает на части
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp
index c78bc618df..548c92bce8 100644
--- a/plugins/SecureIM/src/svcs_clist.cpp
+++ b/plugins/SecureIM/src/svcs_clist.cpp
@@ -11,7 +11,7 @@ int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam)
if (stat == ID_STATUS_OFFLINE) { // go offline
if (ptr->mode == MODE_NATIVE && cpp_keyx(ptr->cntx)) { // have active context
- cpp_delete_context(ptr->cntx); ptr->cntx = 0; // reset context
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr; // reset context
showPopupDC(hContact); // show popup "Disabled"
ShowStatusIconNotify(hContact); // change icon in CL
}
@@ -96,16 +96,16 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM)
// Native/RSAAES
if (!isSecured) // create secureim connection
- Menu_ModifyItem(g_hMenu[0], NULL, mode2icon(ptr->mode | SECURED, 2), 0);
+ Menu_ModifyItem(g_hMenu[0], nullptr, mode2icon(ptr->mode | SECURED, 2), 0);
else // disable secureim connection
- Menu_ModifyItem(g_hMenu[1], NULL, mode2icon(ptr->mode, 2), 0);
+ Menu_ModifyItem(g_hMenu[1], nullptr, mode2icon(ptr->mode, 2), 0);
// set status menu
if (bSCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
Menu_ModifyItem(g_hMenu[2], sim312[ptr->status], g_hICO[ICO_ST_DIS + ptr->status], 0);
for (int i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++)
- Menu_ModifyItem(g_hMenu[3 + i], NULL, (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL, 0);
+ Menu_ModifyItem(g_hMenu[3 + i], nullptr, (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : nullptr, 0);
}
}
else if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
@@ -126,7 +126,7 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM)
for (int i = 0; i < MODE_CNT; i++) {
if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP) continue;
if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG) continue;
- Menu_ModifyItem(g_hMenu[11 + i], NULL, (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL, 0);
+ Menu_ModifyItem(g_hMenu[11 + i], nullptr, (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : nullptr, 0);
}
}
}
diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp
index 79c12b0b83..b7f879dbbf 100644
--- a/plugins/SecureIM/src/svcs_menu.cpp
+++ b/plugins/SecureIM/src/svcs_menu.cpp
@@ -61,7 +61,7 @@ INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM)
}
{
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -84,7 +84,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam)
}
else if (bPGPprivkey) {
char KeyPath[MAX_PATH]; KeyPath[0] = '\0';
- if (ShowSelectKeyDlg(0, KeyPath)) {
+ if (ShowSelectKeyDlg(nullptr, KeyPath)) {
char *publ = LoadKeys(KeyPath, false);
if (publ) {
db_unset(wParam, MODULENAME, "pgp");
@@ -102,7 +102,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam)
Service_PGPdelKey(wParam, lParam);
else {
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -114,7 +114,7 @@ INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM)
db_unset(wParam, MODULENAME, "gpg");
{
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -136,7 +136,7 @@ INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam)
Service_GPGdelKey(wParam, lParam);
else {
pUinKey ptr = getUinKey(wParam);
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
}
ShowStatusIconNotify(wParam);
return 1;
@@ -150,7 +150,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam)
case MODE_NATIVE:
case MODE_RSAAES:
if (isContactSecured(wParam)&SECURED) {
- msgbox(NULL, sim111, MODULENAME, MB_OK);
+ msgbox(nullptr, sim111, MODULENAME, MB_OK);
return 0;
}
if (lParam != MODE_NATIVE && ptr->status > STATUS_ENABLED)
@@ -162,7 +162,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam)
if (ptr) {
if (ptr->cntx) {
cpp_delete_context(ptr->cntx);
- ptr->cntx = 0;
+ ptr->cntx = nullptr;
ptr->keyLoaded = 0;
}
ptr->mode = (BYTE)lParam;
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp
index 00ae0afdf7..9e3a18de80 100644
--- a/plugins/SecureIM/src/svcs_proto.cpp
+++ b/plugins/SecureIM/src/svcs_proto.cpp
@@ -1,7 +1,7 @@
#include "commonheaders.h"
// return SignID
-int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = NULL)
+int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg = nullptr)
{
if (szPlainMsg) *szPlainMsg = (LPSTR)szMsg;
for (int i = 0; signs[i].len; i++) {
@@ -23,7 +23,7 @@ static void sttFakeAck(LPVOID param)
TFakeAckParams *tParam = (TFakeAckParams*)param;
Sleep(100);
- if (tParam->msg == NULL)
+ if (tParam->msg == nullptr)
SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->id, 0);
else
SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, LPARAM(tParam->msg));
@@ -33,7 +33,7 @@ static void sttFakeAck(LPVOID param)
int returnNoError(MCONTACT hContact)
{
- mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, 0));
+ mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, nullptr));
return 777;
}
@@ -43,7 +43,7 @@ int returnError(MCONTACT hContact, LPCSTR err)
return 666;
}
-LPSTR szUnrtfMsg = NULL;
+LPSTR szUnrtfMsg = nullptr;
// RecvMsg handler
INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam)
@@ -51,7 +51,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam)
CCSDATA *ccs = (CCSDATA *)lParam;
PROTORECVEVENT *ppre = (PROTORECVEVENT *)ccs->lParam;
pUinKey ptr = getUinKey(ccs->hContact);
- LPSTR szEncMsg = ppre->szMessage, szPlainMsg = NULL;
+ LPSTR szEncMsg = ppre->szMessage, szPlainMsg = nullptr;
Sent_NetLog("onRecvMsg: %s", szEncMsg);
@@ -140,8 +140,8 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam)
if (!strstr(szEncMsg, "-----END PGP MESSAGE-----"))
return 1; // no end tag, don't display it ...
- LPSTR szNewMsg = NULL;
- LPSTR szOldMsg = NULL;
+ LPSTR szNewMsg = nullptr;
+ LPSTR szOldMsg = nullptr;
if (!ptr->keyLoaded && bPGPloaded) ptr->keyLoaded = LoadKeyPGP(ptr);
if (!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr);
@@ -284,7 +284,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam)
case SiG_DEIN: // deinit message
// other user has disabled SecureIM with you
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
showPopupDC(ptr->hContact);
ShowStatusIconNotify(ptr->hContact);
@@ -298,7 +298,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam)
if (ptr->mode == MODE_RSAAES) {
ptr->mode = MODE_NATIVE;
cpp_delete_context(ptr->cntx);
- ptr->cntx = 0;
+ ptr->cntx = nullptr;
ptr->keyLoaded = 0;
db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
@@ -481,7 +481,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam)
if (!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr);
if (!ptr->keyLoaded) return returnError(ccs->hContact, Translate(sim108));
- LPSTR szNewMsg = NULL;
+ LPSTR szNewMsg = nullptr;
ptrA szUtfMsg(miranda_to_utf8((LPCSTR)ccs->lParam, ccs->wParam));
if (ptr->keyLoaded == 1) // PGP
szNewMsg = pgp_encode(ptr->cntx, szUtfMsg);
@@ -606,7 +606,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam)
return returnError(ccs->hContact, Translate(sim105));
if (ptr->cntx) { // if secure context exists
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
CCSDATA ccsd;
memcpy(&ccsd, (HLOCAL)lParam, sizeof(CCSDATA));
@@ -651,7 +651,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam)
else {
db_unset(ptr->hContact, MODULENAME, "offlineKey");
db_unset(ptr->hContact, MODULENAME, "offlineKeyTimeout");
- if (msgbox1(0, sim106, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDNO)
+ if (msgbox1(nullptr, sim106, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDNO)
return returnNoError(ccs->hContact);
// exit and send unencrypted message
@@ -689,7 +689,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam)
// disable SecureIM only if it was enabled
if (ptr->cntx) {
- cpp_delete_context(ptr->cntx); ptr->cntx = 0;
+ cpp_delete_context(ptr->cntx); ptr->cntx = nullptr;
ccs->wParam |= PREF_METANODB;
Proto_ChainSend(wParam, ccs);
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp
index e60c19430a..66dbfe4686 100644
--- a/plugins/SecureIM/src/svcs_rsa.cpp
+++ b/plugins/SecureIM/src/svcs_rsa.cpp
@@ -1,6 +1,6 @@
#include "commonheaders.h"
-pRSA_EXPORT mir_exp = NULL;
+pRSA_EXPORT mir_exp = nullptr;
RSA_IMPORT imp =
{
rsa_inject,
@@ -36,7 +36,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int
LPSTR uin = (LPSTR)mir_alloc(KEYSIZE); getContactUinA(ptr->hContact, uin);
LPSTR msg = (LPSTR)mir_alloc(MSGSIZE);
LPSTR sha = mir_strdup(to_hex(sig, sigLen));
- LPSTR sha_old = NULL;
+ LPSTR sha_old = nullptr;
Sent_NetLog("rsa_check_pub: %s %s %s", cnm, uin, sha);
@@ -62,7 +62,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int
else {
if (k) mir_snprintf(msg, MSGSIZE, Translate(sim522), cnm, sha, sha_old);
else mir_snprintf(msg, MSGSIZE, Translate(sim520), cnm, sha);
- v = (msgbox(0, msg, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES);
+ v = (msgbox(nullptr, msg, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: manual accepted %d", v);
#endif
@@ -82,7 +82,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int
void __cdecl rsa_notify(HANDLE context, int state)
{
pUinKey ptr = getUinCtx(context); if (!ptr) return;
- LPCSTR msg = NULL;
+ LPCSTR msg = nullptr;
Sent_NetLog("rsa_notify: 0x%x", state);
@@ -194,6 +194,6 @@ void resetRSAcntx(pUinKey ptr)
void deleteRSAcntx(pUinKey ptr)
{
cpp_delete_context(ptr->cntx);
- ptr->cntx = 0;
+ ptr->cntx = nullptr;
ptr->keyLoaded = 0;
}