summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-07-15 19:52:27 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-07-15 19:52:27 +0000
commit2a6d817808b12cb58eb2358b0352210579b3c1fd (patch)
tree0e790b1ea358f5b9519c3dca53970ed70d0129f1
parentdc98e715b03ef373305ac4dcdb51b63a53db762a (diff)
MirLua: removed module prefix from icon name in m_icolib
git-svn-id: http://svn.miranda-ng.org/main/trunk@14571 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/MirLua/src/m_icolib.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp
index 1ff2b97f53..00411fbf85 100644
--- a/plugins/MirLua/src/m_icolib.cpp
+++ b/plugins/MirLua/src/m_icolib.cpp
@@ -2,17 +2,18 @@
static int lua_AddIcon(lua_State *L)
{
+ const char* name = luaL_checkstring(L, 1);
+ const char* description = luaL_checkstring(L, 2);
+ const char* section = luaL_optstring(L, 3, MODULE);
+
TCHAR filePath[MAX_PATH];
GetModuleFileName(g_hInstance, filePath, _countof(filePath));
- char iconName[MAX_PATH];
- mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
-
SKINICONDESC si = { 0 };
- si.flags = SIDF_PATH_TCHAR;
- si.pszName = iconName;
- si.description.a = mir_utf8decode((char*)luaL_checkstring(L, 2), NULL);
- si.section.a = lua_isnone(L, 3) ? MODULE : mir_utf8decode((char*)luaL_checkstring(L, 3), NULL);
+ si.flags = SIDF_ALL_TCHAR;
+ si.pszName = ptrA(mir_utf8decodeA(name));
+ si.description.t = ptrT(mir_utf8decodeT(description));
+ si.section.t = ptrT(mir_utf8decodeT(section));
si.defaultFile.t = filePath;
si.iDefaultIndex = -IDI_ICON;
@@ -24,10 +25,9 @@ static int lua_AddIcon(lua_State *L)
static int lua_GetIcon(lua_State *L)
{
- char iconName[MAX_PATH];
- mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
+ const char* name = luaL_checkstring(L, 1);
- HANDLE res = ::IcoLib_GetIconHandle(iconName);
+ HANDLE res = ::IcoLib_GetIconHandle(name);
lua_pushlightuserdata(L, res);
return 1;
@@ -40,11 +40,7 @@ static int lua_RemoveIcon(lua_State *L)
if (lua_isuserdata(L, 1))
::IcoLib_RemoveIconByHandle(lua_touserdata(L, 1));
else if (lua_isstring(L, 1))
- {
- char iconName[MAX_PATH];
- mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, lua_tostring(L, 1));
- ::IcoLib_RemoveIcon(iconName);
- }
+ ::IcoLib_RemoveIcon(luaL_checkstring(L, 1));
else
res = 1;