From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/MirLua/Modules/WinAPI/src/winapi.cpp | 90 ++++++++++++------------ plugins/MirLua/Modules/m_popup/src/main.cpp | 6 +- plugins/MirLua/Modules/m_schedule/src/main.cpp | 52 +++++++------- plugins/MirLua/Modules/m_toptoolbar/src/main.cpp | 4 +- plugins/MirLua/Modules/m_variables/src/main.cpp | 4 +- plugins/MirLua/src/m_chat.cpp | 2 +- plugins/MirLua/src/m_clist.cpp | 2 +- plugins/MirLua/src/m_core.cpp | 28 ++++---- plugins/MirLua/src/m_database.cpp | 20 +++--- plugins/MirLua/src/m_genmenu.cpp | 2 +- plugins/MirLua/src/m_hotkeys.cpp | 8 +-- plugins/MirLua/src/m_http.cpp | 14 ++-- plugins/MirLua/src/m_icolib.cpp | 8 +-- plugins/MirLua/src/m_json.cpp | 6 +- plugins/MirLua/src/m_message.cpp | 4 +- plugins/MirLua/src/m_options.cpp | 2 +- plugins/MirLua/src/m_protocols.cpp | 12 ++-- plugins/MirLua/src/m_sounds.cpp | 2 +- plugins/MirLua/src/m_srmm.cpp | 2 +- plugins/MirLua/src/main.cpp | 4 +- plugins/MirLua/src/mlua.cpp | 8 +-- plugins/MirLua/src/mlua_enviroment.cpp | 2 +- plugins/MirLua/src/mlua_icons.cpp | 4 +- plugins/MirLua/src/mlua_options.cpp | 8 +-- plugins/MirLua/src/mlua_utils.cpp | 2 +- 25 files changed, 148 insertions(+), 148 deletions(-) (limited to 'plugins/MirLua') diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp index da4f62ec50..11b7daebd7 100644 --- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp +++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp @@ -28,7 +28,7 @@ static int lua_ShellExecute(lua_State *L) ptrW args(mir_utf8decodeW(lua_tostring(L, 3))); int flags = lua_tointeger(L, 4); - ::ShellExecute(NULL, command, file, args, NULL, flags); + ::ShellExecute(nullptr, command, file, args, nullptr, flags); return 0; } @@ -41,7 +41,7 @@ static int lua_FindIterator(lua_State *L) wchar_t* path = (wchar_t*)lua_touserdata(L, lua_upvalueindex(2)); WIN32_FIND_DATA ffd = { 0 }; - if (hFind == NULL) + if (hFind == nullptr) { hFind = FindFirstFile(path, &ffd); if (hFind == INVALID_HANDLE_VALUE) @@ -100,7 +100,7 @@ static int lua_Find(lua_State *L) { wchar_t *path = mir_utf8decodeW(luaL_checkstring(L, 1)); - lua_pushlightuserdata(L, NULL); + lua_pushlightuserdata(L, nullptr); lua_pushlightuserdata(L, path); lua_pushcclosure(L, lua_FindIterator, 2); @@ -168,7 +168,7 @@ static int lua_DeleteIniValue(lua_State *L) ptrW section(mir_utf8decodeW(luaL_checkstring(L, 2))); ptrW key(mir_utf8decodeW(luaL_checkstring(L, 3))); - bool res = ::WritePrivateProfileString(section, key, NULL, path) != 0; + bool res = ::WritePrivateProfileString(section, key, nullptr, path) != 0; lua_pushboolean(L, res); return 1; @@ -182,7 +182,7 @@ static int lua_GetRegValue(lua_State *L) ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2))); ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3))); - HKEY hKey = 0; + HKEY hKey = nullptr; LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_READ, &hKey); if (res != ERROR_SUCCESS) { @@ -193,12 +193,12 @@ static int lua_GetRegValue(lua_State *L) DWORD type = 0; DWORD length = 1024; BYTE* value = (BYTE*)mir_alloc(length); - res = ::RegQueryValueEx(hKey, valueName, NULL, &type, (LPBYTE)value, &length); + res = ::RegQueryValueEx(hKey, valueName, nullptr, &type, (LPBYTE)value, &length); while (res == ERROR_MORE_DATA) { length += length; value = (BYTE*)mir_realloc(value, length); - res = ::RegQueryValueEx(hKey, valueName, NULL, &type, (LPBYTE)value, &length); + res = ::RegQueryValueEx(hKey, valueName, nullptr, &type, (LPBYTE)value, &length); } if (res == ERROR_SUCCESS) @@ -243,7 +243,7 @@ static int lua_SetRegValue(lua_State *L) ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2))); ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3))); - HKEY hKey = 0; + HKEY hKey = nullptr; LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey); if (res != ERROR_SUCCESS) { @@ -253,7 +253,7 @@ static int lua_SetRegValue(lua_State *L) DWORD type = 0; DWORD length = 0; - BYTE* value = NULL; + BYTE* value = nullptr; switch (lua_type(L, 4)) { case LUA_TNUMBER: @@ -299,7 +299,7 @@ static int lua_DeleteRegValue(lua_State *L) ptrW path(mir_utf8decodeW(luaL_checkstring(L, 2))); ptrW valueName(mir_utf8decodeW(luaL_checkstring(L, 3))); - HKEY hKey = 0; + HKEY hKey = nullptr; LSTATUS res = ::RegOpenKeyEx(hRootKey, path, NULL, KEY_WRITE, &hKey); if (res != ERROR_SUCCESS) { @@ -321,7 +321,7 @@ static int global_FindWindow(lua_State *L) { const char *cname = luaL_checkstring(L, 1); const char *wname = luaL_checkstring(L, 2); - lua_pushnumber(L, (intptr_t)FindWindowA(cname[0] ? cname : NULL, wname[0] ? wname : NULL)); + lua_pushnumber(L, (intptr_t)FindWindowA(cname[0] ? cname : nullptr, wname[0] ? wname : nullptr)); return(1); } @@ -333,8 +333,8 @@ static int global_FindWindowEx(lua_State *L) const char *wname = luaL_checkstring(L, 4); long lrc = (long)FindWindowExA(parent, childaft, - cname[0] ? cname : NULL, - wname[0] ? wname : NULL); + cname[0] ? cname : nullptr, + wname[0] ? wname : nullptr); lua_pushnumber(L, lrc); @@ -575,7 +575,7 @@ static int global_CreateEvent(lua_State *L) const char *name; sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; + sa.lpSecurityDescriptor = nullptr; sa.bInheritHandle = FALSE; if (lua_istable(L, 1)) { @@ -635,7 +635,7 @@ static int global_CreateMutex(lua_State *L) const char *name; sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; + sa.lpSecurityDescriptor = nullptr; sa.bInheritHandle = FALSE; if (lua_istable(L, 1)) { @@ -676,7 +676,7 @@ static int global_CreateSemaphore(lua_State *L) const char *name; sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; + sa.lpSecurityDescriptor = nullptr; sa.bInheritHandle = FALSE; if (lua_istable(L, 1)) { @@ -732,7 +732,7 @@ static int global_CreateProcess(lua_State *L) const char *cd = lua_tostring(L, 8); psa.nLength = sizeof(psa); - psa.lpSecurityDescriptor = NULL; + psa.lpSecurityDescriptor = nullptr; psa.bInheritHandle = FALSE; if (lua_istable(L, 3)) { lua_pushstring(L, "bInheritHandle"); @@ -743,7 +743,7 @@ static int global_CreateProcess(lua_State *L) } tsa.nLength = sizeof(tsa); - tsa.lpSecurityDescriptor = NULL; + tsa.lpSecurityDescriptor = nullptr; tsa.bInheritHandle = FALSE; if (lua_istable(L, 4)) { lua_pushstring(L, "bInheritHandle"); @@ -753,7 +753,7 @@ static int global_CreateProcess(lua_State *L) lua_pop(L, 4); } - env = NULL; + env = nullptr; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); @@ -813,9 +813,9 @@ static int global_CreateProcess(lua_State *L) brc = CreateProcessA(an, (char *)cl, &psa, &tsa, ih, cf, env, cd, &si, &pi); - if (si.lpDesktop != NULL) + if (si.lpDesktop != nullptr) mir_free(si.lpDesktop); - if (si.lpTitle != NULL) + if (si.lpTitle != nullptr) mir_free(si.lpTitle); lua_pushnumber(L, brc); @@ -900,7 +900,7 @@ static int global_CreateNamedPipe(lua_State *L) DWORD nOutBufferSize = luaL_checknumber(L, 5); DWORD nInBufferSize = luaL_checknumber(L, 6); DWORD nDefaultTimeOut = luaL_checknumber(L, 7); - SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, false }; + SECURITY_ATTRIBUTES sa = { sizeof(sa), nullptr, false }; HANDLE hPipe = CreateNamedPipeA(lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, &sa); lua_pushnumber(L, (intptr_t)hPipe); @@ -941,7 +941,7 @@ static int global_CreateFile(lua_State *L) intptr_t th = 0; sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; + sa.lpSecurityDescriptor = nullptr; sa.bInheritHandle = FALSE; if (lua_istable(L, 4)) { lua_pushstring(L, "bInheritHandle"); @@ -983,9 +983,9 @@ static int global_ReadFile(lua_State *L) { DWORD btoread = (DWORD)luaL_checknumber(L, 2); buf = (char*)mir_alloc(btoread); - if (buf != NULL) + if (buf != nullptr) { - brc = ReadFile(h, buf, btoread, &bread, NULL); + brc = ReadFile(h, buf, btoread, &bread, nullptr); lua_pushboolean(L, TRUE); lua_pushlstring(L, buf, bread); mir_free(buf); @@ -1022,7 +1022,7 @@ static int global_WriteFile(lua_State *L) { HANDLE h = (HANDLE)(intptr_t)luaL_checknumber(L, 1); const char *buf = luaL_checklstring(L, 2, (size_t*)&btowrite); - brc = WriteFile(h, buf, btowrite, &bwrite, NULL); + brc = WriteFile(h, buf, btowrite, &bwrite, nullptr); lua_pushboolean(L, brc); luaM_PushNumberIf(L, bwrite, brc); return(2); @@ -1128,7 +1128,7 @@ static int global_RegQueryValueEx(lua_State *L) rv = RegOpenKeyExA(hkey, subkey, 0, KEY_QUERY_VALUE, &hsk); if (rv == ERROR_SUCCESS) { len = sizeof(dwdata); - rv = RegQueryValueExA(hsk, valuename, NULL, &type, (LPBYTE)&dwdata, &len); + rv = RegQueryValueExA(hsk, valuename, nullptr, &type, (LPBYTE)&dwdata, &len); if ((rv == ERROR_SUCCESS) || (rv == ERROR_MORE_DATA)) { switch (type) { case REG_DWORD_BIG_ENDIAN: @@ -1141,11 +1141,11 @@ static int global_RegQueryValueEx(lua_State *L) case REG_SZ: if (rv == ERROR_MORE_DATA) { szdata = (char*)mir_alloc(len); - if (szdata == NULL) { + if (szdata == nullptr) { lua_pushnil(L); } else { - rv = RegQueryValueExA(hsk, valuename, NULL, &type, (LPBYTE)szdata, &len); + rv = RegQueryValueExA(hsk, valuename, nullptr, &type, (LPBYTE)szdata, &len); if (rv == ERROR_SUCCESS) lua_pushlstring(L, szdata, mir_strlen(szdata)); else @@ -1176,7 +1176,7 @@ static int global_RegSetValueEx(lua_State *L) { DWORD type; DWORD dwdata; DWORD len = 0; - char *szdata = NULL; + char *szdata = nullptr; HKEY hkey = (HKEY)(intptr_t)luaL_checknumber(L, 1); const char *subkey = luaL_checkstring(L, 2); const char *valuename = luaL_checkstring(L, 3); @@ -1190,9 +1190,9 @@ static int global_RegSetValueEx(lua_State *L) { type = (DWORD)luaL_optnumber(L, 5, REG_SZ); } - rv = RegCreateKeyExA(hkey, subkey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hsk, NULL); + rv = RegCreateKeyExA(hkey, subkey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hsk, nullptr); if (rv == ERROR_SUCCESS) { - if (szdata == NULL) + if (szdata == nullptr) rv = RegSetValueExA(hsk, valuename, 0, type, (CONST BYTE *) &dwdata, sizeof(dwdata)); else rv = RegSetValueExA(hsk, valuename, 0, type, (CONST BYTE *) szdata, len + 1); @@ -1251,7 +1251,7 @@ static int global_RegEnumKeyEx(lua_State *L) { len = sizeof(name); if (RegEnumKeyExA(hsk, index, name, &len, - NULL, NULL, NULL, &ft) != ERROR_SUCCESS) + nullptr, nullptr, nullptr, &ft) != ERROR_SUCCESS) break; lua_pushnumber(L, index + 1); lua_pushstring(L, name); @@ -1282,7 +1282,7 @@ static int global_RegEnumValue(lua_State *L) { { len = sizeof(name); if (RegEnumValueA(hsk, index, name, &len, - NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + nullptr, nullptr, nullptr, nullptr) != ERROR_SUCCESS) break; lua_pushnumber(L, index + 1); lua_pushstring(L, name); @@ -1402,7 +1402,7 @@ static int global_FindFirstFile(lua_State *L) const char *fname = luaL_checkstring(L, 1); hfd = FindFirstFileA(fname, &wfd); - if (hfd == NULL) { + if (hfd == nullptr) { lua_pushnumber(L, 0); lua_pushnil(L); } @@ -1509,7 +1509,7 @@ static int global_IsUserAdmin(lua_State *L) &AdministratorsGroup); if (b) { - if (!CheckTokenMembership(NULL, AdministratorsGroup, &b)) + if (!CheckTokenMembership(nullptr, AdministratorsGroup, &b)) b = FALSE; FreeSid(AdministratorsGroup); } @@ -1525,7 +1525,7 @@ static int global_OpenProcess(lua_State *L) { DWORD pid = (DWORD)luaL_checknumber(L, 3); h = OpenProcess(da, ih, pid); - if (h != NULL) + if (h != nullptr) lua_pushnumber(L, (long)h); else lua_pushnil(L); @@ -1539,7 +1539,7 @@ static int global_IsRunning(lua_State *L) { DWORD pid = (DWORD)luaL_checknumber(L, 1); h = OpenProcess(SYNCHRONIZE, FALSE, pid); - if (h != NULL) { + if (h != nullptr) { b = TRUE; CloseHandle(h); } @@ -1562,7 +1562,7 @@ static int global_GetWindowThreadProcessId(lua_State *L) static int global_OpenSCManager(lua_State *L) { - lua_pushnumber(L, (intptr_t)OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)); + lua_pushnumber(L, (intptr_t)OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS)); return 1; } @@ -1657,7 +1657,7 @@ static int global_DeleteService(lua_State *L) static int global_StartService(lua_State *L) { SC_HANDLE h = (SC_HANDLE)(intptr_t)luaL_checknumber(L, 1); - lua_pushboolean(L, StartService(h, 0, NULL)); + lua_pushboolean(L, StartService(h, 0, nullptr)); return 1; } @@ -1665,7 +1665,7 @@ static int global_StartService(lua_State *L) static int global_mciSendString(lua_State *L) { const char *cmd = luaL_checkstring(L, 1); // only one string parameter is used - DWORD lrc = mciSendStringA(cmd, NULL, 0, NULL); + DWORD lrc = mciSendStringA(cmd, nullptr, 0, nullptr); lua_pushnumber(L, lrc); return(1); } @@ -1686,7 +1686,7 @@ static int global_Beep(lua_State *L) static int global_CoInitialize(lua_State *L) { - HRESULT lrc = CoInitialize(NULL); + HRESULT lrc = CoInitialize(nullptr); lua_pushinteger(L, lrc); return(1); } @@ -1884,7 +1884,7 @@ static luaM_consts consts[] = { "MB_OK", MB_OK }, { "BM_CLICK", BM_CLICK }, - { NULL, 0 } + { nullptr, 0 } }; /***********************************************/ @@ -1984,14 +1984,14 @@ static luaL_Reg winApi[] = { "GetCurrentProcessId", global_GetCurrentProcessId }, { "GetOpenFileName", global_GetOpenFileName }, - { NULL, NULL } + { nullptr, nullptr } }; LUA_WINAPI_LIB luaopen_winapi(lua_State *L) { luaL_newlib(L, winApi); - for (size_t i = 0; consts[i].name != NULL; i++) + for (size_t i = 0; consts[i].name != nullptr; i++) { lua_pushstring(L, consts[i].name); lua_pushnumber(L, consts[i].value); diff --git a/plugins/MirLua/Modules/m_popup/src/main.cpp b/plugins/MirLua/Modules/m_popup/src/main.cpp index 62d6bfb43b..35f2b9bb28 100644 --- a/plugins/MirLua/Modules/m_popup/src/main.cpp +++ b/plugins/MirLua/Modules/m_popup/src/main.cpp @@ -35,7 +35,7 @@ static int lua_AddPopup(lua_State *L) { if (lua_type(L, 1) != LUA_TTABLE) { - lua_pushlightuserdata(L, 0); + lua_pushlightuserdata(L, nullptr); return 1; } @@ -98,7 +98,7 @@ static int lua_AddPopup2(lua_State *L) { if (lua_type(L, 1) != LUA_TTABLE) { - lua_pushlightuserdata(L, 0); + lua_pushlightuserdata(L, nullptr); return 1; } @@ -118,7 +118,7 @@ static luaL_Reg popupApi[] = { "AddPopup", lua_AddPopup }, { "AddPopup2", lua_AddPopup2 }, - { NULL, NULL } + { nullptr, nullptr } }; extern "C" LUAMOD_API int luaopen_m_popup(lua_State *L) diff --git a/plugins/MirLua/Modules/m_schedule/src/main.cpp b/plugins/MirLua/Modules/m_schedule/src/main.cpp index 093a95ca94..fd6820ea9f 100644 --- a/plugins/MirLua/Modules/m_schedule/src/main.cpp +++ b/plugins/MirLua/Modules/m_schedule/src/main.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" static mir_cs threadLock; -static HANDLE hScheduleEvent = NULL; -static HANDLE hScheduleThread = NULL; +static HANDLE hScheduleEvent = nullptr; +static HANDLE hScheduleThread = nullptr; #define STOP ((void *) -1) @@ -24,7 +24,7 @@ struct ScheduleTask ScheduleTask() { - timestamp = time(NULL); + timestamp = time(nullptr); interval = 0; repeat = false; } @@ -63,7 +63,7 @@ void ExecuteTaskThread(void *arg) { mir_cslock lock(threadLock); - time_t now = time(NULL); + time_t now = time(nullptr); if (task->timestamp + task->interval >= now) task->timestamp += task->interval; else @@ -87,7 +87,7 @@ wait: WaitForSingleObject(hScheduleEvent, waitTime); if (Miranda_IsTerminated()) return; - time_t now = time(NULL); + time_t now = time(nullptr); if (task->timestamp > now) { waitTime = (task->timestamp - now) * 1000; @@ -165,7 +165,7 @@ static int fluent_Do(lua_State *L) ScheduleTask *task = *(ScheduleTask**)lua_touserdata(L, lua_upvalueindex(1)); - time_t now = time(NULL); + time_t now = time(nullptr); if (task->timestamp < now) { if (task->interval == 0) @@ -200,7 +200,7 @@ static int fluent_From(lua_State *L) const luaL_Reg funcs[] = { { "Do", fluent_Do }, - { NULL, NULL } + { nullptr, nullptr } }; lua_pushvalue(L, lua_upvalueindex(1)); @@ -214,7 +214,7 @@ static const luaL_Reg fluentApi[] = { "From", fluent_From }, { "Do", fluent_Do }, - { NULL, NULL } + { nullptr, nullptr } }; static int fluent_Second(lua_State *L) @@ -323,7 +323,7 @@ static int fluent_Week(lua_State *L) static int fluent_Monday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(1 - ti->tm_wday); @@ -339,7 +339,7 @@ static int fluent_Monday(lua_State *L) static int fluent_Tuesday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(2 - ti->tm_wday); @@ -355,7 +355,7 @@ static int fluent_Tuesday(lua_State *L) static int fluent_Wednesday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(3 - ti->tm_wday); @@ -371,7 +371,7 @@ static int fluent_Wednesday(lua_State *L) static int fluent_Thursday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(4 - ti->tm_wday); @@ -387,7 +387,7 @@ static int fluent_Thursday(lua_State *L) static int fluent_Friday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(5 - ti->tm_wday); @@ -403,7 +403,7 @@ static int fluent_Friday(lua_State *L) static int fluent_Saturday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(6 - ti->tm_wday); @@ -419,7 +419,7 @@ static int fluent_Saturday(lua_State *L) static int fluent_Sunday(lua_State *L) { - time_t timestamp = time(NULL); + time_t timestamp = time(nullptr); struct tm *ti = localtime(×tamp); ti->tm_mday += abs(-ti->tm_wday); @@ -439,14 +439,14 @@ static const luaL_Reg scheduleAtApi[] = { { "Do", fluent_Do }, - { NULL, NULL } + { nullptr, nullptr } }; static int schedule_At(lua_State *L) { ScheduleTask **task = (ScheduleTask**)lua_newuserdata(L, sizeof(ScheduleTask)); *task = new ScheduleTask(); - (*task)->timestamp = luaM_opttimestamp(L, 1, time(NULL)); + (*task)->timestamp = luaM_opttimestamp(L, 1, time(nullptr)); lua_newtable(L); lua_newtable(L); @@ -475,7 +475,7 @@ static const luaL_Reg scheduleEvery1Api[] = { "Saturday", fluent_Saturday }, { "Sunday", fluent_Sunday }, - { NULL, NULL } + { nullptr, nullptr } }; static const luaL_Reg scheduleEvery2Api[] = @@ -485,7 +485,7 @@ static const luaL_Reg scheduleEvery2Api[] = { "Hours", fluent_Hours }, { "Days", fluent_Days }, - { NULL, NULL } + { nullptr, nullptr } }; static int schedule_Every(lua_State *L) @@ -522,7 +522,7 @@ static const luaL_Reg scheduleWait1Api[] = { "Day", fluent_Day }, { "Week", fluent_Week }, - { NULL, NULL } + { nullptr, nullptr } }; static const luaL_Reg scheduleWait2Api[] = @@ -532,7 +532,7 @@ static const luaL_Reg scheduleWait2Api[] = { "Hours", fluent_Hours }, { "Days", fluent_Days }, - { NULL, NULL } + { nullptr, nullptr } }; static int schedule_Wait(lua_State *L) @@ -564,9 +564,9 @@ static const luaL_Reg scheduleApi[] = { "Every", schedule_Every }, { "Wait", schedule_Wait }, - { "STOP", NULL }, + { "STOP", nullptr }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -577,10 +577,10 @@ extern "C" LUAMOD_API int luaopen_m_schedule(lua_State *L) lua_pushlightuserdata(L, STOP); lua_setfield(L, -2, "STOP"); - if (hScheduleEvent == NULL) - hScheduleEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + if (hScheduleEvent == nullptr) + hScheduleEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - if (hScheduleThread == NULL) + if (hScheduleThread == nullptr) hScheduleThread = mir_forkthread(ScheduleThread); return 1; diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp index 17a8d95b00..55c4cf04d8 100644 --- a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp +++ b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp @@ -60,7 +60,7 @@ static int lua_AddButton(lua_State *L) { if (lua_type(L, 1) != LUA_TTABLE) { - lua_pushlightuserdata(L, 0); + lua_pushlightuserdata(L, nullptr); return 1; } @@ -98,7 +98,7 @@ static luaL_Reg toptoolbarApi[] = { "AddButton", lua_AddButton }, { "RemoveButton", lua_RemoveButton }, - { NULL, NULL } + { nullptr, nullptr } }; extern "C" LUAMOD_API int luaopen_m_toptoolbar(lua_State *L) diff --git a/plugins/MirLua/Modules/m_variables/src/main.cpp b/plugins/MirLua/Modules/m_variables/src/main.cpp index a9c5204f96..dcd2a7e773 100644 --- a/plugins/MirLua/Modules/m_variables/src/main.cpp +++ b/plugins/MirLua/Modules/m_variables/src/main.cpp @@ -11,7 +11,7 @@ static int lua_Parse(lua_State *L) ptrW format(mir_utf8decodeW(luaL_checkstring(L, 1))); MCONTACT hContact = lua_tointeger(L, 2); - wchar_t *res = variables_parse_ex(format, NULL, hContact, NULL, 0); + wchar_t *res = variables_parse_ex(format, nullptr, hContact, nullptr, 0); lua_pushstring(L, T2Utf(res)); return 1; @@ -21,7 +21,7 @@ static luaL_Reg variablesApi[] = { { "Parse", lua_Parse }, - { NULL, NULL } + { nullptr, nullptr } }; extern "C" LUAMOD_API int luaopen_m_variables(lua_State *L) diff --git a/plugins/MirLua/src/m_chat.cpp b/plugins/MirLua/src/m_chat.cpp index f84caa4591..ed57b7b9de 100644 --- a/plugins/MirLua/src/m_chat.cpp +++ b/plugins/MirLua/src/m_chat.cpp @@ -2,7 +2,7 @@ static luaL_Reg chatApi[] = { - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_chat(lua_State *L) diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp index d5d8d76a10..cc32c188db 100644 --- a/plugins/MirLua/src/m_clist.cpp +++ b/plugins/MirLua/src/m_clist.cpp @@ -89,7 +89,7 @@ static luaL_Reg clistApi[] = { "AddTrayMenuItem", clist_AddTrayMenuItem }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_clist(lua_State *L) diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index bf3b5233cf..33214d061a 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -65,13 +65,13 @@ static int core_HookEvent(lua_State *L) lua_pushvalue(L, 2); int ref = luaL_ref(L, LUA_REGISTRYINDEX); - HANDLE res = NULL; + HANDLE res = nullptr; CMLuaEnviroment *env = CMLuaEnviroment::GetEnviroment(L); if (env) res = HookEventObjParam(name, HookEventEnvParam, env, ref); else res = HookEventObjParam(name, HookEventLuaStateParam, L, ref); - if (res == NULL) + if (res == nullptr) { luaL_unref(L, LUA_REGISTRYINDEX, ref); lua_pushnil(L); @@ -94,14 +94,14 @@ static int core_HookTemporaryEvent(lua_State *L) lua_pushvalue(L, 2); int ref = luaL_ref(L, LUA_REGISTRYINDEX); - HANDLE res = NULL; + HANDLE res = nullptr; CMLuaEnviroment *env = CMLuaEnviroment::GetEnviroment(L); if (env) res = HookEventObjParam(name, HookEventEnvParam, env, ref); else res = HookEventObjParam(name, HookEventLuaStateParam, L, ref); // event does not exists, call hook immideatelly - if (res == NULL) + if (res == nullptr) { lua_pushnil(L); lua_pushnil(L); @@ -125,7 +125,7 @@ static int core_UnhookEvent(lua_State *L) if (!res) { HandleRefParam *param = (HandleRefParam*)CMLua::HookRefs.find(&hEvent); - if (param != NULL) + if (param != nullptr) { luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref); CMLua::HookRefs.remove(param); @@ -194,7 +194,7 @@ static int core_CreateServiceFunction(lua_State *L) lua_pushvalue(L, 2); int ref = luaL_ref(L, LUA_REGISTRYINDEX); - HANDLE res = NULL; + HANDLE res = nullptr; CMLuaEnviroment *env = CMLuaEnviroment::GetEnviroment(L); if (env) res = CreateServiceFunctionObjParam(name, CreateServiceFunctionEnvParam, env, ref); @@ -242,7 +242,7 @@ static int core_DestroyServiceFunction(lua_State *L) HANDLE hService = lua_touserdata(L, 1); HandleRefParam *param = (HandleRefParam*)CMLua::ServiceRefs.find(&hService); - if (param != NULL) + if (param != nullptr) { luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref); CMLua::ServiceRefs.remove(param); @@ -303,7 +303,7 @@ static int core_Parse(lua_State *L) static int core_GetFullPath(lua_State *L) { wchar_t path[MAX_PATH]; - GetModuleFileName(NULL, path, MAX_PATH); + GetModuleFileName(nullptr, path, MAX_PATH); lua_pushstring(L, ptrA(mir_utf8encodeW(path))); @@ -405,13 +405,13 @@ luaL_Reg coreApi[] = { "ForkThread", core_ForkThread }, { "TerminateThread", core_TerminateThread }, - { "Version", NULL }, + { "Version", nullptr }, - { "NULL", NULL }, - { "INVALID_HANDLE_VALUE", NULL }, - { "CALLSERVICE_NOTFOUND", NULL }, + { "NULL", nullptr }, + { "INVALID_HANDLE_VALUE", nullptr }, + { "CALLSERVICE_NOTFOUND", nullptr }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -419,7 +419,7 @@ luaL_Reg coreApi[] = LUAMOD_API int luaopen_m_core(lua_State *L) { luaL_newlib(L, coreApi); - lua_pushlightuserdata(L, NULL); + lua_pushlightuserdata(L, nullptr); lua_setfield(L, -2, "NULL"); lua_pushlightuserdata(L, INVALID_HANDLE_VALUE); lua_setfield(L, -2, "INVALID_HANDLE_VALUE"); diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 7519caa8c8..5556c77e5c 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -87,7 +87,7 @@ static int db_ContactIterator(lua_State *L) static int db_Contacts(lua_State *L) { - const char *szModule = NULL; + const char *szModule = nullptr; switch (lua_type(L, 1)) { @@ -131,7 +131,7 @@ static const char *mods[] = "FullName", "Uid", "DisplayName", - NULL + nullptr }; static int db_GetContactInfo(lua_State *L) @@ -145,7 +145,7 @@ static int db_GetContactInfo(lua_State *L) type = luaL_checkinteger(L, 2); break; case LUA_TSTRING: - type = luaL_checkoption(L, 2, NULL, mods) + 1; + type = luaL_checkoption(L, 2, nullptr, mods) + 1; break; default: luaL_argerror(L, 2, luaL_typename(L, 2)); @@ -641,14 +641,14 @@ static luaL_Reg databaseApi[] = { "SetSetting", db_WriteSetting }, { "DeleteSetting", db_DeleteSetting }, - { "DBVT_BYTE", NULL }, - { "DBVT_WORD", NULL }, - { "DBVT_DWORD", NULL }, - { "DBVT_ASCIIZ", NULL }, - { "DBVT_UTF8", NULL }, - { "DBVT_WCHAR", NULL }, + { "DBVT_BYTE", nullptr }, + { "DBVT_WORD", nullptr }, + { "DBVT_DWORD", nullptr }, + { "DBVT_ASCIIZ", nullptr }, + { "DBVT_UTF8", nullptr }, + { "DBVT_WCHAR", nullptr }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 4814a7410e..56ab193d52 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -122,7 +122,7 @@ static luaL_Reg genmenuApi[] = { "CheckMenuItem", genmenu_CheckMenuItem }, { "RemoveMenuItem", genmenu_RemoveMenuItem }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_genmenu(lua_State *L) diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index 2661197d2a..4988c80332 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -58,7 +58,7 @@ static int hotkeys_Unregister(lua_State *L) return 0; } -static const char *mods[] = { "shift", "ctrl", "alt", "ext", NULL }; +static const char *mods[] = { "shift", "ctrl", "alt", "ext", nullptr }; static int hotkeys_MakeHotkey(lua_State *L) { @@ -69,11 +69,11 @@ static int hotkeys_MakeHotkey(lua_State *L) mod = luaL_checkinteger(L, 1); break; case LUA_TSTRING: - mod = (1 << (luaL_checkoption(L, 1, NULL, mods) - 1)); + mod = (1 << (luaL_checkoption(L, 1, nullptr, mods) - 1)); break; case LUA_TTABLE: for (lua_pushnil(L); lua_next(L, 1); lua_pop(L, 1)) - mod |= (1 << (luaL_checkoption(L, -1, NULL, mods) - 1)); + mod |= (1 << (luaL_checkoption(L, -1, nullptr, mods) - 1)); break; default: luaL_argerror(L, 1, luaL_typename(L, 1)); @@ -92,7 +92,7 @@ static luaL_Reg hotkeysApi[] = { "Register", hotkeys_Register }, { "Unregister", hotkeys_Unregister }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_hotkeys(lua_State *L) diff --git a/plugins/MirLua/src/m_http.cpp b/plugins/MirLua/src/m_http.cpp index ce09fdb392..e1aece0e12 100644 --- a/plugins/MirLua/src/m_http.cpp +++ b/plugins/MirLua/src/m_http.cpp @@ -103,7 +103,7 @@ static const luaL_Reg headersApi[] = { "__index", headers__index }, { "__len", headers__len }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -155,7 +155,7 @@ static const luaL_Reg contentApi[] = { "__len", content__len }, { "__tostring", content__tostring }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -213,7 +213,7 @@ static const luaL_Reg responseApi[] = { "__index", response__index }, { "__gc", response__gc }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -301,7 +301,7 @@ static void request_SetContentType(lua_State *L, int idx, NETLIBHTTPREQUEST *req SetHeader(request, "Content-Type", type); } -static const char *httpMethods[] = { "GET", "POST", "PUT", "DELETE", NULL }; +static const char *httpMethods[] = { "GET", "POST", "PUT", "DELETE", nullptr }; static int request_Send(lua_State *L) { @@ -310,7 +310,7 @@ static int request_Send(lua_State *L) NETLIBHTTPREQUEST *request = CreateRequest(L); lua_getfield(L, 1, "Method"); - request->requestType = (1 << (luaL_checkoption(L, -1, NULL, httpMethods))); + request->requestType = (1 << (luaL_checkoption(L, -1, nullptr, httpMethods))); lua_pop(L, 1); lua_getfield(L, 1, "Url"); @@ -403,7 +403,7 @@ static const luaL_Reg requestApi[] = { { "__gc", request__gc }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ @@ -416,7 +416,7 @@ static const luaL_Reg httpApi[] = { "Put", request_Put }, { "Delete", request_Delete }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_http(lua_State *L) diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index d2904be320..d329d07ae4 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -25,7 +25,7 @@ static void MakeSKINICONDESC(lua_State *L, SKINICONDESC &sid) sid.defaultFile.w = mir_utf8decodeW(lua_tostring(L, -1)); lua_pop(L, 1); - if (sid.defaultFile.w == NULL) + if (sid.defaultFile.w == nullptr) { sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1); GetModuleFileName(g_hInstance, sid.defaultFile.w, MAX_PATH); @@ -61,7 +61,7 @@ static int lua_AddIcon(lua_State *L) sid.defaultFile.w = mir_utf8decodeW(lua_tostring(L, 4)); sid.hDefaultIcon = GetIcon(IDI_SCRIPT); - if (sid.defaultFile.w == NULL) + if (sid.defaultFile.w == nullptr) { sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1); GetModuleFileName(g_hInstance, sid.defaultFile.w, MAX_PATH); @@ -88,7 +88,7 @@ static int lua_GetIcon(lua_State *L) { bool big = luaM_toboolean(L, 2); - HICON hIcon = NULL; + HICON hIcon = nullptr; switch (lua_type(L, 1)) { case LUA_TLIGHTUSERDATA: @@ -144,7 +144,7 @@ static luaL_Reg icolibApi[] = { "GetIconHandle", lua_GetIconHandle }, { "RemoveIcon", lua_RemoveIcon }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_icolib(lua_State *L) diff --git a/plugins/MirLua/src/m_json.cpp b/plugins/MirLua/src/m_json.cpp index e4bbf233ef..60f75411e9 100644 --- a/plugins/MirLua/src/m_json.cpp +++ b/plugins/MirLua/src/m_json.cpp @@ -133,7 +133,7 @@ const struct luaL_Reg jsonApi[] = { "__tostring", json__tostring }, { "__gc", json__gc }, - { NULL, NULL } + { nullptr, nullptr } }; @@ -195,7 +195,7 @@ static int lua_Encode(lua_State *L) break; } case LUA_TLIGHTUSERDATA: - if (lua_touserdata(L, 1) == NULL) + if (lua_touserdata(L, 1) == nullptr) { lua_pushliteral(L, "null"); break; @@ -212,7 +212,7 @@ static const luaL_Reg methods[] = { "Decode", lua_Decode }, { "Encode", lua_Encode }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_json(lua_State *L) diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp index 13cbba952d..c02adb0478 100644 --- a/plugins/MirLua/src/m_message.cpp +++ b/plugins/MirLua/src/m_message.cpp @@ -38,7 +38,7 @@ static int message_Send(lua_State *L) { DBEVENTINFO dbei = {}; dbei.szModule = MODULE; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (DWORD)mir_strlen(message); dbei.pBlob = (PBYTE)mir_strdup(message); @@ -59,7 +59,7 @@ static luaL_Reg messageApi[] = { "Paste", message_Paste }, { "Send", message_Send }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_message(lua_State *L) diff --git a/plugins/MirLua/src/m_options.cpp b/plugins/MirLua/src/m_options.cpp index ee968a6982..9c549e96a2 100644 --- a/plugins/MirLua/src/m_options.cpp +++ b/plugins/MirLua/src/m_options.cpp @@ -106,7 +106,7 @@ static luaL_Reg optionsApi[] = { { "AddPage", opt_AddPage }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_options(lua_State *L) diff --git a/plugins/MirLua/src/m_protocols.cpp b/plugins/MirLua/src/m_protocols.cpp index ab206489f2..f4ea022175 100644 --- a/plugins/MirLua/src/m_protocols.cpp +++ b/plugins/MirLua/src/m_protocols.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" -HANDLE hRecvMessage = NULL; +HANDLE hRecvMessage = nullptr; static int lua_GetProtocol(lua_State *L) { - const char *szProto = NULL; + const char *szProto = nullptr; switch (lua_type(L, 1)) { @@ -109,7 +109,7 @@ static int lua_ChainRecv(lua_State *L) static int lua_GetAccount(lua_State *L) { - const char *name = NULL; + const char *name = nullptr; switch (lua_type(L, 1)) { @@ -157,7 +157,7 @@ static int lua_AccountIterator(lua_State *L) static int lua_Accounts(lua_State *L) { - const char *szProto = NULL; + const char *szProto = nullptr; switch (lua_type(L, 1)) { @@ -191,7 +191,7 @@ static int lua_Accounts(lua_State *L) static int lua_CallService(lua_State *L) { - const char *szModule = NULL; + const char *szModule = nullptr; switch (lua_type(L, 1)) { @@ -247,7 +247,7 @@ static luaL_Reg protocolsApi[] = { "CallService", lua_CallService }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ diff --git a/plugins/MirLua/src/m_sounds.cpp b/plugins/MirLua/src/m_sounds.cpp index 2acd36f203..f362e6b264 100644 --- a/plugins/MirLua/src/m_sounds.cpp +++ b/plugins/MirLua/src/m_sounds.cpp @@ -40,7 +40,7 @@ static luaL_Reg soundApi[] = { "PlaySound", lua_PlaySound }, { "PlayFile", lua_PlayFile }, - { NULL, NULL } + { nullptr, nullptr } }; LUAMOD_API int luaopen_m_sounds(lua_State *L) diff --git a/plugins/MirLua/src/m_srmm.cpp b/plugins/MirLua/src/m_srmm.cpp index d29ca0d901..232fd0f7c8 100644 --- a/plugins/MirLua/src/m_srmm.cpp +++ b/plugins/MirLua/src/m_srmm.cpp @@ -108,7 +108,7 @@ static luaL_Reg srmmApi[] = { "ModifyButton", lua_ModifyButton }, { "RemoveButton", lua_RemoveButton }, - { NULL, NULL } + { nullptr, nullptr } }; /***********************************************/ diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp index 7cb6ce4981..1795c56878 100644 --- a/plugins/MirLua/src/main.cpp +++ b/plugins/MirLua/src/main.cpp @@ -9,7 +9,7 @@ CMLua *g_mLua; HANDLE g_hCLibsFolder; HANDLE g_hScriptsFolder; -HNETLIBUSER hNetlib = NULL; +HNETLIBUSER hNetlib = nullptr; PLUGININFOEX pluginInfo = { @@ -104,7 +104,7 @@ extern "C" int __declspec(dllexport) Unload(void) if (hNetlib) { Netlib_CloseHandle(hNetlib); - hNetlib = NULL; + hNetlib = nullptr; } return 0; diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 952e528e44..150f5639ab 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -10,7 +10,7 @@ static int CompareScripts(const CMLuaScript* p1, const CMLuaScript* p2) return mir_strcmpi(p1->GetModuleName(), p2->GetModuleName()); } -CMLua::CMLua() : L(NULL), Scripts(10, CompareScripts) +CMLua::CMLua() : L(nullptr), Scripts(10, CompareScripts) { MUUID muidLast = MIID_LAST; hMLuaLangpack = GetPluginLangId(muidLast, 0); @@ -67,7 +67,7 @@ static int mlua_toansi(lua_State *L) int codepage = luaL_optinteger(L, 2, Langpack_GetDefaultCodePage()); ptrA string(mir_strdup(value)); - lua_pushstring(L, mir_utf8decodecp(string, codepage, NULL)); + lua_pushstring(L, mir_utf8decodecp(string, codepage, nullptr)); return 1; } @@ -270,7 +270,7 @@ void CMLua::KillLuaRefs() while (HookRefs.getCount()) { HandleRefParam *param = (HandleRefParam*)HookRefs[0]; - if (param != NULL) + if (param != nullptr) { luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref); HookRefs.remove(0); @@ -281,7 +281,7 @@ void CMLua::KillLuaRefs() while (ServiceRefs.getCount()) { HandleRefParam *param = (HandleRefParam*)ServiceRefs[0]; - if (param != NULL) + if (param != nullptr) { luaL_unref(param->L, LUA_REGISTRYINDEX, param->ref); ServiceRefs.remove(0); diff --git a/plugins/MirLua/src/mlua_enviroment.cpp b/plugins/MirLua/src/mlua_enviroment.cpp index 268afc46b0..4e7225fd16 100644 --- a/plugins/MirLua/src/mlua_enviroment.cpp +++ b/plugins/MirLua/src/mlua_enviroment.cpp @@ -23,7 +23,7 @@ CMLuaEnviroment::~CMLuaEnviroment() CMLuaEnviroment* CMLuaEnviroment::GetEnviroment(lua_State *L) { if (!luaM_getenv(L)) - return NULL; + return nullptr; lua_rawgeti(L, -1, NULL); CMLuaEnviroment *env = (CMLuaEnviroment*)lua_touserdata(L, -1); diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp index 92bcd1dcd5..4b13f8c52e 100644 --- a/plugins/MirLua/src/mlua_icons.cpp +++ b/plugins/MirLua/src/mlua_icons.cpp @@ -20,7 +20,7 @@ HICON GetIcon(int iconId) if (Icons[i].defIconID == iconId) return IcoLib_GetIconByHandle(Icons[i].hIcolib); - return NULL; + return nullptr; } HANDLE GetIconHandle(int iconId) @@ -29,5 +29,5 @@ HANDLE GetIconHandle(int iconId) if (Icons[i].defIconID == iconId) return Icons[i].hIcolib; - return NULL; + return nullptr; } \ No newline at end of file diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index b4e11cb01d..6a2dbd669b 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -61,12 +61,12 @@ void CMLuaOptions::OnInitDialog() wchar_t scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100]; FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT)); - PathToRelativeW(scriptDir, relativeScriptDir, NULL); + PathToRelativeW(scriptDir, relativeScriptDir, nullptr); mir_snwprintf(header, L"%s (%s)", TranslateT("Common scripts"), relativeScriptDir); m_scripts.AddColumn(0, L"Script", 380); - m_scripts.AddColumn(1, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL)); - m_scripts.AddColumn(2, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL)); + m_scripts.AddColumn(1, nullptr, 32 - GetSystemMetrics(SM_CXVSCROLL)); + m_scripts.AddColumn(2, nullptr, 32 - GetSystemMetrics(SM_CXVSCROLL)); LoadScripts(); @@ -126,7 +126,7 @@ void CMLuaOptions::OnScriptListClick(CCtrlListView::TEventInfo *evt) switch (lvi.iSubItem) { case 1: - ShellExecute(m_hwnd, L"Open", script->GetFilePath(), NULL, NULL, SW_SHOWNORMAL); + ShellExecute(m_hwnd, L"Open", script->GetFilePath(), nullptr, nullptr, SW_SHOWNORMAL); break; case 2: diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index 9abbc6e492..9275b74a7f 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -32,7 +32,7 @@ void ShowNotification(const char *caption, const char *message, int flags, MCONT return; } - MessageBoxA(NULL, message, caption, MB_OK | flags); + MessageBoxA(nullptr, message, caption, MB_OK | flags); } void ObsoleteMethod(lua_State *L, const char *message) -- cgit v1.2.3