diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-20 13:34:45 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-20 13:34:45 +0300 |
commit | e96132b4d5344d2d58d247906bcaefccfb9d5253 (patch) | |
tree | 24a9524e4900547f2ba3a461e228fd3c98c0410d /plugins/MirLua | |
parent | 4dac8bd56f9116ac76423b2664286ed894ca80c2 (diff) |
DBEVENTINFO::hContact to be returned inside an event, no need to call db_event_getContact() just after db_event_get()
Diffstat (limited to 'plugins/MirLua')
-rw-r--r-- | plugins/MirLua/src/Modules/m_database.cpp | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/Modules/m_message.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/plugins/MirLua/src/Modules/m_database.cpp b/plugins/MirLua/src/Modules/m_database.cpp index 6ca2e20f28..e3f4922643 100644 --- a/plugins/MirLua/src/Modules/m_database.cpp +++ b/plugins/MirLua/src/Modules/m_database.cpp @@ -305,8 +305,8 @@ void MakeDbEvent(lua_State *L, DBEVENTINFO &dbei) switch (lua_type(L, -1)) { case LUA_TTABLE: dbei.cbBlob = (uint32_t)lua_rawlen(L, 4); - dbei.pBlob = (uint8_t*)mir_calloc(dbei.cbBlob); - for (uint32_t i = 0; i < dbei.cbBlob; i++) { + dbei.pBlob = (char *)mir_calloc(dbei.cbBlob); + for (int i = 0; i < dbei.cbBlob; i++) { lua_geti(L, 4, i + 1); dbei.pBlob[i] = lua_tointeger(L, -1); lua_pop(L, 1); @@ -316,7 +316,7 @@ void MakeDbEvent(lua_State *L, DBEVENTINFO &dbei) size_t nLen; const char *str = lua_tolstring(L, -1, &nLen); dbei.cbBlob = (uint32_t)nLen; - dbei.pBlob = (uint8_t*)mir_alloc(nLen); + dbei.pBlob = (char *)mir_alloc(nLen); memcpy(dbei.pBlob, str, nLen); break; } @@ -649,7 +649,7 @@ int MT<DBEVENTINFO>::Get(lua_State *L, DBEVENTINFO *dbei) if (mir_strcmpi(key, "Blob") == 0) { lua_createtable(L, dbei->cbBlob, 0); - for (uint32_t i = 0; i < dbei->cbBlob; i++) { + for (int i = 0; i < dbei->cbBlob; i++) { lua_pushinteger(L, dbei->pBlob[i]); lua_rawseti(L, -2, i + 1); } diff --git a/plugins/MirLua/src/Modules/m_message.cpp b/plugins/MirLua/src/Modules/m_message.cpp index a9f026ec89..1425771a14 100644 --- a/plugins/MirLua/src/Modules/m_message.cpp +++ b/plugins/MirLua/src/Modules/m_message.cpp @@ -39,7 +39,7 @@ static int message_Send(lua_State *L) dbei.timestamp = time(0); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(message); - dbei.pBlob = (uint8_t*)mir_strdup(message); + dbei.pBlob = mir_strdup(message); dbei.flags = DBEF_UTF | DBEF_SENT; db_event_add(hContact, &dbei); |