summaryrefslogtreecommitdiff
path: root/plugins/Weather
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/Weather
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/Weather')
-rw-r--r--plugins/Weather/src/weather.cpp16
-rw-r--r--plugins/Weather/src/weather_addstn.cpp28
-rw-r--r--plugins/Weather/src/weather_contacts.cpp28
-rw-r--r--plugins/Weather/src/weather_conv.cpp64
-rw-r--r--plugins/Weather/src/weather_data.cpp14
-rw-r--r--plugins/Weather/src/weather_http.cpp14
-rw-r--r--plugins/Weather/src/weather_icons.cpp4
-rw-r--r--plugins/Weather/src/weather_info.cpp18
-rw-r--r--plugins/Weather/src/weather_ini.cpp62
-rw-r--r--plugins/Weather/src/weather_mwin.cpp36
-rw-r--r--plugins/Weather/src/weather_opt.cpp34
-rw-r--r--plugins/Weather/src/weather_popup.cpp14
-rw-r--r--plugins/Weather/src/weather_svcs.cpp10
-rw-r--r--plugins/Weather/src/weather_update.cpp42
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp10
15 files changed, 197 insertions, 197 deletions
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 94327bc8e4..6739dcf5da 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -56,7 +56,7 @@ BOOL ThreadRunning;
// variable to determine if module loaded
BOOL ModuleLoaded;
-HANDLE hTBButton = NULL;
+HANDLE hTBButton = nullptr;
// plugin info
static const PLUGININFOEX pluginInfoEx =
@@ -87,7 +87,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
int WeatherShutdown(WPARAM, LPARAM)
{
- KillTimer(NULL, timerId); // kill update timer
+ KillTimer(nullptr, timerId); // kill update timer
SaveOptions(); // save options once more
status = ID_STATUS_OFFLINE; // set status to offline
@@ -103,7 +103,7 @@ int WeatherShutdown(WPARAM, LPARAM)
int OnToolbarLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.name = LPGEN("Enable/disable auto update");
ttb.pszService = MS_WEATHER_ENABLED;
ttb.pszTooltipUp = LPGEN("Auto Update Enabled");
@@ -128,7 +128,7 @@ int WeatherInit(WPARAM, LPARAM)
AddMenuItems();
// timer for the first update
- timerId = SetTimer(NULL, 0, 5000, timerProc2); // first update is 5 sec after load
+ timerId = SetTimer(nullptr, 0, 5000, timerProc2); // first update is 5 sec after load
// weather user detail
HookEvent(ME_USERINFO_INITIALISE, UserInfoInit);
@@ -142,8 +142,8 @@ int WeatherInit(WPARAM, LPARAM)
void InitVar()
{
// setup the linklist for weather update list
- UpdateListTail = NULL;
- UpdateListHead = NULL;
+ UpdateListTail = nullptr;
+ UpdateListHead = nullptr;
// other settings
timerId = 0;
@@ -213,7 +213,7 @@ extern "C" int __declspec(dllexport) Load(void)
hDataWindowList = WindowList_Create();
hWindowList = WindowList_Create();
- hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
+ hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr);
// register weather protocol
PROTOCOLDESCRIPTOR pd = { 0 };
@@ -233,7 +233,7 @@ extern "C" int __declspec(dllexport) Load(void)
wchar_t SvcFunc[100];
mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, hInst, nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
return 0;
}
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 58379ec9c4..20b93fcecd 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -111,7 +111,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
// notification message box
mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
}
@@ -125,8 +125,8 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
// show a message box and cancel search if update is in process
BOOL CheckSearch()
{
- if (UpdateListHead != NULL) {
- MessageBox(NULL, TranslateT("Please try again after weather update is completed."), TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
+ if (UpdateListHead != nullptr) {
+ MessageBox(nullptr, TranslateT("Please try again after weather update is completed."), TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
return FALSE;
}
return TRUE;
@@ -160,7 +160,7 @@ INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
sttSID[_countof(sttSID) - 1] = 0;
sttSearchId = 1;
// create a thread for the ID search
- mir_forkthread(BasicSearchTimerProc, NULL);
+ mir_forkthread(BasicSearchTimerProc, nullptr);
return sttSearchId;
}
@@ -214,7 +214,7 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, _countof(name1));
// search for the weather station using a thread
- mir_forkthread(NameSearchTimerProc, NULL);
+ mir_forkthread(NameSearchTimerProc, nullptr);
return sttSearchId;
}
@@ -231,16 +231,16 @@ int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *s
if (sData->Available) {
char loc[255];
- wchar_t *szData = NULL;
+ wchar_t *szData = nullptr;
// load the page
mir_snprintf(loc, sData->SearchURL, sID);
- BOOL bFound = (InternetDownloadFile(loc, NULL, NULL, &szData) == 0);
+ BOOL bFound = (InternetDownloadFile(loc, nullptr, nullptr, &szData) == 0);
if (bFound) {
wchar_t* szInfo = szData;
// not found
- if (wcsstr(szInfo, sData->NotFoundStr) == NULL)
+ if (wcsstr(szInfo, sData->NotFoundStr) == nullptr)
GetDataValue(&sData->Name, str, &szInfo);
}
@@ -276,7 +276,7 @@ int IDSearch(wchar_t *sID, const int searchId)
WIDATALIST *Item = WIHead;
// search every weather service using the search station ID
- while (Item != NULL) {
+ while (Item != nullptr) {
IDSearchProc(sID, searchId, &Item->Data.IDSearch, Item->Data.InternalName, Item->Data.DisplayName);
Item = Item->next;
}
@@ -306,21 +306,21 @@ int IDSearch(wchar_t *sID, const int searchId)
// svcname = the name of the weather service that is currently searching (ie. Yahoo Weather)
int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar_t *svc, wchar_t *svcname)
{
- wchar_t Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = NULL, *search;
+ wchar_t Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = nullptr, *search;
// replace spaces with %20
char loc[256];
T2Utf szSearchName(name);
mir_snprintf(loc, sData->SearchURL, ptrA(mir_urlEncode(szSearchName)));
- if (InternetDownloadFile(loc, NULL, NULL, &szData) == 0) {
+ if (InternetDownloadFile(loc, nullptr, nullptr, &szData) == 0) {
wchar_t* szInfo = szData;
search = wcsstr(szInfo, sData->NotFoundStr); // determine if data is available
- if (search == NULL) { // if data is found
+ if (search == nullptr) { // if data is found
// test if it is single result
if (sData->Single.Available && sData->Multiple.Available)
search = wcsstr(szInfo, sData->SingleStr);
// for single result
- if (sData->Single.Available && (search != NULL || !sData->Multiple.Available)) { // single result
+ if (sData->Single.Available && (search != nullptr || !sData->Multiple.Available)) { // single result
// if station ID appears first in the downloaded data
if (!mir_wstrcmpi(sData->Single.First, L"ID")) {
GetDataValue(&sData->Single.ID, str, &szInfo);
@@ -414,7 +414,7 @@ int NameSearch(wchar_t *name, const int searchId)
WIDATALIST *Item = WIHead;
// search every weather service using the search station name
- while (Item != NULL) {
+ while (Item != nullptr) {
if (Item->Data.NameSearch.Single.Available || Item->Data.NameSearch.Multiple.Available)
NameSearchProc(name, searchId, &Item->Data.NameSearch, Item->Data.InternalName, Item->Data.DisplayName);
Item = Item->next;
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp
index 582ba51831..6d8bd85541 100644
--- a/plugins/Weather/src/weather_contacts.cpp
+++ b/plugins/Weather/src/weather_contacts.cpp
@@ -47,7 +47,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam)
db_free(&dbv);
}
else // display warning dialog if no path is specified
- MessageBox(NULL, TranslateT("Weather condition was not logged."),
+ MessageBox(nullptr, TranslateT("Weather condition was not logged."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
return 0;
}
@@ -61,7 +61,7 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM)
if (id[0] != 0) {
// check if the complte forecast URL is set. If it is not, display warning and quit
if (db_get_wstatic(wParam, WEATHERPROTONAME, "InfoURL", loc2, _countof(loc2)) || loc2[0] == 0) {
- MessageBox(NULL, NO_FORECAST_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
+ MessageBox(nullptr, NO_FORECAST_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
// set the url and open the webpage
@@ -79,7 +79,7 @@ INT_PTR WeatherMap(WPARAM wParam, LPARAM)
if (id[0] != 0) {
// check if the weather map URL is set. If it is not, display warning and quit
if (db_get_wstatic(wParam, WEATHERPROTONAME, "MapURL", loc2, _countof(loc2)) || loc2[0] == 0) {
- MessageBox(NULL, NO_MAP_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
+ MessageBox(nullptr, NO_MAP_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
return 1;
}
@@ -111,7 +111,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
OPENFILENAME ofn; // common dialog box structure
MCONTACT hContact;
WIDATA *sData;
- CntSetWndDataType *wndData = NULL;
+ CntSetWndDataType *wndData = nullptr;
switch (msg) {
case WM_INITDIALOG:
@@ -206,7 +206,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
// if not, don't let user change the setting
GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
chop = wcsstr(str, L"/");
- if (chop == NULL)
+ if (chop == nullptr)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
else
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), TRUE);
@@ -236,13 +236,13 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
// load the page
mir_snprintf(loc, sData->IDSearch.SearchURL, str);
str[0] = 0;
- wchar_t *pData = NULL;
- if (InternetDownloadFile(loc, NULL, sData->UserAgent, &pData) == 0) {
+ wchar_t *pData = nullptr;
+ if (InternetDownloadFile(loc, nullptr, sData->UserAgent, &pData) == 0) {
wchar_t *szInfo = pData;
wchar_t* search = wcsstr(szInfo, sData->IDSearch.NotFoundStr);
// if the page is found (ie. valid ID), get the name of the city
- if (search == NULL)
+ if (search == nullptr)
GetDataValue(&sData->IDSearch.Name, str, &szInfo);
}
// free memory
@@ -284,9 +284,9 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
+ ofn.lpstrInitialDir = nullptr;
ofn.Flags = OFN_PATHMUSTEXIST;
// Display a Open dialog box and put the file name on the dialog
@@ -410,7 +410,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM)
HWND hEditDlg = WindowList_Find(hWindowList, wParam);
// search the dialog list to prevent multiple instance of dialog for the same contact
- if (hEditDlg != NULL) {
+ if (hEditDlg != nullptr) {
// if the dialog box already opened, bring it to the front
SetForegroundWindow(hEditDlg);
SetFocus(hEditDlg);
@@ -418,7 +418,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM)
else {
// if the dialog box is not opened, open a new one
if (IsMyContact(wParam))
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), NULL, DlgProcChange, (LPARAM)wParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
}
return 0;
@@ -458,7 +458,7 @@ int ContactDeleted(WPARAM wParam, LPARAM)
if (tszNick != NULL) {
wchar_t str[255];
mir_snwprintf(str, TranslateT("%s is now the default weather station"), (wchar_t*)tszNick);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
return 0; // exit this function quickly
@@ -475,5 +475,5 @@ int ContactDeleted(WPARAM wParam, LPARAM)
BOOL IsMyContact(MCONTACT hContact)
{
const char *szProto = GetContactProto(hContact);
- return szProto != NULL && mir_strcmp(WEATHERPROTONAME, szProto) == 0;
+ return szProto != nullptr && mir_strcmp(WEATHERPROTONAME, szProto) == 0;
}
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp
index 15428e3839..ab9f85a26f 100644
--- a/plugins/Weather/src/weather_conv.cpp
+++ b/plugins/Weather/src/weather_conv.cpp
@@ -328,58 +328,58 @@ WORD GetIcon(const wchar_t* cond, WIDATA *Data)
// internal detection
if (
- wcsstr(cond, L"mainy sunny") != NULL ||
- wcsstr(cond, L"mainy clear") != NULL ||
- wcsstr(cond, L"partly cloudy") != NULL ||
- wcsstr(cond, L"mostly") != NULL ||
- wcsstr(cond, L"clouds") != NULL) {
+ wcsstr(cond, L"mainy sunny") != nullptr ||
+ wcsstr(cond, L"mainy clear") != nullptr ||
+ wcsstr(cond, L"partly cloudy") != nullptr ||
+ wcsstr(cond, L"mostly") != nullptr ||
+ wcsstr(cond, L"clouds") != nullptr) {
return PCLOUDY;
}
else if (
- wcsstr(cond, L"sunny") != NULL ||
- wcsstr(cond, L"clear") != NULL ||
- wcsstr(cond, L"fair") != NULL) {
+ wcsstr(cond, L"sunny") != nullptr ||
+ wcsstr(cond, L"clear") != nullptr ||
+ wcsstr(cond, L"fair") != nullptr) {
return SUNNY;
}
else if (
- wcsstr(cond, L"thunder") != NULL ||
- wcsstr(cond, L"t-storm") != NULL) {
+ wcsstr(cond, L"thunder") != nullptr ||
+ wcsstr(cond, L"t-storm") != nullptr) {
return LIGHT;
}
else if (
- wcsstr(cond, L"cloud") != NULL ||
- wcsstr(cond, L"overcast") != NULL) {
+ wcsstr(cond, L"cloud") != nullptr ||
+ wcsstr(cond, L"overcast") != nullptr) {
return CLOUDY;
}
else if (
- wcsstr(cond, L"fog") != NULL ||
- wcsstr(cond, L"mist") != NULL ||
- wcsstr(cond, L"smoke") != NULL ||
- wcsstr(cond, L"sand") != NULL ||
- wcsstr(cond, L"dust") != NULL ||
- wcsstr(cond, L"haze") != NULL) {
+ wcsstr(cond, L"fog") != nullptr ||
+ wcsstr(cond, L"mist") != nullptr ||
+ wcsstr(cond, L"smoke") != nullptr ||
+ wcsstr(cond, L"sand") != nullptr ||
+ wcsstr(cond, L"dust") != nullptr ||
+ wcsstr(cond, L"haze") != nullptr) {
return FOG;
}
else if (
- (wcsstr(cond, L"shower") != NULL && wcsstr(cond, L"snow") != NULL) ||
- wcsstr(cond, L"flurries") != NULL) {
+ (wcsstr(cond, L"shower") != nullptr && wcsstr(cond, L"snow") != nullptr) ||
+ wcsstr(cond, L"flurries") != nullptr) {
return SSHOWER;
}
else if (
- wcsstr(cond, L"rain shower") != NULL ||
- wcsstr(cond, L"shower") != NULL) {
+ wcsstr(cond, L"rain shower") != nullptr ||
+ wcsstr(cond, L"shower") != nullptr) {
return RSHOWER;
}
else if (
- wcsstr(cond, L"snow") != NULL ||
- wcsstr(cond, L"ice") != NULL ||
- wcsstr(cond, L"freezing") != NULL ||
- wcsstr(cond, L"wintry") != NULL) {
+ wcsstr(cond, L"snow") != nullptr ||
+ wcsstr(cond, L"ice") != nullptr ||
+ wcsstr(cond, L"freezing") != nullptr ||
+ wcsstr(cond, L"wintry") != nullptr) {
return SNOW;
}
else if (
- wcsstr(cond, L"drizzle") != NULL ||
- wcsstr(cond, L"rain") != NULL) {
+ wcsstr(cond, L"drizzle") != nullptr ||
+ wcsstr(cond, L"rain") != nullptr) {
return RAIN;
}
@@ -393,7 +393,7 @@ WORD GetIcon(const wchar_t* cond, WIDATA *Data)
mir_snwprintf(LangPackStr, L"# Weather %s %i #", statusStr[i], j);
wcsncpy_s(LangPackStr1, TranslateW(LangPackStr), _TRUNCATE);
CharLowerBuff(LangPackStr1, (DWORD)mir_wstrlen(LangPackStr1));
- if (wcsstr(cond, LangPackStr1) != NULL)
+ if (wcsstr(cond, LangPackStr1) != nullptr)
return statusValue[i];
// loop until the translation string exists (ie, the translated string is differ from original)
} while (mir_wstrcmp(TranslateW(LangPackStr), LangPackStr));
@@ -518,7 +518,7 @@ wchar_t* GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str)
switch (chr) {
case 'c': mir_wstrcat(str, w->cond); break;
case 'd': // get the current date
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, lpzDate, _countof(lpzDate));
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, lpzDate, _countof(lpzDate));
mir_wstrcat(str, lpzDate); break;
case 'e': mir_wstrcat(str, w->dewpoint); break;
case 'f': mir_wstrcat(str, w->feel); break;
@@ -581,7 +581,7 @@ INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam)
void GetSvc(wchar_t *pszID)
{
wchar_t *chop = wcsstr(pszID, L"/");
- if (chop != NULL) *chop = '\0';
+ if (chop != nullptr) *chop = '\0';
else pszID[0] = 0;
}
@@ -591,7 +591,7 @@ void GetSvc(wchar_t *pszID)
void GetID(wchar_t *pszID)
{
wchar_t *chop = wcsstr(pszID, L"/");
- if (chop != NULL) mir_wstrcpy(pszID, chop + 1);
+ if (chop != nullptr) mir_wstrcpy(pszID, chop + 1);
else pszID[0] = 0;
}
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp
index 498d9db482..e446b8bcb0 100644
--- a/plugins/Weather/src/weather_data.cpp
+++ b/plugins/Weather/src/weather_data.cpp
@@ -144,7 +144,7 @@ void EraseAllInfo()
if (!db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
}
// get the handle of the default station
@@ -171,7 +171,7 @@ void EraseAllInfo()
if (!db_get_ws(LastContact, WEATHERPROTONAME, "Nick", &dbv)) {
mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.ptszVal);
db_free(&dbv);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
}
// save option in case of default station changed
@@ -259,7 +259,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData)
// the start string must be found
if (UpdateData->Start[0] != 0) {
start = wcsstr(szInfo, UpdateData->Start);
- if (start != NULL) {
+ if (start != nullptr) {
// set the starting location for getting data
start += mir_wstrlen(UpdateData->Start);
szInfo = start;
@@ -272,7 +272,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData)
else
end = wcsstr(szInfo, L" ");
- if (end != NULL) {
+ if (end != nullptr) {
// set the ending location
startloc = 0;
endloc = end - szInfo;
@@ -281,7 +281,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData)
}
// ignore if not both of the string found - this prevent crashes
- if (start != NULL && end != NULL) {
+ if (start != nullptr && end != nullptr) {
// begin reading the data from start location to end location
// remove all HTML tag in between, as well as leading space, ending space,
// multiple spaces, tabs, and return key
@@ -377,14 +377,14 @@ void wfree(char **Data)
{
if (*Data && mir_strlen(*Data) > 0)
mir_free(*Data);
- *Data = NULL;
+ *Data = nullptr;
}
void wfree(WCHAR **Data)
{
if (*Data && mir_wstrlen(*Data) > 0)
mir_free(*Data);
- *Data = NULL;
+ *Data = nullptr;
}
//============ MANAGE THE ITEMS STORED IN DB ============
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index d2ffb09070..8b5995926b 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -47,7 +47,7 @@ static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr)
//
int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **szData)
{
- if (userAgent == NULL || userAgent[0] == 0)
+ if (userAgent == nullptr || userAgent[0] == 0)
userAgent = NETLIB_USER_AGENT;
NETLIBHTTPHEADER headers[5];
@@ -71,17 +71,17 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s
nlhr.headers = headers;
nlhr.headersCount = _countof(headers);
- if (cookie == NULL || cookie[0] == 0)
+ if (cookie == nullptr || cookie[0] == 0)
--nlhr.headersCount;
// download the page
NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
- if (nlhrReply == 0) {
+ if (nlhrReply == nullptr) {
// if the data does not downloaded successfully (ie. disconnected), then return 1000 as error code
*szData = (wchar_t*)mir_alloc(512);
// store the error code in szData
mir_wstrcpy(*szData, L"NetLib error occurred!!");
- hNetlibHttp = NULL;
+ hNetlibHttp = nullptr;
return NLHRF_REDIRECT;
}
@@ -125,10 +125,10 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s
}
}
- wchar_t *retVal = NULL;
+ wchar_t *retVal = nullptr;
if (bIsUtf)
retVal = mir_utf8decodeW(nlhrReply->pData);
- if (retVal == NULL)
+ if (retVal == nullptr)
retVal = mir_a2u(nlhrReply->pData);
*szData = retVal;
}
@@ -164,7 +164,7 @@ void NetlibHttpDisconnect(void)
{
if (hNetlibHttp) {
HANDLE hConn = hNetlibHttp;
- hNetlibHttp = NULL;
+ hNetlibHttp = nullptr;
Netlib_CloseHandle(hConn);
}
}
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp
index 68d162e8fc..12f40ebaa3 100644
--- a/plugins/Weather/src/weather_icons.cpp
+++ b/plugins/Weather/src/weather_icons.cpp
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-HANDLE hIcoLibIconsChanged = NULL;
+HANDLE hIcoLibIconsChanged = nullptr;
static IconItem iconList[] =
{
@@ -55,7 +55,7 @@ HANDLE GetIconHandle(const char* name)
if (mir_strcmp(iconList[i].szName, name) == 0)
return iconList[i].hIcolib;
- return NULL;
+ return nullptr;
}
void ReleaseIconEx(HICON hIcon)
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp
index d78be15988..6f7ca4c1c7 100644
--- a/plugins/Weather/src/weather_info.cpp
+++ b/plugins/Weather/src/weather_info.cpp
@@ -43,7 +43,7 @@ static void INIInfo(HWND hwndDlg)
LVITEM lvi = { 0 };
lvi.mask = LVIF_TEXT;
lvi.iItem = 0;
- for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next) {
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
// get the data for the ini file
lvi.iSubItem = 0;
lvi.pszText = Item->Data.InternalName;
@@ -146,9 +146,9 @@ void GetINIInfo(wchar_t *pszSvc)
wchar_t str2[2048];
WIDATA *sData = GetWIData(pszSvc);
// if the service does not exist among the loaded INI's
- if (sData == NULL) {
+ if (sData == nullptr) {
mir_snwprintf(str2, TranslateT("The corresponding INI file for \"%s\" is not found."), pszSvc);
- MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
}
// if exist, get the information
else {
@@ -197,7 +197,7 @@ void GetINIInfo(wchar_t *pszSvc)
mir_wstrncat(str2, sData->Description, _countof(str2) - mir_wstrlen(str2));
// display the message box and quit
- MessageBox(NULL, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, str2, TranslateT("Weather INI information"), MB_OK | MB_ICONINFORMATION);
}
}
@@ -213,16 +213,16 @@ void MoreVarList(void)
wcsncpy(str, VARS_LIST, _countof(str) - 1);
mir_wstrncat(str, L"\n\n", _countof(str) - mir_wstrlen(str));
// loop through all weather services to find custom variables
- for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next) {
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next) {
// loop through all update items in a service
- for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != NULL; WItem = WItem->Next) {
+ for (WIDATAITEMLIST *WItem = Item->Data.UpdateData; WItem != nullptr; WItem = WItem->Next) {
// the custom variable is defined as "%[<variable name>]"
// ignore the "hi" item and hidden items
if (mir_wstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
mir_snwprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
wchar_t *find = wcsstr(str, tempstr);
// if the custom variable does not exist in the list, add it to the list
- if (find == NULL) {
+ if (find == nullptr) {
mir_wstrncat(str, tempstr, _countof(str) - mir_wstrlen(str));
mir_wstrncat(str, L", ", _countof(str) - mir_wstrlen(str));
}
@@ -231,10 +231,10 @@ void MoreVarList(void)
}
// remove the last comma in the list
wchar_t* find = wcsrchr(str, ',');
- if (find != NULL)
+ if (find != nullptr)
*find = '\0';
// display the list in a message box
- MessageBox(NULL, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
+ MessageBox(nullptr, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
}
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp
index e0001c4159..717e7e1fd3 100644
--- a/plugins/Weather/src/weather_ini.cpp
+++ b/plugins/Weather/src/weather_ini.cpp
@@ -39,8 +39,8 @@ static void WIListAdd(WIDATA Data)
WIDATALIST *newItem = (WIDATALIST*)mir_alloc(sizeof(WIDATALIST));
newItem->Data = Data;
// add to the linked list
- newItem->next = NULL;
- if (WITail == NULL) WIHead = newItem;
+ newItem->next = nullptr;
+ if (WITail == nullptr) WIHead = newItem;
else WITail->next = newItem;
WITail = newItem;
}
@@ -51,13 +51,13 @@ static void WIListAdd(WIDATA Data)
WIDATA* GetWIData(wchar_t *pszServ)
{
// loop through the list to find matching internal name
- for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next)
+ for (WIDATALIST *Item = WIHead; Item != nullptr; Item = Item->next)
// if internal name found, return the data
if (mir_wstrcmp(Item->Data.InternalName, pszServ) == 0)
return &Item->Data;
// return NULL when no match found
- return NULL;
+ return nullptr;
}
//============ DATA ITEM LIST (LINKED LIST) ============
@@ -67,8 +67,8 @@ void WIItemListAdd(WIDATAITEM *DataItem, WIDATA *Data)
{
WIDATAITEMLIST *newItem = (WIDATAITEMLIST*)mir_alloc(sizeof(WIDATAITEMLIST));
newItem->Item = *DataItem;
- newItem->Next = NULL;
- if (Data->UpdateData == NULL) Data->UpdateData = newItem;
+ newItem->Next = nullptr;
+ if (Data->UpdateData == nullptr) Data->UpdateData = newItem;
else Data->UpdateDataTail->Next = newItem;
Data->UpdateDataTail = newItem;
}
@@ -104,8 +104,8 @@ void FreeDataItem(WIDATAITEM *Item)
// initiate icon assignmet list
void WICondListInit(WICONDLIST *List)
{
- List->Tail = NULL;
- List->Head = NULL;
+ List->Tail = nullptr;
+ List->Head = nullptr;
}
// add a new update item into the current list
@@ -114,8 +114,8 @@ void WICondListAdd(char *str, WICONDLIST *List)
WICONDITEM *newItem = (WICONDITEM*)mir_alloc(sizeof(WICONDITEM));
wSetData(&newItem->Item, str);
CharLowerBuff(newItem->Item, (DWORD)mir_wstrlen(newItem->Item));
- newItem->Next = NULL;
- if (List->Tail == NULL) List->Head = newItem;
+ newItem->Next = nullptr;
+ if (List->Tail == nullptr) List->Head = newItem;
else List->Tail->Next = newItem;
List->Tail = newItem;
}
@@ -124,7 +124,7 @@ void WICondListAdd(char *str, WICONDLIST *List)
bool IsContainedInCondList(const wchar_t *pszStr, WICONDLIST *List)
{
// loop through the list to find matching internal name
- for (WICONDITEM *Item = List->Head; Item != NULL; Item = Item->Next) {
+ for (WICONDITEM *Item = List->Head; Item != nullptr; Item = Item->Next) {
// if internal name found, return true indicating that the data is found
if (wcsstr(pszStr, Item->Item))
return true;
@@ -138,13 +138,13 @@ bool IsContainedInCondList(const wchar_t *pszStr, WICONDLIST *List)
void DestroyCondList(WICONDLIST *List)
{
// free the list one by one
- for (WICONDITEM *temp = List->Head; temp != NULL; temp = List->Head) {
+ for (WICONDITEM *temp = List->Head; temp != nullptr; temp = List->Head) {
List->Head = temp->Next;
wfree(&temp->Item); // free the data struct
mir_free(temp);
}
// make sure the entire list is clear
- List->Tail = NULL;
+ List->Tail = nullptr;
}
@@ -179,7 +179,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case IDC_STEP2:
{
wchar_t szPath[1024];
- GetModuleFileName(GetModuleHandle(NULL), szPath, _countof(szPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szPath, _countof(szPath));
wchar_t *chop = wcsrchr(szPath, '\\');
if (chop) {
*chop = '\0';
@@ -192,7 +192,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case IDC_STEP3:
if (LoadWIData(false))
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("All update data has been reloaded."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
break;
@@ -248,7 +248,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat
// open the ini file
FILE *pfile = _wfsopen(pszFile, L"rt", _SH_DENYWR);
- if (pfile != NULL) {
+ if (pfile != nullptr) {
char Line[4096];
fgets(Line, _countof(Line), pfile);
TrimString(Line);
@@ -271,7 +271,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat
else {
wchar_t str[4096];
mir_snwprintf(str, TranslateT("Invalid ini format for: %s"), pszFile);
- MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
fclose(pfile);
return;
}
@@ -324,8 +324,8 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat
// initialize the linked list for update items
Data->UpdateDataCount = 0;
Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_wstrlen(pszShortFile) + mir_wstrlen(pszFile) + 20)*sizeof(wchar_t);
- Data->UpdateData = NULL;
- Data->UpdateDataTail = NULL;
+ Data->UpdateData = nullptr;
+ Data->UpdateDataTail = nullptr;
// initialize the icon assignment list
for (int i = 0; i < 10; i++)
@@ -334,14 +334,14 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat
while (!feof(pfile)) {
// determine current tag
- if (fgets(Line, _countof(Line), pfile) == NULL)
+ if (fgets(Line, _countof(Line), pfile) == nullptr)
break;
TrimString(Line);
// if the line is a group header/footer
if (Line[0] == '[') {
char *chop = strchr(Line + 1, ']');
- if (chop == NULL)
+ if (chop == nullptr)
continue;
if (Line[1] != '/') { // if it is not a footer (for old ini)
@@ -371,7 +371,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat
}
// ignore comments and all lines without an '='
Value = strstr(Line, "=");
- if (Value == NULL) continue;
+ if (Value == nullptr) continue;
// get the string before '=' (ValName) and after '=' (Value)
ValName = (char *)mir_alloc(mir_strlen(Line) + 1);
@@ -481,14 +481,14 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat
bool LoadWIData(bool dial)
{
// make sure that the current service data list is empty
- WITail = NULL;
+ WITail = nullptr;
WIHead = WITail;
// find all *.ini file in the plugin\weather directory
wchar_t szSearchPath[MAX_PATH], FileName[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szSearchPath, _countof(szSearchPath));
wchar_t *chop = wcsrchr(szSearchPath, '\\');
- if (chop == NULL)
+ if (chop == nullptr)
return false;
*chop = '\0';
mir_wstrncat(szSearchPath, L"\\Plugins\\Weather\\*.ini", _countof(szSearchPath) - mir_wstrlen(szSearchPath));
@@ -515,12 +515,12 @@ bool LoadWIData(bool dial)
FindClose(hFind);
}
- if (WIHead == NULL) {
+ if (WIHead == nullptr) {
// no ini found, display an error message box.
if (dial)
- hWndSetup = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETUP), NULL, DlgProcSetup);
+ hWndSetup = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
else
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("No update data file is found. Please check your Plugins\\Weather directory."),
TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
return false;
@@ -536,7 +536,7 @@ static void FreeWIData(WIDATA *Data)
{
// free update items linked list first
WIDATAITEMLIST *WItem = Data->UpdateData;
- while (WItem != NULL) {
+ while (WItem != nullptr) {
Data->UpdateData = WItem->Next;
FreeDataItem(&WItem->Item);
mir_free(WItem);
@@ -579,7 +579,7 @@ static void FreeWIData(WIDATA *Data)
void DestroyWIList(void)
{
// free the list one by one
- while (WIHead != NULL) {
+ while (WIHead != nullptr) {
WIDATALIST *wi = WIHead;
WIHead = wi->next;
FreeWIData(&wi->Data); // free the data struct
@@ -587,5 +587,5 @@ void DestroyWIList(void)
}
// make sure the entire list is clear
- WITail = NULL;
+ WITail = nullptr;
}
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 14266b6a4f..a87517a9b4 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -48,7 +48,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
data->hContact = (DWORD_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD,
- 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, NULL, hInst, 0);
+ 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, hInst, nullptr);
if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
break;
@@ -61,7 +61,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
POINT pt;
GetCursorPos(&pt);
HMENU hMenu = Menu_BuildContactMenu(data->hContact);
- TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -121,14 +121,14 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
LONG_PTR style = GetWindowLongPtr(data->hAvt, GWL_STYLE);
data->haveAvatar = newava;
SetWindowLongPtr(data->hAvt, GWL_STYLE, newava ? (style | WS_VISIBLE) : (style & ~WS_VISIBLE));
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
}
}
break;
case WM_REDRAWWIN:
- if (data->hAvt != NULL) MoveWindow(data->hAvt, 0, 0, opt.AvatarSize, opt.AvatarSize, TRUE);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ if (data->hAvt != nullptr) MoveWindow(data->hAvt, 0, 0, opt.AvatarSize, opt.AvatarSize, TRUE);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case WM_PAINT:
@@ -141,7 +141,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
COLORREF fntc, fntc1;
COLORREF clr;
int picSize = opt.AvatarSize;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (!data->haveAvatar) {
int statusIcon = db_get_w(data->hContact, WEATHERPROTONAME, "Status", 0);
@@ -182,7 +182,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
}
if (!data->haveAvatar)
- DrawIconEx(hdc, 1, 1, hIcon, 0, 0, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdc, 1, 1, hIcon, 0, 0, 0, nullptr, DI_NORMAL);
SetBkMode(hdc, TRANSPARENT);
@@ -238,7 +238,7 @@ static void addWindow(MCONTACT hContact)
db_free(&dbv);
HWND hWnd = CreateWindow(L"WeatherFrame", L"", WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, pcli->hwndContactList, NULL, hInst, (void*)hContact);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, (void*)hContact);
WindowList_Add(hMwinWindowList, hWnd, hContact);
CLISTFrame Frame = { 0 };
@@ -269,13 +269,13 @@ void removeWindow(MCONTACT hContact)
void UpdateMwinData(MCONTACT hContact)
{
HWND hwnd = WindowList_Find(hMwinWindowList, hContact);
- if (hwnd != NULL)
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ if (hwnd != nullptr)
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
}
INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM)
{
- BOOL addwnd = WindowList_Find(hMwinWindowList, wParam) == NULL;
+ BOOL addwnd = WindowList_Find(hMwinWindowList, wParam) == nullptr;
if (addwnd)
addWindow(wParam);
else
@@ -286,7 +286,7 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM)
int BuildContactMenu(WPARAM wparam, LPARAM)
{
int flags = db_get_dw(wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0;
- Menu_ModifyItem(hMwinMenu, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(hMwinMenu, nullptr, INVALID_HANDLE_VALUE, flags);
return 0;
}
@@ -309,10 +309,10 @@ void InitMwin(void)
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.hIcon = nullptr;
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = L"WeatherFrame";
RegisterClass(&wndclass);
@@ -333,9 +333,9 @@ void InitMwin(void)
mir_wstrcpy(fontid.name, LPGENW("Frame Font"));
mir_strcpy(fontid.prefix, "fnt0");
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
fontid.deffontsettings.size = -13;
- ReleaseDC(0, hdc);
+ ReleaseDC(nullptr, hdc);
fontid.deffontsettings.charset = DEFAULT_CHARSET;
mir_wstrcpy(fontid.deffontsettings.szFace, L"Verdana");
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index a84b00d61c..e7b1566672 100644
--- a/plugins/Weather/src/weather_opt.cpp
+++ b/plugins/Weather/src/weather_opt.cpp
@@ -35,43 +35,43 @@ void SetTextDefault(const char* in)
{
wchar_t str[MAX_TEXT_SIZE];
- if (strchr(in, 'C') != NULL) {
+ if (strchr(in, 'C') != nullptr) {
wcsncpy(str, C_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.cText, str);
}
- if (strchr(in, 'b') != NULL) {
+ if (strchr(in, 'b') != nullptr) {
wcsncpy(str, b_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.bTitle, str);
}
- if (strchr(in, 'B') != NULL) {
+ if (strchr(in, 'B') != nullptr) {
wcsncpy(str, B_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.bText, str);
}
- if (strchr(in, 'N') != NULL) {
+ if (strchr(in, 'N') != nullptr) {
wcsncpy(str, N_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.nText, str);
}
- if (strchr(in, 'E') != NULL) {
+ if (strchr(in, 'E') != nullptr) {
wcsncpy(str, E_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.eText, str);
}
- if (strchr(in, 'H') != NULL) {
+ if (strchr(in, 'H') != nullptr) {
wcsncpy(str, H_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.hText, str);
}
- if (strchr(in, 'X') != NULL) {
+ if (strchr(in, 'X') != nullptr) {
wcsncpy(str, X_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.xText, str);
}
- if (strchr(in, 'P') != NULL) {
+ if (strchr(in, 'P') != nullptr) {
wcsncpy(str, P_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.pTitle, str);
}
- if (strchr(in, 'p') != NULL) {
+ if (strchr(in, 'p') != nullptr) {
wcsncpy(str, p_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.pText, str);
}
- if (strchr(in, 'S') != NULL) {
+ if (strchr(in, 'S') != nullptr) {
wcsncpy(str, s_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.sText, str);
}
@@ -337,8 +337,8 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
GetDlgItemText(hdlg, IDC_UPDATETIME, str, _countof(str));
opt.UpdateTime = (WORD)_wtoi(str);
if (opt.UpdateTime < 1) opt.UpdateTime = 1;
- KillTimer(NULL, timerId);
- timerId = SetTimer(NULL, 0, opt.UpdateTime * 60000, timerProc);
+ KillTimer(nullptr, timerId);
+ timerId = SetTimer(nullptr, 0, opt.UpdateTime * 60000, timerProc);
// other general options
GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, _countof(opt.DegreeSign));
@@ -349,7 +349,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
opt.UpdateOnlyConditionChanged = (BYTE)IsDlgButtonChecked(hdlg, IDC_UPDCONDCHG);
opt.RemoveOldData = IsDlgButtonChecked(hdlg, IDC_REMOVEOLD);
opt.MakeItalic = IsDlgButtonChecked(hdlg, IDC_MAKEI);
- opt.AvatarSize = GetDlgItemInt(hdlg, IDC_AVATARSIZE, NULL, FALSE);
+ opt.AvatarSize = GetDlgItemInt(hdlg, IDC_AVATARSIZE, nullptr, FALSE);
opt.DoNotAppendUnit = IsDlgButtonChecked(hdlg, IDC_DONOTAPPUNITS);
opt.NoFrac = IsDlgButtonChecked(hdlg, IDC_NOFRAC);
UpdateMenu(opt.AutoUpdate);
@@ -486,13 +486,13 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
- switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL)) {
+ switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
case ID_MPREVIEW:
{
// show the preview in a message box, using the weather data from the default station
WEATHERINFO winfo = LoadWeatherInfo(opt.DefStn);
GetDisplay(&winfo, *var[LOWORD(wParam) - IDC_TM1], str);
- MessageBox(NULL, str, TranslateT("Weather Protocol Text Preview"), MB_OK | MB_TOPMOST);
+ MessageBox(nullptr, str, TranslateT("Weather Protocol Text Preview"), MB_OK | MB_TOPMOST);
break;
}
case ID_MRESET:
@@ -514,7 +514,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
- switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL)) {
+ switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
case ID_T1:
// reset to the strings in memory, discard all changes
LoadTextSettings(hdlg);
@@ -594,7 +594,7 @@ int OptInit(WPARAM wParam, LPARAM)
odp.position = 100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.szGroup.a = LPGEN("Popups");
- odp.szTab.a = NULL;
+ odp.szTab.a = nullptr;
odp.pfnDlgProc = DlgPopupOpts;
Options_AddPage(wParam, &odp);
}
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index 765d71f830..c48e4c37c3 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -54,18 +54,18 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
wcsncpy(str1, tszMsg, _countof(str1) - 1);
wcsncpy(str2, tszMsg, _countof(str2) - 1);
wchar_t *chop = wcschr(str1, 255);
- if (chop != NULL)
+ if (chop != nullptr)
*chop = '\0';
else
str1[0] = 0;
chop = wcschr(str2, 255);
- if (chop != NULL)
+ if (chop != nullptr)
wcsncpy(str2, chop + 1, _countof(str2) - 1);
else
str2[0] = 0;
// setup the popup
- ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(OIC_BANG), IMAGE_ICON,
+ ppd.lchIcon = (HICON)LoadImage(nullptr, MAKEINTRESOURCE(OIC_BANG), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
mir_wstrcpy(ppd.lptzContactName, str1);
mir_wstrcpy(ppd.lptzText, str2);
@@ -176,7 +176,7 @@ LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
hMenu = Menu_BuildContactMenu(wParam);
GetCursorPos(&pt);
hPopupContact = wParam;
- TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, NULL);
+ TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, nullptr);
DestroyMenu(hMenu);
break;
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.RightClickAction);
- ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL);
+ ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr);
if (ID)
opt.RightClickAction = ID;
DestroyMenu(hMenu);
@@ -355,7 +355,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.LeftClickAction);
- ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, NULL);
+ ID = TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr);
if (ID) opt.LeftClickAction = ID;
DestroyMenu(hMenu);
@@ -398,7 +398,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
mir_wstrncat(str, VAR_LIST_POPUP, _countof(str) - mir_wstrlen(str));
mir_wstrncat(str, L"\n", _countof(str) - mir_wstrlen(str));
mir_wstrncat(str, CUSTOM_VARS, _countof(str) - mir_wstrlen(str));
- MessageBox(NULL, str, TranslateT("Variable List"), MB_OK | MB_ICONASTERISK | MB_TOPMOST);
+ MessageBox(nullptr, str, TranslateT("Variable List"), MB_OK | MB_ICONASTERISK | MB_TOPMOST);
break;
case IDC_PREVIEW:
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index 705288a25f..58d2dcfca9 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -132,7 +132,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
unsigned i;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
+ GetModuleFileName(GetModuleHandle(nullptr), szSearchPath, _countof(szSearchPath));
chop = wcsrchr(szSearchPath, '\\');
if (chop) *chop = '\0';
@@ -169,7 +169,7 @@ void AvatarDownloaded(MCONTACT hContact)
if (WeatherGetAvatarInfo(GAIF_FORCE, (LPARAM)&ai) == GAIR_SUCCESS)
ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
else
- ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr, 0);
}
static void __cdecl WeatherGetAwayMsgThread(void *arg)
@@ -188,7 +188,7 @@ static void __cdecl WeatherGetAwayMsgThread(void *arg)
static INT_PTR WeatherGetAwayMsg(WPARAM, LPARAM lParam)
{
CCSDATA* ccs = (CCSDATA*)lParam;
- if (ccs == NULL)
+ if (ccs == nullptr)
return 0;
mir_forkthread(WeatherGetAwayMsgThread, (void*)ccs->hContact);
@@ -372,8 +372,8 @@ void AddMenuItems(void)
mi.pszService = "Weather/mwin_menu";
CreateServiceFunction(mi.pszService, Mwin_MenuClicked);
mi.position = -0x7FFFFFF0;
- mi.hIcolibItem = NULL;
- mi.root = NULL;
+ mi.hIcolibItem = nullptr;
+ mi.root = nullptr;
mi.name.a = LPGEN("Display in a frame");
hMwinMenu = Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
}
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index 02d5129fab..d64786e53c 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -138,7 +138,7 @@ int UpdateWeather(MCONTACT hContact)
else
db_unset(hContact, "CList", "StatusMsg");
- ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)(str2[0] ? str2 : 0));
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)(str2[0] ? str2 : nullptr));
// save descriptions in MyNotes
GetDisplay(&winfo, opt.nText, str2);
@@ -174,7 +174,7 @@ int UpdateWeather(MCONTACT hContact)
// open the file and set point to the end of file
FILE *file = _wfopen(dbv.ptszVal, L"a");
db_free(&dbv);
- if (file != NULL) {
+ if (file != nullptr) {
// write data to the file and close
GetDisplay(&winfo, opt.eText, str2);
fputws(str2, file);
@@ -191,7 +191,7 @@ int UpdateWeather(MCONTACT hContact)
DBEVENTINFO dbei = {};
dbei.szModule = WEATHERPROTONAME;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.flags = DBEF_READ | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.pBlob = szMessage;
@@ -211,7 +211,7 @@ int UpdateWeather(MCONTACT hContact)
// update brief info if its opened
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
- if (hMoreDataDlg != NULL)
+ if (hMoreDataDlg != nullptr)
PostMessage(hMoreDataDlg, WM_UPDATEDATA, 0, 0);
return 0;
}
@@ -225,11 +225,11 @@ void UpdateListAdd(MCONTACT hContact)
{
UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST));
newItem->hContact = hContact;
- newItem->next = NULL;
+ newItem->next = nullptr;
WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListTail == NULL) UpdateListHead = newItem;
+ if (UpdateListTail == nullptr) UpdateListHead = newItem;
else UpdateListTail->next = newItem;
UpdateListTail = newItem;
@@ -244,15 +244,15 @@ MCONTACT UpdateGetFirst()
WaitForSingleObject(hUpdateMutex, INFINITE);
- if (UpdateListHead != NULL) {
+ if (UpdateListHead != nullptr) {
UPDATELIST* Item = UpdateListHead;
hContact = Item->hContact;
UpdateListHead = Item->next;
mir_free(Item);
- if (UpdateListHead == NULL)
- UpdateListTail = NULL;
+ if (UpdateListHead == nullptr)
+ UpdateListTail = nullptr;
}
ReleaseMutex(hUpdateMutex);
@@ -266,13 +266,13 @@ void DestroyUpdateList(void)
// free the list one by one
UPDATELIST *temp = UpdateListHead;
- while (temp != NULL) {
+ while (temp != nullptr) {
UpdateListHead = temp->next;
mir_free(temp);
temp = UpdateListHead;
}
// make sure the entire list is clear
- UpdateListTail = NULL;
+ UpdateListTail = nullptr;
ReleaseMutex(hUpdateMutex);
}
@@ -290,7 +290,7 @@ static void UpdateThreadProc(void *)
ReleaseMutex(hUpdateMutex);
// update weather by getting the first station from the queue until the queue is empty
- while (UpdateListHead != NULL && !Miranda_IsTerminated())
+ while (UpdateListHead != nullptr && !Miranda_IsTerminated())
UpdateWeather(UpdateGetFirst());
NetlibHttpDisconnect();
@@ -384,7 +384,7 @@ int GetWeatherData(MCONTACT hContact)
// test ID format
wchar_t* szInfo = wcschr(id, '/');
- if (szInfo == NULL)
+ if (szInfo == nullptr)
return INVALID_ID_FORMAT;
GetID(id);
@@ -399,7 +399,7 @@ int GetWeatherData(MCONTACT hContact)
// get the update strings (loaded to memory from ini files)
WIDATA *Data = GetWIData(Svc);
- if (Data == NULL)
+ if (Data == nullptr)
return SVC_NOT_FOUND; // the ini for the station cannot be found
WORD cond = NA;
@@ -431,13 +431,13 @@ int GetWeatherData(MCONTACT hContact)
continue;
// download the html file from the internet
- wchar_t* szData = NULL;
+ wchar_t* szData = nullptr;
int retval = InternetDownloadFile(loc, Data->Cookie, Data->UserAgent, &szData);
if (retval != 0) {
mir_free(szData);
return retval;
}
- if (wcsstr(szData, L"Document Not Found") != NULL) {
+ if (wcsstr(szData, L"Document Not Found") != nullptr) {
mir_free(szData);
return DOC_NOT_FOUND;
}
@@ -446,7 +446,7 @@ int GetWeatherData(MCONTACT hContact)
WIDATAITEMLIST *Item = Data->UpdateData;
// begin parsing item by item
- while (Item != NULL) {
+ while (Item != nullptr) {
if (Item->Item.Url[0] != 0 && Item->Item.Url[0] != (i + '1')) {
Item = Item->Next;
continue;
@@ -477,7 +477,7 @@ int GetWeatherData(MCONTACT hContact)
do {
// the end of the string, last item
chop = wcsstr(str, L" & ");
- if (chop == NULL)
+ if (chop == nullptr)
chop = wcschr(str, '\0');
stl = min(sizeof(str2) - 1, (unsigned)(chop - str - 2));
@@ -523,7 +523,7 @@ int GetWeatherData(MCONTACT hContact)
// generate the strings
wchar_t* end = wcsstr(DataValue, Item->Item.Break);
- if (end == NULL) {
+ if (end == nullptr) {
DataValue[0] = 0;
break; // exit if break string is not found
}
@@ -597,7 +597,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
// when this is run, it kill the old startup timer and create the permenant one above
void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, timerId);
+ KillTimer(nullptr, timerId);
ThreadRunning = FALSE;
if (Miranda_IsTerminated())
@@ -605,5 +605,5 @@ void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD)
if (opt.StartupUpdate && opt.NoProtoCondition)
UpdateAll(FALSE, FALSE);
- timerId = SetTimer(NULL, 0, ((int)opt.UpdateTime) * 60000, timerProc);
+ timerId = SetTimer(nullptr, 0, ((int)opt.UpdateTime) * 60000, timerProc);
}
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index a11962c332..cfba17d431 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -133,7 +133,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
Window_FreeIcon_IcoLib(hwndDlg);
Window_SetProtoIcon_IcoLib(hwndDlg, WEATHERPROTONAME, db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0));
- RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
break;
case WM_SIZE:
@@ -293,8 +293,8 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
switch (LOWORD(wParam)) {
case IDC_MOREDETAIL:
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
- if (hMoreDataDlg == NULL)
- hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData, hContact);
+ if (hMoreDataDlg == nullptr)
+ hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
else {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
@@ -344,11 +344,11 @@ int BriefInfo(WPARAM wParam, LPARAM)
// make sure that the contact is actually a weather one
if (IsMyContact(wParam)) {
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, wParam);
- if (hMoreDataDlg != NULL) {
+ if (hMoreDataDlg != nullptr) {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
}
- else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData, (LPARAM)wParam);
+ else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 0);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 1);