summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/m_database.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-02-01 12:58:04 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-02-01 12:58:04 +0000
commit014e23323d6dc79605da8ebad1c357176ede9122 (patch)
tree783042c8aba1d71645028720bac8f8f70eca3b54 /plugins/MirLua/src/m_database.cpp
parente1b171840899382e773c89b21e0510e9eddd95b0 (diff)
MirLua: Code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@16206 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_database.cpp')
-rw-r--r--plugins/MirLua/src/m_database.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp
index a8cb78f435..82d4fe6aeb 100644
--- a/plugins/MirLua/src/m_database.cpp
+++ b/plugins/MirLua/src/m_database.cpp
@@ -182,8 +182,7 @@ static int array__call(lua_State *L)
BLOB *blob = (BLOB*)lua_newuserdata(L, sizeof(BLOB));
blob->cbSize = size;
- blob->pBlobData = (BYTE*)mir_alloc(sizeof(BYTE) * blob->cbSize);
- memcpy(blob->pBlobData, udata, sizeof(BYTE)* blob->cbSize);
+ blob->pBlobData = mir_memdup(udata, size);
luaL_setmetatable(L, MT_BLOB);
return 1;
@@ -291,8 +290,7 @@ static int lua_GetSetting(lua_State *L)
{
BLOB *blob = (BLOB*)lua_newuserdata(L, sizeof(BLOB));
blob->cbSize = dbv.cpbVal;
- blob->pBlobData = (BYTE*)mir_alloc(sizeof(BYTE) * blob->cbSize);
- memcpy(blob->pBlobData, dbv.pbVal, sizeof(BYTE) * blob->cbSize);
+ blob->pBlobData = mir_memdup(dbv.pbVal, dbv.cpbVal);
luaL_setmetatable(L, MT_BLOB);
}
break;
@@ -542,8 +540,7 @@ static int dbcw__index(lua_State *L)
{
BLOB *blob = (BLOB*)lua_newuserdata(L, sizeof(BLOB));
blob->cbSize = dbcw->value.cpbVal;
- blob->pBlobData = (BYTE*)mir_alloc(sizeof(BYTE) * blob->cbSize);
- memcpy(blob->pBlobData, dbcw->value.pbVal, sizeof(BYTE) * blob->cbSize);
+ blob->pBlobData = mir_memdup(dbcw->value.pbVal, blob->cbSize);
luaL_setmetatable(L, MT_BLOB);
}
break;