diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/HTTPServer/src | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
less TCHARs:
- TCHAR is replaced with wchar_t everywhere;
- LPGENT replaced with either LPGENW or LPGEN;
- fixes for ANSI plugins that improperly used _t functions;
- TCHAR *t removed from MAllStrings;
- ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz*
git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HTTPServer/src')
-rw-r--r-- | plugins/HTTPServer/src/Glob.h | 2 | ||||
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 52 | ||||
-rw-r--r-- | plugins/HTTPServer/src/main.cpp | 34 |
3 files changed, 42 insertions, 46 deletions
diff --git a/plugins/HTTPServer/src/Glob.h b/plugins/HTTPServer/src/Glob.h index 2e0c92fc4f..c556f73786 100644 --- a/plugins/HTTPServer/src/Glob.h +++ b/plugins/HTTPServer/src/Glob.h @@ -54,7 +54,7 @@ using namespace std; #define SD_BOTH 0x02
#define MODULE "HTTPServer"
-#define MSG_BOX_TITEL TranslateT("Miranda NG HTTP-Server")
+#define MSG_BOX_TITEL Translate("Miranda NG HTTP-Server")
#define SplitIpAddress( p ) (BYTE)(p>>24),(BYTE)(p>>16),(BYTE)(p>>8),(BYTE)(p)
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index d79e8a8450..ed36ad8ac2 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -462,7 +462,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) | OFN_ALLOWMULTISELECT;
ofn.hwndOwner = hwndOwner;
ofn.hInstance = hInstance;
- ofn.lpstrTitle = TranslateT("Specify a file to share");
+ ofn.lpstrTitle = Translate("Specify a file to share");
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_NEW_SHARE_PROPERTIES);
ofn.lpfnHook = ShareNewFileDialogHook;
ofn.lCustData = (LPARAM)pstNewShare;
@@ -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, TranslateT("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(NULL, 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, TranslateT("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
}
@@ -722,36 +722,36 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara LVCOLUMN cCol = { 0 };
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx1", 126);
- cCol.pszText = TranslateT("Share name");
+ cCol.pszText = Translate("Share name");
ListView_InsertColumn(hShareList, 0, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx2", 48);
- cCol.pszText = TranslateT("Max Downloads");
+ cCol.pszText = Translate("Max Downloads");
ListView_InsertColumn(hShareList, 1, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx3", 96);
- cCol.pszText = TranslateT("Allowed IP");
+ cCol.pszText = Translate("Allowed IP");
ListView_InsertColumn(hShareList, 2, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx4", 104);
- cCol.pszText = TranslateT("Allowed Mask");
+ cCol.pszText = Translate("Allowed Mask");
ListView_InsertColumn(hShareList, 3, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx5", 252);
- cCol.pszText = TranslateT("Real path");
+ cCol.pszText = Translate("Real path");
ListView_InsertColumn(hShareList, 4, &cCol);
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx6", 142);
- cCol.pszText = TranslateT("Share name");
+ cCol.pszText = Translate("Share name");
ListView_InsertColumn(hUserList, 0, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx7", 111);
- cCol.pszText = TranslateT("User");
+ cCol.pszText = Translate("User");
ListView_InsertColumn(hUserList, 1, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx8", 100);
- cCol.pszText = TranslateT("Agent");
+ cCol.pszText = Translate("Agent");
ListView_InsertColumn(hUserList, 2, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx9", 100);
- cCol.pszText = TranslateT("Completed");
+ cCol.pszText = Translate("Completed");
ListView_InsertColumn(hUserList, 3, &cCol);
cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx10", 100);
- cCol.pszText = TranslateT("Speed");
+ cCol.pszText = Translate("Speed");
ListView_InsertColumn(hUserList, 4, &cCol);
bool b = db_get_b(NULL, MODULE, "StatWnd_ShowHidden", 0) != 0;
@@ -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, TranslateT("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(NULL, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
return false;
}
}
@@ -915,18 +915,18 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara if (ListView_GetItem(hShareList, &sItem)) {
string sLink = sCreateLink(sItem.pszText);
if (sLink.size() <= 0) {
- MessageBox(hwndDlg, TranslateT("Selected link size is 0"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, Translate("Selected link size is 0"), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
if (LOWORD(wParam) == ID_SHARELIST_COPYLINK) {
if (!OpenClipboard(hwndDlg)) {
- MessageBox(hwndDlg, TranslateT("Failed to get access to clipboard"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, Translate("Failed to get access to clipboard"), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
if (!EmptyClipboard()) {
- MessageBox(hwndDlg, TranslateT("Failed to get close the clipboard"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, Translate("Failed to get close the clipboard"), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
@@ -940,15 +940,15 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara HANDLE hMyData = SetClipboardData(CF_TEXT, hglbCopy);
if (!hMyData)
- MessageBox(hwndDlg, TranslateT("Failed to set clipboard data"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, Translate("Failed to set clipboard data"), MSG_BOX_TITEL, MB_OK);
CloseClipboard();
}
else Utils_OpenUrl(sLink.c_str());
}
- else MessageBox(hwndDlg, TranslateT("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK);
+ else MessageBox(hwndDlg, Translate("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK);
}
- else MessageBox(hwndDlg, TranslateT("No share selected"), MSG_BOX_TITEL, MB_OK);
+ else MessageBox(hwndDlg, Translate("No share selected"), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
@@ -1238,14 +1238,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
db_set_b(NULL, MODULE, "AddStatisticsMenuItem", bNew);
- MessageBox(hwndDlg, TranslateT("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
}
b = db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1) != 0;
bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
db_set_b(NULL, MODULE, "AddAcceptConMenuItem", bNew);
- MessageBox(hwndDlg, TranslateT("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
}
bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED;
@@ -1343,8 +1343,8 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) odp.hInstance = hInstance;
odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_HTTP_SERVER);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.ptszTitle = LPGENT("HTTP Server");
- odp.ptszGroup = LPGENT("Network");
+ odp.pwszTitle = LPGENW("HTTP Server");
+ odp.pwszGroup = LPGENW("Network");
odp.pfnDlgProc = OptionsDlgProc;
Options_AddPage(wParam, &odp);
return 0;
@@ -1477,7 +1477,7 @@ void InitGuiElements() SET_UID(mi, 0xb30a6ab5, 0x17a8, 0x4e2e, 0x84, 0x52, 0x5f, 0xbc, 0x83, 0x35, 0xf2, 0x6);
mi.hIcolibItem = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
mi.position = -2000019955;
- mi.name.t = LPGENT("HTTP Share new file");
+ mi.name.w = LPGENW("HTTP Share new file");
mi.pszService = MS_SHARE_NEW_FILE;
hShareNewFileMenuItem = Menu_AddContactMenuItem(&mi);
@@ -1485,7 +1485,7 @@ void InitGuiElements() SET_UID(mi, 0x68db84c9, 0xe6b4, 0x4b4f, 0x93, 0x4b, 0xfd, 0x34, 0x2d, 0x83, 0x11, 0xe7);
mi.position = 1000085005;
mi.flags = CMIF_TCHAR;
- mi.name.t = LPGENT("Show HTTP server statistics");
+ mi.name.w = LPGENW("Show HTTP server statistics");
mi.pszService = MS_SHOW_STATISTICS_VIEW;
hShowStatisticsViewMenuItem = Menu_AddMainMenuItem(&mi);
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 76f1ffe840..9cad408bbd 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -152,15 +152,15 @@ bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) // Developer : KN
/////////////////////////////////////////////////////////////////////
-void LogEvent(const TCHAR * pszTitle, const char * pszLog)
+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);
if (hFile == INVALID_HANDLE_VALUE) {
- MessageBox(NULL, TranslateT("Failed to open or create log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(NULL, 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, TranslateT("Failed to move to the end of the log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(NULL, 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 TCHAR * pszTitle, const char * pszLog) !bWriteToFile(hFile, " : ") ||
!bWriteToFile(hFile, pszLog, nLogLen) ||
!bWriteToFile(hFile, "\r\n")) {
- MessageBox(NULL, TranslateT("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(NULL, Translate("Failed to write some part of the log file"), MSG_BOX_TITEL, MB_OK);
}
CloseHandle(hFile);
}
@@ -251,7 +251,7 @@ bool bReadConfigurationFile() // move rest of buffer to front
if (pszCurPos && pszCurPos != szBuf) {
dwBytesInBuffer = DWORD(sizeof(szBuf) - (pszCurPos - szBuf));
- memmove(szBuf, pszCurPos, dwBytesInBuffer * sizeof(TCHAR));
+ memmove(szBuf, pszCurPos, dwBytesInBuffer * sizeof(wchar_t));
}
// append data to buffer
@@ -336,21 +336,19 @@ bool bReadConfigurationFile() bool bWriteConfigurationFile()
{
CLFileShareListAccess clCritSection;
- char szBuf[1000];
+ 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);
if (hFile == INVALID_HANDLE_VALUE) {
- TCHAR temp[200];
- mir_sntprintf(temp, "%s%s", TranslateT("Failed to open or create file "), _T(szConfigFile));
+ mir_snprintf(temp, "%s%s", Translate("Failed to open or create file "), szConfigFile);
MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
return false;
}
DWORD dwBytesWriten = 0;
if (!WriteFile(hFile, szXmlHeader, sizeof(szXmlHeader) - 1, &dwBytesWriten, NULL)) {
- TCHAR temp[200];
- mir_sntprintf(temp, "%s%s", TranslateT("Failed to write xml header to file "), _T(szConfigFile));
+ mir_snprintf(temp, "%s%s", TranslateT("Failed to write xml header to file "), szConfigFile);
MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
}
else {
@@ -364,8 +362,7 @@ bool bWriteConfigurationFile() SplitIpAddress(pclCur->st.dwAllowedMask));
if (!WriteFile(hFile, szBuf, dwBytesToWrite, &dwBytesWriten, NULL)) {
- TCHAR temp[200];
- mir_sntprintf(temp, "%s%s", TranslateT("Failed to write xml data to file "), _T(szConfigFile));
+ mir_snprintf(temp, "%s%s", Translate("Failed to write xml data to file "), szConfigFile);
MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
break;
}
@@ -373,8 +370,7 @@ bool bWriteConfigurationFile() }
if (!WriteFile(hFile, szXmlTail, sizeof(szXmlTail) - 1, &dwBytesWriten, NULL)) {
- TCHAR temp[200];
- mir_sntprintf(temp, "%s%s", TranslateT("Failed to write xml tail to file "), _T(szConfigFile));
+ mir_snprintf(temp, "%s%s", Translate("Failed to write xml tail to file "), szConfigFile);
MessageBox(NULL, temp, MSG_BOX_TITEL, MB_OK);
}
}
@@ -653,8 +649,8 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) hDirectBoundPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)& nlb);
if (!hDirectBoundPort) {
- TCHAR szTemp[200];
- mir_snprintf(szTemp, TranslateT("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port"),
+ 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);
return 1001;
@@ -746,9 +742,9 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
+ nlu.flags = NUF_OUTGOING | NUF_INCOMING;
nlu.szSettingsModule = MODULE;
- nlu.ptszDescriptiveName = TranslateT("HTTP Server");
+ nlu.szDescriptiveName = Translate("HTTP Server");
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)& nlu);
if (!hNetlibUser) {
MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
@@ -931,7 +927,7 @@ extern "C" __declspec(dllexport) int Load() mi.flags = CMIF_TCHAR;
mi.hIcolibItem = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
mi.position = 1000085000;
- mi.name.a = LPGENT("Enable HTTP server");
+ mi.name.a = LPGEN("Enable HTTP server");
mi.pszService = MS_HTTP_ACCEPT_CONNECTIONS;
hAcceptConnectionsMenuItem = Menu_AddMainMenuItem(&mi);
}
|