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/MirLua | |
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/MirLua')
-rw-r--r-- | plugins/MirLua/Modules/WinAPI/src/stdafx.h | 1 | ||||
-rw-r--r-- | plugins/MirLua/Modules/WinAPI/src/winapi.cpp | 12 | ||||
-rw-r--r-- | plugins/MirLua/Modules/m_variables/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/m_core.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/m_icolib.cpp | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/m_options.cpp | 12 | ||||
-rw-r--r-- | plugins/MirLua/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_icons.cpp | 14 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_options.cpp | 14 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script.cpp | 12 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script.h | 10 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script_loader.cpp | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script_loader.h | 2 |
15 files changed, 52 insertions, 53 deletions
diff --git a/plugins/MirLua/Modules/WinAPI/src/stdafx.h b/plugins/MirLua/Modules/WinAPI/src/stdafx.h index 1e67e7c313..4885e14c2f 100644 --- a/plugins/MirLua/Modules/WinAPI/src/stdafx.h +++ b/plugins/MirLua/Modules/WinAPI/src/stdafx.h @@ -52,7 +52,6 @@ #include <stddef.h>
#include <process.h>
#include <direct.h>
-#include <tchar.h>
#include <shlwapi.h>
#include <shlobj.h>
diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp index b6d77a2973..8bb7ec0d8b 100644 --- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp +++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp @@ -38,7 +38,7 @@ static int lua_ShellExecute(lua_State *L) static int lua_FindIterator(lua_State *L)
{
HANDLE hFind = lua_touserdata(L, lua_upvalueindex(1));
- TCHAR* path = (TCHAR*)lua_touserdata(L, lua_upvalueindex(2));
+ wchar_t* path = (wchar_t*)lua_touserdata(L, lua_upvalueindex(2));
WIN32_FIND_DATA ffd = { 0 };
if (hFind == NULL)
@@ -98,7 +98,7 @@ static int lua_FindIterator(lua_State *L) static int lua_Find(lua_State *L)
{
- TCHAR *path = mir_utf8decodeT(luaL_checkstring(L, 1));
+ wchar_t *path = mir_utf8decodeT(luaL_checkstring(L, 1));
lua_pushlightuserdata(L, NULL);
lua_pushlightuserdata(L, path);
@@ -137,7 +137,7 @@ static int lua_GetIniValue(lua_State *L) ptrT default(mir_utf8decodeT(lua_tostring(L, 4)));
- TCHAR value[MAX_PATH] = { 0 };
+ wchar_t value[MAX_PATH] = { 0 };
if (!::GetPrivateProfileString(section, key, default, value, _countof(value), path))
{
lua_pushvalue(L, 4);
@@ -218,7 +218,7 @@ static int lua_GetRegValue(lua_State *L) case REG_LINK:
case REG_EXPAND_SZ:
{
- ptrA str(Utf8EncodeT((TCHAR*)value));
+ ptrA str(Utf8EncodeT((wchar_t*)value));
lua_pushlstring(L, str, mir_strlen(str));
}
break;
@@ -274,7 +274,7 @@ static int lua_SetRegValue(lua_State *L) case LUA_TSTRING:
type = REG_SZ;
- length = mir_strlen(lua_tostring(L, 4)) * sizeof(TCHAR);
+ length = mir_strlen(lua_tostring(L, 4)) * sizeof(wchar_t);
value = (BYTE*)mir_utf8decodeT(lua_tostring(L, 4));
break;
@@ -1708,7 +1708,7 @@ static int global_GetOpenFileName(lua_State *L) {
_A2T tszExt(lua_tostring(L, 1));
- TCHAR buff[MAX_PATH] = L"";
+ wchar_t buff[MAX_PATH] = L"";
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
diff --git a/plugins/MirLua/Modules/m_variables/src/main.cpp b/plugins/MirLua/Modules/m_variables/src/main.cpp index 8eac605407..308325e202 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) ptrT format(mir_utf8decodeT(luaL_checkstring(L, 1)));
MCONTACT hContact = lua_tointeger(L, 2);
- TCHAR *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
+ wchar_t *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
lua_pushstring(L, T2Utf(res));
return 1;
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index 4c2b6e7a38..27d4cc7714 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -296,7 +296,7 @@ static int core_Parse(lua_State *L) static int core_GetFullPath(lua_State *L)
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
lua_pushstring(L, ptrA(mir_utf8encodeT(path)));
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 64540804a0..78ed5343d6 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -18,7 +18,7 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) lua_pop(L, 1);
lua_getfield(L, -1, "Name");
- mi.name.t = mir_utf8decodeT(luaL_checkstring(L, -1));
+ mi.name.w = mir_utf8decodeT(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Position");
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index 019d1ccf25..8827cc749c 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -9,16 +9,16 @@ static int icolib_AddIcon(lua_State *L) if (filePath == NULL)
{
- filePath = (TCHAR*)mir_calloc(MAX_PATH + 1);
+ filePath = (wchar_t*)mir_calloc(MAX_PATH + 1);
GetModuleFileName(g_hInstance, filePath, MAX_PATH);
}
SKINICONDESC si = { 0 };
si.flags = SIDF_ALL_TCHAR;
si.pszName = mir_utf8decodeA(name);
- si.description.t = description;
- si.section.t = section;
- si.defaultFile.t = filePath;
+ si.description.w = description;
+ si.section.w = section;
+ si.defaultFile.w = filePath;
si.hDefaultIcon = GetIcon(IDI_SCRIPT);
int hScriptLangpack = CMLuaScript::GetScriptIdFromEnviroment(L);
diff --git a/plugins/MirLua/src/m_options.cpp b/plugins/MirLua/src/m_options.cpp index 149403ee44..d67106d247 100644 --- a/plugins/MirLua/src/m_options.cpp +++ b/plugins/MirLua/src/m_options.cpp @@ -54,15 +54,15 @@ void MakeOptionDialogPage(lua_State *L, OPTIONSDIALOGPAGE &odp) odp.flags |= ODPF_TCHAR;
lua_getfield(L, -1, "Group");
- odp.ptszGroup = mir_utf8decodeT(lua_tostring(L, -1));
+ odp.pwszGroup = mir_utf8decodeT(lua_tostring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Title");
- odp.ptszTitle = mir_utf8decodeT(luaL_checkstring(L, -1));
+ odp.pwszTitle = mir_utf8decodeT(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Tab");
- odp.ptszTab = mir_utf8decodeT(lua_tostring(L, -1));
+ odp.pwszTab = mir_utf8decodeT(lua_tostring(L, -1));
lua_pop(L, 1);
int onInitDialogRef = LUA_NOREF;
@@ -95,9 +95,9 @@ int opt_AddPage(lua_State *L) INT_PTR res = Options_AddPage(wParam, &odp);
lua_pushboolean(L, !res);
- mir_free(odp.ptszGroup);
- mir_free(odp.ptszTitle);
- mir_free(odp.ptszTab);
+ mir_free(odp.pwszGroup);
+ mir_free(odp.pwszTitle);
+ mir_free(odp.pwszTab);
return 1;
}
diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp index 49b50190fd..ce2d3aa589 100644 --- a/plugins/MirLua/src/main.cpp +++ b/plugins/MirLua/src/main.cpp @@ -62,8 +62,8 @@ extern "C" int __declspec(dllexport) Load(void) NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_NOOPTIONS | NUF_UNICODE;
- nlu.ptszDescriptiveName = _T(MODULE);
+ nlu.flags = NUF_NOOPTIONS;
+ nlu.szDescriptiveName = MODULE;
nlu.szSettingsModule = MODULE;
hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 2c67f32f3e..5386f364d1 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -23,7 +23,7 @@ CMLua::~CMLua() void CMLua::SetPaths()
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
lua_getglobal(L, "package");
diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp index 175e5c62e8..92bcd1dcd5 100644 --- a/plugins/MirLua/src/mlua_icons.cpp +++ b/plugins/MirLua/src/mlua_icons.cpp @@ -1,17 +1,17 @@ #include "stdafx.h"
-IconItemT Icons[] =
+IconItem Icons[] =
{
- { LPGENT("Script"), "script", IDI_SCRIPT },
- { LPGENT("Loaded"), "loaded", IDI_LOADED },
- { LPGENT("Failed"), "failed", IDI_FAILED },
- { LPGENT("Open"), "open", IDI_OPEN },
- { LPGENT("Reload"), "reload", IDI_RELOAD },
+ { LPGEN("Script"), "script", IDI_SCRIPT },
+ { LPGEN("Loaded"), "loaded", IDI_LOADED },
+ { LPGEN("Failed"), "failed", IDI_FAILED },
+ { LPGEN("Open"), "open", IDI_OPEN },
+ { LPGEN("Reload"), "reload", IDI_RELOAD },
};
void InitIcons()
{
- Icon_RegisterT(g_hInstance, LPGENT(MODULE), Icons, _countof(Icons), MODULE);
+ Icon_Register(g_hInstance, MODULE, Icons, _countof(Icons), MODULE);
}
HICON GetIcon(int iconId)
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index 6714d7ebed..cc902165d6 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -37,7 +37,7 @@ void CMLuaOptions::LoadScripts() for (int i = 0; i < g_mLua->Scripts.getCount(); i++)
{
CMLuaScript *script = g_mLua->Scripts[i];
- TCHAR *fileName = NEWTSTR_ALLOCA(script->GetFileName());
+ wchar_t *fileName = NEWWSTR_ALLOCA(script->GetFileName());
int iIcon = script->GetStatus() - 1;
int iItem = m_scripts.AddItem(fileName, iIcon, (LPARAM)script);
if (db_get_b(NULL, MODULE, _T2A(fileName), 1))
@@ -59,7 +59,7 @@ void CMLuaOptions::OnInitDialog() ImageList_AddIcon(hImageList, GetIcon(IDI_OPEN));
ImageList_AddIcon(hImageList, GetIcon(IDI_RELOAD));
- TCHAR scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
+ wchar_t scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARST(MIRLUA_PATHT));
PathToRelativeT(scriptDir, relativeScriptDir, NULL);
mir_sntprintf(header, L"%s (%s)", TranslateT("Common scripts"), relativeScriptDir);
@@ -78,7 +78,7 @@ void CMLuaOptions::OnApply() int count = m_scripts.GetItemCount();
for (int iItem = 0; iItem < count; iItem++)
{
- TCHAR fileName[MAX_PATH];
+ wchar_t fileName[MAX_PATH];
m_scripts.GetItemText(iItem, 0, fileName, _countof(fileName));
if (!m_scripts.GetCheckState(iItem))
db_set_b(NULL, MODULE, _T2A(fileName), 0);
@@ -115,7 +115,7 @@ void CMLuaOptions::OnScriptListClick(CCtrlListView::TEventInfo *evt) LVITEM lvi = { 0 };
lvi.iItem = evt->nmlvia->iItem;
if (lvi.iItem == -1) return;
- lvi.pszText = (LPTSTR)mir_calloc(MAX_PATH * sizeof(TCHAR));
+ lvi.pszText = (LPTSTR)mir_calloc(MAX_PATH * sizeof(wchar_t));
lvi.cchTextMax = MAX_PATH;
lvi.mask = LVIF_GROUPID | LVIF_TEXT | LVIF_PARAM;
evt->treeviewctrl->GetItem(&lvi);
@@ -161,9 +161,9 @@ int CMLuaOptions::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInstance;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
- odp.ptszGroup = LPGENT("Services");
- odp.ptszTitle = L"Lua";
- odp.ptszTab = LPGENT("Scripts");
+ odp.pwszGroup = LPGENW("Services");
+ odp.pwszTitle = L"Lua";
+ odp.pwszTab = LPGENW("Scripts");
odp.pDialog = CMLuaOptions::CreateOptionsPage();
Options_AddPage(wParam, &odp);
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp index d36f93b7a8..b84c3d978e 100644 --- a/plugins/MirLua/src/mlua_script.cpp +++ b/plugins/MirLua/src/mlua_script.cpp @@ -2,17 +2,17 @@ #define SCRIPT "Script"
-CMLuaScript::CMLuaScript(lua_State *L, const TCHAR *path)
+CMLuaScript::CMLuaScript(lua_State *L, const wchar_t *path)
: L(L), status(None), unloadRef(LUA_NOREF)
{
mir_tstrcpy(filePath, path);
- fileName = _tcsrchr(filePath, '\\') + 1;
- TCHAR *dot = _tcsrchr(fileName, '.');
+ fileName = wcsrchr(filePath, '\\') + 1;
+ wchar_t *dot = wcsrchr(fileName, '.');
size_t length = mir_tstrlen(fileName) - mir_tstrlen(dot) + 1;
- ptrT name((TCHAR*)mir_calloc(sizeof(TCHAR) * (length + 1)));
+ ptrT name((wchar_t*)mir_calloc(sizeof(wchar_t) * (length + 1)));
mir_tstrncpy(name, fileName, length);
moduleName = mir_utf8encodeT(name);
@@ -76,12 +76,12 @@ const char* CMLuaScript::GetModuleName() const return moduleName;
}
-const TCHAR* CMLuaScript::GetFilePath() const
+const wchar_t* CMLuaScript::GetFilePath() const
{
return filePath;
}
-const TCHAR* CMLuaScript::GetFileName() const
+const wchar_t* CMLuaScript::GetFileName() const
{
return fileName;
}
diff --git a/plugins/MirLua/src/mlua_script.h b/plugins/MirLua/src/mlua_script.h index c466e16c20..042e78dadf 100644 --- a/plugins/MirLua/src/mlua_script.h +++ b/plugins/MirLua/src/mlua_script.h @@ -17,13 +17,13 @@ private: int id;
int unloadRef;
char *moduleName;
- TCHAR *fileName;
- TCHAR filePath[MAX_PATH];
+ wchar_t *fileName;
+ wchar_t filePath[MAX_PATH];
Status status;
public:
- CMLuaScript(lua_State *L, const TCHAR *path);
+ CMLuaScript(lua_State *L, const wchar_t *path);
~CMLuaScript();
static CMLuaScript* GetScriptFromEnviroment(lua_State *L);
@@ -34,8 +34,8 @@ public: const char* GetModuleName() const;
- const TCHAR* GetFilePath() const;
- const TCHAR* GetFileName() const;
+ const wchar_t* GetFilePath() const;
+ const wchar_t* GetFileName() const;
const Status GetStatus() const;
diff --git a/plugins/MirLua/src/mlua_script_loader.cpp b/plugins/MirLua/src/mlua_script_loader.cpp index f95fdbfc78..a8efa32320 100644 --- a/plugins/MirLua/src/mlua_script_loader.cpp +++ b/plugins/MirLua/src/mlua_script_loader.cpp @@ -4,9 +4,9 @@ CMLuaScriptLoader::CMLuaScriptLoader(lua_State *L) : L(L) {
}
-void CMLuaScriptLoader::LoadScript(const TCHAR *scriptDir, const TCHAR *file)
+void CMLuaScriptLoader::LoadScript(const wchar_t *scriptDir, const wchar_t *file)
{
- TCHAR fullPath[MAX_PATH], path[MAX_PATH];
+ wchar_t fullPath[MAX_PATH], path[MAX_PATH];
mir_sntprintf(fullPath, L"%s\\%s", scriptDir, file);
PathToRelativeT(fullPath, path);
@@ -25,12 +25,12 @@ void CMLuaScriptLoader::LoadScript(const TCHAR *scriptDir, const TCHAR *file) void CMLuaScriptLoader::LoadScripts()
{
- TCHAR scriptDir[MAX_PATH];
+ wchar_t scriptDir[MAX_PATH];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARST(MIRLUA_PATHT));
Log(L"Loading scripts from %s", scriptDir);
- TCHAR searchMask[MAX_PATH];
+ wchar_t searchMask[MAX_PATH];
mir_sntprintf(searchMask, L"%s\\%s", scriptDir, L"*.lua");
WIN32_FIND_DATA fd;
diff --git a/plugins/MirLua/src/mlua_script_loader.h b/plugins/MirLua/src/mlua_script_loader.h index 949f870fac..e455793adf 100644 --- a/plugins/MirLua/src/mlua_script_loader.h +++ b/plugins/MirLua/src/mlua_script_loader.h @@ -8,7 +8,7 @@ private: CMLuaScriptLoader(lua_State *L);
- void LoadScript(const TCHAR *scriptDir, const TCHAR *file);
+ void LoadScript(const wchar_t *scriptDir, const wchar_t *file);
void LoadScripts();
public:
|