| 4272 | } |
| 4273 | |
| 4274 | static int internal_md5file(lua_State *L) |
| 4275 | { |
| 4276 | const char *s = luaL_checkstring(L, 1); |
| 4277 | uint32_t len; |
| 4278 | char *first_kb_raw = nullptr; |
| 4279 | vector<char> first_kb; |
| 4280 | if (lua_toboolean(L, 2)) |
| 4281 | first_kb_raw = new char[1024]; |
| 4282 | |
| 4283 | string hash = md5_wrap.getHashFromFile(s, len, first_kb_raw); |
| 4284 | bool err = (hash.find("file") != string::npos); |
| 4285 | |
| 4286 | if (first_kb_raw) |
| 4287 | { |
| 4288 | first_kb.assign(first_kb_raw, first_kb_raw + 1024); |
| 4289 | delete[] first_kb_raw; |
| 4290 | } |
| 4291 | |
| 4292 | if (err) |
| 4293 | { |
| 4294 | lua_pushnil(L); |
| 4295 | lua_pushstring(L, hash.c_str()); |
| 4296 | return 2; |
| 4297 | } |
| 4298 | else |
| 4299 | { |
| 4300 | lua_pushstring(L, hash.c_str()); |
| 4301 | lua_pushinteger(L, len); |
| 4302 | if (!first_kb.empty()) |
| 4303 | { |
| 4304 | Lua::PushVector(L, first_kb); |
| 4305 | return 3; |
| 4306 | } |
| 4307 | else |
| 4308 | { |
| 4309 | return 2; |
| 4310 | } |
| 4311 | } |
| 4312 | } |
| 4313 | |
| 4314 | static int internal_getSuppressDuplicateKeyboardEvents(lua_State *L) { |
| 4315 | Lua::Push(L, Core::getInstance().getSuppressDuplicateKeyboardEvents()); |
nothing calls this directly
no test coverage detected