mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
dont bother comparing to nullptr
This commit is contained in:
parent
88b797cd33
commit
28d14bcc32
@ -118,7 +118,7 @@ bool ExtenWindow::eventFilter(QObject* target, QEvent* event)
|
|||||||
|
|
||||||
void ExtenWindow::keyPressEvent(QKeyEvent* event)
|
void ExtenWindow::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
if (event->key() == Qt::Key_Delete && ui->extenList->currentItem() != nullptr)
|
if (event->key() == Qt::Key_Delete && ui->extenList->currentItem())
|
||||||
{
|
{
|
||||||
Unload(ui->extenList->currentIndex().row());
|
Unload(ui->extenList->currentIndex().row());
|
||||||
Sync();
|
Sync();
|
||||||
|
@ -29,7 +29,7 @@ namespace
|
|||||||
|
|
||||||
TextHook GetHook(uint64_t addr)
|
TextHook GetHook(uint64_t addr)
|
||||||
{
|
{
|
||||||
if (view == nullptr) return {};
|
if (!view) return {};
|
||||||
std::scoped_lock lock(viewMutex);
|
std::scoped_lock lock(viewMutex);
|
||||||
for (auto hook : view)
|
for (auto hook : view)
|
||||||
if (hook.address == addr) return hook;
|
if (hook.address == addr) return hook;
|
||||||
|
@ -14,7 +14,7 @@ struct SentenceInfo
|
|||||||
// nullptr marks end of info array
|
// nullptr marks end of info array
|
||||||
int64_t operator[](std::string propertyName)
|
int64_t operator[](std::string propertyName)
|
||||||
{
|
{
|
||||||
for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value;
|
for (auto info = infoArray; info->name; ++info) if (propertyName == info->name) return info->value;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
|
|||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
{
|
{
|
||||||
std::lock_guard l(m);
|
std::lock_guard l(m);
|
||||||
if (window != nullptr)
|
if (window)
|
||||||
{
|
{
|
||||||
window->settings->setValue(WINDOW, window->geometry());
|
window->settings->setValue(WINDOW, window->geometry());
|
||||||
window->settings->sync();
|
window->settings->sync();
|
||||||
@ -155,7 +155,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
|
|||||||
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
||||||
{
|
{
|
||||||
std::lock_guard l(m);
|
std::lock_guard l(m);
|
||||||
if (window == nullptr || !sentenceInfo["current select"]) return false;
|
if (!window || !sentenceInfo["current select"]) return false;
|
||||||
QMetaObject::invokeMethod(window, [=] { window->display->setText(QString::fromStdWString(sentence)); });
|
QMetaObject::invokeMethod(window, [=] { window->display->setText(QString::fromStdWString(sentence)); });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
|||||||
}
|
}
|
||||||
lua_pushstring(L, WideStringToString(sentence).c_str());
|
lua_pushstring(L, WideStringToString(sentence).c_str());
|
||||||
lua_createtable(L, 0, 0);
|
lua_createtable(L, 0, 0);
|
||||||
for (auto info = sentenceInfo.infoArray; info->name != nullptr; ++info)
|
for (auto info = sentenceInfo.infoArray; info->name; ++info)
|
||||||
{
|
{
|
||||||
lua_pushstring(L, info->name);
|
lua_pushstring(L, info->name);
|
||||||
lua_pushinteger(L, info->value);
|
lua_pushinteger(L, info->value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user