summaryrefslogtreecommitdiff
path: root/plugins/HTTPServer
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/HTTPServer
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/HTTPServer')
-rw-r--r--plugins/HTTPServer/src/FileShareNode.cpp12
-rw-r--r--plugins/HTTPServer/src/GuiElements.cpp44
-rw-r--r--plugins/HTTPServer/src/HttpUser.cpp22
-rw-r--r--plugins/HTTPServer/src/IndexHTML.cpp32
-rw-r--r--plugins/HTTPServer/src/IndexXML.cpp38
-rw-r--r--plugins/HTTPServer/src/MimeHandling.cpp42
-rw-r--r--plugins/HTTPServer/src/main.cpp88
7 files changed, 139 insertions, 139 deletions
diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp
index a23f0c6fe4..939c46f364 100644
--- a/plugins/HTTPServer/src/FileShareNode.cpp
+++ b/plugins/HTTPServer/src/FileShareNode.cpp
@@ -18,7 +18,7 @@
#include "Glob.h"
-CLFileShareNode * pclFirstNode = NULL;
+CLFileShareNode * pclFirstNode = nullptr;
mir_cs csFileShareListAccess;
@@ -40,7 +40,7 @@ CLShareUser::CLShareUser(HNETLIBCONN hCon, in_addr stAdd)
{
hConnection = hCon;
stAddr = stAdd;
- pclNext = NULL;
+ pclNext = nullptr;
dwTotalSize = 0;
dwCurrentDL = 0;
dwSpeed = 0;
@@ -132,8 +132,8 @@ CLFileShareNode::CLFileShareNode(char * pszSrvPath, char * pszRealPath)
{
memset(&st, 0, sizeof(STFileShareInfo));
st.lStructSize = sizeof(STFileShareInfo);
- pclNext = NULL;
- pclCurrentUsers = NULL;
+ pclNext = nullptr;
+ pclCurrentUsers = nullptr;
bSetPaths(pszSrvPath, pszRealPath);
}
@@ -155,8 +155,8 @@ CLFileShareNode::CLFileShareNode(STFileShareInfo * pstInfo)
{
memset(&st, 0, sizeof(STFileShareInfo));
st.lStructSize = sizeof(STFileShareInfo);
- pclNext = NULL;
- pclCurrentUsers = NULL;
+ pclNext = nullptr;
+ pclCurrentUsers = nullptr;
bSetInfo(pstInfo);
}
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp
index 3335b489a2..5e1134b2c9 100644
--- a/plugins/HTTPServer/src/GuiElements.cpp
+++ b/plugins/HTTPServer/src/GuiElements.cpp
@@ -22,15 +22,15 @@
#define WM_RELOAD_STATISTICS (WM_USER+10)
-static HANDLE hShareNewFileService = 0;
-static HANDLE hShowStatisticsViewService = 0;
+static HANDLE hShareNewFileService = nullptr;
+static HANDLE hShowStatisticsViewService = nullptr;
-static HANDLE hShareNewFileMenuItem = 0;
-static HANDLE hShowStatisticsViewMenuItem = 0;
+static HANDLE hShareNewFileMenuItem = nullptr;
+static HANDLE hShowStatisticsViewMenuItem = nullptr;
-static HANDLE hEventOptionsInitialize = 0;
+static HANDLE hEventOptionsInitialize = nullptr;
-HWND hwndStatsticView = 0;
+HWND hwndStatsticView = nullptr;
bool bLastAutoRefress = false;
HANDLE hMainThread;
@@ -99,7 +99,7 @@ string DBGetString(MCONTACT hContact, const char *szModule, const char *szSettin
DBVARIANT dbv = { 0 };
if (!db_get(hContact, szModule, szSetting, &dbv)) {
if (dbv.type != DBVT_ASCIIZ) {
- MessageBox(NULL, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK);
ret = pszError;
}
else ret = dbv.pszVal;
@@ -146,7 +146,7 @@ void UpdateStatisticsView()
unsigned long GetExternIP(const char *szURL, const char *szPattern)
{
- HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(0, IDC_WAIT));
+ HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(nullptr, IDC_WAIT));
NETLIBHTTPREQUEST nlhr;
memset(&nlhr, 0, sizeof(nlhr));
@@ -163,7 +163,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern)
if (nlreply->resultCode >= 200 && nlreply->resultCode < 300) {
nlreply->pData[nlreply->dataLength] = 0;// make sure its null terminated
char * pszIp = strstr(nlreply->pData, szPattern);
- if (pszIp == NULL)
+ if (pszIp == nullptr)
pszIp = nlreply->pData;
else
pszIp += mir_strlen(szPattern);
@@ -319,7 +319,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook(
}
pszTmp = strchr(szSelection, ':');
- if (pszTmp != NULL)
+ if (pszTmp != nullptr)
*pszTmp = '\0';
memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1);
@@ -472,7 +472,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare)
if (dwError) {
char szTemp[200];
mir_snprintf(szTemp, "Failed to create File Open dialog the error returned was %d", dwError);
- MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK);
}
return false;
}
@@ -505,7 +505,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare)
pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0';
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) {
- MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
pszFileNamePos++;
@@ -516,7 +516,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare)
}
else {
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) {
- MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
}
@@ -636,7 +636,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false)
if (bLastAutoRefress != bAutoRefress) {
if (bAutoRefress)
- SetTimer(hwndDlg, 0, 1000, NULL);
+ SetTimer(hwndDlg, 0, 1000, nullptr);
else
KillTimer(hwndDlg, 0);
bLastAutoRefress = bAutoRefress;
@@ -664,14 +664,14 @@ void SetWindowsCtrls(HWND hwndDlg)
const int nSpacing = 8;
int nCtrlHight = (rNewSize.bottom - (nSpacing * 3)) / 3 - 20;
- SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_SHARES), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_SHARES), nullptr,
nSpacing,
35,
rNewSize.right - (nSpacing * 2),
nCtrlHight * 2,
SWP_NOZORDER);
- SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_USERS), 0,
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_CURRENT_USERS), nullptr,
nSpacing,
(nSpacing * 2) + nCtrlHight * 2 + 25,
rNewSize.right - (nSpacing * 2),
@@ -778,7 +778,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara
return TRUE;
case WM_DESTROY:
- hwndStatsticView = NULL;
+ hwndStatsticView = nullptr;
return 0;
case WM_DROPFILES:
@@ -787,7 +787,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara
char szDropedFile[MAX_PATH];
char szServPath[MAX_PATH] = { 0 };
- int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
+ int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
for (int i = 0; i < nLen; i++) {
DragQueryFile(hDrop, i, szDropedFile, sizeof(szDropedFile));
@@ -805,7 +805,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara
strncpy(&szServPath[1], fileName + 1, MAX_PATH - 2);
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) {
- MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
}
@@ -852,7 +852,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara
TranslateMenu(hMenu);
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON,
- pt.x, pt.y, 0, hwndDlg, NULL);
+ pt.x, pt.y, 0, hwndDlg, nullptr);
DestroyMenu(hMainMenu);
}
@@ -1077,7 +1077,7 @@ static INT_PTR nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/)
BringWindowToTop(hwndStatsticView);
return 0;
}
- hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), NULL, DlgProcStatsticView, (LPARAM)NULL);
+ hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), nullptr, DlgProcStatsticView, (LPARAM)NULL);
ShowWindow(hwndStatsticView, SW_SHOWNORMAL);
return 0;
}
@@ -1492,7 +1492,7 @@ void InitGuiElements()
hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
if (!hEventOptionsInitialize)
- MessageBox(NULL, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to HookEvent ME_OPT_INITIALISE", MSG_BOX_TITEL, MB_OK);
bShowPopups = db_get_b(NULL, MODULE, "ShowPopups", bShowPopups) != 0;
}
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp
index 3ceb656f77..db86533b7f 100644
--- a/plugins/HTTPServer/src/HttpUser.cpp
+++ b/plugins/HTTPServer/src/HttpUser.cpp
@@ -442,7 +442,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
* pszTmp = '\\';
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
if (pszSrvPath[mir_strlen(pszSrvPath) - 1] != '/') {
@@ -454,14 +454,14 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
strmcat(szRealPath, "index.htm", MAX_PATH);
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
// a directory with index.html
strmcat(szRealPath, "l", MAX_PATH);
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
// generate directory index in temporary file
@@ -486,7 +486,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
(indexCreationMode == INDEX_CREATION_DETECT && BrowserSupportsXML)) &&
bCreateIndexXML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) {
hFile = CreateFile(szTempfile, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
mir_strcpy(szRealPath, "a.xml"); // restore .xml for mime type
}
@@ -494,7 +494,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
indexCreationMode == INDEX_CREATION_DETECT) &&
bCreateIndexHTML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) {
hFile = CreateFile(szTempfile, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
mir_strcpy(szRealPath, "a.html"); // restore .html for mime type
}
@@ -518,7 +518,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
}
else {
hFile = CreateFile(pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
SendError(404, "Not Found", "HTTP server failed to open local file");
@@ -528,11 +528,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
mir_strcpy(this->szCurrentDLSrvPath, pszSrvPath);
- DWORD nDataSize = GetFileSize(hFile, NULL);
+ DWORD nDataSize = GetFileSize(hFile, nullptr);
dwTotalSize = nDataSize;
FILETIME stFileTime;
- GetFileTime(hFile, NULL, NULL, &stFileTime);
+ GetFileTime(hFile, nullptr, nullptr, &stFileTime);
char szCurTime[100];
time_t ltime;
@@ -557,7 +557,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
}
if (*(ULONG*)(&stAddr) != 0x0100007F && // do not show popup of 127.0.0.1
- strstr(pszRealPath, "\\@") == NULL) { // and of shares which start with an @
+ strstr(pszRealPath, "\\@") == nullptr) { // and of shares which start with an @
ShowPopupWindow(inet_ntoa(stAddr), pszSrvPath);
}
@@ -623,7 +623,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
char szBuf[1460 * 4];
if (dwFileStart > 0 || dwDataToSend != nDataSize) {
- if (SetFilePointer(hFile, dwFileStart, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ if (SetFilePointer(hFile, dwFileStart, nullptr, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
SendError(416, "Requested Range Not Satisfiable");
return true;
}
@@ -700,7 +700,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand)
if (bSpeedLimit)
dwCurOpr = min(nMaxBytesToSend, sizeof(szBuf));
- if (!ReadFile(hFile, szBuf, dwCurOpr, &dwBytesToWrite, NULL))
+ if (!ReadFile(hFile, szBuf, dwCurOpr, &dwBytesToWrite, nullptr))
break;
if (dwBytesToWrite <= 0)
diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp
index cd7687330c..c32f782f81 100644
--- a/plugins/HTTPServer/src/IndexHTML.cpp
+++ b/plugins/HTTPServer/src/IndexHTML.cpp
@@ -19,7 +19,7 @@
eIndexCreationMode indexCreationMode;
-static char* szIndexHTMLTemplate = NULL;
+static char* szIndexHTMLTemplate = nullptr;
static const int MAX_PARAM_LENGTH = 5;
// signs below 32 are not used anyway
@@ -55,7 +55,7 @@ enum Symbol
bool LoadIndexHTMLTemplate()
{
- if (szIndexHTMLTemplate != NULL)
+ if (szIndexHTMLTemplate != nullptr)
return true;
char szBuf[10000];
@@ -67,14 +67,14 @@ bool LoadIndexHTMLTemplate()
mir_snprintf(szBuf, "%s%s", szPluginPath, szIndexHTMLTemplateFile);
HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
- MessageBox(NULL, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK);
return false;
}
DWORD dwBytesRead = 0;
- if (ReadFile(hFile, pszBuf, sizeof(szBuf), &dwBytesRead, NULL) || dwBytesRead <= 0) {
+ if (ReadFile(hFile, pszBuf, sizeof(szBuf), &dwBytesRead, nullptr) || dwBytesRead <= 0) {
while (dwBytesRead > (DWORD)(pszBuf - szBuf)) {
if (*pszBuf == '[') {
char* pszKeywordBegin = pszBuf + 1;
@@ -259,9 +259,9 @@ bool LoadIndexHTMLTemplate()
void FreeIndexHTMLTemplate()
{
- if (szIndexHTMLTemplate != NULL) {
+ if (szIndexHTMLTemplate != nullptr) {
delete[] szIndexHTMLTemplate;
- szIndexHTMLTemplate = NULL;
+ szIndexHTMLTemplate = nullptr;
}
}
@@ -283,7 +283,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
{
#define RelativeJump(begin) { pszPos += *((WORD*)(begin+1)) & 0x7FFF; }
- if (szIndexHTMLTemplate == NULL)
+ if (szIndexHTMLTemplate == nullptr)
return false;
// check if directory exists
@@ -297,10 +297,10 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
return FALSE;
FindClose(hFind);
- hFind = 0;
+ hFind = nullptr;
HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ,
- NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
+ nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
@@ -339,12 +339,12 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
switch (*pszPos) {
case SY_FOR_FILES:
case SY_FOR_DIRS:
- if (hFind == 0) {
+ if (hFind == nullptr) {
pszLevelBegin[iLevel++] = pszPos;
iCurrentAction = *pszPos;
hFind = FindFirstFile(szMask, &fdFindFileData);
- if (hFind == 0) {
+ if (hFind == nullptr) {
iCurrentAction = 0;
RelativeJump(pszLevelBegin[iLevel - 1]);
break;
@@ -353,7 +353,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
else {
if (!FindNextFile(hFind, &fdFindFileData)) {
FindClose(hFind);
- hFind = 0;
+ hFind = nullptr;
iCurrentAction = 0;
RelativeJump(pszLevelBegin[iLevel - 1]);
break;
@@ -366,7 +366,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
((*pszPos == 19) == ((fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0))) {
if (!FindNextFile(hFind, &fdFindFileData)) {
FindClose(hFind);
- hFind = 0;
+ hFind = nullptr;
iCurrentAction = 0;
RelativeJump(pszLevelBegin[iLevel - 1]);
break;
@@ -503,14 +503,14 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
// flush the buffer from time to time
if (*pszPos == '\0' || pszBuffer - szBuffer > 8000) {
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
pszBuffer = szBuffer;
}
} while (*pszPos != '\0');
- if (hFind != 0)
+ if (hFind != nullptr)
FindClose(hFind);
SetEndOfFile(hFile);
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp
index c258832321..ea94a2cadc 100644
--- a/plugins/HTTPServer/src/IndexXML.cpp
+++ b/plugins/HTTPServer/src/IndexXML.cpp
@@ -73,8 +73,8 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
if (hFind == INVALID_HANDLE_VALUE)
return FALSE;
- HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, NULL,
- OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
+ HANDLE hFile = CreateFile(pszIndexPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr,
+ OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
FindClose(hFind);
@@ -99,14 +99,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
strncpy(szFileName, pszTemp + 1, MAX_PATH);
// Write Header
- WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, NULL);
+ WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, nullptr);
// check if a index.xsl exists in the same directory otherwise use the global
mir_snprintf(szMask, "%s%s", pszRealPath, "index.xsl");
HANDLE hFileExists = CreateFile(szMask, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFileExists == INVALID_HANDLE_VALUE) {
strncpy(szBuffer, "/index.xsl", BUFFER_SIZE);
@@ -116,15 +116,15 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
strncpy(szBuffer, "index.xsl", BUFFER_SIZE);
}
- WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL);
+ WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, nullptr);
- WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, NULL);
+ WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, nullptr);
// Write dirname
ReplaceSign(szFileName, MAX_PATH, '&', "&amp;");
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <dirname>%s</dirname>\r\n", szFileName);
- WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL);
+ WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr);
// Find files and directories
do {
@@ -143,14 +143,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
else {
pszExt = strrchr(szFileName, '.');
- if (pszExt != NULL) {
+ if (pszExt != nullptr) {
*pszExt = '\0';
pszExt++;
}
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
- szFileName, (pszExt == NULL) ? "" : pszExt, fdFindFileData.nFileSizeLow);
+ szFileName, (pszExt == nullptr) ? "" : pszExt, fdFindFileData.nFileSizeLow);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&fdFindFileData.ftCreationTime, &systemTime);
@@ -169,13 +169,13 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
"/>\r\n");
}
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
}
} while (FindNextFile(hFind, &fdFindFileData));
- if (hFind != 0)
+ if (hFind != nullptr)
FindClose(hFind);
// Add other shared files & directories
@@ -195,7 +195,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" isdir=\"true\"/>\r\n", szFileName);
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
}
}
@@ -204,7 +204,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
strncmp(pszRealPath, pclCur->st.pszRealPath, mir_strlen(pszRealPath))) { // no duplicates
pszExt = strrchr(szFileName, '.');
- if (pszExt != NULL) {
+ if (pszExt != nullptr) {
*pszExt = '\0';
pszExt++;
}
@@ -214,16 +214,16 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
FILETIME ftFileAccessTime;
FILETIME ftFileModifyTime;
HANDLE hFileS = CreateFile(pclCur->st.pszRealPath, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFileS != INVALID_HANDLE_VALUE) {
- dwFileSize = GetFileSize(hFileS, NULL);
+ dwFileSize = GetFileSize(hFileS, nullptr);
GetFileTime(hFileS, &ftFileCreateTime, &ftFileAccessTime, &ftFileModifyTime);
CloseHandle(hFileS);
}
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
- szFileName, (pszExt == NULL) ? "" : pszExt, dwFileSize);
+ szFileName, (pszExt == nullptr) ? "" : pszExt, dwFileSize);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&ftFileCreateTime, &systemTime);
@@ -241,14 +241,14 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, const
pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"/>\r\n");
- if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
+ if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, nullptr))
break;
}
}
}
}
- WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWritten, NULL);
+ WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWritten, nullptr);
SetEndOfFile(hFile);
CloseHandle(hFile);
diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp
index 78f8c3c91c..56ec7a320f 100644
--- a/plugins/HTTPServer/src/MimeHandling.cpp
+++ b/plugins/HTTPServer/src/MimeHandling.cpp
@@ -1,7 +1,7 @@
#include "Glob.h"
/* MIME type/ext map */
-ContentTypeDB MIME = NULL;
+ContentTypeDB MIME = nullptr;
/* Default Mime type when recognition fails */
char DefaultMime[] = "application/octet-stream";
@@ -9,18 +9,18 @@ int bInitMimeHandling()
{
FILE *mimeDB;
char line[LINE_MAX_SIZE];
- char *tok = NULL;
- ContentType *pDBCell = NULL;
- ContentTypeDB pDB = NULL;
- ExtensionList extListCur = NULL;
- ExtensionListCell *pExtCell = NULL;
+ char *tok = nullptr;
+ ContentType *pDBCell = nullptr;
+ ContentTypeDB pDB = nullptr;
+ ExtensionList extListCur = nullptr;
+ ExtensionListCell *pExtCell = nullptr;
char szBuf[10000];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szMimeTypeConfigFile);
mimeDB = fopen(szBuf, "r");
- if (mimeDB != NULL) {
+ if (mimeDB != nullptr) {
while (fgets(line, LINE_MAX_SIZE, mimeDB)) {
/*filter junk lines assuming Mime type start with letter
(convention ?) */
@@ -28,7 +28,7 @@ int bInitMimeHandling()
|| (line[0] <= 'Z' && line[0] >= 'A')) {
/*remove comments trailing comments*/
tok = strrchr(line, '#');
- if (tok != NULL) {
+ if (tok != nullptr) {
*tok = '\0';
}
/* remove trailing \n */
@@ -42,29 +42,29 @@ int bInitMimeHandling()
pDBCell = (ContentType*)malloc(sizeof(ContentType));
pDBCell->mimeType = (char*)malloc(mir_strlen(tok) + 1);
mir_strcpy(pDBCell->mimeType, tok);
- pDBCell->extList = NULL;
- pDBCell->next = NULL;
+ pDBCell->extList = nullptr;
+ pDBCell->next = nullptr;
/* looking for extensions */
- tok = (char*)strtok(NULL, " \t");
- while (tok != NULL) {
+ tok = (char*)strtok(nullptr, " \t");
+ while (tok != nullptr) {
/*create and fill a cell*/
pExtCell = (ExtensionListCell*)malloc(sizeof(ExtensionListCell));
pExtCell->ext = (char*)malloc(mir_strlen(tok) + 1);
mir_strcpy(pExtCell->ext, tok);
- pExtCell->next = NULL;
+ pExtCell->next = nullptr;
/*link*/
- if (pDBCell->extList == NULL) {
+ if (pDBCell->extList == nullptr) {
pDBCell->extList = pExtCell;
}
else {
extListCur->next = pExtCell;
}
extListCur = pExtCell;
- tok = (char*)strtok(NULL, " \t");
+ tok = (char*)strtok(nullptr, " \t");
}
/* link */
- if (pDBCell->extList != NULL) { /*extension(s) found*/
- if (MIME == NULL) {
+ if (pDBCell->extList != nullptr) { /*extension(s) found*/
+ if (MIME == nullptr) {
MIME = pDBCell;
}
else {
@@ -81,7 +81,7 @@ int bInitMimeHandling()
fclose(mimeDB);
}
- if (MIME == NULL) {
+ if (MIME == nullptr) {
return 0;
}
return 1;
@@ -95,7 +95,7 @@ const char* pszGetMimeType(const char * pszFileName)
ext = strrchr(pszFileName, '.');
- if (ext != NULL) {
+ if (ext != nullptr) {
if (ext[1] == '\0') {
/*empty extension */
return DefaultMime;
@@ -106,9 +106,9 @@ const char* pszGetMimeType(const char * pszFileName)
}
courMIME = MIME;
- while (courMIME != NULL) {
+ while (courMIME != nullptr) {
courEXT = courMIME->extList;
- while (courEXT != NULL) {
+ while (courEXT != nullptr) {
if (!_stricmp(courEXT->ext, ext)) {
return courMIME->mimeType;
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp
index a6126e8f51..fb821023f6 100644
--- a/plugins/HTTPServer/src/main.cpp
+++ b/plugins/HTTPServer/src/main.cpp
@@ -39,7 +39,7 @@ const char* pszDefaultShares[] = {
"htdocs\\@settings\\index.xsl", "/index.xsl",
"htdocs\\@settings\\theme\\", "/theme/",
"htdocs\\", "/",
- 0, 0
+ nullptr, nullptr
};
void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP);
@@ -48,21 +48,21 @@ int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/);
HNETLIBUSER hNetlibUser;
HANDLE hDirectBoundPort;
-HINSTANCE hInstance = NULL;
+HINSTANCE hInstance = nullptr;
CLIST_INTERFACE *pcli;
string sLogFilePath;
// static so they can not be used from other modules ( sourcefiles )
-static HANDLE hEventSystemInit = 0;
-static HANDLE hPreShutdown = 0;
+static HANDLE hEventSystemInit = nullptr;
+static HANDLE hPreShutdown = nullptr;
-static HANDLE hHttpAcceptConnectionsService = 0;
-static HANDLE hHttpAddChangeRemoveService = 0;
-static HANDLE hHttpGetShareService = 0;
-static HANDLE hHttpGetAllShares = 0;
+static HANDLE hHttpAcceptConnectionsService = nullptr;
+static HANDLE hHttpAddChangeRemoveService = nullptr;
+static HANDLE hHttpGetShareService = nullptr;
+static HANDLE hHttpGetAllShares = nullptr;
-static HGENMENU hAcceptConnectionsMenuItem = 0;
+static HGENMENU hAcceptConnectionsMenuItem = nullptr;
char szPluginPath[MAX_PATH] = { 0 };
int nPluginPathLen = 0;
@@ -77,7 +77,7 @@ int nMaxConnectionsPerUser = -1;
int nDefaultDownloadLimit = -1;
bool bIsOnline = true;
-static HANDLE hEventProtoAck = 0;
+static HANDLE hEventProtoAck = nullptr;
bool bLimitOnlyWhenOnline = true;
@@ -121,7 +121,7 @@ bool bOpenLogFile()
SHELLEXECUTEINFO st = { 0 };
st.cbSize = sizeof(st);
st.fMask = SEE_MASK_INVOKEIDLIST;
- st.hwnd = NULL;
+ st.hwnd = nullptr;
st.lpFile = sLogFilePath.c_str();
st.nShow = SW_SHOWDEFAULT;
ShellExecuteEx(&st);
@@ -134,7 +134,7 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1)
if (nLen < 0)
nLen = (int)mir_strlen(pszSrc);
DWORD dwBytesWritten;
- return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen);
+ return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, nullptr) && (dwBytesWritten == (DWORD)nLen);
}
@@ -154,13 +154,13 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1)
void LogEvent(const char * pszTitle, const char * pszLog)
{
- HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(sLogFilePath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
- MessageBox(NULL, Translate("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK);
return;
}
- if (SetFilePointer(hFile, 0, 0, FILE_END) == INVALID_SET_FILE_POINTER) {
- MessageBox(NULL, Translate("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK);
+ if (SetFilePointer(hFile, 0, nullptr, FILE_END) == INVALID_SET_FILE_POINTER) {
+ MessageBox(nullptr, Translate("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK);
CloseHandle(hFile);
return;
}
@@ -179,7 +179,7 @@ void LogEvent(const char * pszTitle, const char * pszLog)
!bWriteToFile(hFile, " : ") ||
!bWriteToFile(hFile, pszLog, nLogLen) ||
!bWriteToFile(hFile, "\r\n")) {
- MessageBox(NULL, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK);
}
CloseHandle(hFile);
}
@@ -232,13 +232,13 @@ bool bReadConfigurationFile()
{
CLFileShareListAccess clCritSection;
- CLFileShareNode * pclLastNode = NULL;
+ CLFileShareNode * pclLastNode = nullptr;
char szBuf[1000];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szConfigFile);
HANDLE hFile = CreateFile(szBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return false;
@@ -257,14 +257,14 @@ bool bReadConfigurationFile()
// append data to buffer
DWORD dwBytesRead = 0;
bEof = !ReadFile(hFile, &szBuf[dwBytesInBuffer], sizeof(szBuf) - dwBytesInBuffer,
- &dwBytesRead, NULL) || dwBytesRead <= 0;
+ &dwBytesRead, nullptr) || dwBytesRead <= 0;
pszCurPos = szBuf;
if (pszCurPos) {
- while (pszCurPos && (pszCurPos = strstr(pszCurPos, "<share>")) != NULL) {
+ while (pszCurPos && (pszCurPos = strstr(pszCurPos, "<share>")) != nullptr) {
pszCurPos += 7;
- char * pszColData[5] = { NULL };
+ char * pszColData[5] = {};
for (int n = 0; n < 5; n++) {
pszColData[n] = strstr(pszCurPos, ">");
if (!pszColData[n])
@@ -339,17 +339,17 @@ bool bWriteConfigurationFile()
char szBuf[1000], temp[200];
mir_strcpy(szBuf, szPluginPath);
mir_strcat(szBuf, szConfigFile);
- HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
mir_snprintf(temp, "%s%s", Translate("Failed to open or create file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
return false;
}
DWORD dwBytesWriten = 0;
- if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, NULL)) {
+ if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, nullptr)) {
mir_snprintf(temp, "%s%s", TranslateT("Failed to write xml header to file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
}
else {
CLFileShareNode *pclCur = pclFirstNode;
@@ -361,17 +361,17 @@ bool bWriteConfigurationFile()
SplitIpAddress(pclCur->st.dwAllowedIP),
SplitIpAddress(pclCur->st.dwAllowedMask));
- if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, NULL)) {
+ if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, nullptr)) {
mir_snprintf(temp, "%s%s", Translate("Failed to write xml data to file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
break;
}
pclCur = pclCur->pclNext;
}
- if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, NULL)) {
+ if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, nullptr)) {
mir_snprintf(temp, "%s%s", Translate("Failed to write xml tail to file "), szConfigFile);
- MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, temp, MSG_BOX_TITEL, MB_OK);
}
}
SetEndOfFile(hFile);
@@ -650,7 +650,7 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/)
char szTemp[200];
mir_snprintf(szTemp, Translate("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port"),
nlb.wPort == 80 ? "80" : nus.szIncomingPorts);
- MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK);
return 1001;
}
dwLocalPortUsed = nlb.wPort;
@@ -660,13 +660,13 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/)
}
else if (hDirectBoundPort && wparam == 0) {
Netlib_CloseHandle(hDirectBoundPort);
- hDirectBoundPort = 0;
+ hDirectBoundPort = nullptr;
Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
}
else return 0; // no changes;
if (!bShutdownInProgress)
- db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != 0);
+ db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != nullptr);
return 0;
}
@@ -744,7 +744,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/)
nlu.szDescriptiveName.a = Translate("HTTP Server");
hNetlibUser = Netlib_RegisterUser(& nlu);
if (!hNetlibUser) {
- MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
return 0;
}
@@ -810,7 +810,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/)
pclFirstNode = pclFirstNode->pclNext;
delete pclCur;
}
- pclFirstNode = NULL;
+ pclFirstNode = nullptr;
UnInitGuiElements();
@@ -858,49 +858,49 @@ extern "C" __declspec(dllexport) int Load()
hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections);
if (!hHttpAcceptConnectionsService) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_ACCEPT_CONNECTIONS", MSG_BOX_TITEL, MB_OK);
return 1;
}
hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare);
if (!hHttpAddChangeRemoveService) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_ADD_CHANGE_REMOVE", MSG_BOX_TITEL, MB_OK);
return 1;
}
hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare);
if (!hHttpGetShareService) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_GET_SHARE", MSG_BOX_TITEL, MB_OK);
return 1;
}
hHttpGetAllShares = CreateServiceFunction(MS_HTTP_GET_ALL_SHARES, nHttpGetAllShares);
if (!hHttpGetAllShares) {
- MessageBox(NULL, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to CreateServiceFunction MS_HTTP_GET_ALL_SHARES", MSG_BOX_TITEL, MB_OK);
return 1;
}
hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
if (!hEventSystemInit) {
- MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to HookEvent ME_SYSTEM_MODULESLOADED", MSG_BOX_TITEL, MB_OK);
return 1;
}
hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
if (!hPreShutdown) {
- MessageBox(NULL, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to HookEvent ME_SYSTEM_PRESHUTDOWN", MSG_BOX_TITEL, MB_OK);
return 1;
}
if (Profile_GetPathA(MAX_PATH, szPluginPath)) {
- MessageBox(NULL, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to retrieve plugin path.", MSG_BOX_TITEL, MB_OK);
return 1;
}
mir_strncat(szPluginPath, "\\HTTPServer\\", _countof(szPluginPath) - mir_strlen(szPluginPath));
int err = CreateDirectoryTree(szPluginPath);
if ((err != 0) && (err != ERROR_ALREADY_EXISTS)) {
- MessageBox(NULL, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK);
return 1;
}
@@ -910,7 +910,7 @@ extern "C" __declspec(dllexport) int Load()
sLogFilePath += "HTTPServer.log";
if (!bInitMimeHandling())
- MessageBox(NULL, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK);
nMaxUploadSpeed = db_get_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed);
nMaxConnectionsTotal = db_get_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal);